/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0f172a;
  --surface:    #1e293b;
  --surface2:   #273548;
  --surface3:   #334155;
  --border:     #334155;
  --text:       #e2e8f0;
  --text-muted: #94a3b8;
  --accent:     #6366f1;
  --accent-h:   #4f46e5;
  --success:    #22c55e;
  --warning:    #f59e0b;
  --danger:     #ef4444;
  --radius:     10px;
  --radius-sm:  6px;
  --shadow:     0 4px 24px rgba(0,0,0,.35);
  --trans:      .15s ease;
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select {
  font-family: inherit;
  font-size: .875rem;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .5rem .75rem;
  width: 100%;
  outline: none;
  transition: border-color var(--trans);
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--text-muted); }
select option { background: var(--surface); }
textarea { resize: vertical; min-height: 80px; }

/* ── Login Page ──────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 2rem;
  justify-content: center;
}
.login-logo .logo-icon {
  width: 42px; height: 42px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
}
.login-logo h1 { font-size: 1.25rem; font-weight: 700; }
.login-logo span { color: var(--accent); }
.login-card h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: .4rem; }
.login-card p  { font-size: .85rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.login-card label { font-size: .8rem; font-weight: 500; color: var(--text-muted); display: block; margin-bottom: .35rem; }
.login-card .form-group { margin-bottom: 1.25rem; }
.login-error { color: var(--danger); font-size: .8rem; margin-top: .35rem; display: none; }

/* ── App Shell ───────────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--trans);
}
.sidebar-logo {
  display: flex; align-items: center; gap: .6rem;
  padding: 0 1.25rem 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: .75rem;
}
.sidebar-logo .logo-icon {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
}
.sidebar-logo span { font-weight: 700; font-size: .95rem; }
.sidebar-logo .logo-sub { color: var(--accent); }

.sidebar nav { flex: 1; padding: 0 .75rem; }
.nav-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem .75rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--trans);
  margin-bottom: 2px;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: rgba(99,102,241,.15); color: var(--accent); }
.nav-item .nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-footer {
  padding: .75rem;
  border-top: 1px solid var(--border);
}
.btn-logout {
  width: 100%; display: flex; align-items: center; gap: .5rem;
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  font-size: .8rem; color: var(--text-muted);
  background: none; border: none;
  transition: all var(--trans);
}
.btn-logout:hover { background: rgba(239,68,68,.1); color: var(--danger); }

/* Main content */
.main-content {
  margin-left: 220px;
  flex: 1;
  padding: 2rem;
  max-width: calc(100% - 220px);
}

/* Mobile toggle */
.mobile-menu-btn {
  display: none;
  position: fixed; top: 1rem; left: 1rem;
  z-index: 200;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 38px; height: 38px;
  align-items: center; justify-content: center;
  font-size: 1.1rem; color: var(--text);
}

/* ── Section Header ──────────────────────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem;
}
.section-header h2 { font-size: 1.4rem; font-weight: 700; }
.section-header .subtitle { font-size: .85rem; color: var(--text-muted); margin-top: .15rem; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 500;
  border: none; transition: all var(--trans);
  white-space: nowrap;
}
.btn-primary  { background: var(--accent);   color: #fff; }
.btn-primary:hover  { background: var(--accent-h); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface3); }
.btn-danger   { background: rgba(239,68,68,.15); color: var(--danger); }
.btn-danger:hover  { background: rgba(239,68,68,.25); }
.btn-success  { background: rgba(34,197,94,.15); color: var(--success); }
.btn-success:hover { background: rgba(34,197,94,.25); }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-icon { padding: .35rem; border-radius: var(--radius-sm); background: none; border: none; color: var(--text-muted); transition: all var(--trans); }
.btn-icon:hover { background: var(--surface3); color: var(--text); }
.btn-icon.danger:hover { background: rgba(239,68,68,.15); color: var(--danger); }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 1rem; gap: .5rem;
}
.card-actions { display: flex; gap: .25rem; flex-shrink: 0; }
.card-title { font-size: 1rem; font-weight: 600; }
.card-meta  { font-size: .8rem; color: var(--text-muted); margin-top: .15rem; }

/* ── Status Badges ───────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .55rem;
  border-radius: 999px; font-size: .75rem; font-weight: 600;
}
.badge-on-track  { background: rgba(34,197,94,.15);  color: var(--success); }
.badge-off-track { background: rgba(239,68,68,.15);  color: var(--danger); }
.badge-done      { background: rgba(99,102,241,.15); color: var(--accent); }
.badge-high      { background: rgba(239,68,68,.15);  color: var(--danger); }
.badge-medium    { background: rgba(245,158,11,.15); color: var(--warning); }
.badge-low       { background: rgba(148,163,184,.15);color: var(--text-muted); }

/* ── Progress Bar ────────────────────────────────────────────────────────── */
.progress-wrap { margin: .75rem 0 .25rem; }
.progress-label { display: flex; justify-content: space-between; font-size: .75rem; color: var(--text-muted); margin-bottom: .35rem; }
.progress-bar { height: 6px; background: var(--surface3); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s ease; }
.progress-fill.full { background: var(--success); }

/* ── Tasks List ──────────────────────────────────────────────────────────── */
.tasks-list { margin-top: .75rem; }
.task-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .4rem .1rem;
  border-bottom: 1px solid rgba(51,65,85,.5);
}
.task-item:last-child { border-bottom: none; }
.task-item input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0; cursor: pointer;
}
.task-item .task-title {
  flex: 1; font-size: .85rem;
  transition: color var(--trans), text-decoration var(--trans);
}
.task-item.done .task-title { text-decoration: line-through; color: var(--text-muted); }
.task-item.dragging { opacity: .4; }
.task-item.drag-over { border-top: 2px solid var(--accent); }
.drag-handle { cursor: grab; color: var(--text-muted); font-size: 1rem; flex-shrink: 0; user-select: none; }
.drag-handle:active { cursor: grabbing; }
.task-add { display: flex; gap: .5rem; margin-top: .65rem; }
.task-add input { flex: 1; }

/* ── Grid layouts ────────────────────────────────────────────────────────── */
.rocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1rem;
}

/* ── Owner tag ───────────────────────────────────────────────────────────── */
.owner-tag {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .78rem; font-weight: 600;
  padding: .15rem .5rem;
  border-radius: 999px;
  background: rgba(99,102,241,.12); color: var(--accent);
}

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 1rem;
  opacity: 0; pointer-events: none;
  transition: opacity var(--trans);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%; max-width: 500px;
  box-shadow: var(--shadow);
  transform: translateY(10px);
  transition: transform var(--trans);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-body { display: flex; flex-direction: column; gap: .9rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.25rem; }
.form-group label { font-size: .8rem; font-weight: 500; color: var(--text-muted); display: block; margin-bottom: .3rem; }

/* ── L10 Styles ──────────────────────────────────────────────────────────── */
.l10-layout { display: flex; gap: 1.5rem; align-items: flex-start; }
.l10-sidebar-steps {
  width: 200px; flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 0;
  position: sticky; top: 1.5rem;
}
.step-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem .9rem;
  cursor: pointer;
  font-size: .85rem; color: var(--text-muted);
  transition: all var(--trans);
  border-left: 3px solid transparent;
}
.step-item:hover { background: var(--surface2); color: var(--text); }
.step-item.active { color: var(--accent); border-left-color: var(--accent); background: rgba(99,102,241,.08); }
.step-item.completed { color: var(--success); }
.step-item .step-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface3);
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; flex-shrink: 0;
}
.step-item.active .step-num    { background: var(--accent); color: #fff; }
.step-item.completed .step-num { background: var(--success); color: #fff; }

.l10-content-area { flex: 1; min-width: 0; }
.step-panel { display: none; }
.step-panel.active { display: block; }

.step-panel .card { margin-bottom: 1rem; }
.step-time { font-size: .78rem; color: var(--text-muted); }

/* Meeting list */
.meeting-list { display: flex; flex-direction: column; gap: .5rem; }
.meeting-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem; cursor: pointer;
  transition: border-color var(--trans);
}
.meeting-item:hover { border-color: var(--accent); }
.meeting-item.active { border-color: var(--accent); background: rgba(99,102,241,.08); }

/* ── Scorecard Table ─────────────────────────────────────────────────────── */
.scorecard-wrap { overflow-x: auto; }
.scorecard-table {
  width: 100%; border-collapse: collapse;
  font-size: .85rem; min-width: 700px;
}
.scorecard-table th {
  background: var(--surface2);
  padding: .6rem .75rem; text-align: left;
  font-size: .78rem; font-weight: 600; color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.scorecard-table td {
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.scorecard-table tr:last-child td { border-bottom: none; }
.scorecard-table tr:hover td { background: rgba(255,255,255,.02); }

.scorecard-table .metric-name { font-weight: 600; min-width: 180px; }
.scorecard-table .metric-owner { min-width: 90px; }
.scorecard-table .metric-target {
  color: var(--text-muted); font-size: .78rem; min-width: 80px;
}
.scorecard-cell input {
  text-align: center;
  min-width: 70px; max-width: 90px;
  padding: .3rem .4rem;
}
.scorecard-cell.on-target input  { border-color: rgba(34,197,94,.4); }
.scorecard-cell.off-target input { border-color: rgba(239,68,68,.4); }

/* ── Divider ─────────────────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 3rem 1.5rem; color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.empty-state p { font-size: .9rem; }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  display: flex; flex-direction: column; gap: .5rem; z-index: 9999;
}
.toast {
  background: var(--surface3); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .65rem 1rem; font-size: .85rem;
  display: flex; align-items: center; gap: .5rem;
  box-shadow: var(--shadow);
  animation: slideIn .2s ease;
}
.toast.success { border-color: var(--success); }
.toast.error   { border-color: var(--danger); }
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow);
  }
  .mobile-menu-btn { display: flex; }
  .main-content { margin-left: 0; padding: 1rem; padding-top: 4rem; max-width: 100%; }
  .l10-layout { flex-direction: column; }
  .l10-sidebar-steps { width: 100%; position: static; display: flex; flex-wrap: wrap; padding: .5rem; }
  .step-item { border-left: none; border-bottom: 3px solid transparent; flex: 1; min-width: 80px; justify-content: center; flex-direction: column; text-align: center; gap: .25rem; padding: .5rem; }
  .step-item.active { border-bottom-color: var(--accent); }
  .rocks-grid { grid-template-columns: 1fr; }
}

/* ── Overlay (sidebar close) ─────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
}
.sidebar-overlay.open { display: block; }

/* ── Section pages ───────────────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

/* ── Inline edit ─────────────────────────────────────────────────────────── */
.inline-input {
  background: transparent; border: none; border-bottom: 1px dashed var(--border);
  border-radius: 0; padding: .2rem .3rem; width: auto;
}
.inline-input:focus { border-bottom-color: var(--accent); background: rgba(99,102,241,.05); }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: .25rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border); padding-bottom: -1px; }
.tab-btn {
  padding: .5rem .9rem; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: .85rem; font-weight: 500; color: var(--text-muted);
  background: none; border: none; cursor: pointer; border-bottom: 2px solid transparent;
  transition: all var(--trans);
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn:hover  { color: var(--text); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── IDS issue row ───────────────────────────────────────────────────────── */
.issue-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .75rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: .5rem;
}
.issue-row.solved { opacity: .55; }
.issue-row .issue-title { flex: 1; font-size: .875rem; }
.issue-row.solved .issue-title { text-decoration: line-through; color: var(--text-muted); }
