:root {
  --bg: #f9fafb;
  --bg-card: #ffffff;
  --bg-soft: #f2f4f7;
  --bg-soft-2: #f7f7fc;
  --bg-deep: #101828;
  --accent: #6941c6;
  --accent-hover: #50398c;
  --accent-soft: rgba(105, 65, 198, 0.08);
  --text: #101828;
  --text-muted: #667085;
  --text-soft: #344054;
  --border: #e4e7ec;
  --success: #039855;
  --success-soft: rgba(3, 152, 85, 0.08);
  --warning: #b54708;
  --warning-soft: rgba(181, 71, 8, 0.08);
  --danger: #d92d20;
  --danger-soft: rgba(217, 45, 32, 0.08);
  --radius: 16px;
  --shadow: 0 12px 32px rgba(16, 24, 40, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(105, 65, 198, 0.08), transparent 24%),
    linear-gradient(180deg, #fbfcfe 0%, #f6f7fb 100%);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.auth-card {
  width: min(520px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.auth-card h1 {
  margin: 12px 0 8px;
}

.auth-card p {
  color: var(--text-muted);
  line-height: 1.6;
}

.auth-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.auth-dev-action {
  margin-top: 14px;
}

.auth-form label {
  display: grid;
  gap: 8px;
}

.auth-form span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}

.auth-form input {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text);
  outline: none;
}

.auth-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(105, 65, 198, 0.12);
}

.auth-message {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-soft);
}

.auth-message.success {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(3, 152, 85, 0.18);
}

.auth-message.error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(217, 45, 32, 0.18);
}

button,
input,
select,
textarea {
  font: inherit;
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px 1fr;
}

.sidebar {
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 28px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  margin-bottom: 24px;
}

.logo-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
  padding: 6px;
}

.sidebar-logo strong,
.sidebar-footer strong {
  display: block;
}

.sidebar-logo span,
.sidebar-footer span,
.footer-label {
  color: var(--text-muted);
  font-size: 13px;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  border: 0;
  background: transparent;
  color: var(--text-soft);
  text-align: left;
  padding: 11px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.18s ease;
  text-decoration: none;
}

.nav-item:hover,
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-item-accent {
  margin-top: 8px;
  font-weight: 700;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 18px 10px 0;
}

.sidebar-session-action {
  margin-top: 14px;
}

.main {
  min-width: 0;
}

.page-header {
  padding: 42px 48px 30px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.page-header h1,
.card h2,
.hero-card h2,
.modal-head h2 {
  margin: 10px 0 8px;
}

.page-header p,
.hero-card p,
.note-card p,
.metric-card small,
.alert-card p,
.summary-card p,
.modal-head p {
  color: var(--text-muted);
}

.page-tag,
.section-tag,
.pill,
.priority,
.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.page-tag,
.section-tag {
  padding: 6px 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.public-brand {
  margin-bottom: 18px;
}

.public-brand img {
  width: 111px;
  height: auto;
  display: block;
}

.header-actions,
.form-actions,
.tabs,
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  transition: 0.18s ease;
  text-decoration: none;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted) !important;
  border-radius: 8px;
  padding: 0;
  cursor: pointer;
  transition: 0.18s ease;
  text-decoration: none;
  flex-shrink: 0;
  -webkit-appearance: none;
  appearance: none;
  font-size: 0;
}

.btn-icon:hover {
  background: var(--bg-soft);
  color: var(--text);
  border-color: #c8cdd6;
  transform: translateY(-1px);
}

.btn-icon.danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger);
}

.btn-icon svg {
  width: 14px;
  height: 14px;
  min-width: 14px;
  aspect-ratio: 1;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
  overflow: visible;
}

.btn-icon svg * {
  stroke: inherit;
  fill: inherit;
  stroke-width: inherit;
  stroke-linecap: inherit;
  stroke-linejoin: inherit;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: #fff;
  color: var(--text-soft);
  border-color: var(--border);
}

.compact-select {
  min-width: 280px;
}

.content {
  padding: 28px 48px 60px;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  margin-bottom: 34px;
}

.card,
.hero-card,
.metric-card,
.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card,
.hero-card {
  padding: 24px;
}

.card-head,
.hero-card,
.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.toolbar {
  margin: 18px 0 4px;
}

.metrics-grid,
.summary-grid,
.stack {
  display: grid;
  gap: 18px;
}

.metrics-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin: 22px 0 30px;
}

.summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
}

.metric-card {
  padding: 20px;
}

.metric-card strong {
  display: block;
  margin-top: 14px;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.metric-card.negative strong {
  color: var(--danger);
}

.metric-card.positive strong {
  color: var(--success);
}

.note-card,
.alert-card,
.summary-card {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
}

.attention-board {
  margin-top: 8px;
}

.attention-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 8px 0 22px;
}

.attention-summary strong {
  font-size: 36px;
  line-height: 1;
  letter-spacing: -0.05em;
}

.attention-summary span {
  color: var(--text-muted);
}

.attention-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.attention-item,
.attention-empty {
  display: grid;
  gap: 12px;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #fdfdff 0%, #f5f7fb 100%);
  text-decoration: none;
  color: inherit;
  transition: 0.18s ease;
}

.attention-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(16, 24, 40, 0.08);
}

.attention-warning {
  border-color: rgba(181, 71, 8, 0.16);
  background: linear-gradient(180deg, #fffaf5 0%, #fff6ed 100%);
}

.attention-danger {
  border-color: rgba(217, 45, 32, 0.16);
  background: linear-gradient(180deg, #fff8f7 0%, #fff1f0 100%);
}

.attention-neutral {
  border-color: rgba(105, 65, 198, 0.14);
  background: linear-gradient(180deg, #fbfaff 0%, #f5f3ff 100%);
}

.attention-item-top,
.attention-item-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.attention-client {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.attention-item > strong,
.attention-empty > strong {
  font-size: 20px;
  line-height: 1.3;
}

.attention-item p,
.attention-empty p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.attention-item-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid label {
  display: grid;
  gap: 8px;
}

.form-grid span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}

.required-mark {
  color: var(--danger);
}

.form-grid input,
.form-grid select,
.form-grid textarea,
.compact-select {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 13px 14px;
  color: var(--text);
  outline: none;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.compact-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(105, 65, 198, 0.12);
}

.full {
  grid-column: 1 / -1;
}

.field-hint {
  display: block;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.context-note {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
}

.context-note strong {
  font-size: 13px;
}

.context-note span {
  color: var(--text-soft);
  font-size: 14px;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  margin-top: 14px;
  padding-bottom: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

.activities-table {
  min-width: 1320px;
}

.table-link {
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}

.table-link:hover {
  color: var(--accent);
}

.activities-table .col-date {
  width: 110px;
}

.activities-table .col-priority {
  width: 110px;
}

.activities-table .col-hours {
  width: 96px;
}

.activities-table .col-status {
  width: 150px;
}

.activities-table .col-actions {
  width: 120px;
}

table .col-actions {
  width: 140px;
}

.activities-table .col-description {
  width: 320px;
}

.activities-table .col-comments {
  width: 420px;
}

th,
td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.activities-table td:nth-child(1),
.activities-table td:nth-child(2),
.activities-table td:nth-child(5),
.activities-table td:nth-child(6),
.activities-table td:nth-child(7),
.activities-table td:nth-child(8) {
  white-space: nowrap;
}

.cell-description,
.cell-comments {
  min-width: 0;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.cell-empty {
  color: var(--text-muted);
}

.expandable-text {
  min-width: 0;
}

.expandable-text summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  list-style: none;
}

.expandable-text summary::-webkit-details-marker {
  display: none;
}

.expandable-preview {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text);
}

.expandable-arrow {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(45deg);
  flex-shrink: 0;
  transition: transform 0.18s ease;
}

.expandable-text[open] .expandable-arrow {
  transform: rotate(225deg);
  margin-top: 10px;
}

.expandable-text[open] .expandable-preview {
  display: none;
}

.expandable-content {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  color: var(--text-soft);
}

.expandable-text[open] .expandable-content {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.expandable-text.is-compact summary {
  cursor: default;
}

.expandable-text.is-compact .expandable-arrow {
  display: none;
}

.expandable-text.is-compact .expandable-content {
  display: none;
}

.expandable-content a,
.cell-comments a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.email-list {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.email-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.tabs a,
.tabs button {
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  gap: 8px;
  display: inline-flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  transition: all 0.18s ease;
  position: relative;
}

.tabs a:hover,
.tabs button:hover {
  color: var(--accent);
  border-bottom-color: rgba(105, 65, 198, 0.2);
}

.tabs a.active,
.tabs button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 700;
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
}

.tabs a.active .tab-count,
.tabs button.active .tab-count {
  background: var(--accent);
  color: #fff;
}

.actions-inline {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  white-space: nowrap;
  align-items: center;
}

.actions-inline form {
  margin: 0;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}


.priority,
.status,
.pill {
  padding: 7px 10px;
}

.priority-high,
.status-negative {
  background: var(--danger-soft);
  color: var(--danger);
}

.priority-medium {
  background: var(--warning-soft);
  color: var(--warning);
}

.priority-low,
.status-positive,
.status-ativo,
.status-concluido {
  background: var(--success-soft);
  color: var(--success);
}

.status-expirado,
.status-inadimplente,
.status-pendente {
  background: var(--warning-soft);
  color: var(--warning);
}

.pill {
  background: var(--accent-soft);
  color: var(--accent);
}

.status-cell {
  text-transform: capitalize;
  font-weight: 700;
}

.status.status-concluido {
  background: var(--success-soft);
  color: var(--success);
}

.route {
  display: none;
}

.route.active {
  display: block;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.48);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 40;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-card {
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 24px;
}

.modal-form {
  margin-top: 18px;
}

.modal-close {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-soft);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.public-mode .sidebar {
  display: none;
}

.public-mode .layout {
  grid-template-columns: 1fr;
}

.public-mode .main {
  width: 100%;
}

.public-mode .page-header,
.public-mode .content {
  max-width: 1640px;
  margin: 0 auto;
}

.public-mode .page-header {
  padding-top: 36px;
}

.public-mode .metrics-grid {
  gap: 22px;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .page-header,
  .hero-card,
  .modal-head {
    flex-direction: column;
  }

  .page-header,
  .content {
    padding-left: 20px;
    padding-right: 20px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .compact-select {
    min-width: 0;
    width: 100%;
  }
}

.inline-status-form {
  margin: 0;
}

.status-inline-select {
  width: 100%;
  min-width: 128px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 34px 8px 12px;
  font-weight: 700;
  background-color: var(--bg-soft);
  cursor: pointer;
}

.status-inline-select.status-concluido {
  background: var(--success-soft);
  color: var(--success);
}

.status-inline-select.status-pendente {
  background: var(--warning-soft);
  color: var(--warning);
}

.due-alert {
  display: inline-flex;
  white-space: nowrap;
}
