:root {
  --navy: #142a36;
  --blue: #237a8b;
  --cyan: #55b7b3;
  --teal: #2aa8a6;
  --bg: #f3f6f6;
  --ink: #18262d;
  --muted: #708088;
  --line: #dfe7e7;
  --white: #fff;
  --warn: #d8952e;
  --danger: #b94c55;
  --ok: #27866b;
  --sidebar: 242px;
  --font: Manrope, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.45 var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}
.muted { color: var(--muted); }
.eyebrow {
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .13em;
  margin: 0;
  text-transform: uppercase;
}

/* Login gate */
.gate {
  position: fixed; inset: 0; z-index: 100;
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background:
    radial-gradient(900px 500px at 0% 0%, #1a3a3a 0%, transparent 50%),
    radial-gradient(800px 400px at 100% 0%, #243047 0%, transparent 45%),
    #0e141b;
  color: #e8eef5;
}
/* display:grid above would otherwise override HTML [hidden] */
.gate[hidden],
#app[hidden] {
  display: none !important;
}
.gate-card {
  width: min(440px, 100%); background: #172029; border: 1px solid #2b3846;
  border-radius: 16px; padding: 1.6rem; box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.gate .eyebrow { color: var(--teal); }
.gate-card h1 { margin: 0.4rem 0; color: #fff; font-size: 1.8rem; }
.gate .muted { color: #95a6b8; }
.gate-actions { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 1.2rem; }
.gate-actions input {
  background: #121820; border: 1px solid #2b3846; border-radius: 8px;
  color: #e8eef5; padding: 0.65rem 0.75rem; font: inherit;
}
.google-btn { display: flex; justify-content: center; min-height: 44px; }
.msg { margin-top: 0.8rem; }
.msg.ok { color: #3cb371; }
.msg.err { color: #d45d5d; }
.gate .msg.ok { color: #9dffc0; }
.gate .msg.err { color: #ffb4b4; }

/* Shell */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar);
  background: var(--navy); color: #fff;
  padding: 22px 16px; display: flex; flex-direction: column; gap: 18px;
  z-index: 30;
}
.sidebar-user {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding-bottom: 16px; border-bottom: 1px solid #38505b;
}
.sidebar-user img {
  width: 56px; height: 56px; border-radius: 50%; object-fit: cover;
  border: 2px solid rgba(42,168,166,.45); background: #1c3a48;
}
.sidebar-user-text b {
  display: block; color: #fff; font: 700 13px/1.25 var(--font);
}
.sidebar-user-text small {
  display: block; margin-top: 4px; color: #9eb3bc; font: 500 11px/1.3 var(--font);
}
.sidebar-email {
  display: block; margin-top: 6px; color: #9eb3bc;
  font: 500 10px/1.3 var(--font); word-break: break-all;
}
.sidebar-actions { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; margin-top: 4px; }
.sidebar-actions button {
  border: 1px solid rgba(255,255,255,.28); background: transparent; color: #fff;
  border-radius: 8px; padding: 7px 10px; cursor: pointer; font: 700 12px var(--font);
}
.sidebar-actions button:hover { border-color: #2aa8a6; color: #9fe3e0; }

.sidebar-nav { display: grid; gap: 6px; }
.sidebar-nav .nav-btn {
  border: 0; background: transparent; color: #b8c7cd; text-align: left;
  padding: 12px 14px; border-radius: 9px; font: 600 13px var(--font); cursor: pointer;
}
.sidebar-nav .nav-btn.active,
.sidebar-nav .nav-btn:hover {
  background: #fff; color: var(--navy);
}

.sidebar-foot {
  margin-top: auto; border-top: 1px solid #38505b; padding: 18px 8px 0;
}
.sidebar-foot b {
  color: var(--cyan); font-size: 10px; letter-spacing: .12em;
}
.sidebar-foot p { color: #b8c7cd; font-size: 12px; margin: 8px 0 0; }

.content {
  margin-left: var(--sidebar);
  padding: 28px 36px 60px;
  max-width: 1600px;
}
.page-header {
  display: flex; justify-content: space-between; gap: 24px;
  align-items: flex-start; margin-bottom: 22px;
}
.page-header h1 {
  font-size: 30px; margin: 3px 0 4px; letter-spacing: -.04em; color: var(--ink);
}
.page-header p:last-child { color: var(--muted); margin: 3px 0; }
.brand-mark {
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--navy);
}
.brand-mark span {
  display: grid; place-items: center; width: 42px; height: 42px;
  border-radius: 12px; background: linear-gradient(135deg, #2aa8a6, #146f7a);
  color: #fff; font-weight: 800;
}
.brand-mark strong { font-size: 18px; letter-spacing: .02em; }

.view { display: none; }
.view.active { display: block; }

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 21px;
  margin-bottom: 16px;
}
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-head p { margin: 3px 0 0; color: var(--muted); }
.panel-head.row {
  display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start;
  margin-bottom: 12px;
}

.btn {
  border-radius: 8px; border: 1px solid var(--line); padding: 0.55rem 0.9rem;
  cursor: pointer; font: 700 13px var(--font); color: var(--ink); background: #fff;
}
.btn.primary {
  background: var(--blue); border-color: transparent; color: #fff;
}
.btn.ghost { background: transparent; }
.link {
  background: none; border: none; color: var(--blue); cursor: pointer;
  font: inherit; text-decoration: none; padding: 0;
}

.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.8rem; margin: 1.1rem 0;
}
.kpi {
  text-align: left; background: #f7fafa; border: 1px solid var(--line);
  border-radius: 12px; padding: 0.9rem; cursor: pointer; color: inherit; font: inherit;
}
.kpi:hover { border-color: var(--teal); }
.kpi .label { color: var(--muted); font-size: 0.8rem; font-weight: 700; }
.kpi .value { font-size: 1.45rem; font-weight: 800; margin-top: 0.25rem; color: var(--navy); }
.kpi.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.kpi.danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }

.row-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.action-rail {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.8rem;
}
.action-card {
  background: #f7fafa;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  border-left: 4px solid var(--teal);
}
.action-card.prio-1 { border-left-color: var(--danger); }
.action-card.prio-2 { border-left-color: var(--warn); }
.action-card.prio-3 { border-left-color: #8a6d3b; }
.action-card-top { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.45rem; }
.action-card h4 { margin: 0; font-size: 0.95rem; letter-spacing: -.02em; }
.action-card-foot {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.6rem; margin-top: 0.7rem;
}
.action-links { display: flex; gap: 0.7rem; }

.timeline-panel { margin: 0.4rem 0 1rem; }
.timeline {
  display: flex; align-items: flex-end; gap: 0.7rem;
  min-height: 120px; padding-top: 0.5rem;
}
.timeline-bar {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 0.35rem; min-width: 0;
}
.timeline-fill {
  width: 100%; max-width: 42px;
  background: linear-gradient(180deg, var(--cyan), var(--blue));
  border-radius: 8px 8px 4px 4px;
  min-height: 8px;
}
.timeline-label { font-size: 0.72rem; font-weight: 800; color: var(--muted); }
.timeline-count { font-size: 0.7rem; color: var(--ink); font-weight: 700; }

.stack-btn {
  width: 100%; background: transparent; border: 0; cursor: pointer;
  font: inherit; color: inherit; text-align: left;
}
.stack-btn:hover { color: var(--blue); }

.detail-card.highlight {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #eef7f6, #f7fafa);
  border-color: color-mix(in srgb, var(--teal) 35%, var(--line));
}

.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.subpanel {
  background: #f7fafa; border: 1px solid var(--line); border-radius: 12px; padding: 0.9rem;
}
.subpanel h3 { margin: 0 0 0.7rem; font-size: 0.95rem; }
.stack { display: flex; flex-direction: column; gap: 0.55rem; }
.stack-item {
  display: flex; justify-content: space-between; gap: 0.7rem;
  padding: 0.45rem 0; border-bottom: 1px solid var(--line); font-size: 0.9rem;
}
.stack-item:last-child { border-bottom: 0; }

.filters {
  display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0 0 1rem; align-items: center;
}
.filters input, .filters select, .invite-form input, .invite-form select, table select {
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink); padding: 0.55rem 0.7rem; font: inherit;
}
.filters input[type="search"] { min-width: 220px; flex: 1; }
.check { display: flex; align-items: center; gap: 0.4rem; color: var(--muted); font-size: 0.85rem; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.75rem 0.45rem; border-bottom: 1px solid var(--line); }
th {
  color: var(--muted); font-weight: 800; font-size: 10px; text-transform: uppercase;
}
.badge {
  display: inline-block; padding: 0.2rem 0.55rem; border-radius: 999px;
  border: 1px solid var(--line); font-size: 0.72rem; color: var(--blue); background: #e8f3f2;
}
.badge.warn { color: #9b5e0a; background: #fff2df; border-color: transparent; }
.badge.danger { color: #fff; background: var(--danger); border-color: transparent; }
.pill {
  display: inline-block; padding: 0.25rem 0.7rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 800;
}
.pill.green { background: #e4f3ec; color: var(--ok); }

.invite-box {
  margin: 1rem 0 1.2rem; padding: 1rem; border: 1px solid var(--line);
  border-radius: 12px; background: #f7fafa;
}
.invite-box h3 { margin: 0 0 0.35rem; }
.invite-form {
  display: grid; grid-template-columns: 1fr 1.3fr 0.9fr auto;
  gap: 0.7rem; align-items: end; margin-top: 0.8rem;
}
.invite-form label {
  display: flex; flex-direction: column; gap: 0.35rem;
  font-size: 0.8rem; color: var(--muted); font-weight: 600;
}

.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; margin-top: 1rem;
}
.detail-card {
  background: #f7fafa; border: 1px solid var(--line); border-radius: 10px; padding: 0.9rem;
}
.detail-card h3 { margin: 0 0 0.5rem; font-size: 0.95rem; }
.detail-card p { margin: 0.3rem 0; font-size: 0.9rem; }

@media (max-width: 900px) {
  .sidebar { width: 78px; padding: 16px 10px; }
  .sidebar-user-text, .sidebar-actions, .sidebar-foot, .sidebar-email { display: none; }
  .sidebar-user { align-items: center; border: 0; padding: 0; }
  .sidebar-user img { width: 36px; height: 36px; }
  .sidebar-nav .nav-btn { font-size: 0; padding: 12px; }
  .sidebar-nav .nav-btn::after { content: "•"; font-size: 20px; color: inherit; }
  .content { margin-left: 78px; padding: 20px; }
  .split-2, .detail-grid { grid-template-columns: 1fr; }
  .invite-form { grid-template-columns: 1fr; }
}
