:root {
  --bg: #fff; --card: #fff; --text: #000; --muted: #666; --line: #e5e5e5; --line-strong: #000;
  --danger: #c0392b; --radius: 6px;
  --display: Anton, Impact, "Arial Narrow Bold", sans-serif;
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--text); }
main { max-width: 1100px; margin: 0 auto; padding: 24px 20px 40px; }
h1 { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: 2.2rem; line-height: 1; letter-spacing: .01em; margin: 0 0 16px; }
h2 { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: 1.3rem; line-height: 1; letter-spacing: .01em; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.hint { color: var(--muted); font-size: .85em; margin: 4px 0 0; }
.nowrap { white-space: nowrap; }

/* --- top bar --- */
.topbar { display: flex; align-items: center; gap: 24px; padding: 14px 20px; background: #fff; border-bottom: 1px solid var(--line-strong); flex-wrap: wrap; }
.brand { font-family: var(--display); text-transform: uppercase; font-size: 1.6rem; line-height: 1; text-decoration: none; color: var(--text); letter-spacing: .01em; }
.topbar nav { display: flex; gap: 2px; flex-wrap: wrap; align-items: center; margin-left: auto; }
.topbar nav a { text-decoration: none; color: var(--text); padding: 6px 10px; border-radius: var(--radius); font-weight: 500; }
.topbar nav a:hover { background: #f2f2f2; }
.topbar nav a.active { background: #000; color: #fff; }
/* profile chip + logout popup */
.profile { position: relative; }
.profile summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 10px 4px 4px; border: 1px solid #000; border-radius: 999px; user-select: none; }
.profile summary::-webkit-details-marker { display: none; }
.profile summary:hover, .profile[open] summary { background: #000; color: #fff; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: #000; color: #fff; font-family: var(--display); font-size: 1rem; line-height: 1; }
.profile[open] .avatar, .profile summary:hover .avatar { background: #fff; color: #000; }
.profile-name { font-weight: 600; }
.profile-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 180px; background: #fff; border: 1px solid #000; border-radius: var(--radius); padding: 14px; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.profile-menu form { margin: 0; }
.profile-menu button { width: 100%; }
.profile-who { margin: 0 0 12px; line-height: 1.35; }
@media (max-width: 480px) { .profile-name { display: none; } .profile summary { padding-right: 4px; } }
.foot { text-align: center; color: var(--muted); font-size: .8em; padding: 24px; }

/* --- cards --- */
.card { background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.card.narrow { max-width: 520px; margin-left: auto; margin-right: auto; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.card-head h1, .card-head h2 { white-space: nowrap; }
.card-head.wrap { flex-wrap: wrap; align-items: center; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }

.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid #000; }
.flash-ok { background: #000; color: #fff; }
.flash-error { background: #fff; color: var(--danger); border-color: var(--danger); }

/* --- forms --- */
form.stack { display: flex; flex-direction: column; gap: 12px; }
form.inline, .inline { display: inline; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .8em; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
input[type=text], input[type=password], input[type=date], input[type=datetime-local], select {
  font: inherit; font-size: 15px; color: var(--text); padding: 9px 10px; border: 1px solid #000; border-radius: var(--radius); background: #fff; min-width: 0; text-transform: none; letter-spacing: 0;
}
input:focus, select:focus { outline: 2px solid #000; outline-offset: 1px; }
input[type=color] { width: 44px; height: 38px; padding: 2px; border: 1px solid #000; border-radius: var(--radius); background: #fff; }
button, .btn { font: inherit; font-weight: 600; padding: 9px 16px; border-radius: var(--radius); border: 1px solid #000; background: #fff; color: #000; cursor: pointer; text-decoration: none; display: inline-block; line-height: 1.2; }
button:hover, .btn:hover { background: #f2f2f2; }
button.primary { background: #000; border-color: #000; color: #fff; }
button.primary:hover { background: #222; }
button.danger { background: #fff; border: 2px solid #000; color: #000; }
button.danger:hover { background: #000; color: #fff; }
.danger-text { color: var(--danger); border-color: var(--danger); }
.danger-text:hover { background: var(--danger); color: #fff; }
button.big { padding: 14px 24px; font-size: 1.05rem; }
.btn.small, button.small { padding: 4px 9px; font-size: .8em; }
.new-cat summary { cursor: pointer; color: var(--muted); font-size: .9em; }
.new-cat .row { margin-top: 8px; }

/* --- dashboard --- */
.hero { border-width: 2px; }
.hero.running h1 { display: flex; align-items: center; gap: 12px; }
.status { margin: 0 0 18px; font-size: 1.05rem; }
.controls { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.controls form { padding: 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); }
.controls .clock-out { justify-content: space-between; }
@media (max-width: 640px) { .controls { grid-template-columns: 1fr; } }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.big-dot { width: 18px; height: 18px; }
.swatch { display: inline-block; width: 18px; height: 18px; border-radius: 4px; vertical-align: middle; margin-right: 6px; }
.total { font-family: var(--display); font-size: 2.4rem; line-height: 1; margin: 6px 0 14px; }
.total .muted { font-family: inherit; font-size: 1rem; }
.breakdown { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.breakdown li { display: grid; grid-template-columns: 14px 1fr auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; }
.breakdown .name { font-weight: 500; }
.breakdown .hours { font-variant-numeric: tabular-nums; }
.breakdown .bar { grid-column: 2 / 4; height: 6px; background: #eee; border-radius: 3px; overflow: hidden; }
.breakdown .bar-fill { display: block; height: 100%; border-radius: 3px; }

/* --- tables --- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .75em; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; border-bottom: 1px solid #000; }
tr.in-progress td { background: #f7f7f7; }
tr.archived td { color: var(--muted); }
td.note { max-width: 320px; overflow-wrap: anywhere; }
td.actions form { margin-left: 4px; }
.add-cat { margin-bottom: 16px; }
.cats input[type=text] { width: 100%; }

/* --- timeline --- */
.nav-row { display: flex; gap: 6px; }
.gantt { margin-top: 12px; }
.gantt-row { display: grid; grid-template-columns: 140px 1fr; gap: 8px; align-items: stretch; border-top: 1px solid var(--line); }
.gantt-row.today .gantt-label { font-weight: 700; }
.gantt-axis { border-top: 0; }
.gantt-axis .gantt-track { height: 20px; background: none; }
.gantt-axis .tick { position: absolute; top: 0; transform: translateX(-50%); font-size: .75em; color: var(--muted); }
.gantt-label { padding: 8px 0; font-size: .9em; line-height: 1.3; }
.gantt-track { position: relative; height: 40px; background: #fafafa; overflow: visible; }
.gridline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.block { position: absolute; top: 6px; bottom: 6px; border-radius: 3px; display: block; text-decoration: none; }
.block:hover, .block:focus { outline: 2px solid #000; z-index: 3; }
.block.open { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.3) 0 6px, transparent 6px 12px); }
span.block { cursor: default; }
.tip { display: none; position: absolute; top: 100%; left: 0; margin-top: 6px; background: #000; color: #fff; padding: 8px 10px; border-radius: var(--radius); font-size: .85em; white-space: nowrap; z-index: 5; }
.block:hover .tip, .block:focus .tip { display: block; }
.gantt-row:last-child .tip { top: auto; bottom: 100%; margin: 0 0 6px; }
@media (max-width: 640px) {
  .gantt-row { grid-template-columns: 90px 1fr; }
  .gantt-label { font-size: .8em; }
  .tip { white-space: normal; min-width: 160px; }
  h1 { font-size: 1.8rem; }
}
