/* ====================================================================
   TaskMaster Saporito — Design System v4
   Refined corporate UI · navy + gold · light & dark themes
   ==================================================================== */

:root {
  /* ----- Primary / ação (azul) ----- */
  --primary:        #2563eb;
  --primary-50:     #eff6ff;
  --primary-100:    #dbeafe;
  --primary-200:    #bfdbfe;
  --primary-300:    #93c5fd;
  --primary-600:    #2563eb;
  --primary-700:    #1d4ed8;
  --primary-800:    #1e40af;
  --primary-900:    #1e3a8a;

  /* ----- Brand (navy) — estrutura/sidebar ----- */
  --brand:          #1e3a8a;
  --sidebar-bg:     linear-gradient(185deg, #1b3aa3 0%, #15307c 52%, #0f2055 100%);

  /* ----- Accent (gold) ----- */
  --accent:         #f59e0b;
  --accent-300:     #fcd34d;
  --accent-500:     #f59e0b;
  --accent-600:     #d97706;
  --accent-100:     #fef3c7;

  /* ----- Neutrals (cool slate) ----- */
  --bg:             #f3f5f9;
  --bg-2:           #f8fafc;
  --surface:        #ffffff;
  --surface-elev:   #ffffff;
  --th-bg:          #f6f8fc;
  --border:         #e7ecf3;
  --border-strong:  #d6deea;
  --text:           #101828;
  --text-muted:     #5a6678;
  --text-dim:       #98a2b3;

  /* ----- Semantic ----- */
  --success:        #16a34a;
  --success-50:     #f0fdf4;
  --success-100:    #d6f5e0;
  --success-text:   #15803d;
  --warning:        #d97706;
  --warning-50:     #fffaeb;
  --warning-100:    #fdedcd;
  --warning-text:   #b45309;
  --danger:         #dc2626;
  --danger-50:      #fef3f3;
  --danger-100:     #fbdcdc;
  --danger-text:    #b91c1c;
  --info:           #0284c7;
  --info-50:        #eff8ff;
  --info-100:       #d6ecfd;
  --info-text:      #075985;

  /* ----- Badge palette ----- */
  --badge-sec-bg:   #eef1f6;
  --badge-sec-text: #4b586b;

  /* ----- Soft shadows ----- */
  --shadow-xs: 0 1px 2px rgba(16,28,54,.04);
  --shadow-sm: 0 1px 2px rgba(16,28,54,.04), 0 1px 3px rgba(16,28,54,.05);
  --shadow:    0 2px 8px -2px rgba(16,28,54,.08), 0 4px 16px -8px rgba(16,28,54,.10);
  --shadow-md: 0 4px 12px -4px rgba(16,28,54,.10), 0 12px 28px -10px rgba(16,28,54,.12);
  --shadow-lg: 0 12px 28px -8px rgba(16,28,54,.14), 0 24px 48px -16px rgba(16,28,54,.16);
  --ring:      0 0 0 3px rgba(37,99,235,.20);

  /* ----- Radii ----- */
  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius:    13px;
  --radius-lg: 17px;
  --radius-xl: 22px;
  --radius-pill: 999px;

  /* ----- Layout ----- */
  --sidebar-width: 264px;
  --header-height: 66px;
  --max-content: 1280px;

  /* ----- Type ----- */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-display: "Poppins", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  color-scheme: light;
}

/* =========================
   DARK THEME
   ========================= */
[data-theme="dark"] {
  --primary:        #3b82f6;
  --primary-50:     #11203e;
  --primary-100:    #16294d;
  --primary-200:    #1d3b6b;
  --primary-300:    #60a5fa;
  --primary-600:    #3b82f6;
  --primary-700:    #2f6fd6;
  --primary-800:    #1e40af;
  --primary-900:    #1e3a8a;

  --sidebar-bg:     linear-gradient(185deg, #12203c 0%, #0e1a30 55%, #0a1424 100%);

  --bg:             #0b1220;
  --bg-2:           #111a2b;
  --surface:        #151f33;
  --surface-elev:   #1b2740;
  --th-bg:          #1a2742;
  --border:         #233152;
  --border-strong:  #33456b;
  --text:           #e8edf7;
  --text-muted:     #9fabc2;
  --text-dim:       #6c7a96;

  --success-50:     #0f2a1d;
  --success-100:    #173a28;
  --success-text:   #54d98a;
  --warning-50:     #2b2410;
  --warning-100:    #3c3216;
  --warning-text:   #f5b452;
  --danger-50:      #2e1518;
  --danger-100:     #401c20;
  --danger-text:    #f48a8a;
  --info-50:        #0d2436;
  --info-100:       #123247;
  --info-text:      #6cc0f0;

  --badge-sec-bg:   #1e2a42;
  --badge-sec-text: #b3c0d6;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.30);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.30), 0 1px 3px rgba(0,0,0,.34);
  --shadow:    0 2px 8px -2px rgba(0,0,0,.40), 0 4px 16px -8px rgba(0,0,0,.46);
  --shadow-md: 0 4px 12px -4px rgba(0,0,0,.46), 0 12px 28px -10px rgba(0,0,0,.52);
  --shadow-lg: 0 12px 28px -8px rgba(0,0,0,.55), 0 24px 48px -16px rgba(0,0,0,.6);
  --ring:      0 0 0 3px rgba(59,130,246,.34);

  color-scheme: dark;
}

/* ----- Reset / base ----- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background:
    radial-gradient(900px 500px at 100% -5%, rgba(33,82,214,.05), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(245,158,11,.04), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: -.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .25s ease, color .25s ease;
}
a { color: var(--primary-600); text-decoration: none; transition: color .15s; }
a:hover { color: var(--primary-700); }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; color: var(--text); }
hr { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

::selection { background: var(--primary-200); color: var(--text); }

/* Refined scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-dim); background-clip: content-box; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-xs); }

/* =========================
   LAYOUT (sidebar + main)
   ========================= */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: rgba(255,255,255,.95);
  position: fixed; left: 0; top: 0; bottom: 0;
  display: flex; flex-direction: column;
  z-index: 50;
  box-shadow: 1px 0 0 rgba(255,255,255,.04);
}
.sidebar-brand {
  height: var(--header-height);
  display: flex; align-items: center; gap: 12px;
  padding: 0 22px;
  font-family: var(--font-display);
  font-weight: 700; font-size: 17px;
  border-bottom: 1px solid rgba(255,255,255,.10);
  letter-spacing: -.02em;
  position: relative; z-index: 1;
}
.sidebar-brand .brand-mark {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent-300) 0%, var(--accent-600) 100%);
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; color: #3a2606; font-weight: 900;
  box-shadow: 0 3px 10px rgba(245,158,11,.4);
}
.sidebar-nav { flex: 1; padding: 14px 14px; overflow-y: auto; position: relative; z-index: 1; }
.sidebar-nav .nav-section {
  font-size: 11px;
  letter-spacing: .01em;
  color: rgba(255,255,255,.5);
  padding: 16px 12px 7px;
  font-weight: 600;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px;
  color: rgba(255,255,255,.76);
  font-weight: 500;
  border-radius: 10px;
  margin-bottom: 2px;
  font-size: 14px;
  position: relative;
  transition: background .16s ease, color .16s ease;
}
.sidebar-nav a:hover {
  background: rgba(255,255,255,.08);
  color: #fff; text-decoration: none;
}
.sidebar-nav a.active {
  background: rgba(255,255,255,.12);
  color: #fff;
  font-weight: 600;
}
.sidebar-nav a.active::before {
  content: ''; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 20px; border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, var(--accent-300), var(--accent-600));
}
.sidebar-nav .icon {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px;
  line-height: 1;
}
.sidebar-footer {
  padding: 14px 22px;
  border-top: 1px solid rgba(255,255,255,.10);
  font-size: 11.5px;
  color: rgba(255,255,255,.5);
  position: relative; z-index: 1;
  letter-spacing: .02em;
}

.main {
  flex: 1; margin-left: var(--sidebar-width);
  display: flex; flex-direction: column;
  min-height: 100vh;
}
.topbar {
  height: var(--header-height);
  background: var(--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: 40;
}
.topbar h1 { font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.topbar .user-chip {
  display: flex; align-items: center; gap: 12px;
  font-size: 13px; color: var(--text-muted);
}
.topbar .user-chip .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-800) 100%);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.topbar .user-chip .user-name { font-weight: 600; color: var(--text); }
.topbar .logout-btn {
  background: var(--surface); border: 1px solid var(--border-strong);
  color: var(--text-muted);
  padding: 8px 15px; border-radius: 10px;
  cursor: pointer; font-size: 12.5px; font-weight: 600;
  transition: all .15s;
}
.topbar .logout-btn:hover { background: var(--danger-50); color: var(--danger); border-color: var(--danger-100); }

/* Theme toggle */
.theme-toggle {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .15s;
}
.theme-toggle:hover { background: var(--bg-2); color: var(--primary); border-color: var(--text-dim); transform: rotate(-15deg); }

.menu-toggle {
  display: none; background: none; border: none;
  font-size: 22px; cursor: pointer; color: var(--primary);
  padding: 6px 10px;
}

.content {
  padding: 32px;
  flex: 1;
  max-width: var(--max-content);
  width: 100%;
  margin: 0 auto;
  animation: fadeIn .3s ease both;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* =========================
   PAGE HEADER
   ========================= */
.page-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 26px; flex-wrap: wrap; gap: 14px;
}
.page-header h2 { font-size: 24px; font-weight: 800; letter-spacing: -.028em; }
.page-header .subtitle {
  color: var(--text-muted); margin-top: 5px; font-size: 13.5px;
}

/* =========================
   CARDS
   ========================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow .2s ease, border-color .2s ease;
}
.card:hover { box-shadow: var(--shadow); }
.card-header {
  padding: 17px 22px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -.015em;
  color: var(--text);
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface);
}
.card-body { padding: 22px; }

/* =========================
   STATS CARDS
   ========================= */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card::before { display: none; }
.stat-card.warn::before { background: var(--accent-500); }
.stat-card.danger::before { background: var(--danger); }
.stat-card.success::before { background: var(--success); }
.stat-card .stat-label {
  font-size: 12.5px; color: var(--text-muted);
  letter-spacing: -.005em; font-weight: 600;
  margin-bottom: 8px;
}
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 32px; font-weight: 700; color: var(--text);
  letter-spacing: -.03em; line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.stat-card .stat-icon {
  position: absolute; top: 18px; right: 18px;
  width: 40px; height: 40px;
  border-radius: 11px;
  background: var(--primary-50);
  color: var(--primary-600);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
}
.stat-card.warn .stat-icon { background: var(--warning-50); color: var(--warning); }
.stat-card.danger .stat-icon { background: var(--danger-50); color: var(--danger); }
.stat-card.success .stat-icon { background: var(--success-50); color: var(--success); }

/* =========================
   TABELAS
   ========================= */
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th, .table td {
  text-align: left; padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.table td { color: var(--text); }
.table th {
  background: var(--th-bg); color: var(--text-muted);
  font-weight: 600;
  font-size: 12px; letter-spacing: -.005em;
  position: sticky; top: 0;
}
.table tbody tr { transition: background .12s ease; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--primary-50); }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.row-overdue td { background: var(--danger-50) !important; }
.row-overdue:hover td { background: var(--danger-100) !important; }

/* =========================
   BADGES
   ========================= */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .03em;
  line-height: 1.5;
}
.badge-secondary { background: var(--badge-sec-bg); color: var(--badge-sec-text); }
.badge-primary   { background: var(--primary-100); color: var(--primary-700); }
.badge-info      { background: var(--info-100); color: var(--info-text); }
.badge-success   { background: var(--success-100); color: var(--success-text); }
.badge-warning   { background: var(--warning-100); color: var(--warning-text); }
.badge-danger    { background: var(--danger-100); color: var(--danger-text); }
.badge-dark      { background: var(--text); color: var(--surface); }
.badge-outline   { background: transparent; border: 1px solid var(--border-strong); color: var(--text-muted); }

/* =========================
   BUTTONS
   ========================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 19px;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: transform .12s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease, color .18s ease, filter .18s ease;
  font-family: inherit;
  white-space: nowrap;
  letter-spacing: -.005em;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.99); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { color: #fff; background: var(--primary-700); box-shadow: var(--shadow); transform: translateY(-1px); }

.btn-secondary {
  background: var(--surface); color: var(--text);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--bg-2); color: var(--text); border-color: var(--text-dim); }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-2); color: var(--text); }

.btn-danger {
  background: var(--danger); color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-danger:hover { color: #fff; filter: brightness(1.06); box-shadow: var(--shadow); transform: translateY(-1px); }

.btn-success {
  background: var(--success); color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-success:hover { filter: brightness(1.06); box-shadow: var(--shadow); color: #fff; transform: translateY(-1px); }

.btn-warning {
  background: var(--accent-500); color: #3a2606;
  box-shadow: var(--shadow-sm);
}
.btn-warning:hover { color: #3a2606; filter: brightness(1.04); box-shadow: var(--shadow); transform: translateY(-1px); }

.btn-sm { padding: 7px 13px; font-size: 12px; border-radius: var(--radius-xs); }
.btn-lg { padding: 14px 26px; font-size: 15px; min-height: 50px; border-radius: var(--radius); font-weight: 700; }
.btn-xl { padding: 18px 28px; font-size: 16.5px; min-height: 58px; border-radius: var(--radius); font-weight: 700; }
.btn-block { width: 100%; }

/* =========================
   FORMS
   ========================= */
.form-row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.form-group { display: flex; flex-direction: column; flex: 1; min-width: 220px; }
.form-group.full { flex-basis: 100%; }
.form-group label {
  font-size: 12.5px; font-weight: 600;
  letter-spacing: -.005em;
  color: var(--text-muted); margin-bottom: 7px;
}
.form-group .help-text { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

.form-control, .form-select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 14.5px; font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s, background .15s;
  appearance: none; -webkit-appearance: none;
}
.form-control:hover, .form-select:hover { border-color: var(--text-dim); }
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--ring);
  background: var(--surface);
}
.form-control::placeholder { color: var(--text-dim); }
textarea.form-control { resize: vertical; min-height: 96px; line-height: 1.55; }

/* Seta customizada do select */
.form-select {
  padding-right: 40px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b6677' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}
input[type="date"].form-control, input[type="datetime-local"].form-control,
input[type="time"].form-control, input[type="color"].form-control {
  appearance: auto; -webkit-appearance: auto;
}

.form-error { color: var(--danger); font-size: 12px; margin-top: 5px; font-weight: 500; }
.form-actions { display: flex; gap: 10px; padding-top: 8px; }

.checkbox-row {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 15px;
  background: var(--bg-2); border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.checkbox-row:hover { background: var(--primary-50); border-color: var(--primary-200); box-shadow: var(--shadow-xs); }
.checkbox-row input[type="checkbox"] {
  margin-top: 2px; width: 17px; height: 17px; accent-color: var(--primary);
  cursor: pointer;
}
.checkbox-row .check-content { flex: 1; }
.checkbox-row .check-title { font-weight: 600; font-size: 14px; color: var(--text); }
.checkbox-row .check-desc { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }

.segmented {
  display: inline-flex; gap: 4px; padding: 5px;
  background: var(--bg-2); border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}
.segmented label {
  padding: 8px 17px; font-size: 13px; font-weight: 600;
  color: var(--text-muted); cursor: pointer; border-radius: 7px;
  transition: all .15s; margin: 0;
}
.segmented input[type="radio"] { display: none; }
.segmented input[type="radio"]:checked + label {
  background: var(--surface); color: var(--primary-600);
  box-shadow: var(--shadow-sm);
}

/* =========================
   COMBOBOX
   ========================= */
.combobox { position: relative; }
.combobox-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  z-index: 60;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 300px; overflow-y: auto;
  padding: 6px;
}
.combobox-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 14px;
  transition: background .12s;
}
.combobox-item:hover { background: var(--primary-50); }
.combobox-item .ci-title { font-weight: 500; color: var(--text); }
.combobox-item .ci-weight {
  flex-shrink: 0;
  font-size: 10.5px; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--primary-700);
  background: var(--primary-100);
  padding: 3px 9px; border-radius: var(--radius-pill);
}

/* =========================
   ALERTS
   ========================= */
.alert {
  padding: 14px 17px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  margin-bottom: 18px;
  font-size: 13.5px;
  display: flex; align-items: flex-start; gap: 11px;
  box-shadow: var(--shadow-xs);
}
.alert-success { background: var(--success-50); border-color: var(--success-100); color: var(--success-text); }
.alert-error   { background: var(--danger-50);  border-color: var(--danger-100);  color: var(--danger-text); }
.alert-info    { background: var(--info-50);    border-color: var(--info-100);    color: var(--info-text); }
.alert-warning { background: var(--warning-50); border-color: var(--warning-100); color: var(--warning-text); }

/* =========================
   LOGIN
   ========================= */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1100px 600px at 12% 18%, rgba(245,158,11,.16), transparent 55%),
    radial-gradient(1100px 700px at 88% 85%, rgba(33,82,214,.30), transparent 55%),
    linear-gradient(150deg, #1b3aa3 0%, #15307c 50%, #0e1f52 100%);
  padding: 20px;
  position: relative;
}
.login-wrap::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
}
.login-card {
  width: 100%; max-width: 430px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: 0 40px 80px rgba(8,15,40,.4), 0 0 0 1px rgba(255,255,255,.05);
  overflow: hidden;
  animation: slideUp .4s cubic-bezier(.22,1,.36,1);
  position: relative; z-index: 1;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.login-header {
  padding: 36px 30px 24px; text-align: center;
  background: linear-gradient(180deg, var(--primary-50), transparent);
}
.login-header .brand-mark {
  width: 68px; height: 68px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-800) 100%);
  border-radius: var(--radius-lg);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 30px; color: #fff; font-weight: 900;
  margin-bottom: 16px;
  box-shadow: 0 10px 22px rgba(30,64,175,.4), inset 0 1px 0 rgba(255,255,255,.25);
}
.login-header h1 { margin: 0; font-size: 23px; font-weight: 800; letter-spacing: -.02em; }
.login-header p  { margin: 7px 0 0; color: var(--text-muted); font-size: 13.5px; }
.login-body { padding: 24px 30px 34px; }

/* =========================
   TASK DETAIL VIEW
   ========================= */
.task-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.task-meta-list { list-style: none; padding: 0; margin: 0; }
.task-meta-list li {
  padding: 13px 0; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13.5px;
}
.task-meta-list li:last-child { border-bottom: none; }
.task-meta-list .label { color: var(--text-muted); font-weight: 500; }

/* Comments */
.comment-thread { display: flex; flex-direction: column; gap: 12px; }
.comment {
  background: var(--bg-2); border-radius: var(--radius-sm);
  padding: 14px 16px;
  border-left: 3px solid var(--primary);
  transition: box-shadow .15s;
}
.comment:hover { box-shadow: var(--shadow-xs); }
.comment .meta {
  font-size: 11.5px; color: var(--text-muted);
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 8px;
}
.comment .meta .avatar-mini {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--primary-100); color: var(--primary-700);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 700;
}

/* Attachments grid */
.attachments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.attachment-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  text-align: center;
  transition: transform .15s, box-shadow .15s;
}
.attachment-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.attachment-item img { width: 100%; height: 120px; object-fit: cover; display: block; }
.attachment-item .fname {
  padding: 7px 9px; font-size: 11px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.attachment-item.completion {
  border-color: var(--success);
  border-width: 2px;
  box-shadow: 0 0 0 3px var(--success-50);
}

/* =========================
   PHOTO CAPTURE (mobile-first)
   ========================= */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.hidden { display: none !important; }

.photo-actions {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
}
@media (max-width: 480px) {
  .photo-actions { grid-template-columns: 1fr; }
}

.btn-camera {
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-800) 100%);
  color: #fff;
  border: none;
  padding: 16px 18px;
  font-size: 16px; font-weight: 700;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  cursor: pointer; min-height: 60px;
  box-shadow: var(--shadow);
  transition: all .15s ease;
  font-family: inherit;
}
.btn-camera:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: #fff; text-decoration: none;
}
.btn-camera:active { transform: scale(.98); }
.btn-camera .icon-lg { font-size: 22px; }

.btn-gallery {
  background: var(--surface);
  color: var(--primary-600);
  border: 2px solid var(--primary-200);
  padding: 16px 16px;
  font-size: 14px; font-weight: 600;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; min-height: 60px;
  transition: all .15s ease;
  font-family: inherit;
}
.btn-gallery:hover { background: var(--primary-50); color: var(--primary-700); border-color: var(--primary); }
.btn-gallery:active { transform: scale(.98); }

.photos-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
  border: 2px solid var(--success);
  box-shadow: var(--shadow-sm);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb .remove {
  position: absolute; top: 5px; right: 5px;
  background: rgba(0,0,0,.72); color: #fff;
  border: none; width: 26px; height: 26px;
  border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  transition: background .15s;
}
.photo-thumb .remove:hover { background: var(--danger); }
.photo-thumb .check-corner {
  position: absolute; bottom: 5px; left: 5px;
  background: var(--success); color: #fff;
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  box-shadow: 0 2px 6px rgba(22,163,74,.4);
}

.photo-helper {
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--primary-700);
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 14px;
}
.photo-helper .icon { font-size: 18px; flex-shrink: 0; line-height: 1.2; }
.photo-helper.warning {
  background: var(--warning-50);
  border-color: var(--warning-100);
  color: var(--warning-text);
}

/* =========================
   TASK CARD
   ========================= */
.task-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all .18s ease;
  display: flex !important;
  flex-direction: column;
  gap: 12px;
  position: relative;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
}
.task-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0; width: 4px;
  background: var(--border-strong);
  transition: background .15s, width .15s;
}
.task-card:hover {
  border-color: var(--primary-200);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  text-decoration: none;
  color: var(--text);
}
.task-card:hover::before { background: var(--primary); }
.task-card.overdue { border-color: var(--danger-100); }
.task-card.overdue::before { background: var(--danger); width: 6px; }
.task-card.in-progress::before { background: var(--primary); width: 6px; }
.task-card.completed { opacity: .72; }

.task-card-title {
  font-weight: 700; font-size: 16px; color: var(--text);
  display: flex; gap: 8px; align-items: flex-start;
  line-height: 1.35; letter-spacing: -.01em;
}
.task-card-meta {
  display: flex; flex-wrap: wrap; gap: 6px;
  font-size: 12px;
}
.task-card-footer {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12.5px; color: var(--text-muted);
  padding-top: 12px; border-top: 1px solid var(--border);
  margin-top: auto;
}
.task-card-footer .arrow {
  color: var(--primary); font-weight: 700; font-size: 16px;
  transition: transform .15s;
}
.task-card:hover .task-card-footer .arrow { transform: translateX(3px); }
.task-card-actions {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.task-card-actions .btn { width: 100%; min-height: 42px; font-size: 13.5px; }

/* =========================
   EMPTY STATE
   ========================= */
.empty {
  padding: 56px 20px; text-align: center;
  color: var(--text-muted); font-size: 14px;
}
.empty .empty-icon {
  font-size: 52px; opacity: .3; margin-bottom: 12px;
  display: block;
}
.empty .empty-title { font-weight: 700; color: var(--text); margin-bottom: 4px; font-size: 15px; }

/* =========================
   AREAS
   ========================= */
.area-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex; gap: 14px; align-items: flex-start;
  transition: box-shadow .15s, transform .15s;
  box-shadow: var(--shadow-sm);
}
.area-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.area-icon-box {
  width: 50px; height: 50px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 23px; flex-shrink: 0;
}
.area-info { flex: 1; }
.area-info h4 { font-size: 15px; font-weight: 700; }
.area-info .meta { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.area-members {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px;
}
.member-chip {
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  display: inline-flex; align-items: center; gap: 4px;
}

/* =========================
   MOBILE
   ========================= */
@media (max-width: 768px) {
  :root { --sidebar-width: 0; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.22,1,.36,1);
    width: 270px;
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .task-grid { grid-template-columns: 1fr; }
  .content { padding: 18px; }
  .topbar { padding: 0 16px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header h2 { font-size: 21px; }

  .btn-camera, .btn-gallery { width: 100%; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }

  .form-control, .form-select,
  input[type="text"], input[type="email"], input[type="password"],
  input[type="datetime-local"], input[type="number"], input[type="search"],
  textarea, select {
    font-size: 16px;
  }
}

/* Sticky bottom action bar */
.action-bar {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 14px 16px;
  margin: 18px -16px -16px;
  display: flex; gap: 10px;
  box-shadow: 0 -6px 20px rgba(16,28,54,.08);
  z-index: 10;
}
@media (min-width: 769px) {
  .action-bar { position: static; margin: 18px 0 0; padding: 0; box-shadow: none; border-top: none; background: transparent; }
}

/* =========================
   UTILITIES
   ========================= */
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12.5px; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
