/* Work Tracker: one quiet surface, one accent, nothing that isn't needed. */

:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --text: #1b1b19;
  --muted: #6b6b66;
  --faint: #9b9b95;
  --line: #ebebe7;
  --line-strong: #dcdcd6;
  --hover: #f4f4f1;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #e5f1ef;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn-soft: #fff6e5;
  --warn-ink: #8a4b06;
  --st-not: #a8a8a2;
  --st-prog: #2563eb;
  --st-hold: #d97706;
  --st-done: #15803d;
  --scrim: rgba(20, 20, 18, 0.22);
  --shadow: 0 18px 50px rgba(20, 20, 18, 0.12), 0 2px 8px rgba(20, 20, 18, 0.05);
  --radius: 10px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --surface: #1a1a19;
    --text: #ededea;
    --muted: #a3a39d;
    --faint: #75756f;
    --line: #262624;
    --line-strong: #34342f;
    --hover: #20201e;
    --accent: #2bb3a3;
    --accent-ink: #06201d;
    --accent-soft: #10302c;
    --danger: #f97066;
    --danger-soft: #3a1714;
    --warn-soft: #33260f;
    --warn-ink: #f5c26b;
    --st-not: #77776f;
    --st-prog: #6b9bff;
    --st-hold: #f0a23a;
    --st-done: #4ade80;
    --scrim: rgba(0, 0, 0, 0.5);
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.noscript { padding: 24px; }

/* ---------- full-screen states (loading, sign-in, no access) */
.screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px 32px 32px;
  text-align: center;
}
.card .mark { margin: 0 auto 18px; }
.card h1 { font-size: 20px; font-weight: 600; margin: 0 0 6px; letter-spacing: -0.01em; }
.card p { color: var(--muted); margin: 0 0 24px; }
.card .btn { width: 100%; justify-content: center; }
.card .small { font-size: 12px; color: var(--faint); margin: 18px 0 0; }
.who-list { display: grid; gap: 8px; text-align: left; }
.who-list .btn { justify-content: space-between; }
.who-list .role { color: var(--faint); font-size: 12px; }
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--line-strong); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--accent);
  display: grid; place-items: center; flex: none;
}
.mark svg { width: 16px; height: 16px; }

/* ---------- top bar */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
.top-in {
  position: relative;
  max-width: 1120px; margin: 0 auto; padding: 0 32px;
  height: 56px; display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.01em; }
.brand small { font-weight: 400; color: var(--faint); margin-left: 2px; }
.spacer { flex: 1; }

/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface);
  white-space: nowrap; transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 500; }
.btn.primary:hover { opacity: 0.9; background: var(--text); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.danger { color: var(--danger); border-color: transparent; background: transparent; padding: 0 8px; }
.btn.danger:hover { background: var(--danger-soft); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn svg { width: 16px; height: 16px; flex: none; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent;
  display: grid; place-items: center; color: var(--muted);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

.av {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  background: var(--accent-soft); color: var(--accent);
}
.me { padding: 0; border: 0; background: transparent; border-radius: 50%; }
.me .av { width: 32px; height: 32px; font-size: 12px; }

/* ---------- menu */
.menu {
  position: absolute; right: 32px; top: 52px; z-index: 30;
  min-width: 220px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 6px;
}
.menu .who { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu .who b { display: block; font-weight: 600; }
.menu .who span { color: var(--muted); font-size: 12px; word-break: break-all; }
.menu .who em { font-style: normal; font-size: 11px; color: var(--accent); background: var(--accent-soft); padding: 1px 7px; border-radius: 99px; margin-top: 6px; display: inline-block; }
.menu button {
  display: flex; width: 100%; align-items: center; gap: 10px;
  border: 0; background: transparent; text-align: left;
  padding: 8px 12px; border-radius: 8px;
}
.menu button:hover { background: var(--hover); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* ---------- page */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 32px 64px; }
.head { padding: 36px 0 18px; }
.head h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.head p { margin: 6px 0 0; color: var(--muted); }
.head p b { color: var(--text); font-weight: 600; }
.head p .late { color: var(--danger); }

.banner {
  margin: 0 0 16px; padding: 10px 14px; border-radius: 10px;
  background: var(--warn-soft); color: var(--warn-ink); font-size: 13px;
}

.bar {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.tabs { display: flex; gap: 22px; }
.tab {
  border: 0; background: transparent; padding: 10px 0 12px; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 7px; align-items: baseline;
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 500; }
.tab .n { font-size: 12px; color: var(--faint); font-weight: 400; font-variant-numeric: tabular-nums; }
.tab.on .n { color: var(--accent); }

.filters { display: flex; gap: 8px; align-items: center; padding-bottom: 8px; flex-wrap: wrap; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--faint); pointer-events: none; }
.search input {
  height: 32px; width: 220px; padding: 0 10px 0 32px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface);
}
.search input::placeholder { color: var(--faint); }
.pick {
  height: 32px; padding: 0 28px 0 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%239b9b95' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 8px center / 14px;
  appearance: none; max-width: 180px; color: var(--muted);
}
.pick.set { color: var(--text); border-color: var(--line-strong); }

/* ---------- list */
.list { margin-top: 4px; }
.cols, .row {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr) 132px 176px 118px;
  gap: 16px; align-items: center; padding: 0 12px;
}
.cols {
  height: 36px; color: var(--faint); font-size: 12px;
  border-bottom: 1px solid var(--line);
}
.row {
  width: 100%; min-height: 52px; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; text-align: left; border-radius: 0;
}
.row:hover { background: var(--hover); }
.row.sel { background: var(--accent-soft); }
.st { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.st i { width: 8px; height: 8px; border-radius: 50%; background: var(--st-not); flex: none; }
.st.in-progress i { background: var(--st-prog); }
.st.on-hold i { background: var(--st-hold); }
.st.completed i { background: var(--st-done); }
.ti { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ti-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.done .ti-main { color: var(--muted); }
.ti-id { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; flex: none; }
.flag { font-size: 11px; color: var(--danger); background: var(--danger-soft); padding: 1px 7px; border-radius: 99px; flex: none; }
.pj { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; }
.as span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.du { font-size: 13px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.du.late { color: var(--danger); font-weight: 500; }
.du.soon { color: var(--text); font-weight: 500; }

.empty { padding: 64px 0; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); font-weight: 600; margin-bottom: 4px; }

.foot { display: flex; justify-content: space-between; align-items: center; padding: 14px 12px 0; color: var(--faint); font-size: 12px; }

/* ---------- drawer */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; animation: fade 0.15s ease; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
  width: min(500px, 100%); background: var(--surface); box-shadow: var(--shadow);
  display: flex; flex-direction: column; animation: slide 0.18s ease;
}
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.d-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 0 24px; color: var(--faint); font-size: 12px; }
.d-body { flex: 1; overflow: auto; padding: 8px 24px 24px; }
.d-foot { display: flex; align-items: center; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--line); }
.title-in {
  width: 100%; border: 0; background: transparent; font-size: 20px; font-weight: 600;
  letter-spacing: -0.01em; padding: 6px 0 10px; resize: none; line-height: 1.3;
}
.title-in::placeholder { color: var(--faint); }
.title-in:focus { outline: none; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; margin: 6px 0 18px; }
.field { display: grid; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field > span { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface);
  border-radius: 8px; padding: 7px 10px; min-height: 34px;
}
.field textarea { resize: vertical; min-height: 76px; line-height: 1.45; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field :disabled { background: var(--bg); color: var(--muted); }
.note { font-size: 12px; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 4px 0 14px; }
.err { font-size: 13px; color: var(--danger); background: var(--danger-soft); border-radius: 8px; padding: 8px 10px; margin: 0 0 12px; }

.sec { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 18px; }
.sec-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sec-h h3 { font-size: 13px; font-weight: 600; margin: 0; }
.files { list-style: none; margin: 0; padding: 0; }
.files li { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; }
.files a { color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; cursor: pointer; }
.files a:hover { color: var(--accent); text-decoration: underline; }
.files .sz { color: var(--faint); font-size: 12px; }
.muted { color: var(--faint); font-size: 13px; }
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { padding: 7px 0; font-size: 13px; border-bottom: 1px dashed var(--line); }
.hist li:last-child { border-bottom: 0; }
.hist .when { color: var(--faint); font-size: 12px; }
.hist .chg { color: var(--muted); font-size: 12px; margin-top: 2px; }
.meta { color: var(--faint); font-size: 12px; margin-top: 18px; }

/* ---------- admin dialogs */
.modal {
  position: fixed; z-index: 41; left: 50%; top: 8vh; transform: translateX(-50%);
  width: min(720px, calc(100% - 32px)); max-height: 84vh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); animation: fade 0.15s ease;
}
.m-head { display: flex; align-items: center; padding: 18px 20px 6px 24px; }
.m-head h2 { font-size: 17px; font-weight: 600; margin: 0; flex: 1; }
.m-sub { padding: 0 24px 12px; color: var(--muted); font-size: 13px; margin: 0; }
.m-body { overflow: auto; padding: 0 24px 12px; }
.m-foot { border-top: 1px solid var(--line); padding: 14px 24px 18px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 400; color: var(--faint); font-size: 12px; padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); }
.tbl td { padding: 7px 8px 7px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.off td { color: var(--faint); }
.tbl select { border: 1px solid var(--line); border-radius: 6px; background: var(--surface); padding: 4px 6px; }
.tbl .email { color: var(--muted); word-break: break-all; }
.add { display: grid; grid-template-columns: 1fr 1.3fr 120px auto; gap: 8px; align-items: center; }
.add input, .add select { height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: var(--surface); min-width: 0; }
.add.two { grid-template-columns: 1fr auto; }
.switch { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }

/* ---------- toast */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; }
.toast {
  background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 10px;
  font-size: 13px; box-shadow: var(--shadow); animation: fade 0.15s ease;
}
.toast.bad { background: var(--danger); color: #fff; }

/* ---------- small screens */
@media (max-width: 860px) {
  .top-in, .wrap { padding-left: 16px; padding-right: 16px; }
  .menu { right: 16px; }
  .brand small { display: none; }
  .head { padding-top: 24px; }
  .head h1 { font-size: 22px; }
  .bar { flex-direction: column; align-items: stretch; gap: 0; }
  .tabs { overflow-x: auto; gap: 18px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .filters { padding: 10px 0; }
  .search { flex: 1 1 100%; }
  .search input { width: 100%; }
  .pick { flex: 1; max-width: none; }
  .cols { display: none; }
  .row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "ti du" "st as";
    gap: 4px 12px; padding: 12px 4px;
  }
  .row .ti { grid-area: ti; align-items: flex-start; }
  .row .ti-id { display: none; }
  .row .ti-main { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .row .du { grid-area: du; }
  .row .st { grid-area: st; font-size: 12px; }
  .row .as { grid-area: as; justify-content: flex-end; font-size: 12px; color: var(--muted); }
  .row .pj { display: none; }
  .grid { grid-template-columns: 1fr; }
  .add { grid-template-columns: 1fr; }
  .modal { top: 16px; max-height: calc(100vh - 32px); }
  .tbl th:nth-child(2), .tbl td:nth-child(2) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
