/* ═══════════════════════════════════════════════════════
   Surface Ops — Style System
   ═══════════════════════════════════════════════════════ */

/* ─── 1. Variables + Reset ─── */
:root {
  --bg: #f8f9fa;
  --card: #ffffff;
  --card-shadow: 0 4px 16px rgba(0,0,0,0.06);
  --text: #1a1a2e;
  --muted: #6c757d;
  --line: #dee2e6;
  --accent: #2563eb;
  --accent-secondary: #1d4ed8;
  --accent-gold: #2563eb;
  --danger: #dc3545;
  --success: #198754;
  --warning: #ffc107;
  --input-bg: #ffffff;
  --subcard-bg: #f8f9fa;
  --topbar-bg: rgba(248,249,250,0.92);
  --font-sans: 'Source Sans 3', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 8px;
  --radius-lg: 8px;

  --sidebar-bg: #1A1A1A;
  --sidebar-text: #E9EEF5;
  --sidebar-muted: #7A7C86;
  --sidebar-hover: rgba(255,255,255,0.08);
  --sidebar-active: rgba(194,162,95,0.15);
  --sidebar-active-text: #C2A25F;
  --sidebar-width: 240px;
  --panel-width: 480px;
  --panel-shadow: -4px 0 24px rgba(0,0,0,0.12);
  --info: #378ADD;
}

[data-theme="dark"] {
  --bg: #0b0d10;
  --card: #12161c;
  --card-shadow: 0 4px 16px rgba(0,0,0,0.25);
  --text: #e9eef5;
  --muted: #a7b3c4;
  --line: #273244;
  --accent: #C2A25F;
  --accent-secondary: #F8F6F1;
  --accent-gold: #C2A25F;
  --danger: #ff5d5d;
  --input-bg: #0f1319;
  --subcard-bg: rgba(255,255,255,0.04);
  --topbar-bg: rgba(10,12,16,0.85);

  --sidebar-bg: #0a0c0f;
  --sidebar-hover: rgba(255,255,255,0.06);
  --sidebar-active: rgba(194,162,95,0.12);
  --panel-shadow: -4px 0 24px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-secondary); text-decoration: underline; }

/* Skip link */
.skip-link {
  position: absolute; top: -40px; left: 0;
  background: var(--accent); color: var(--bg);
  padding: 8px 16px; z-index: 100; font-weight: 600;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { top: 0; }

/* ─── 2. Layout (sidebar, main area, panel) ─── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 40;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.08);
}

.main-area {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 48px;
  gap: 12px;
}
.page-header__left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-header__breadcrumb { font-size: 13px; color: var(--muted); }
.page-header__breadcrumb a { color: var(--muted); }
.page-header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.page-header__timer-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--subcard-bg);
}
.page-header__timer-name { font-weight: 600; }
.page-header__timer-clock {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 18px;
  color: var(--text);
  line-height: 1;
}

.page-content {
  flex: 1;
  padding: 20px 24px;
  max-width: 1200px;
  width: 100%;
}

/* ─── Slide-out panel ─── */
.panel-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 50;
}
.panel-overlay.open { display: block; }

.panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: var(--panel-width);
  background: var(--card);
  box-shadow: var(--panel-shadow);
  z-index: 51;
  transform: translateX(100%);
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.panel.open { transform: translateX(0); }

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.panel__title { margin: 0; font-size: 16px; font-weight: 600; }
.panel__close {
  background: none; border: none;
  font-size: 20px; color: var(--muted);
  cursor: pointer; padding: 4px 8px;
  border-radius: var(--radius);
}
.panel__close:hover { background: var(--line); color: var(--text); }
.panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* ─── 3. Sidebar Navigation ─── */
.sidebar__brand {
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar__brand a {
  color: var(--sidebar-active-text);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.02em;
}
.sidebar__brand a:hover { text-decoration: none; color: var(--sidebar-active-text); }

.sidebar__nav { flex: 1; padding: 8px 0; overflow-y: auto; }

.sidebar__section { padding: 4px 0; }
.sidebar__section + .sidebar__section {
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: 4px;
  padding-top: 8px;
}

.sidebar__heading {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sidebar-muted);
  padding: 8px 16px 4px;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  border-radius: 6px;
  margin: 1px 8px;
  transition: background 0.1s;
}
.sidebar__link:hover { background: var(--sidebar-hover); color: var(--sidebar-text); text-decoration: none; }
.sidebar__link.active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
  font-weight: 600;
}
.sidebar__icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.6; }

.sidebar__timer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(194,162,95,0.08);
}
.sidebar__timer-label { font-size: 11px; text-transform: uppercase; color: var(--sidebar-muted); letter-spacing: 0.04em; }
.sidebar__timer-project { font-size: 13px; font-weight: 600; color: var(--sidebar-active-text); margin: 2px 0; }
.sidebar__timer-clock {
  font-size: 20px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--sidebar-text);
  margin: 4px 0 8px;
}

.sidebar__user {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}
.sidebar__user-name { color: var(--sidebar-text); font-weight: 600; }
.sidebar__logout { color: var(--sidebar-muted); font-size: 12px; text-decoration: none; }
.sidebar__logout:hover { color: var(--danger); text-decoration: none; }

.theme-toggle {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 5px 8px;
  font-size: 1rem;
  line-height: 1;
  color: var(--sidebar-muted);
  transition: background 0.15s, border-color 0.15s;
}
.theme-toggle:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.3);
}

/* ─── 4. Components (pills, buttons, forms, inputs) ─── */

/* Forms */
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
label.inline { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.inline { display: inline-flex; align-items: center; gap: 6px; }
.small-label { font-size: 13px; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.stacked-form {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}
.stacked-form .btn { width: 100%; }

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  font: inherit;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  min-height: 38px;
  line-height: 1.2;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea { resize: vertical; }

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

select[multiple] {
  background-image: none;
  padding-right: 12px;
  min-height: 100px;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

input[type="checkbox"],
input[type="radio"] {
  width: 16px; height: 16px; margin: 0;
  accent-color: var(--accent);
}

/* Buttons */
.btn {
  font: inherit;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
}
.btn:hover { background: var(--accent-secondary); border-color: var(--accent-secondary); color: #fff; text-decoration: none; }
.btn.danger { border-color: var(--danger); background: var(--danger); color: #fff; }
.btn.danger:hover { background: #bb2d3b; border-color: #bb2d3b; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text); opacity: 0.9; }
.btn.ghost:hover { opacity: 1; background: var(--bg); }
.btn.ghost.danger { color: var(--danger); border-color: rgba(220,53,69,0.4); }
.btn.ghost.danger:hover { background: rgba(220,53,69,0.08); }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: 12px; }
.full-width { width: 100%; }

.btn-icon {
  background: none; border: none;
  color: var(--muted); cursor: pointer;
  font-size: 16px; padding: 2px 4px;
  line-height: 1; border-radius: var(--radius);
}
.btn-icon:hover { color: var(--danger); background: rgba(220,53,69,0.08); }

/* Pills & tags */
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: default;
}
.pill.running { border-color: var(--accent); color: var(--accent); background: rgba(37,99,235,0.08); }
.pill.idle { color: var(--muted); }
.pill.positive { color: #198754; border-color: rgba(25,135,84,0.4); background: rgba(25,135,84,0.08); }
.pill.negative { color: var(--danger); border-color: rgba(220,53,69,0.4); background: rgba(220,53,69,0.08); }

.pill.tiny {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: rgba(37,99,235,0.06);
}

.tag-pill {
  display: inline-block;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--subcard-bg);
  border: 1px solid var(--line);
  color: var(--muted);
  margin: 0 2px;
}

.tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.tag-pill-btn {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.tag-pill-btn:hover {
  border-color: var(--accent-gold);
  color: var(--text);
}
.tag-pill-btn.active {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #fff;
}

/* Status pills */
.pill.status.open { color: #198754; border-color: rgba(25,135,84,0.4); background: rgba(25,135,84,0.08); }
.pill.status.closed, .pill.status.done { color: var(--muted); border-color: var(--line); background: var(--subcard-bg); }
.pill.status.on_hold { color: #6c757d; border-color: rgba(108,117,125,0.4); background: rgba(108,117,125,0.08); }
.pill.status.not_started { color: var(--muted); border-color: var(--line); background: var(--bg); }
.pill.status.in_progress { color: #1a6fb5; border-color: rgba(26,111,181,0.4); background: rgba(26,111,181,0.1); }
.pill.status.in_review { color: #856404; border-color: rgba(255,193,7,0.5); background: rgba(255,193,7,0.1); }
.pill.status.approved, .pill.status.complete { color: #198754; border-color: rgba(25,135,84,0.4); background: rgba(25,135,84,0.08); }
.pill.status.blocked { color: var(--danger); border-color: rgba(220,53,69,0.5); background: rgba(220,53,69,0.08); }

/* Priority pills */
.pill.priority.urgent { background: var(--danger); color: #fff; border-color: var(--danger); }
.pill.priority.high { background: var(--accent); color: #fff; border-color: var(--accent); }
.pill.priority.medium { background: var(--warning); color: #1a1a2e; border-color: var(--warning); }
.pill.priority.low { background: var(--line); color: var(--text); border-color: var(--line); }

/* ─── 5. Task rows + task lists ─── */
.task-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.task-row:hover { background: var(--subcard-bg); }
.task-row:last-child { border-bottom: none; }
.task-row--dependency { border-left: 3px solid var(--warning); }

.task-row__status { flex-shrink: 0; }
.task-row__status form { display: inline; }
.task-row__status .pill { cursor: pointer; }
.task-row__status .pill:hover { opacity: 0.8; }
.task-row__title { min-width: 0; }
.task-row__title a { color: var(--text); text-decoration: none; }
.task-row__title a:hover { color: var(--accent); }
.task-row__project { display: block; font-size: 12px; }
.task-row__priority { flex-shrink: 0; }
.task-row__meta { flex-shrink: 0; font-size: 13px; text-align: right; }

.overdue { color: var(--danger); font-weight: 600; }

.dependency-badge {
  font-size: 12px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ─── 6. Cards + sections ─── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin: 16px 0;
  box-shadow: var(--card-shadow);
}

h1, h2 { margin: 0 0 8px 0; }
h1 { font-size: 1.3rem; }
h2 { font-size: 1.05rem; }
.lead { font-size: 1rem; }

.muted { color: var(--muted); }
.row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.dashboard-header { padding: 4px 0; }
.dashboard-header h1 { margin: 0; }

.subcard {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px;
  background: var(--subcard-bg);
}

.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 768px) { .split { grid-template-columns: 1fr; } }

/* Grids */
.grid { display: grid; grid-template-columns: 1.4fr 1.2fr auto; gap: 10px; align-items: end; }
.grid > * { min-width: 0; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: 1.2fr 1.6fr 1fr auto; }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid .full { grid-column: 1 / -1; }

@media (max-width: 768px) {
  .grid, .grid.two, .grid.three, .grid.four { grid-template-columns: 1fr; }
}

/* Stat grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.stat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--subcard-bg);
}
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-size: 1.3rem; font-weight: 700; margin: 2px 0; }
.stat-meta { color: var(--muted); font-size: 12px; }

/* Filters */
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
}
.filters .full { grid-column: 1 / -1; }
@media (max-width: 768px) { .filters { grid-template-columns: 1fr 1fr; } }
@media (max-width: 500px) { .filters { grid-template-columns: 1fr; } }

/* ─── 7. Tables (compact) ─── */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -18px;
  padding: 0 18px;
}
.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}
.table th, .table td {
  border-top: 1px solid var(--line);
  padding: 8px;
  vertical-align: top;
}
.table th {
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

/* ─── 8. Tab bar ─── */
.tab-bar {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.tab {
  padding: 8px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--accent-gold);
  border-bottom-color: var(--accent-gold);
  font-weight: 600;
}

/* ─── 9. Milestones + sections ─── */
.milestone-group { margin-bottom: 24px; }
.milestone-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 2px solid var(--line);
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.milestone-header h3 { margin: 0; font-size: 15px; }
.milestone-dates { font-size: 13px; color: var(--muted); }
.milestone-stats { font-size: 13px; color: var(--muted); }

.milestone-group > details > summary { cursor: pointer; list-style: none; }
.milestone-group > details > summary::-webkit-details-marker { display: none; }
.milestone-group > details > summary::before {
  content: "\25B8 ";
  font-size: 12px; color: var(--muted);
  transition: transform 0.15s ease;
  display: inline-block;
}
.milestone-group > details[open] > summary::before { transform: rotate(90deg); }

.section-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-secondary, var(--accent));
  padding: 8px 0 4px;
  margin-top: 12px;
  border-bottom: 1px solid var(--line);
}

.section-compact { padding: 12px 0; }
.section-compact__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}
.section-compact__title { font-size: 15px; font-weight: 600; }
.section-compact__meta { font-size: 13px; color: var(--muted); }

.milestone-manage-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.milestone-manage-item:last-child { border-bottom: none; }
.section-manage-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 4px 20px;
  font-size: 13px;
}

.ungrouped-header {
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 0 6px;
  border-bottom: 2px solid var(--line);
  margin-bottom: 12px;
  margin-top: 24px;
}

/* ─── 10. Comments + checklists ─── */
.comment { padding: 10px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: none; }
.comment__meta { font-size: 12px; margin-bottom: 4px; }
.comment__body { white-space: pre-wrap; font-size: 14px; }

.checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item.done .checklist-item__title {
  text-decoration: line-through;
  color: var(--muted);
}
.checklist-item__title { flex: 1; font-size: 14px; }

.checklist-toggle {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  color: var(--text);
  line-height: 1;
}
.checklist-toggle:hover { color: var(--accent); }

.checklist-add-form {
  display: flex;
  gap: 8px;
  align-items: end;
  margin-top: 8px;
}
.checklist-add-form input { flex: 1; }

.comment-add-form {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.checklist-delete { display: inline; }

/* Progress bar */
.progress-bar {
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
  margin: 6px 0;
}
.progress-bar__fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* ─── 11. Panel task detail ─── */
.panel-task__status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.panel-task__meta {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 16px;
}
.panel-meta-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}
.panel-meta-row:last-child { border-bottom: none; }

.panel-section {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}
.panel-section__heading {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 8px;
}
.panel-section__body { font-size: 14px; }

.panel-entry-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 13px;
}

.panel-actions {
  display: flex;
  gap: 8px;
}

.dependency-card {
  border: 1px solid var(--warning);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(255,193,7,0.06);
}

/* ─── 12. Attention items ─── */
.attention-list { display: grid; gap: 8px; margin-top: 8px; }
.attention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  font-size: 14px;
}
.attention-item--danger {
  border-color: rgba(220,53,69,0.3);
  background: rgba(220,53,69,0.04);
}
.attention-count {
  font-size: 18px;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
}

/* ─── 13. Inline edit, actions, misc ─── */
.inline-edit-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 44;
}
.inline-edit-overlay.open { display: block; }

.inline-edit { position: relative; }
.inline-edit__body {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 45;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0,0,0,0.22);
  padding: 24px;
  min-width: 340px;
  max-width: 560px;
  width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
}

@media (min-width: 769px) {
  .inline-edit__body {
    width: 480px;
  }
}

@media (max-width: 768px) {
  .inline-edit__body {
    right: 8px; left: 8px;
    top: auto; bottom: 8px;
    transform: none;
    max-width: none; width: auto;
    max-height: 80vh;
  }
}

details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }

.actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.footer { padding-bottom: 28px; }
.padtop { margin-top: 10px; }

.editform {
  display: grid;
  gap: 10px;
  max-width: 520px;
}

/* Task cards (legacy, used on project detail clock-in) */
.task-list { display: grid; gap: 10px; }
.task-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  align-items: center;
}
.task-card .btn[disabled] { opacity: 0.6; cursor: not-allowed; }

/* Project cards */
.project-grid { display: grid; gap: 12px; }
.project-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px;
  background: var(--subcard-bg);
  display: grid;
  gap: 10px;
}
.project-card.overdue { border-color: rgba(220,53,69,0.5); box-shadow: 0 0 0 1px rgba(220,53,69,0.15); }
.project-card.due_soon { border-color: rgba(255,193,7,0.5); }
.project-card__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.project-card__title { font-weight: 700; }
.project-card__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

/* Due dates */
.due {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
}
.due.overdue { color: var(--danger); border-color: rgba(220,53,69,0.5); background: rgba(220,53,69,0.08); }
.due.due_soon { color: #856404; border-color: rgba(255,193,7,0.5); background: rgba(255,193,7,0.1); }

/* Trend rows */
.trend-list { display: grid; gap: 14px; }
.trend-item { display: grid; gap: 4px; }
.trend-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.trend-row:first-of-type { border-top: none; }
.trend-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(37,99,235,0.12);
  overflow: hidden;
  position: relative;
}
.trend-bar > span {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-gold));
  border-radius: inherit;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 0 4px;
  border-top: 1px solid var(--line);
  margin-top: 12px;
}

/* Date ranges */
.date-range { font-size: 13px; color: var(--muted); }
.date-range .separator { margin: 0 4px; }

/* Breadcrumb */
.breadcrumb { font-size: 13px; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.breadcrumb .sep { margin: 0 4px; }

/* Empty states */
.empty-state {
  text-align: center;
  padding: 24px 16px;
  color: var(--muted);
}
.empty-state p { margin: 0 0 12px; font-size: 14px; }

/* Flash messages */
.flash-container { padding: 0 24px; }
.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin: 8px 0;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
}
.flash--success { background: rgba(25,135,84,0.08); border: 1px solid rgba(25,135,84,0.25); color: #198754; }
.flash--error { background: rgba(220,53,69,0.08); border: 1px solid rgba(220,53,69,0.25); color: var(--danger); }
.flash--info { background: rgba(37,99,235,0.08); border: 1px solid rgba(37,99,235,0.25); color: #1d4ed8; }
.flash__close {
  background: none; border: none;
  color: inherit; font-size: 1.2rem;
  cursor: pointer; padding: 0 4px;
  opacity: 0.6; line-height: 1;
}
.flash__close:hover { opacity: 1; }

[data-theme="dark"] .flash--success { color: #6ecf72; }
[data-theme="dark"] .flash--error { color: #ff7a7a; }
[data-theme="dark"] .flash--info { color: #93b4f5; }

/* Clock banner (legacy, kept for compat) */
.clock-banner {
  border-bottom: 1px solid var(--line);
  background: rgba(37,99,235,0.06);
  padding: 8px 24px;
}
.clock-banner__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 0;
  flex-wrap: wrap;
}
.clock-banner__meta { display: flex; flex-direction: column; gap: 2px; min-width: 200px; }
.clock-banner__title { font-weight: 700; }
.clock-banner__detail { font-size: 13px; }
.clock-banner__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.clock-banner__timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.35);
  font-size: 13px;
}

/* Statements */
.statement-card { display: grid; gap: 14px; }
.statement-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.statement-contact { display: flex; gap: 6px; flex-wrap: wrap; }
.statement-period { text-align: right; min-width: 200px; }
.statement-period__range { font-size: 1.1rem; font-weight: 600; margin-top: 6px; }
.statement-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px;
  background: var(--subcard-bg);
}

/* Aging */
.aging-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}
.aging-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--bg);
}

/* Ledger */
.ledger-table td .ledger-title { font-weight: 600; }
.ledger-table tfoot th { border-top: 2px solid var(--line); font-weight: 700; }

/* Wrap (legacy, used in some templates) */
.wrap { max-width: 1100px; margin: 0 auto; padding: 18px; }

/* Task create options */
.task-create-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}

/* ─── 14. Login page ─── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
.login-wrapper {
  width: 100%;
  max-width: 420px;
  padding: 18px;
}
.login-card { padding: 32px 28px; }
.login-header { text-align: center; margin-bottom: 24px; }
.login-logo { border-radius: 12px; margin-bottom: 12px; }
.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}
.login-btn { width: 100%; margin-top: 4px; }

/* ─── 15. Mobile responsive ─── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 60;
  }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .panel { width: 100%; }
  .mobile-menu-toggle { display: block; }

  .page-content { padding: 12px; }
  .page-header { padding: 10px 12px; }

  .task-row {
    grid-template-columns: auto 1fr;
    gap: 4px;
  }
  .task-row__priority, .task-row__meta {
    grid-column: 2;
    font-size: 12px;
  }

  .tab-bar { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── 16. Utilities ─── */
.dep-icon { margin-right: 2px; }
.dependency-detail { display: grid; gap: 8px; }

/* ─── 17. Billable indicators ─── */
.pill.billable {
  background: var(--success, #1D9E75);
  color: #fff;
}
.pill.non-billable {
  background: var(--line);
  color: var(--muted);
}

.billable-dot {
  color: var(--success, #1D9E75);
  font-size: 10px;
}
.non-billable-dot {
  color: var(--muted);
  font-size: 10px;
}

.internal-banner {
  font-size: 13px;
  color: var(--muted);
  padding: 8px 12px;
  background: var(--subcard-bg);
  border-radius: var(--radius);
  margin-bottom: 12px;
}
