/* ============================================================
   Project Assistant — design tokens
   ============================================================ */
:root {
  /* Surfaces */
  --bg: #f5f6fb;
  --bg-tint: radial-gradient(1200px 500px at 15% -10%, #e8e9ff 0%, transparent 60%),
             radial-gradient(1000px 450px at 95% -5%, #e4f2ff 0%, transparent 55%);
  --panel: #ffffff;
  --panel-2: #f8f9fc;
  --panel-3: #f1f3f9;

  /* Lines */
  --border: #e6e8f0;
  --border-strong: #d4d8e4;

  /* Text */
  --text: #111629;
  --text-2: #3d4560;
  --muted: #6b7490;
  --faint: #99a1b8;

  /* Brand */
  --brand: #4f46e5;
  --brand-hover: #4338ca;
  --brand-soft: #eef0ff;
  --brand-ring: rgba(99, 102, 241, 0.22);
  --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

  /* Semantic */
  --rose: #e11d48;
  --rose-soft: #ffe9ee;
  --amber: #b45309;
  --amber-soft: #fdf0dc;
  --emerald: #047857;
  --emerald-soft: #dcf5eb;
  --sky: #0369a1;
  --sky-soft: #e0f2fe;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(17, 22, 41, 0.05);
  --shadow: 0 1px 3px rgba(17, 22, 41, 0.06), 0 8px 24px -12px rgba(17, 22, 41, 0.14);
  --shadow-lg: 0 20px 48px -20px rgba(17, 22, 41, 0.28);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #090c14;
    --bg-tint: radial-gradient(1200px 500px at 15% -10%, #1a1b3d 0%, transparent 60%),
               radial-gradient(1000px 450px at 95% -5%, #10243b 0%, transparent 55%);
    --panel: #121724;
    --panel-2: #171d2d;
    --panel-3: #1d2436;

    --border: #242c40;
    --border-strong: #354060;

    --text: #eef1f8;
    --text-2: #c3cadd;
    --muted: #8e98b3;
    --faint: #667089;

    --brand: #818cf8;
    --brand-hover: #a5b0ff;
    --brand-soft: #1e2143;
    --brand-ring: rgba(129, 140, 248, 0.26);
    --grad: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);

    --rose: #fb7185;
    --rose-soft: #3a1620;
    --amber: #fbbf24;
    --amber-soft: #392a12;
    --emerald: #34d399;
    --emerald-soft: #0e2f26;
    --sky: #38bdf8;
    --sky-soft: #0c2639;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 8px 24px -12px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 20px 48px -20px rgba(0, 0, 0, 0.85);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: var(--bg-tint);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv02", "cv03", "cv04", "tnum";
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }

/* ============================================================ topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  font-size: 15.5px;
  letter-spacing: -0.015em;
  color: var(--text);
}
.brand:hover { color: var(--text); }
.mark { width: 26px; height: 26px; border-radius: 7px; flex: none; box-shadow: var(--shadow-sm); }

.topbar nav { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: 13.5px; }
.topbar nav a {
  color: var(--muted);
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.topbar nav a:hover { background: var(--panel-3); color: var(--text); }
.topbar nav a.lock { border: 1px solid var(--border); }

/* ============================================================ layout */
.wrap { max-width: 1120px; margin: 0 auto; padding: 30px 20px 90px; }

.crumb { font-size: 13px; color: var(--muted); margin-bottom: 12px; font-weight: 500; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--brand); }

h1 {
  font-size: 28px;
  font-weight: 680;
  letter-spacing: -0.028em;
  margin: 0 0 6px;
  line-height: 1.2;
}
h2 { font-size: 15.5px; font-weight: 630; letter-spacing: -0.012em; margin: 0 0 14px; }
.subtitle { color: var(--muted); font-size: 14.5px; margin: 0 0 26px; }

.personhead { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.personhead h1 { margin: 0; }
.personhead .subtitle { margin: 2px 0 0; }

/* ============================================================ cards */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 20px;
}
.card-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.card-head h2 { margin: 0; }
.card-head .spacer { margin-left: auto; }

/* ============================================================ stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(136px, 1fr)); gap: 12px; }
.stat {
  position: relative;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 15px 16px 14px;
  overflow: hidden;
}
.stat::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--faint);
  opacity: 0.85;
}
.stat .n {
  font-size: 28px;
  font-weight: 660;
  letter-spacing: -0.035em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat .k {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
  margin-top: 4px;
}
.stat.indigo::before  { background: var(--brand); }
.stat.indigo .n       { color: var(--brand); }
.stat.amber::before   { background: var(--amber); }
.stat.amber .n        { color: var(--amber); }
.stat.emerald::before { background: var(--emerald); }
.stat.emerald .n      { color: var(--emerald); }
.stat.rose::before    { background: var(--rose); }
.stat.rose .n         { color: var(--rose); }
.stat.slate::before   { background: var(--border-strong); }

.bar {
  height: 8px;
  border-radius: 99px;
  background: var(--panel-3);
  overflow: hidden;
  margin-top: 18px;
  border: 1px solid var(--border);
}
.bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
  border-radius: 99px;
  transition: width 0.4s ease;
}

/* ============================================================ avatars */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: #fff;
  user-select: none;
}
.avatar.lg { width: 52px; height: 52px; font-size: 17px; box-shadow: var(--shadow); }
.avatar.t0 { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.avatar.t1 { background: linear-gradient(135deg, #0ea5e9, #2563eb); }
.avatar.t2 { background: linear-gradient(135deg, #10b981, #059669); }
.avatar.t3 { background: linear-gradient(135deg, #f59e0b, #ea580c); }
.avatar.t4 { background: linear-gradient(135deg, #ec4899, #db2777); }
.avatar.t5 { background: linear-gradient(135deg, #14b8a6, #0891b2); }

.personcell { display: flex; align-items: center; gap: 12px; }
.personcell-text { min-width: 0; }

/* ============================================================ tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
  font-weight: 650;
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-2);
}
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: var(--panel-2); }
tr:last-child td { border-bottom: none; }
td.right, th.right { text-align: right; font-variant-numeric: tabular-nums; }
.rowlink { font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.rowlink:hover { color: var(--brand); }
.sub { color: var(--muted); font-size: 12.5px; line-height: 1.45; }

/* ============================================================ pills */
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  white-space: nowrap;
  background: var(--panel-3);
  color: var(--muted);
  border: 1px solid transparent;
}
.pill.in_progress, .pill.soon { background: var(--amber-soft); color: var(--amber); }
.pill.done { background: var(--emerald-soft); color: var(--emerald); }
.pill.overdue { background: var(--rose-soft); color: var(--rose); }
.pill.muted { color: var(--faint); background: transparent; }

/* ============================================================ forms */
label {
  display: block;
  font-size: 12px;
  font-weight: 620;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: 0.005em;
}
input[type=text], input[type=email], input[type=date], input[type=password],
input[type=file], textarea, select {
  width: 100%;
  padding: 10px 13px;
  font: inherit;
  font-size: 14.5px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, textarea:hover, select:hover { border-color: var(--faint); }
input:focus, textarea:focus, select:focus {
  background: var(--panel);
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-ring);
}
textarea { resize: vertical; min-height: 140px; line-height: 1.6; font-family: inherit; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > .field { flex: 1 1 180px; margin-bottom: 14px; }

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 17px;
  font: inherit;
  font-size: 14px;
  font-weight: 580;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.15s, border-color 0.15s, background 0.15s;
}
button:hover, .btn:hover {
  border-color: var(--faint);
  background: var(--panel-2);
  color: var(--text);
}
button:active, .btn:active { transform: translateY(1px); }

.btn-primary, button.primary {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.3), 0 8px 20px -10px rgba(99, 102, 241, 0.7);
}
.btn-primary:hover, button.primary:hover {
  filter: brightness(1.08);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.34), 0 12px 26px -10px rgba(99, 102, 241, 0.8);
}
button:disabled, .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.5);
  box-shadow: none;
}
button.tiny, .btn.tiny { padding: 5px 10px; font-size: 12.5px; }
button.link {
  background: none;
  border: none;
  color: var(--faint);
  padding: 5px 7px;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: none;
}
button.link:hover { color: var(--rose); background: var(--rose-soft); }
.inline { display: inline; }

select.status {
  width: auto;
  padding: 5px 9px;
  font-size: 12.5px;
  font-weight: 550;
  border-radius: 7px;
}

/* ============================================================ notices */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 18px;
  border: 1px solid transparent;
  animation: slide-in 0.25s ease;
}
@keyframes slide-in {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: none; }
}
.notice::before { font-weight: 700; line-height: 1.4; }
.notice.ok   { background: var(--emerald-soft); color: var(--emerald); }
.notice.ok::before { content: '✓'; }
.notice.err  { background: var(--rose-soft); color: var(--rose); }
.notice.err::before { content: '!'; }
.notice.info { background: var(--sky-soft); color: var(--sky); }
.notice.info::before { content: 'i'; font-style: italic; }

.empty {
  color: var(--muted);
  font-size: 14px;
  padding: 34px 0;
  text-align: center;
  background: var(--panel-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}

/* ============================================================ login */
.login { max-width: 380px; margin: 13vh auto; padding: 0 20px; }
.login .card { text-align: center; padding: 34px 30px; box-shadow: var(--shadow-lg); }
.login .mark { width: 46px; height: 46px; border-radius: 12px; margin-bottom: 16px; }
.login h1 { font-size: 21px; }
.login input {
  text-align: center;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  padding: 13px;
}
.login .notice { justify-content: center; }

/* ============================================================ task lists */
.tasklist { list-style: none; padding: 0; margin: 0; }
.tasklist li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 10px;
  margin: 0 -10px;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  transition: background 0.12s;
}
.tasklist li:hover { background: var(--panel-2); }
.tasklist li:last-child { border-bottom: none; }
.tasklist .title { font-weight: 550; flex: 1 1 220px; color: var(--text); letter-spacing: -0.008em; }
.tasklist .done-title { text-decoration: line-through; color: var(--faint); font-weight: 450; }
.actions { display: flex; gap: 6px; align-items: center; margin-left: auto; }

details.mailbody { margin-top: 8px; }
details.mailbody summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  width: fit-content;
}
details.mailbody summary:hover { color: var(--brand); }
details.mailbody pre {
  white-space: pre-wrap;
  font: inherit;
  font-size: 13px;
  color: var(--text-2);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  margin: 9px 0 0;
}

.divider { border: none; border-top: 1px solid var(--border); margin: 22px 0; }
.muted { color: var(--muted); }

/* Danger zone reads as dangerous. */
.card.danger { border-color: color-mix(in srgb, var(--rose) 32%, var(--border)); }
.card.danger h2 { color: var(--rose); }
.card.danger button {
  border-color: color-mix(in srgb, var(--rose) 45%, transparent);
  color: var(--rose);
}
.card.danger button:hover { background: var(--rose-soft); border-color: var(--rose); }

/* ============================================================ responsive */
@media (max-width: 680px) {
  .wrap { padding: 22px 16px 70px; }
  h1 { font-size: 23px; }
  .card { padding: 18px 16px; }
  .topbar-inner { padding: 0 16px; height: 56px; }
  .brand span { display: none; }
  .avatar.lg { width: 44px; height: 44px; font-size: 15px; }

  table.responsive thead { display: none; }
  table.responsive tr {
    display: block;
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
  }
  table.responsive tr:hover { background: transparent; }
  table.responsive td { display: block; border: none; padding: 3px 0; }
  table.responsive td.right { text-align: left; }
  .actions { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
