@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('/fonts/Inter-Regular.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url('/fonts/Inter-Medium.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('/fonts/Inter-SemiBold.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-weight: 500; font-display: swap; src: url('/fonts/SpaceGrotesk-Medium.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-weight: 700; font-display: swap; src: url('/fonts/SpaceGrotesk-Bold.woff2') format('woff2'); }

/* it.res CGP */
:root {
  --brand: #4B5563;
  --soft: #6B7280;
  --accent: #FF8F00;
  --accent-ink: #1A1000;
  --accent-tint: rgba(255, 143, 0, 0.12);
  --bg: #0A0E13;
  --surface: #121418;
  --surface-2: #181B21;
  --line: #2B3138;
  --text: #E9EEF3;
  --muted: #A5ADB8;
  --danger: #FF6B5E;
  --ok: #4ADE80;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --head: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
svg.i { width: 20px; height: 20px; flex: none; }
.sprite { position: absolute; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-family: var(--head); font-variant-numeric: tabular-nums; }
#app { min-height: 100vh; }
#app.loading::after { content: ''; display: block; width: 34px; height: 34px; margin: 40vh auto 0; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- gumbi in polja ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: var(--soft); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { border-color: #FFB04D; background: #FF9C1F; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--line); }
.btn-danger { color: var(--danger); }
.btn-icon { width: 44px; padding: 0; }
.btn-big { min-height: 52px; font-size: 16px; padding: 0 22px; }

.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; min-width: 0; }
.in, select.in, textarea.in {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 16px;
}
textarea.in { min-height: 84px; resize: vertical; line-height: 1.4; }
.in:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-tint); }
select.in { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.row3 { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; color: var(--text); }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.hint { font-size: 12.5px; color: var(--muted); margin: 0; }
.err { color: var(--danger); font-size: 14px; min-height: 1.2em; margin: 0; }

/* ---------- prijava ---------- */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; gap: 14px; }
.login img { width: 84px; height: 84px; border-radius: 20px; }
.login h1 { font-family: var(--head); font-size: 26px; margin: 0; letter-spacing: -0.01em; }
.login h1 span { color: var(--accent); }
.login form { width: 100%; max-width: 300px; display: flex; flex-direction: column; gap: 12px; }
.login .in { text-align: center; font-size: 22px; letter-spacing: 0.3em; font-family: var(--head); }

/* ---------- okvir ---------- */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-t)) 16px 10px; background: rgba(10, 14, 19, 0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top img { width: 32px; height: 32px; border-radius: 8px; }
.brand { font-family: var(--head); font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.brand span { color: var(--accent); }
.brand small { font-family: 'Inter', sans-serif; font-weight: 500; font-size: 13px; color: var(--muted); margin-left: 6px; }
.top .grow { flex: 1; }
.tabs { display: flex; gap: 4px; }
.tab { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--muted); font-weight: 600; }
.tab[aria-current="page"] { color: var(--text); background: var(--surface-2); border-color: var(--line); }
main.wrap { max-width: 760px; margin: 0 auto; padding: 16px 16px calc(32px + var(--safe-b)); display: flex; flex-direction: column; gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel h2 { font-family: var(--head); font-size: 15px; font-weight: 500; margin: 0 0 12px; color: var(--muted); letter-spacing: 0.02em; }

/* ---------- štoparica ---------- */
.timer { display: flex; flex-direction: column; gap: 12px; }
.timer.run { border-color: rgba(255, 143, 0, 0.55); box-shadow: 0 0 0 1px rgba(255, 143, 0, 0.2) inset; }
.timer .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.timer .acts { display: flex; gap: 10px; flex-wrap: wrap; }
.timer .acts .btn-accent { flex: 1; }
.clock { font-family: var(--head); font-weight: 700; font-size: 44px; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.run-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.run-who { color: var(--muted); font-size: 14px; }
.run-who b { color: var(--text); font-weight: 600; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-right: 8px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

/* ---------- mesec in filtri ---------- */
.bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.month { display: flex; align-items: center; gap: 2px; }
.month b { font-family: var(--head); font-size: 18px; font-weight: 700; min-width: 140px; text-align: center; }
.month b::first-letter { text-transform: uppercase; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { min-height: 40px; padding: 0 12px; border: none; background: none; color: var(--muted); font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.bar select.in { width: 180px; min-height: 40px; font-size: 15px; }
a.btn { text-decoration: none; color: var(--text); }
.bar .grow { flex: 1; }

.sum { display: flex; gap: 18px; flex-wrap: wrap; align-items: baseline; }
.sum .big { font-family: var(--head); font-weight: 700; font-size: 30px; letter-spacing: -0.02em; }
.sum .lbl { color: var(--muted); font-size: 13px; }
.sum div { display: flex; flex-direction: column; }
.per { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.per span { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.per span b { color: var(--text); font-weight: 600; }

/* ---------- seznam ---------- */
.day { display: flex; flex-direction: column; gap: 6px; }
.day-h { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 2px; font-size: 13px; color: var(--muted); font-weight: 600; }
.day-h .num { color: var(--text); }
.entry { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: start; width: 100%; text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.entry:hover { border-color: var(--soft); }
.entry .dur { font-family: var(--head); font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.entry .span { display: block; font-size: 12px; color: var(--muted); font-family: 'Inter', sans-serif; font-weight: 400; margin-top: 2px; }
.entry .who { font-weight: 600; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.entry .who small { font-weight: 500; color: var(--muted); }
.entry .desc { color: var(--muted); font-size: 14px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.entry .side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; color: var(--muted); font-size: 12.5px; }
.entry .side span { display: inline-flex; align-items: center; gap: 4px; }
.entry .side svg { width: 16px; height: 16px; }
.tag { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); letter-spacing: 0.02em; }
.tag.sp { color: var(--accent); border-color: rgba(255, 143, 0, 0.45); background: var(--accent-tint); }
.tag.racun { color: var(--ok); border-color: rgba(74, 222, 128, 0.4); }
.tag.nz { border-style: dashed; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty p { margin: 0 0 14px; }

/* ---------- stranke ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.client { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.client:hover { border-color: var(--soft); }
.client .n { font-weight: 600; }
.client .m { font-size: 13px; color: var(--muted); }
.client.off { opacity: 0.55; }
.proj { display: flex; gap: 8px; align-items: center; }
.proj .in { flex: 1; }

/* ---------- okno (dialog) ---------- */
.sheet { width: min(620px, 100vw); max-height: min(92vh, 900px); margin: auto auto 0; padding: 0; border: 1px solid var(--line); border-bottom: none; border-radius: 18px 18px 0 0; background: var(--surface); color: var(--text); }
.sheet::backdrop { background: rgba(0, 0, 0, 0.6); }
@media (min-width: 700px) { .sheet { margin: auto; border-radius: 18px; border-bottom: 1px solid var(--line); } }
.sheet form { display: flex; flex-direction: column; gap: 14px; padding: 18px 18px calc(18px + var(--safe-b)); }
.sheet-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sheet-h h2 { font-family: var(--head); font-size: 20px; margin: 0; }
.sheet-f { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; padding-top: 4px; }
.sheet-f .r { display: flex; gap: 10px; margin-left: auto; }
.dur-show { font-family: var(--head); font-weight: 700; font-size: 15px; color: var(--accent); align-self: flex-end; min-height: 44px; display: flex; align-items: center; }

/* ---------- priponke ---------- */
.files { display: flex; flex-direction: column; gap: 8px; }
.drop { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; border: 1.5px dashed var(--line); border-radius: 12px; color: var(--muted); font-weight: 600; cursor: pointer; text-align: center; padding: 10px; }
.drop:hover, .drop.over { border-color: var(--accent); color: var(--text); background: var(--accent-tint); }
.file { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.file .th { width: 48px; height: 48px; border-radius: 8px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; flex: none; color: var(--muted); }
.file .th img { width: 100%; height: 100%; object-fit: cover; }
.file .meta { flex: 1; min-width: 0; }
.file .meta a, .file .meta span.nm { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); text-decoration: none; font-weight: 500; }
.file .meta a:hover { color: var(--accent); }
.file .meta small { color: var(--muted); font-size: 12px; }
.bar-p { height: 4px; border-radius: 2px; background: var(--line); margin-top: 6px; overflow: hidden; }
.bar-p i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }

.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); z-index: 50; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4); max-width: calc(100vw - 32px); }

@media (max-width: 520px) {
  .brand small { display: none; }
  .tab span { display: none; }
  .clock { font-size: 38px; }
  .entry { grid-template-columns: 56px 1fr auto; gap: 10px; padding: 12px; }
  .bar select.in { flex: 1; width: auto; min-width: 0; }
  .bar .grow { display: none; }
  #bar .month { order: 0; flex: 1; justify-content: space-between; }
  #bar .csv { order: 1; }
  #bar .seg { order: 2; }
  #bar select.in { order: 3; }
  .row3 { grid-template-columns: 1fr 1fr; }
  .row3 > :first-child { grid-column: 1 / -1; }
  .month b { min-width: 120px; font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) { .dot, #app.loading::after { animation: none; } }
.page-h { margin: 0; font-size: 22px; }
.btn.armed { width: auto; padding: 0 12px; color: var(--danger); border-color: rgba(255, 107, 94, 0.5); }
.f > .seg { align-self: flex-start; }
.entry-new { display: flex; flex-direction: column; gap: 12px; }
.entry-new .sheet-f { justify-content: flex-end; }
.entry-new .sheet-f .r { width: 100%; }
.entry-new .sheet-f .btn-accent { flex: 1; }
.pick-add { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px; border: 1px dashed rgba(255, 143, 0, 0.5); border-radius: 12px; background: var(--accent-tint); }
.pick-add[hidden] { display: none; }
.pick-add .in[type=text] { flex: 1 1 180px; }
.pick-add select.in { width: auto; flex: 0 0 110px; }
.row-end { align-items: flex-end; }
.f .dur-show { min-height: 0; display: inline; font-size: 13px; }
.err:empty { display: none; }
