/* Time Study — single stylesheet. Dark, calm, dense enough for a work tool.
 * Rhythm: 4px base. Cards 16px padding, column gap 16px, page gutter 24px. */
:root {
  --bg: #0b1220;
  --bg-2: #0f172a;
  --card: #111a2e;
  --card-2: #16213a;
  --line: #22304d;
  --line-soft: #1a2640;
  --text: #e6ebf5;
  --muted: #94a3b8;
  --accent: #14b8a6;
  --accent-2: #0f766e;
  --accent-ink: #052e2b;
  --danger: #f87171;
  --warn: #fbbf24;
  --radius: 12px;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.25);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --head-h: 36px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--sans); }
body { min-height: 100vh; background: radial-gradient(1200px 600px at 10% -10%, #10203a 0%, var(--bg) 60%); }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; }
.muted { color: var(--muted); } .small { font-size: 12px; }
kbd { font: 11px var(--mono); padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--bg-2); }
a { color: var(--accent); }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 20px; height: 52px;
  padding: 0 24px; background: rgba(11,18,32,.85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand-mark { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(20,184,166,.18); align-self: center; }
.brand-name { font-weight: 700; }
.brand-sub { color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 4px; margin-left: 8px; }
.tab { background: none; border: 0; color: var(--muted); padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 500; font: inherit; }
.tab.is-active { background: var(--card-2); color: var(--text); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.clock { font: 13px var(--mono); color: var(--muted); }
.who { font-weight: 500; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 9px; line-height: 1.2;
  border: 1px solid var(--line); background: var(--card-2); color: var(--text); cursor: pointer; font: inherit; font-weight: 500; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #33466d; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn-primary:hover { background: #2dd4bf; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--line); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }

/* cards + layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.app { display: grid; grid-template-columns: minmax(340px, 2fr) minmax(420px, 3fr); gap: 24px; padding: 20px 24px 40px; max-width: 1440px; margin: 0 auto; align-items: start; }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.report { display: flex; flex-direction: column; gap: 16px; }
/* Both columns open with the same header row so their first cards line up. */
.col-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--head-h); flex-wrap: wrap; }
@media (max-width: 960px) { .app { grid-template-columns: 1fr; gap: 20px; padding: 16px; } .topbar { gap: 10px; padding: 0 16px; } .brand-sub, .clock { display: none; } }

/* login */
.login { display: grid; place-items: center; min-height: calc(100vh - 52px); padding: 20px; }
.login-card { width: 100%; max-width: 380px; padding: 26px; display: flex; flex-direction: column; gap: 14px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
input, textarea, select { font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(20,184,166,.18); }
.form-error { color: var(--danger); min-height: 1.2em; margin: 0; font-size: 13px; }

/* composer */
.composer { padding: 16px; display: flex; flex-direction: column; gap: 10px; border-color: #1f3b3a; background: linear-gradient(180deg, #112130 0%, var(--card) 100%); }
.composer-label { font-size: 15px; font-weight: 600; }
.composer-input { width: 100%; resize: vertical; min-height: 84px; font-size: 16px; line-height: 1.45; padding: 12px 14px; }
.composer-hint { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.hint-privacy { color: #7dd3c8; }
.phi-warn { margin: 0; color: var(--warn); font-size: 12px; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; min-height: 24px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; }
.pill { display: inline-block; min-width: 20px; padding: 0 7px; border-radius: 999px; background: var(--card-2); color: var(--text); font: 12px/20px var(--mono); text-align: center; margin-left: 8px; }
.open-list { display: flex; flex-direction: column; gap: 10px; }
.open-list:empty { display: none; }
.empty-box { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 13px; padding: 26px 16px;
  border: 1px dashed var(--line); border-radius: var(--radius); background: rgba(15,23,42,.35); }
.empty-box.in-card { border: 0; border-radius: 0; background: transparent; padding: 28px 16px; }
.empty-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }

/* open task card */
.open-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; border-left: 3px solid var(--accent); }
.open-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.timer { font: 600 24px/1 var(--mono); letter-spacing: .02em; color: #5eead4; font-variant-numeric: tabular-nums; }
.open-title { width: 100%; resize: none; overflow: hidden; font-size: 14.5px; line-height: 1.4; min-height: 38px; }
.open-remark { width: 100%; font-size: 13px; padding: 7px 10px; }
.open-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.open-card.is-saving .timer::after { content: " ·"; color: var(--muted); }

/* range + filters */
.range-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--card); border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 5px 11px; cursor: pointer; font: inherit; font-size: 12.5px; line-height: 1.2; }
.chip:hover { color: var(--text); }
.chip.is-active { background: var(--card-2); color: var(--text); border-color: #33466d; }
.custom-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: -4px; }
.custom-range input { padding: 6px 9px; font-size: 13px; }
.team-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.team-filters select { min-width: 240px; max-width: 360px; padding: 7px 10px; }
.team-filters .btn { margin-left: auto; }
.live-note { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(20,184,166,.18); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.tbl td.live-timer { font: 600 13.5px var(--mono); color: #5eead4; }
.tbl tr.total td { font-weight: 600; background: var(--bg-2); border-top: 1px solid var(--line); }

/* stats strip */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat-label { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { font: 600 22px/1.1 var(--mono); font-variant-numeric: tabular-nums; color: var(--text); }
.stat-value.stat-small { font-size: 15px; line-height: 1.3; padding-top: 2px; }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* tables */
.table-card { padding: 0; overflow: hidden; }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); min-height: 48px; }
.toolbar-title { font-weight: 600; font-size: 13.5px; }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { padding: 10px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
.tbl th { color: var(--muted); font-weight: 500; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; background: rgba(15,23,42,.5); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: rgba(255,255,255,.02); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl td.time { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text); }
.tbl .col-date, .tbl .col-time { width: 1%; white-space: nowrap; }
.tbl .col-dur { width: 1%; }
.tbl .col-act { width: 1%; }
.tbl td.task { min-width: 220px; word-break: break-word; }
.tbl td.task .remark { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.tbl tr.is-open td { color: var(--muted); font-style: italic; }
.tbl tr.is-open td .badge { font-style: normal; }
.tbl td.dim { color: var(--muted); }
.badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: rgba(20,184,166,.15); color: #5eead4; margin-left: 6px; vertical-align: middle; }
.tbl .btn-edit-remark { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0; }
.tbl .btn-edit-remark:hover { color: var(--text); }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--bg-2); color: var(--muted); font-size: 12.5px; }
.table-foot .num { font: 600 13px var(--mono); color: var(--text); font-variant-numeric: tabular-nums; }
.punch-note { color: var(--muted); font-size: 13px; padding: 20px 16px; margin: 0; text-align: center; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1e293b; color: var(--text);
  border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: 90vw; font-size: 13.5px; z-index: 10; }
.toast.is-error { border-color: rgba(248,113,113,.5); }
