@import url('https://fonts.googleapis.com/css2?family=Aboreto&family=Gotu&family=Figtree:wght@300;400;500;600;700&display=swap');

:root {
  --inkwell:      #2C3639;
  --eclipse:      #3F4E4F;
  --creme:        #A27B5B;
  --au-lait:      #DCD7C9;
  --au-lait-soft: rgba(220,215,201,0.08);
  --au-lait-mid:  rgba(220,215,201,0.15);
  --creme-accent: rgba(162,123,91,0.25);
  --creme-border: rgba(162,123,91,0.4);

  --status-recebido:         #4A9EBF;
  --status-em-analise:       #E8A838;
  --status-relatorio:        #8B7FD4;
  --status-aguardando:       #D47F5A;
  --status-concluido:        #5AB87A;

  --sidebar-width: 220px;
  --topbar-height: 60px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --transition: 0.2s ease;
}

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

html, body {
  height: 100%;
  font-family: 'Figtree', sans-serif;
  font-size: 15px;
  background: var(--inkwell);
  color: var(--au-lait);
  line-height: 1.6;
}

/* ─── Layout ─────────────────────────────────────────── */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--topbar-height) 1fr;
  min-height: 100vh;
}

/* ─── Sidebar ─────────────────────────────────────────── */

.sidebar {
  grid-row: 1 / 3;
  background: #232c2e;
  border-right: 1px solid rgba(220,215,201,0.07);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.sidebar-logo {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(220,215,201,0.07);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar-logo .wordmark {
  font-family: 'Aboreto', serif;
  font-size: 1.1rem;
  color: var(--creme);
  letter-spacing: 0.08em;
  line-height: 1;
}

.sidebar-logo .subtitle {
  font-family: 'Gotu', serif;
  font-size: 0.65rem;
  color: rgba(220,215,201,0.45);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.nav-section-label {
  font-family: 'Gotu', serif;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(220,215,201,0.3);
  padding: 0.75rem 1.25rem 0.25rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 1.25rem;
  color: rgba(220,215,201,0.6);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-left: 2px solid transparent;
  transition: all var(--transition);
}

.nav-link:hover {
  color: var(--au-lait);
  background: var(--au-lait-soft);
}

.nav-link.active {
  color: var(--creme);
  background: var(--creme-accent);
  border-left-color: var(--creme);
}

.nav-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-link.active svg { opacity: 1; }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(220,215,201,0.07);
  font-size: 0.75rem;
  color: rgba(220,215,201,0.35);
}

/* ─── Topbar ─────────────────────────────────────────── */

.topbar {
  background: #252e30;
  border-bottom: 1px solid rgba(220,215,201,0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  gap: 1rem;
}

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--au-lait);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ─── Main content ───────────────────────────────────── */

.main {
  padding: 1.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ─── Buttons ─────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-family: 'Figtree', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--creme);
  color: #1a2020;
}

.btn-primary:hover {
  background: #b8906a;
  box-shadow: 0 4px 16px var(--creme-accent);
}

.btn-secondary {
  background: var(--au-lait-soft);
  color: var(--au-lait);
  border: 1px solid rgba(220,215,201,0.15);
}

.btn-secondary:hover {
  background: var(--au-lait-mid);
}

.btn-ghost {
  background: transparent;
  color: rgba(220,215,201,0.6);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  color: var(--au-lait);
  border-color: rgba(220,215,201,0.15);
}

.btn-danger {
  background: rgba(220,80,80,0.12);
  color: #e07070;
  border: 1px solid rgba(220,80,80,0.2);
}

.btn-danger:hover { background: rgba(220,80,80,0.2); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.65rem 1.5rem; font-size: 0.95rem; }

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ─── Cards ───────────────────────────────────────────── */

.card {
  background: #2e3a3c;
  border: 1px solid rgba(220,215,201,0.07);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.card-title {
  font-family: 'Gotu', serif;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--creme);
}

/* ─── Stats ───────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: #2e3a3c;
  border: 1px solid rgba(220,215,201,0.07);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.stat-card.accent { border-color: var(--creme-border); }

.stat-label {
  font-family: 'Gotu', serif;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(220,215,201,0.45);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--au-lait);
  line-height: 1;
}

.stat-sub {
  font-size: 0.75rem;
  color: rgba(220,215,201,0.4);
}

/* ─── Table ───────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid rgba(220,215,201,0.07);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  background: #252e30;
  padding: 0.75rem 1rem;
  text-align: left;
  font-family: 'Gotu', serif;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(220,215,201,0.45);
  white-space: nowrap;
  border-bottom: 1px solid rgba(220,215,201,0.07);
}

tbody tr {
  border-bottom: 1px solid rgba(220,215,201,0.05);
  transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--au-lait-soft); }

tbody td {
  padding: 0.85rem 1rem;
  vertical-align: middle;
}

/* ─── Status badges ──────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-recebido       { background: rgba(74,158,191,0.15);  color: var(--status-recebido); }
.badge-em_analise     { background: rgba(232,168,56,0.15);  color: var(--status-em-analise); }
.badge-relatorio      { background: rgba(139,127,212,0.15); color: var(--status-relatorio); }
.badge-aguardando     { background: rgba(212,127,90,0.15);  color: var(--status-aguardando); }
.badge-concluido      { background: rgba(90,184,122,0.15);  color: var(--status-concluido); }

.badge-artigo         { background: rgba(162,123,91,0.15);  color: var(--creme); }
.badge-tcc            { background: rgba(100,140,180,0.15); color: #7aaed4; }
.badge-projeto        { background: rgba(140,100,180,0.15); color: #b07ad4; }

/* ─── Forms ───────────────────────────────────────────── */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(220,215,201,0.7);
}

.form-label span { color: var(--creme); }

.form-input,
.form-select,
.form-textarea {
  background: #232c2e;
  border: 1px solid rgba(220,215,201,0.12);
  border-radius: var(--radius-sm);
  color: var(--au-lait);
  font-family: 'Figtree', sans-serif;
  font-size: 0.875rem;
  padding: 0.6rem 0.9rem;
  transition: border-color var(--transition);
  width: 100%;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--creme);
}

.form-input::placeholder { color: rgba(220,215,201,0.25); }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23A27B5B' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.2rem;
  cursor: pointer;
}

.form-select option { background: #232c2e; }

.form-textarea { resize: vertical; min-height: 90px; }

.form-hint {
  font-size: 0.75rem;
  color: rgba(220,215,201,0.35);
}

.form-error {
  font-size: 0.75rem;
  color: #e07070;
}

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

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

/* ─── Modal ───────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: #2e3a3c;
  border: 1px solid var(--creme-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  transform: translateY(12px);
  transition: transform 0.2s ease;
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--au-lait);
}

.modal-close {
  background: none;
  border: none;
  color: rgba(220,215,201,0.4);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  transition: color var(--transition);
}

.modal-close:hover { color: var(--au-lait); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(220,215,201,0.07);
}

/* ─── Empty state ─────────────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  gap: 0.75rem;
  color: rgba(220,215,201,0.35);
}

.empty-state svg {
  width: 40px;
  height: 40px;
  opacity: 0.3;
}

.empty-state p { font-size: 0.875rem; }

/* ─── Alerts ──────────────────────────────────────────── */

.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.alert-info    { background: rgba(74,158,191,0.12); border-left: 3px solid var(--status-recebido); color: #a8d4e8; }
.alert-warning { background: rgba(232,168,56,0.12); border-left: 3px solid var(--status-em-analise); color: #e8c878; }
.alert-success { background: rgba(90,184,122,0.12); border-left: 3px solid var(--status-concluido); color: #8ed4a8; }
.alert-error   { background: rgba(220,80,80,0.12);  border-left: 3px solid #e07070; color: #e8a8a8; }

/* ─── Score bars ──────────────────────────────────────── */

.score-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
}

.score-bar-label { flex: 1; color: rgba(220,215,201,0.65); }
.score-bar-track {
  flex: 0 0 120px;
  height: 5px;
  background: rgba(220,215,201,0.1);
  border-radius: 3px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

.score-bar-fill.green  { background: var(--status-concluido); }
.score-bar-fill.amber  { background: var(--status-em-analise); }
.score-bar-fill.red    { background: #e07070; }

.score-bar-value { min-width: 2.5rem; text-align: right; font-weight: 600; }

/* ─── Pricing table ───────────────────────────────────── */

.pricing-table {
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(220,215,201,0.1);
}

.pricing-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(220,215,201,0.05);
  font-size: 0.875rem;
}

.pricing-row:last-child { border-bottom: none; }

.pricing-row.header {
  background: #252e30;
  font-family: 'Gotu', serif;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(220,215,201,0.45);
}

.pricing-row.total-row {
  background: var(--creme-accent);
  border: none;
  font-weight: 700;
  color: var(--au-lait);
}

.pricing-row.urgency-row {
  background: rgba(232,168,56,0.08);
}

.price-value {
  font-weight: 600;
  color: var(--creme);
  white-space: nowrap;
}

.price-range {
  font-size: 0.75rem;
  color: rgba(220,215,201,0.4);
  white-space: nowrap;
}

/* ─── Deadline badge ──────────────────────────────────── */

.deadline-urgent { color: #e07070; font-weight: 600; }
.deadline-soon   { color: var(--status-em-analise); font-weight: 600; }
.deadline-ok     { color: rgba(220,215,201,0.5); }

/* ─── Misc ────────────────────────────────────────────── */

.divider {
  border: none;
  border-top: 1px solid rgba(220,215,201,0.07);
  margin: 0.5rem 0;
}

.text-muted  { color: rgba(220,215,201,0.45); }
.text-creme  { color: var(--creme); }
.text-small  { font-size: 0.8rem; }
.text-center { text-align: center; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(220,215,201,0.2);
  border-top-color: var(--creme);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(44,54,57,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  z-index: 10;
}

/* ─── Toast ───────────────────────────────────────────── */

#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: #3a4a4c;
  border: 1px solid var(--creme-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.1rem;
  font-size: 0.85rem;
  color: var(--au-lait);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: toast-in 0.25s ease;
  max-width: 320px;
}

.toast.success { border-color: rgba(90,184,122,0.5); }
.toast.error   { border-color: rgba(220,80,80,0.5); }

@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ─── Responsive ──────────────────────────────────────── */

@media (max-width: 800px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: var(--topbar-height) 1fr;
  }
  .sidebar { display: none; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
