/* Záznam práce — jeden stylopis, mobil first. */

:root {
  --bg: #0f172a;
  --bg-soft: #1e293b;
  --bg-card: #1e293b;
  --border: #334155;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --text-faint: #64748b;
  --accent: #38bdf8;
  --accent-dim: #0ea5e9;
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --work: #38bdf8;
  --personal: #c084fc;
  --radius: 10px;
  --gap: 14px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .35);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f8fafc;
    --bg-soft: #f1f5f9;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-dim: #475569;
    --text-faint: #94a3b8;
    --accent: #0284c7;
    --accent-dim: #0369a1;
    --ok: #16a34a;
    --warn: #d97706;
    --bad: #dc2626;
    --shadow: 0 1px 3px rgba(0, 0, 0, .08);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 76px;
}

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

/* ---------------------------------------------------------- rozvržení */

header.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}

header.topbar h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -.01em;
}

main { padding: var(--gap); max-width: 1180px; margin: 0 auto; }

nav.tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}

nav.tabs a {
  padding: 9px 2px 7px;
  text-align: center;
  font-size: 10.5px;
  color: var(--text-dim);
  text-decoration: none;
  border-top: 2px solid transparent;
}

nav.tabs a .ico { display: block; font-size: 19px; line-height: 1.15; }
nav.tabs a.active { color: var(--accent); border-top-color: var(--accent); }

@media (min-width: 860px) {
  body { padding-bottom: 0; }
  nav.tabs {
    position: static;
    display: flex;
    gap: 4px;
    border-top: none;
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
  }
  nav.tabs a { padding: 11px 14px; font-size: 14px; border-top: none; border-bottom: 2px solid transparent; }
  nav.tabs a .ico { display: inline; font-size: 15px; margin-right: 5px; }
  nav.tabs a.active { border-bottom-color: var(--accent); }
}

/* ---------------------------------------------------------- karty */

.grid { display: grid; gap: var(--gap); }
.grid.cols-2 { grid-template-columns: 1fr; }
.grid.cols-3 { grid-template-columns: 1fr; }
.grid.cols-4 { grid-template-columns: repeat(2, 1fr); }

@media (min-width: 700px) {
  .grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
  .grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.card h2 { margin: 0 0 10px; font-size: 14px; font-weight: 650; color: var(--text-dim);
           text-transform: uppercase; letter-spacing: .04em; }

.stat { font-size: 27px; font-weight: 680; letter-spacing: -.02em; }
.stat small { font-size: 13px; font-weight: 400; color: var(--text-dim); margin-left: 4px; }
.sub { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; }

/* ---------------------------------------------------------- ovládání */

button, .btn {
  font: inherit;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  cursor: pointer;
  transition: filter .12s;
}
button:hover, .btn:hover { filter: brightness(1.15); text-decoration: none; }
button:disabled { opacity: .5; cursor: not-allowed; }

button.primary, .btn.primary {
  background: var(--accent); border-color: var(--accent); color: #062330; font-weight: 600;
}
button.danger { border-color: var(--bad); color: var(--bad); }
button.ghost { background: transparent; }
button.sm { padding: 4px 9px; font-size: 12.5px; }

input, select, textarea {
  font: inherit;
  font-size: 15px;
  width: 100%;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { min-height: 74px; resize: vertical; }
label { display: block; font-size: 12.5px; color: var(--text-dim); margin: 9px 0 4px; font-weight: 500; }

.row { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 auto; }
.row > .fixed { flex: 0 0 auto; }

/* ---------------------------------------------------------- seznam aktivit */

.activity {
  display: flex;
  gap: 11px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  margin-bottom: 8px;
  align-items: flex-start;
}
.activity.selected { outline: 2px solid var(--accent); }
.activity .time { flex: 0 0 78px; font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--text-dim); }
.activity .time b { display: block; font-size: 14.5px; color: var(--text); font-weight: 600; }
.activity .body { flex: 1 1 auto; min-width: 0; }
.activity .title { font-weight: 570; overflow-wrap: anywhere; }
.activity .meta { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; display: flex;
                  gap: 7px; flex-wrap: wrap; align-items: center; }
.activity .actions { flex: 0 0 auto; display: flex; gap: 5px; flex-direction: column; }

.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  white-space: nowrap;
}
.pill.work { border-color: var(--work); color: var(--work); }
.pill.personal { border-color: var(--personal); color: var(--personal); }
.pill.warn { border-color: var(--warn); color: var(--warn); }
.pill.bad { border-color: var(--bad); color: var(--bad); }
.pill.ok { border-color: var(--ok); color: var(--ok); }
.pill.billable { border-color: var(--ok); color: var(--ok); }

.gap-row, .overlap-row {
  padding: 9px 12px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 13.5px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.gap-row { border: 1px dashed var(--warn); color: var(--warn); background: rgba(251, 191, 36, .07); }
.overlap-row { border: 1px dashed var(--bad); color: var(--bad); background: rgba(248, 113, 113, .07); }

/* ---------------------------------------------------------- pruhy a osa */

.bar { height: 7px; border-radius: 4px; background: var(--accent); min-width: 3px; }
.bar-track { background: var(--bg); border-radius: 4px; overflow: hidden; height: 7px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--border); }
th { color: var(--text-dim); font-weight: 600; font-size: 12px; text-transform: uppercase;
     letter-spacing: .03em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; }

.timeline { position: relative; height: 40px; background: var(--bg); border-radius: 6px;
            overflow: hidden; border: 1px solid var(--border); }
.timeline .seg { position: absolute; top: 0; bottom: 0; background: var(--accent); opacity: .82; }
.timeline .seg.personal { background: var(--personal); }
.timeline .hour { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border); }

/* ---------------------------------------------------------- dialog */

dialog {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  color: var(--text);
  padding: 18px;
  width: min(560px, calc(100vw - 24px));
  max-height: 88vh;
  overflow-y: auto;
}
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog h3 { margin: 0 0 10px; font-size: 17px; }

.fab {
  position: fixed;
  right: 16px;
  bottom: 82px;
  z-index: 45;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  font-size: 27px;
  line-height: 1;
  background: var(--accent);
  color: #062330;
  border: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .4);
}
@media (min-width: 860px) { .fab { bottom: 22px; } }

/* ---------------------------------------------------------- hlášky */

.toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  z-index: 90;
  padding: 10px 16px;
  border-radius: 9px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .45);
  font-size: 14px;
  max-width: calc(100vw - 32px);
}
.toast.bad { border-color: var(--bad); color: var(--bad); }
.toast.ok { border-color: var(--ok); }

.empty { text-align: center; padding: 30px 16px; color: var(--text-faint); font-size: 14px; }
.muted { color: var(--text-dim); }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.spacer { height: 14px; }
.right { text-align: right; }

.banner {
  padding: 10px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--warn);
  background: rgba(251, 191, 36, .09);
  color: var(--warn);
  font-size: 13.5px;
  margin-bottom: var(--gap);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.banner.ok { border-color: var(--ok); background: rgba(74, 222, 128, .09); color: var(--ok); }

.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  font-size: 13px;
  cursor: pointer;
}
.chip.on { border-color: var(--accent); color: var(--accent); }

.sync-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); }
.sync-dot.ok { background: var(--ok); }
.sync-dot.stale { background: var(--warn); }
.sync-dot.bad { background: var(--bad); }
