/* Moderan, minimalan izgled (Revolut / iOS): sive pozadine, bijele kartice,
   zaobljeni uglovi, velika tipografija, tamni način po postavci uređaja. */
:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --field: #f2f2f7;
  --line: rgba(60, 60, 67, .12);
  --text: #0b0b0f;
  --muted: #6c6c75;
  --accent: #0666eb;
  --accent-press: #0553c0;
  --accent-soft: #e6f0ff;
  --danger: #e5384f;
  --danger-soft: #fdeaed;
  --ok: #1b8a4b;
  --ok-soft: #e4f5ea;
  --warn: #8a5a00;
  --warn-soft: #fff3d1;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04);
  --bar-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --field: #2c2c2e;
    --line: rgba(255, 255, 255, .1);
    --text: #f5f5f7;
    --muted: #9a9aa3;
    --accent: #4b97ff;
    --accent-press: #7ab3ff;
    --accent-soft: #14253d;
    --danger: #ff6b7d;
    --danger-soft: #3a1b20;
    --ok: #4cd282;
    --ok-soft: #12301f;
    --warn: #f0b94a;
    --warn-soft: #33290f;
    --shadow: none;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { color-scheme: light dark; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1 { font-size: 2rem; line-height: 1.15; margin: 0; letter-spacing: -.03em; font-weight: 700; }
h2 { font-size: 1.05rem; margin: 0 0 4px; font-weight: 650; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 15px; margin: 0 0 14px; }
.error { color: var(--danger); background: var(--danger-soft); padding: 12px 16px; border-radius: var(--radius-sm); margin: 0 0 16px; }
.warn { color: var(--warn); background: var(--warn-soft); padding: 12px 16px; border-radius: var(--radius-sm); margin: 8px 0; font-size: 15px; }
.wrap { max-width: 640px; margin: 0 auto; padding: 24px 16px 48px; }
.wrap.narrow { max-width: 420px; padding-top: 14vh; }

/* navigacija */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 82%, transparent); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
.topbar-inner { max-width: 640px; margin: 0 auto; padding: 0 16px; height: 60px; display: flex; align-items: center; gap: 24px; }
.brand { font-weight: 800; font-size: 1.25rem; text-decoration: none; letter-spacing: -.04em; color: var(--text); }
.nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav form { margin: 0; }
.nav a, .nav button { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; font: inherit; font-size: 15px; font-weight: 500; text-decoration: none; color: var(--muted); background: none; border: 0; cursor: pointer; }
.nav a:hover, .nav button:hover { background: var(--line); color: var(--text); }
.nav a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* telefon: iOS tab bar pri dnu */
@media (max-width: 720px) {
  .topbar-inner { height: 52px; }
  .wrap { padding-bottom: calc(var(--bar-h) + 40px + env(safe-area-inset-bottom)); }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; z-index: 30; justify-content: space-around; gap: 0;
    height: calc(var(--bar-h) + env(safe-area-inset-bottom)); padding: 6px 4px env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--card) 85%, transparent); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--line); }
  .nav > a, .nav form, .nav button { flex: 1; }
  .nav a, .nav button { flex-direction: column; justify-content: center; gap: 2px; padding: 4px 0; border-radius: 12px; font-size: 11px; width: 100%; }
  .nav a.active { background: none; }
  .nav a:hover, .nav button:hover { background: none; }
  .nav .label { display: block; }
}

/* naslovi */
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 8px 0 20px; }
.back { display: inline-block; margin-bottom: 8px; color: var(--accent); text-decoration: none; font-size: 16px; font-weight: 500; }

/* dugmad */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 20px; border: 0; border-radius: 999px; font: inherit; font-size: 16px; font-weight: 600; text-decoration: none; cursor: pointer; transition: transform .08s, background .15s; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-press); }
@media (prefers-color-scheme: dark) { .btn-primary { color: #000; } }
.btn-secondary { background: var(--line); color: var(--text); }
.btn-secondary:hover { background: color-mix(in srgb, var(--line) 160%, transparent); }
.btn-danger { background: none; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-icon { min-width: 40px; min-height: 40px; padding: 6px; }
.btn:disabled { opacity: .35; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 8px; }
.actions form, form.inline-form { display: inline; margin: 0; }

/* kartice */
.card, .stack-lg > section, .auth, a.row, .list, .banner, details, .remote { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.card, .stack-lg > section, .auth { padding: 20px; }
.stack-lg > section { margin: 0; }

/* forme */
form { margin: 0; }
.stack { display: grid; gap: 12px; }
.stack-lg { display: grid; gap: 16px; }
label.label { display: block; font-weight: 600; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; padding: 14px 16px; font: inherit; color: inherit; background: var(--field);
  border: 2px solid transparent; border-radius: var(--radius-sm); -webkit-appearance: none; appearance: none;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--card); }
input, select, textarea, button { font-size: 16px; } /* sprječava zumiranje na iOS-u */
textarea { resize: vertical; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline input { flex: 1; min-width: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .two { grid-template-columns: 1fr; } }
.check { display: flex; align-items: flex-start; gap: 12px; margin-top: 12px; }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.check span { flex: 1; font-size: 15px; }
.step { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin-right: 10px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 14px; font-weight: 700; }

/* segmentirani prekidač (iOS) */
.seg { display: flex; padding: 3px; margin-bottom: 14px; background: var(--field); border-radius: 12px; }
.seg label { position: relative; flex: 1; }
.seg input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.seg span { display: block; padding: 9px 12px; text-align: center; font-size: 15px; font-weight: 600; color: var(--muted); border-radius: 10px; }
.seg input:checked + span { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.seg input:disabled + span { opacity: .4; }

.opt { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.opt:last-child { border-bottom: 0; padding-bottom: 0; }
.opt input[type=radio] { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.opt input[type=number] { display: inline-block; vertical-align: middle; width: 72px; padding: 8px; margin: 0 4px; text-align: center; }

/* liste */
a.row { display: block; padding: 16px 20px; margin-bottom: 12px; text-decoration: none; color: var(--text); transition: transform .08s; }
a.row:active { transform: scale(.985); }
.row-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.row-top strong { font-size: 17px; letter-spacing: -.01em; }
.row-meta { color: var(--muted); font-size: 14px; }
.list { list-style: none; margin: 12px 0 0; padding: 4px 20px; }
.list > li { display: flex; align-items: center; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list .text { flex: 1; white-space: pre-wrap; word-break: break-word; }
.list form { display: inline; }
.num { color: var(--muted); min-width: 24px; font-variant-numeric: tabular-nums; }

.chip { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--line); color: var(--muted); white-space: nowrap; }
.chip-confirmed { background: var(--accent-soft); color: var(--accent); }
.chip-running { background: var(--ok-soft); color: var(--ok); }
.chip-paused { background: var(--warn-soft); color: var(--warn); }
.chip-completed { background: var(--ok-soft); color: var(--ok); }
.chip-cancelled { background: var(--danger-soft); color: var(--danger); }

/* raspored */
.day { margin: 28px 4px 8px; font-weight: 600; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.day + .card { padding-top: 6px; padding-bottom: 6px; }
.slot { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.slot:last-child { border-bottom: 0; }
.slot .time { flex: none; width: 48px; font-weight: 600; font-variant-numeric: tabular-nums; }
.slot .body { flex: 1; min-width: 0; }
.slot .text { word-break: break-word; white-space: pre-wrap; }
.slot .meta { color: var(--muted); font-size: 14px; }
.slot .state { flex: none; font-size: 13px; font-weight: 600; color: var(--muted); }
.slot .state.sent { color: var(--ok); }
.slot .state.failed { color: var(--danger); }
details { margin: 14px 0; padding: 14px 20px; }
summary { cursor: pointer; color: var(--muted); font-weight: 500; }
details ul { margin: 10px 0 0; padding-left: 20px; }

.empty { text-align: center; padding: 56px 16px; color: var(--muted); background: var(--card); border-radius: var(--radius); }
.empty .btn { margin-top: 12px; }

/* prijava */
.auth { padding: 28px 24px; }
.auth h1 { text-align: center; font-size: 2rem; margin-bottom: 24px; }

.banner { margin: 16px 0; padding: 14px 18px; color: var(--warn); background: var(--warn-soft); }
.notice { margin: 0 0 16px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--text); font-size: 15px; }
.notice a { font-weight: 600; }

@media (max-width: 560px) {
  h1 { font-size: 1.75rem; }
  .head { flex-wrap: wrap; }
  .head .btn { width: 100%; }
  .actions .btn, .actions form { flex: 1 1 100%; }
  .actions form .btn { width: 100%; }
  .opt { flex-wrap: wrap; }
  .list > li { flex-wrap: wrap; }
  .list .text { flex: 1 1 100%; order: 2; }
  .list .num { order: 1; }
}

/* daljinski prikaz browsera (captcha i slične provjere) */
.remote { overflow: auto; max-height: 70vh; background: var(--field); -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-x pan-y; }
.remote-inner { position: relative; width: 100%; }
.remote img { display: block; width: 100%; height: auto; cursor: pointer; touch-action: pan-x pan-y; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.tap-dot { position: absolute; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%; background: rgba(6, 102, 235, .35); border: 3px solid var(--accent); pointer-events: none; }
.tap-dot.pulse { animation: tap .5s ease-out; }
@keyframes tap { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.remote-tools { margin-top: 12px; display: grid; gap: 10px; }
.tool-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tool-row .btn { flex: 1 1 auto; min-width: 56px; }

/* cijeli ekran */
body.rfull { overflow: hidden; }
body.rfull .remote { position: fixed; inset: 0; z-index: 50; max-height: none; border-radius: 0; background: #000; padding-bottom: 170px; }
body.rfull .remote-tools { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; margin: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); }
body.rfull .topbar, body.rfull .nav { display: none; }

/* prijava / registracija */
.auth-tabs a { flex: 1; padding: 9px 12px; text-align: center; font-size: 15px; font-weight: 600; color: var(--muted); border-radius: 10px; text-decoration: none; }
.auth-tabs a.on { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.auth-switch { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: 15px; }
.auth-switch a { font-weight: 600; text-decoration: none; }
.auth .btn { width: 100%; }
