/* ============================================
   FreelanceDesk — Design System (Light Mode)
   Sistema visual: Design Thinking / SF Pro
   ============================================ */

/* ============================================
   FONTS — SF Pro Display (system font)
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================
   CSS VARIABLES — Light Palette
   ============================================ */
:root {
  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", monospace;

  /* Background layers */
  --bg-base:     #F0F2F8;
  --bg-surface:  #FFFFFF;
  --bg-card:     #FFFFFF;
  --bg-elevated: #F6F7FB;
  --bg-hover:    #EEF0F7;
  --bg-input:    #F6F7FB;

  /* Text colors */
  --text-primary:   #1D2034;
  --text-secondary: #3D4966;
  --text-muted:     #8892B0;

  /* Borders */
  --border:        #E2E6F0;
  --border-subtle: #EDF0F7;

  /* Accent — Dark Navy (primary) */
  --accent-blue:      #1D2034;
  --accent-blue-dim:  #2D3455;
  --accent-blue-light: rgba(29, 32, 52, 0.07);
  --accent-blue-glow:  rgba(29, 32, 52, 0.12);

  /* Accent — Steel Blue (secondary) */
  --accent-steel:      #3D4966;
  --accent-steel-light: rgba(61, 73, 102, 0.08);

  /* Status colors */
  --accent-green:       #16A34A;
  --accent-green-light: rgba(22, 163, 74, 0.09);
  --accent-yellow:      #CA8A04;
  --accent-yellow-light: rgba(202, 138, 4, 0.09);
  --accent-red:         #DC2626;
  --accent-red-light:   rgba(220, 38, 38, 0.09);
  --accent-purple:      #7C3AED;
  --accent-purple-light: rgba(124, 58, 237, 0.09);

  /* Shadows (navy-tinted) */
  --shadow-sm:  0 1px 2px rgba(29, 32, 52, 0.05);
  --shadow-md:  0 4px 12px rgba(29, 32, 52, 0.08);
  --shadow-lg:  0 8px 28px rgba(29, 32, 52, 0.10);
  --shadow-xl:  0 20px 60px rgba(29, 32, 52, 0.14);

  /* Geometry */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 99px;

  /* Timing */
  --transition:      0.15s ease;
  --transition-slow: 0.25s ease;

  /* Layout */
  --sidebar-width:   240px;
  --topbar-height:   60px;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: 14px;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
button { border: none; background: none; cursor: pointer; font: inherit; color: inherit; }
input, select, textarea { font: inherit; }
img { max-width: 100%; }

/* ============================================
   LAYOUT
   ============================================ */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--transition-slow);
  box-shadow: var(--shadow-sm);
}

.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar-header {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 36px; height: 36px;
  background: var(--accent-blue);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.logo-text {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.sidebar-close {
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius-sm);
  display: none;
  transition: all var(--transition);
}
.sidebar-close:hover { background: var(--bg-elevated); color: var(--text-primary); }

.sidebar-nav {
  flex: 1;
  padding: 16px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  position: relative;
}

.nav-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-blue);
  color: white;
  font-weight: 600;
}

.nav-item.active svg { opacity: 1; }
.nav-item svg { flex-shrink: 0; opacity: 0.7; }
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid var(--border-subtle);
}

.tax-summary-mini {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 8px;
}

.tax-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.tax-value { font-size: 1rem; font-weight: 700; color: var(--text-primary); }

/* ============================================
   Topbar
   ============================================ */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left { display: flex; align-items: center; gap: 14px; }

.menu-toggle {
  color: var(--text-secondary);
  padding: 6px;
  border-radius: var(--radius-sm);
  display: none;
  transition: color var(--transition);
}
.menu-toggle:hover { color: var(--text-primary); }

.page-breadcrumb {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-right { display: flex; align-items: center; gap: 14px; }

.alert-bell {
  position: relative;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.alert-bell:hover { color: var(--text-primary); background: var(--bg-elevated); }

.alert-count {
  position: absolute;
  top: 2px; right: 2px;
  background: var(--accent-red);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}
.alert-count.hidden { display: none; }

.topbar-date { font-size: 0.8rem; color: var(--text-muted); font-weight: 400; }

.avatar {
  width: 34px; height: 34px;
  background: var(--accent-blue);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; color: white;
  flex-shrink: 0;
}

.user-info { display: flex; align-items: center; gap: 8px; }
.user-email { font-size: 0.78rem; color: var(--text-muted); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) { .user-email { display: none; } }

/* ============================================
   Pages
   ============================================ */
.page { display: none; padding: 28px; animation: fadeSlideUp 0.25s ease; }
.page.active { display: block; }

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Section Headers
   ============================================ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.section-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.section-actions { display: flex; align-items: center; gap: 10px; }

/* ============================================
   Stats Grid
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-color, var(--accent-blue));
  opacity: 0;
  transition: opacity var(--transition);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card:hover::before { opacity: 1; }

.stat-card.blue   { --accent-color: var(--accent-blue); }
.stat-card.green  { --accent-color: var(--accent-green); }
.stat-card.yellow { --accent-color: var(--accent-yellow); }
.stat-card.red    { --accent-color: var(--accent-red); }
.stat-card.purple { --accent-color: var(--accent-purple); }

.stat-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}

.stat-icon.blue   { background: var(--accent-blue-light);   color: var(--accent-blue);   }
.stat-icon.green  { background: var(--accent-green-light);  color: var(--accent-green);  }
.stat-icon.yellow { background: var(--accent-yellow-light); color: var(--accent-yellow); }
.stat-icon.red    { background: var(--accent-red-light);    color: var(--accent-red);    }
.stat-icon.purple { background: var(--accent-purple-light); color: var(--accent-purple); }

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1;
}

.stat-value.positive { color: var(--accent-green); }
.stat-value.negative { color: var(--accent-red);   }
.stat-value.warning  { color: var(--accent-yellow); }

.stat-change {
  font-size: 0.76rem;
  margin-top: 8px;
  font-weight: 500;
  color: var(--text-muted);
}
.stat-change.up   { color: var(--accent-green); }
.stat-change.down { color: var(--accent-red);   }

/* ============================================
   Cards
   ============================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title   { font-size: 0.9rem;  font-weight: 600; color: var(--text-primary); }
.card-subtitle{ font-size: 0.76rem; color: var(--text-muted); margin-top: 2px; }
.card-body    { padding: 22px; }

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

/* ============================================
   Chart Container
   ============================================ */
.chart-container        { position: relative; width: 100%; height: 240px; }
.chart-container.tall   { height: 300px; }
.chart-container.short  { height: 180px; }

/* ============================================
   Tables
   ============================================ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

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

thead { background: var(--bg-elevated); }

th {
  padding: 11px 16px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}

td strong { color: var(--text-primary); font-weight: 600; }

tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child td { border-bottom: none; }

/* Row checkbox (multi-select) */
.row-check-col { width: 44px; }

.row-checkbox {
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.row-checkbox:checked {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
}

.row-checkbox:checked::after {
  content: '';
  position: absolute;
  width: 5px; height: 9px;
  border: 2px solid white;
  border-top: none; border-left: none;
  transform: rotate(44deg) translateY(-1px);
  display: block;
}

.row-checkbox:hover:not(:checked) { border-color: var(--accent-steel); }

/* Client name clickable (opens history) */
td .client-name-link {
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition);
}
td .client-name-link:hover {
  color: var(--accent-steel);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ============================================
   Bulk Action Bar
   ============================================ */
.bulk-bar {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--accent-blue);
  color: white;
  border-radius: var(--radius-pill);
  padding: 11px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-xl);
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-slow);
  white-space: nowrap;
  font-size: 0.855rem;
  font-weight: 600;
}

.bulk-bar.visible {
  opacity: 1;
  pointer-events: all;
  transform: translateX(-50%) translateY(0);
}

.bulk-bar-count { opacity: 0.75; font-weight: 400; }

.bulk-bar-sep { width: 1px; height: 18px; background: rgba(255,255,255,0.25); }

.bulk-bar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all var(--transition);
  color: white;
}

.bulk-bar-btn.danger { background: rgba(220, 38, 38, 0.3); }
.bulk-bar-btn.danger:hover { background: rgba(220, 38, 38, 0.6); }

.bulk-bar-cancel {
  color: rgba(255,255,255,0.6);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  transition: color var(--transition);
}
.bulk-bar-cancel:hover { color: white; }

/* ============================================
   Badges
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.71rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-paid      { background: var(--accent-green-light);  color: var(--accent-green);  }
.badge-pending   { background: var(--accent-yellow-light); color: var(--accent-yellow); }
.badge-overdue   { background: var(--accent-red-light);    color: var(--accent-red);    }
.badge-partial   { background: var(--accent-steel-light);  color: var(--accent-steel);  }
.badge-active    { background: var(--accent-blue-light);   color: var(--accent-blue);   }
.badge-completed { background: var(--accent-green-light);  color: var(--accent-green);  }
.badge-paused    { background: var(--accent-yellow-light); color: var(--accent-yellow); }
.badge-cancelled { background: var(--accent-red-light);    color: var(--accent-red);    }

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 0.855rem;
  font-weight: 600;
  transition: all var(--transition);
  border: 1.5px solid transparent;
  white-space: nowrap;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent-blue);
  color: white;
  border-color: var(--accent-blue);
}
.btn-primary:hover {
  background: var(--accent-blue-dim);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-danger {
  background: var(--accent-red);
  color: white;
  border-color: var(--accent-red);
}
.btn-danger:hover {
  background: #b91c1c;
  box-shadow: 0 0 0 3px rgba(220,38,38,0.15);
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover         { background: var(--bg-elevated); color: var(--text-primary); }
.btn-icon.danger:hover  { background: var(--accent-red-light);   color: var(--accent-red);   }
.btn-icon.edit:hover    { background: var(--accent-blue-light);  color: var(--accent-blue);  }
.btn-icon.project:hover { background: var(--accent-green-light); color: var(--accent-green); }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

.w-full { width: 100%; justify-content: center; }

/* ============================================
   Forms
   ============================================ */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.form-group:not(.form-row .form-group) { margin-bottom: 16px; }

label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
select,
textarea {
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 10px 13px;
  font-size: 0.875rem;
  outline: none;
  transition: all var(--transition);
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent-steel);
  box-shadow: 0 0 0 3px rgba(61,73,102,0.10);
  background: var(--bg-surface);
}

input::placeholder, textarea::placeholder { color: var(--text-muted); }
select option { background: var(--bg-surface); }
textarea { resize: vertical; min-height: 80px; }

/* ============================================
   Search & Filter
   ============================================ */
.search-bar { position: relative; display: flex; align-items: center; }

.search-bar input { padding-left: 38px; width: 260px; }

.search-bar svg {
  position: absolute;
  left: 11px;
  color: var(--text-muted);
  pointer-events: none;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-select {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: all var(--transition);
}
.filter-select:focus { border-color: var(--accent-steel); }

/* ============================================
   Modals
   ============================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(29, 32, 52, 0.45);
  backdrop-filter: blur(4px);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-backdrop.active { opacity: 1; pointer-events: all; }

.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  z-index: 400;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-slow);
  box-shadow: var(--shadow-xl);
}

.modal.modal-sm { max-width: 420px; }

.modal.active {
  opacity: 1;
  pointer-events: all;
  transform: translate(-50%, -50%) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

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

.modal-close {
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.modal-close:hover { background: var(--bg-elevated); color: var(--text-primary); }

.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-body p { color: var(--text-secondary); line-height: 1.7; }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

/* ============================================
   CLIENT HISTORY DRAWER
   ============================================ */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(29, 32, 52, 0.3);
  z-index: 450;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}
.drawer-overlay.active { opacity: 1; pointer-events: all; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  max-width: 95vw;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  z-index: 500;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
  box-shadow: var(--shadow-xl);
}
.drawer.active { transform: translateX(0); }

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-shrink: 0;
}

.drawer-client-info { flex: 1; }

.drawer-client-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.drawer-client-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drawer-close {
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  margin-left: 12px;
  flex-shrink: 0;
}
.drawer-close:hover { background: var(--bg-elevated); color: var(--text-primary); }

.drawer-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.drawer-stat {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
}

.drawer-stat-value { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.drawer-stat-label { font-size: 0.68rem; color: var(--text-muted); font-weight: 500; margin-top: 3px; text-transform: uppercase; letter-spacing: 0.05em; }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.drawer-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.history-project-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: all var(--transition);
  cursor: pointer;
}

.history-project-card:hover {
  border-color: var(--border);
  background: var(--bg-hover);
  box-shadow: var(--shadow-sm);
}

.history-project-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.history-project-name { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }

.history-project-value {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.history-project-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.drawer-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

/* ============================================
   KANBAN BOARD (Project Scope)
   ============================================ */
.board-wrapper {
  overflow-x: auto;
  padding-bottom: 16px;
}

.board-columns {
  display: flex;
  gap: 16px;
  min-width: max-content;
  align-items: flex-start;
}

.board-column {
  width: 300px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.board-column-header {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.board-column-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

.board-column-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 1px 8px;
}

.board-add-btn {
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.board-add-btn:hover { background: var(--bg-surface); color: var(--text-primary); }

.board-column-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
}

.board-column-body.drag-over {
  background: var(--accent-blue-light);
  border-radius: var(--radius-md);
}

/* Scope Cards */
.scope-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: grab;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.scope-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border);
  transform: translateY(-1px);
}

.scope-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
  transform: rotate(2deg);
}

.scope-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.scope-card-client {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.scope-card-scope {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.scope-card-scope li {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.scope-card-scope li::before {
  content: '•';
  color: var(--text-muted);
  flex-shrink: 0;
  line-height: 1.4;
}

.scope-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.scope-card-deadline {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.scope-card-deadline.near { color: var(--accent-yellow); }
.scope-card-deadline.overdue { color: var(--accent-red); font-weight: 600; }

.scope-card-value {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
}

.scope-card-actions {
  display: flex;
  gap: 4px;
}

.board-empty {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Column accent colors */
.board-column[data-col="briefing"]   .board-column-title { color: #6366F1; }
.board-column[data-col="production"] .board-column-title { color: #0EA5E9; }
.board-column[data-col="review"]     .board-column-title { color: #F59E0B; }
.board-column[data-col="completed"]  .board-column-title { color: var(--accent-green); }

/* ============================================
   Toast
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.855rem;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: toastIn 0.3s ease;
  max-width: 340px;
  border-left: 3px solid var(--accent-steel);
}

.toast.success { border-left-color: var(--accent-green); }
.toast.error   { border-left-color: var(--accent-red);   }
.toast.warning { border-left-color: var(--accent-yellow);}

.toast-icon { flex-shrink: 0; }
.toast.success .toast-icon { color: var(--accent-green); }
.toast.error   .toast-icon { color: var(--accent-red);   }
.toast.warning .toast-icon { color: var(--accent-yellow);}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ============================================
   Alert Items
   ============================================ */
.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid;
  transition: all var(--transition);
}

.alert-item.warning {
  background: var(--accent-yellow-light);
  border-color: rgba(202, 138, 4, 0.18);
}

.alert-item.danger {
  background: var(--accent-red-light);
  border-color: rgba(220, 38, 38, 0.18);
}

.alert-item-icon { flex-shrink: 0; margin-top: 1px; }
.alert-item.warning .alert-item-icon { color: var(--accent-yellow); }
.alert-item.danger  .alert-item-icon { color: var(--accent-red);    }

.alert-item-name   { font-size: 0.855rem; font-weight: 600; color: var(--text-primary); }
.alert-item-detail { font-size: 0.76rem;  color: var(--text-secondary); margin-top: 2px; }

/* ============================================
   Progress Bar
   ============================================ */
.progress-bar { width: 100%; height: 5px; background: var(--bg-elevated); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent-steel), var(--accent-blue)); transition: width 0.5s ease; }

/* ============================================
   Month Selector
   ============================================ */
.month-selector {
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.month-selector button {
  padding: 7px 12px;
  color: var(--text-secondary);
  transition: all var(--transition);
  font-size: 0.85rem;
}
.month-selector button:hover { background: var(--bg-hover); color: var(--text-primary); }

.month-selector span {
  padding: 7px 16px;
  font-size: 0.855rem;
  font-weight: 600;
  color: var(--text-primary);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  min-width: 140px;
  text-align: center;
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state svg { margin-bottom: 16px; opacity: 0.3; }
.empty-state p { font-size: 0.875rem; }

/* ============================================
   Tax Calculator
   ============================================ */
.tax-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.tax-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.tax-item-label  { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
.tax-item-value  { font-size: 1.15rem; font-weight: 700; color: var(--text-primary); }
.tax-item-value.amount  { color: var(--accent-red);    }
.tax-item-value.reserve { color: var(--accent-steel);  }
.tax-item-value.net     { color: var(--accent-green);  }

.tax-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

/* ============================================
   Donut chart legend
   ============================================ */
.donut-wrapper { display: flex; align-items: center; gap: 24px; }
.donut-chart { flex: 0 0 180px; height: 180px; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 8px; }

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.legend-dot  { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-name { flex: 1; font-size: 0.82rem; color: var(--text-secondary); }
.legend-val  { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); }
.legend-pct  { font-size: 0.72rem; color: var(--text-muted); min-width: 32px; text-align: right; }

/* ============================================
   Sidebar Overlay (mobile)
   ============================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(29,32,52,0.4);
  z-index: 150;
}

/* ============================================
   Loading Overlay
   ============================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-base);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.4s ease;
}

.loading-overlay.hidden { opacity: 0; pointer-events: none; }

.loading-logo { display: flex; align-items: center; gap: 12px; }

.loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-steel);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text { font-size: 0.9rem; font-weight: 500; color: var(--text-secondary); }
.loading-sub  { font-size: 0.78rem; color: var(--accent-red); text-align: center; max-width: 300px; }

/* ============================================
   Auth / Login Page
   ============================================ */
.auth-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-base);
  z-index: 8000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(61,73,102,0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(29,32,52,0.04) 0%, transparent 50%);
}

.auth-screen.hidden { display: none; }

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
  animation: fadeSlideUp 0.35s ease;
}

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

.auth-logo .logo-icon {
  background: var(--accent-blue);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: white; flex-shrink: 0;
  box-shadow: var(--shadow-md);
}

.auth-logo-name {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.auth-logo-tagline { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

.auth-tabs {
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 28px;
  gap: 4px;
}

.auth-tab {
  flex: 1;
  padding: 9px;
  border-radius: calc(var(--radius-md) - 2px);
  font-size: 0.855rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition);
}

.auth-tab.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.auth-tab:hover:not(.active) { color: var(--text-secondary); }

.password-field { position: relative; }
.password-field input { padding-right: 42px; }

.password-toggle {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
  transition: color var(--transition);
  display: flex; align-items: center;
}
.password-toggle:hover { color: var(--text-secondary); }

.auth-error {
  font-size: 0.8rem;
  color: var(--accent-red);
  margin-bottom: 12px;
  min-height: 18px;
  line-height: 1.4;
}

.auth-hint {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 16px;
}

.auth-hint a { color: var(--accent-steel); font-weight: 600; transition: color var(--transition); }
.auth-hint a:hover { color: var(--accent-blue); }

/* Remember-me checkbox */
.remember-row { display: flex; align-items: center; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-secondary);
  user-select: none;
  font-weight: 500;
}

.checkbox-label input[type="checkbox"] { display: none; }

.checkbox-custom {
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  flex-shrink: 0;
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
  content: '';
  width: 5px; height: 9px;
  border: 2px solid white;
  border-top: none; border-left: none;
  transform: rotate(44deg) translateY(-1px);
  display: block;
}

.checkbox-label:hover .checkbox-custom { border-color: var(--accent-steel); }

/* ============================================
   Logout Button
   ============================================ */
.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  margin-top: 8px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: transparent;
  transition: all var(--transition);
}
.btn-logout:hover {
  background: var(--accent-red-light);
  color: var(--accent-red);
  border-color: rgba(220,38,38,0.2);
}

/* ============================================
   Utilities
   ============================================ */
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

.flex            { display: flex; }
.flex-col        { flex-direction: column; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2           { gap: 8px; }
.gap-4           { gap: 16px; }

.text-sm     { font-size: 0.82rem; }
.text-xs     { font-size: 0.72rem; }
.text-muted  { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-green  { color: var(--accent-green); }
.text-red    { color: var(--accent-red);   }
.text-blue   { color: var(--accent-steel); }

.font-bold    { font-weight: 700; }
.font-semibold{ font-weight: 600; }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: flex; }
  .sidebar-overlay { display: block; }
  .main-content { margin-left: 0; }
  .menu-toggle { display: flex; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .board-columns { min-width: auto; flex-wrap: wrap; }
  .board-column { width: 100%; max-width: 100%; }
  .drawer { width: 100%; }
  .page { padding: 16px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .auth-card  { padding: 28px 20px; }
}
