/* Ključi na recepciji – tabla v obliki omarice s kavlji */

:root {
  --bg: #E7EAE8;          /* beton */
  --surface: #F6F7F5;
  --board: #D5DAD7;       /* kovinska tabla */
  --hole: rgba(24, 34, 44, .13);
  --ink: #18222C;
  --muted: #5B6770;
  --line: #C9D0CD;
  --brass: #B5872A;       /* obesek na kavlju */
  --brass-ink: #2B1F05;
  --brass-edge: #8E6918;
  --out: #BF3A2F;         /* ključ zunaj */
  --ok: #2D7656;
  --focus: #1F5FBF;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11181F; --surface: #18222B; --board: #1D2933; --hole: rgba(0, 0, 0, .45);
    --ink: #E5EAED; --muted: #8F9BA4; --line: #2A3743;
    --brass: #CFA247; --brass-ink: #241A04; --brass-edge: #9C7624;
    --out: #E2594D; --ok: #52AE84; --focus: #7EA9F0;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11181F; --surface: #18222B; --board: #1D2933; --hole: rgba(0, 0, 0, .45);
  --ink: #E5EAED; --muted: #8F9BA4; --line: #2A3743;
  --brass: #CFA247; --brass-ink: #241A04; --brass-edge: #9C7624;
  --out: #E2594D; --ok: #52AE84; --focus: #7EA9F0;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Archivo", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

h1, h2, h3 { font-stretch: 118%; letter-spacing: -.01em; margin: 0; }
h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem); font-weight: 750; line-height: 1.1; }
h2 { font-size: 1.125rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 650; }

button, select, input {
  font: inherit; font-size: .9375rem; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  padding: .45rem .75rem; min-height: 40px;
}
button { cursor: pointer; background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }
button.ghost { background: transparent; color: var(--ink); border-color: var(--line); font-weight: 500; }
button:hover { filter: brightness(1.08); }

/* ---------- glava ---------- */
.top {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem;
  max-width: 1200px; margin: 0 auto; padding: 1.75rem 16px 1.25rem;
}
.top-title p { margin: .35rem 0 0; }
.top-tools { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.clock { font-stretch: 112%; font-weight: 600; font-size: 1.125rem; min-width: 4.5ch; }
.live { display: inline-flex; align-items: center; gap: .45rem; font-size: .875rem; color: var(--muted); }
.live::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.live[data-state="on"] { color: var(--ok); }
.live[data-state="on"]::before { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.live[data-state="off"] { color: var(--out); }
.live[data-state="off"]::before { background: var(--out); }

main { max-width: 1200px; margin: 0 auto; padding: 0 16px 2rem; }

/* ---------- tabla s kavlji ---------- */
.board-wrap { margin-bottom: 1.5rem; }
.board {
  --gap: clamp(.75rem, 2vw, 1.5rem);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--gap);
  padding: clamp(1.25rem, 3vw, 2.25rem) clamp(1rem, 3vw, 2rem) clamp(1.5rem, 3vw, 2.5rem);
  background-color: var(--board);
  background-image: radial-gradient(circle at 50% 50%, var(--hole) 0 2.2px, transparent 2.6px);
  background-size: 22px 22px;
  border-radius: 14px;
  border: 1px solid var(--line);
}
.slot { display: flex; flex-direction: column; align-items: center; min-height: 196px; }
.hook {
  width: 22px; height: 22px; border-radius: 50%;
  border: 4px solid var(--muted); background: var(--board); position: relative; z-index: 1;
}
.hook::after { /* kavelj */
  content: ""; position: absolute; left: 50%; top: 14px; width: 3px; height: 16px;
  background: var(--muted); transform: translateX(-50%); border-radius: 2px;
}
.tag {
  margin-top: 10px; width: 100%; max-width: 168px; min-height: 140px;
  border-radius: 10px 10px 22px 22px; padding: 2.1rem .9rem 1rem;
  position: relative; text-align: center; display: flex; flex-direction: column; justify-content: space-between; gap: .5rem;
  transform-origin: 50% -16px;
}
.tag::before { /* luknjica obeska */
  content: ""; position: absolute; top: .7rem; left: 50%; transform: translateX(-50%);
  width: 14px; height: 14px; border-radius: 50%;
}
.slot.in .tag { background: var(--brass); color: var(--brass-ink); border: 1px solid var(--brass-edge); }
.slot.in .tag::before { background: var(--board); box-shadow: inset 0 0 0 2px var(--brass-edge); }
.slot.out .hook { border-color: var(--out); }
.slot.out .hook::after { background: var(--out); }
.slot.out .tag { border: 2px dashed color-mix(in srgb, var(--out) 70%, transparent); color: var(--ink); background: color-mix(in srgb, var(--surface) 55%, transparent); }
.slot.out .tag::before { border: 2px dashed color-mix(in srgb, var(--out) 70%, transparent); }
.tag-name { font-stretch: 112%; font-weight: 700; font-size: 1.0625rem; line-height: 1.15; overflow-wrap: anywhere; }
.tag-state { font-size: .875rem; line-height: 1.3; }
.slot.out .dur { display: block; font-stretch: 118%; font-weight: 750; font-size: 1.5rem; color: var(--out); line-height: 1.1; }
.slot.unknown .tag { border: 2px dashed var(--line); color: var(--muted); }

/* edino samodejno gibanje: obesek zaniha, ko se ključ vrne */
@keyframes swing { 0% { transform: rotate(9deg); } 35% { transform: rotate(-6deg); } 65% { transform: rotate(3deg); } 100% { transform: rotate(0); } }
.slot.in.just .tag { animation: swing 1.1s cubic-bezier(.3,.6,.4,1); }
@keyframes flash { from { background: color-mix(in srgb, var(--out) 25%, transparent); } }
.slot.out.just .tag { animation: flash 1.2s ease-out; }
@media (prefers-reduced-motion: reduce) { .slot.just .tag { animation: none !important; } }

.summary { font-size: clamp(1.0625rem, 1rem + .4vw, 1.25rem); margin: 1rem 2px 0; max-width: 70ch; }
.summary strong { font-weight: 700; }

/* ---------- plošče ---------- */
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; margin-bottom: 1.5rem; }
@media (max-width: 860px) { .cols { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.25rem; min-width: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.sub { margin: 1.5rem 0 .75rem; }

/* dnevnik */
.log { list-style: none; margin: 0; padding: 0; max-height: 460px; overflow-y: auto; }
.log .day { font-weight: 650; font-size: .875rem; color: var(--muted); padding: .75rem 0 .25rem; position: sticky; top: 0; background: var(--surface); }
.log .day:first-child { padding-top: 0; }
.log .ev { display: grid; grid-template-columns: 4.5ch 10px minmax(0, 1fr); gap: .75rem; align-items: baseline; padding: .4rem 0; border-top: 1px solid var(--line); }
.log .day + .ev { border-top: 0; }
.log .t { font-weight: 600; }
.log .dot { width: 9px; height: 9px; border-radius: 50%; align-self: center; }
.log .ev.izdan .dot { background: var(--out); }
.log .ev.vrnjen .dot { background: var(--ok); }
.log .what b { font-weight: 650; }
.log .empty { color: var(--muted); padding: .5rem 0; }

/* 14 dni */
.days { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; align-items: end; height: 150px; }
.days .d { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.days .bar { width: 100%; max-width: 26px; background: var(--brass); border-radius: 4px 4px 1px 1px; min-height: 2px; }
.days .d.zero .bar { background: var(--line); }
.days .n { font-size: .75rem; color: var(--muted); }
.days .lbl { font-size: .6875rem; color: var(--muted); white-space: nowrap; }
.days .d.today .lbl { color: var(--ink); font-weight: 650; }

.perkey { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.perkey li { display: grid; grid-template-columns: minmax(7rem, 9rem) minmax(0, 1fr) auto; gap: .75rem; align-items: center; font-size: .9375rem; }
.perkey .track { height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; }
.perkey .fill { height: 100%; background: var(--brass); border-radius: 5px; }
.perkey .val { color: var(--muted); font-size: .875rem; white-space: nowrap; }
@media (max-width: 480px) { .perkey li { grid-template-columns: minmax(0, 1fr) auto; } .perkey .track { grid-column: 1 / -1; grid-row: 2; } }

/* zgodovina */
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-bottom: 1rem; }
.filters label { display: flex; flex-direction: column; gap: .25rem; font-size: .8125rem; color: var(--muted); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8125rem; padding: .5rem .75rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: .55rem .75rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
td.k { white-space: normal; }
.pill { display: inline-block; padding: .05rem .55rem; border-radius: 999px; font-size: .8125rem; font-weight: 600; }
.pill.izdan { color: var(--out); background: color-mix(in srgb, var(--out) 12%, transparent); }
.pill.vrnjen { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.more { margin-top: 1rem; }

.foot { max-width: 1200px; margin: 0 auto; padding: 0 16px 2rem; }

/* ---------- levi rob z ikono in predal z nastavitvami ---------- */
:root { --rail: 64px; }
body { padding-left: var(--rail); }
.rail {
  position: fixed; inset: 0 auto 0 0; width: var(--rail); z-index: 30;
  display: flex; flex-direction: column; align-items: center; padding-top: 1.75rem;
  background: var(--surface); border-right: 1px solid var(--line);
}
.rail-btn {
  width: 44px; height: 44px; min-height: 0; padding: 0; border-radius: 12px;
  display: grid; place-items: center;
  background: transparent; color: var(--muted); border: 1px solid transparent;
}
.rail-btn:hover, .rail-btn[aria-expanded="true"] { color: var(--ink); background: var(--bg); border-color: var(--line); filter: none; }

.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(10, 16, 22, .45); }
.drawer {
  position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(340px, 88vw);
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  transform: translateX(-102%); transition: transform .22s ease; visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; box-shadow: 8px 0 32px rgba(0, 0, 0, .18); }
@media (prefers-reduced-motion: reduce) { .drawer { transition: none; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 1.5rem 1.25rem 1rem; border-bottom: 1px solid var(--line); }
.drawer-body { overflow-y: auto; padding: .5rem 1.25rem 2rem; }
button.icon { width: 40px; padding: 0; display: grid; place-items: center; }
.set { padding: 1.1rem 0; border-bottom: 1px solid var(--line); }
.set:last-child { border-bottom: 0; }
.set h3 { font-size: .9375rem; margin-bottom: .75rem; }
.set p { margin: .25rem 0; }
.jump { list-style: none; margin: 0; padding: 0; display: grid; gap: .15rem; }
.jump a { display: block; padding: .5rem .6rem; border-radius: 8px; text-decoration: none; }
.jump a:hover { background: var(--bg); }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; text-align: center; padding: .45rem .25rem; border-radius: 7px; font-size: .875rem; }
.seg input:checked + span { background: var(--ink); color: var(--bg); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .45rem 0; font-size: .9375rem; }
.num { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.num input { width: 4.5rem; text-align: right; }
.hint { margin-top: 0; }
.switch input {
  appearance: none; -webkit-appearance: none; width: 44px; height: 26px; min-height: 0; padding: 0; flex: none;
  border-radius: 999px; border: 1px solid var(--line); background: var(--line); position: relative; cursor: pointer;
}
.switch input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface); transition: transform .15s ease;
}
.switch input:checked { background: var(--ok); border-color: var(--ok); }
.switch input:checked::after { transform: translateX(18px); }

/* skriti razdelki */
.is-hidden { display: none !important; }
.cols.single { grid-template-columns: minmax(0, 1fr); }

/* opozorilo: ključ zunaj predolgo */
.slot.out.late .tag { background: var(--out); border-style: solid; border-color: var(--out); color: #fff; }
.slot.out.late .tag::before { border-color: rgba(255, 255, 255, .7); }
.slot.out.late .dur { color: #fff; }

/* telefon: ikona zgoraj levo namesto stolpca */
@media (max-width: 700px) {
  body { padding-left: 0; }
  .rail {
    position: absolute; inset: auto; top: 1.4rem; left: 12px; width: auto;
    background: transparent; border: 0; padding: 0;
  }
  .rail-btn { background: var(--surface); border-color: var(--line); color: var(--ink); }
  .top { padding-left: 68px; padding-top: 1.5rem; }
  .top-title p { font-size: .9375rem; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; padding: 1.25rem .75rem 1.5rem; }
  .slot { min-height: 0; }
  .tag { min-height: 128px; padding: 1.9rem .5rem .85rem; border-radius: 8px 8px 18px 18px; }
  .tag-name { font-size: 1rem; }
  .slot.out .dur { font-size: 1.25rem; }
  .tag-state { font-size: .8125rem; }
}

/* ---------- prijava in geslo ---------- */
body.auth-page { padding-left: 0; }
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 16px; }
.auth-hook { display: flex; justify-content: center; margin-bottom: -2px; position: relative; z-index: 1; }
.auth-card {
  width: 100%; max-width: 380px; display: grid; gap: 1rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px 10px 26px 26px; padding: 2.25rem 1.5rem 1.75rem;
}
.auth-card h1 { font-size: 1.5rem; }
.auth-card p { margin: 0; }
.auth-card label { display: grid; gap: .35rem; font-size: .875rem; color: var(--muted); }
.auth-card input { width: 100%; font-size: 1rem; min-height: 44px; }
.auth-card button { min-height: 44px; font-size: 1rem; }
.auth-error { color: var(--out); background: color-mix(in srgb, var(--out) 10%, transparent); border-radius: 8px; padding: .6rem .75rem; font-size: .9375rem; }
.auth-out { margin-top: 1rem; }

/* ---------- predal: račun in uporabniki ---------- */
.me { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.me b { display: block; }
.me-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
.me-actions a, .me-actions button { font-size: .875rem; min-height: 36px; padding: .35rem .7rem; }
.me-actions a { border: 1px solid var(--line); border-radius: 8px; text-decoration: none; display: inline-flex; align-items: center; }
.role { font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.role.admin { color: var(--brass-edge); border-color: var(--brass); }

.users { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .5rem; }
.users li { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .7rem; font-size: .875rem; }
.users li.off { opacity: .6; }
.users .u-top { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.users .u-meta { color: var(--muted); font-size: .8125rem; margin-top: .15rem; }
.users .u-act { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.users .u-act button { font-size: .8125rem; min-height: 32px; padding: .25rem .6rem; }
.newuser { display: grid; gap: .6rem; }
.newuser label { display: grid; gap: .25rem; font-size: .8125rem; color: var(--muted); }
.newuser input, .newuser select { width: 100%; }
.temp-pw {
  border: 1px dashed var(--brass); border-radius: 10px; padding: .75rem; font-size: .875rem; margin-top: .75rem;
  background: color-mix(in srgb, var(--brass) 10%, transparent);
}
.temp-pw code { display: block; font-size: 1.125rem; font-weight: 700; letter-spacing: .04em; margin: .35rem 0; user-select: all; font-family: "Archivo", system-ui, sans-serif; font-stretch: 112%; }
.form-msg { font-size: .8125rem; color: var(--out); min-height: 1em; margin: 0; }
.logins { list-style: none; margin: 0; padding: 0; font-size: .8125rem; max-height: 220px; overflow-y: auto; }
.logins li { display: grid; grid-template-columns: auto 1fr; gap: .5rem; padding: .3rem 0; border-top: 1px solid var(--line); }
.logins li.fail { color: var(--out); }

/* ---------- KeyWatch: logotip ---------- */
.brand { display: flex; align-items: center; gap: .55rem; }
.brand .mark { width: 1.35em; height: 1.35em; color: var(--brass); flex: none; margin-top: .05em; }
.brand-name { font-stretch: 125%; font-weight: 800; letter-spacing: -.02em; }
.brand-sub { margin: .35rem 0 0; font-weight: 600; font-stretch: 105%; }
.top-title .brand-sub + p { margin-top: .1rem; }
.auth-logo { display: grid; justify-items: center; gap: .5rem; margin-bottom: 1.25rem; }
.auth-logo .mark { width: 56px; height: 56px; color: var(--brass); }
.auth-logo .brand-name { font-size: 1.75rem; line-height: 1; }
.auth-card h1 { font-size: 1.25rem; }

/* ---------- prijava: karbonsko ozadje (vedno temno, ne glede na temo) ---------- */
body.auth-page {
  --bg: #0A0D10; --surface: rgba(20, 27, 34, .92); --line: #2C3843;
  --ink: #E7ECEF; --muted: #9AA6AF; --brass: #D1A548; --brass-edge: #9C7624;
  --out: #E2594D; --focus: #7EA9F0;
  color-scheme: dark;
  color: var(--ink);
  background-color: #0A0D10;
  background-image:
    radial-gradient(ellipse 70% 55% at 50% 38%, rgba(255, 255, 255, .07), transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 50%, transparent 45%, rgba(0, 0, 0, .7) 100%),
    url("/static/carbon.png");
  background-size: auto, auto, 32px 32px;
  background-attachment: fixed;
}
body.auth-page .auth-card {
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .05);
}
body.auth-page input { background: rgba(10, 14, 18, .85); }
body.auth-page .auth-logo .mark { filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .6)); }

/* ---------- prijava: slika z digitalnim ščitom (nadomešča karbon) ---------- */
body.auth-page {
  --surface: rgba(8, 15, 26, .74); --line: rgba(120, 170, 230, .22); --focus: #8CC3FF;
  background-color: #03070D;
  background-image:
    linear-gradient(90deg, rgba(3, 7, 13, 0) 0%, rgba(3, 7, 13, .15) 45%, rgba(3, 7, 13, .78) 100%),
    url("/static/prijava.jpg");
  background-image:
    linear-gradient(90deg, rgba(3, 7, 13, 0) 0%, rgba(3, 7, 13, .15) 45%, rgba(3, 7, 13, .78) 100%),
    image-set(url("/static/prijava.webp") type("image/webp"), url("/static/prijava.jpg") type("image/jpeg"));
  background-size: cover, cover;
  background-position: center, 30% 45%;
  background-repeat: no-repeat;
}
body.auth-page input { background: rgba(3, 8, 15, .8); }
body.auth-page .auth-card { box-shadow: 0 20px 60px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(160, 200, 255, .06); }

/* širok zaslon: obrazec desno, ščit levo ostane viden */
@media (min-width: 900px) {
  body.auth-page .auth { align-items: flex-end; padding-right: clamp(3rem, 9vw, 10rem); }
  body.auth-page .auth-logo,
  body.auth-page .auth-out { width: 100%; max-width: 380px; }
}

/* telefon: manjša slika, obrazec na sredini, bolj zatemnjeno */
@media (max-width: 899px) {
  body.auth-page {
    background-image:
      linear-gradient(rgba(3, 7, 13, .55), rgba(3, 7, 13, .7)),
      url("/static/prijava.jpg");
    background-image:
      linear-gradient(rgba(3, 7, 13, .55), rgba(3, 7, 13, .7)),
      image-set(url("/static/prijava-960.webp") type("image/webp"), url("/static/prijava.jpg") type("image/jpeg"));
    background-position: center, 28% 40%;
  }
}

/* ---------- vreme v Ljubljani (zgoraj desno) ---------- */
.weather {
  display: flex; align-items: center; gap: .6rem;
  padding: .35rem .8rem .35rem .55rem; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface);
}
.weather[hidden] { display: none; }
.w-icon { width: 34px; height: 34px; color: var(--brass); flex: none; display: grid; place-items: center; }
.w-icon svg { width: 100%; height: 100%; }
.w-text { display: grid; line-height: 1.2; }
.w-now { font-size: .9375rem; white-space: nowrap; }
.w-now b { font-stretch: 112%; font-weight: 750; font-size: 1.125rem; }
.w-meta { font-size: .78rem; white-space: nowrap; }
@media (max-width: 700px) {
  .top-tools { width: 100%; justify-content: space-between; }
  .weather { padding: .3rem .6rem .3rem .45rem; }
  .w-icon { width: 28px; height: 28px; }
}

/* vreme: čisto v zgornjem desnem kotu strani, brez kartice */
.weather {
  position: absolute; top: .9rem; right: 16px; z-index: 5;
  background: none; border: 0; border-radius: 0; padding: 0;
  text-align: right;
}
.weather .w-text { justify-items: end; }
@media (max-width: 700px) {
  .weather { top: 1.55rem; right: 12px; padding: 0; }
  .top { padding-left: 16px; padding-top: 4.6rem; }
}

/* stanje naprave: zelena / rdeča pika */
.device-line { margin: .45rem 0 0; display: flex; align-items: center; flex-wrap: wrap; gap: .1rem .4rem; color: var(--ink); }
.device-line b { font-weight: 650; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.dot.off { background: var(--out); box-shadow: 0 0 0 3px color-mix(in srgb, var(--out) 22%, transparent); }

/* ---------- prijava: ščit s ključavnico desno, obrazec levo (nadomešča prejšnjo sliko) ---------- */
body.auth-page {
  background-color: #070B1C;
  background-image:
    linear-gradient(90deg, rgba(4, 7, 20, .8) 0%, rgba(4, 7, 20, .25) 50%, rgba(4, 7, 20, 0) 75%),
    url("/static/prijava2.jpg");
  background-image:
    linear-gradient(90deg, rgba(4, 7, 20, .8) 0%, rgba(4, 7, 20, .25) 50%, rgba(4, 7, 20, 0) 75%),
    image-set(url("/static/prijava2.webp") type("image/webp"), url("/static/prijava2.jpg") type("image/jpeg"));
  background-size: cover, cover;
  background-position: center, 72% 40%;
  background-repeat: no-repeat;
}
@media (min-width: 900px) {
  body.auth-page .auth { align-items: flex-start; padding-right: 16px; padding-left: clamp(3rem, 9vw, 10rem); }
}
@media (max-width: 899px) {
  body.auth-page {
    background-image:
      linear-gradient(rgba(4, 7, 20, .55), rgba(4, 7, 20, .72)),
      url("/static/prijava2.jpg");
    background-image:
      linear-gradient(rgba(4, 7, 20, .55), rgba(4, 7, 20, .72)),
      image-set(url("/static/prijava2-960.webp") type("image/webp"), url("/static/prijava2.jpg") type("image/jpeg"));
    background-position: center, 75% 35%;
  }
}

/* naslov naprave in vrstica stanja pod njim */
.device-title { margin: .45rem 0 0; font-weight: 600; font-stretch: 105%; color: var(--ink); }
.device-line { display: block; margin: .2rem 0 0; }
.device-line .dot { vertical-align: middle; margin: 0 .2rem 2px 3px; }

/* meni: podatki o napravi in avtorja */
.devinfo { display: grid; grid-template-columns: auto 1fr; gap: .35rem .9rem; margin: 0; font-size: .875rem; }
.devinfo dt { color: var(--muted); white-space: nowrap; }
.devinfo dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.devinfo .dot { vertical-align: middle; margin: 0 .15rem 2px 2px; width: 9px; height: 9px; }
.credit p { margin: 0; font-size: .8125rem; color: var(--muted); }
.credit .credit-names { margin-top: .25rem; color: var(--ink); font-weight: 650; font-size: .9375rem; }

/* ---------- levi stolpec: profilna slika, ime, tri črtice ---------- */
:root { --rail: 76px; }
.rail { padding-top: 1.25rem; gap: .35rem; }
.avatar {
  width: 46px; height: 46px; border-radius: 50%; overflow: hidden; flex: none;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--brass) 22%, var(--surface));
  color: var(--ink); font-weight: 700; font-stretch: 110%; font-size: 1rem; letter-spacing: .02em;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.1rem; }
.avatar-btn {
  padding: 0; min-height: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; position: relative;
}
.avatar-btn:hover { filter: none; }
.avatar-btn:hover .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--brass); }
.avatar-btn.busy .avatar { opacity: .5; }
.rail-name {
  max-width: calc(var(--rail) - 8px); font-size: .75rem; font-weight: 600; color: var(--muted);
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: .6rem;
}
.rail-btn, .rail-btn:hover, .rail-btn[aria-expanded="true"] {
  background: none; border: 0; box-shadow: none; color: var(--ink); filter: none;
}
.rail-btn { opacity: .8; }
.rail-btn:hover, .rail-btn[aria-expanded="true"] { opacity: 1; }

.me { justify-content: flex-start; }
.me .me-name { flex: 1; min-width: 0; }
.me .me-name span { display: block; }

.toast {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: 10px; font-size: .9rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25); max-width: calc(100vw - 32px);
}

@media (max-width: 700px) {
  .rail {
    position: absolute; inset: auto; top: 1.1rem; left: 12px; width: auto;
    flex-direction: row; align-items: center; gap: .5rem; padding: 0; background: none; border: 0;
  }
  .avatar { width: 38px; height: 38px; font-size: .875rem; }
  .rail-name { margin: 0; max-width: 34vw; font-size: .875rem; color: var(--ink); }
  .rail-btn { background: none; border: 0; }
  .weather { top: 1.2rem; }
}

/* ---------- KLJUC-OBLIKA: prikaz kljuca v obliki kljuca (glava + brada) ---------- */
.slot { min-height: 0; --k-fill: var(--brass); --k-edge: var(--brass-edge); --k-dash: none; --k-sw: 1.5; }
.slot.out { --k-fill: color-mix(in srgb, var(--surface) 55%, transparent); --k-edge: color-mix(in srgb, var(--out) 75%, transparent); --k-dash: 5 4; --k-sw: 2; }
.slot.out.late { --k-fill: var(--out); --k-edge: var(--out); --k-dash: none; }
.slot.unknown { --k-fill: transparent; --k-edge: var(--line); --k-dash: 5 4; --k-sw: 2; }
.key {
  margin-top: 8px; width: 100%; max-width: 160px;
  display: flex; flex-direction: column; align-items: center;
  transform-origin: 50% -14px;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .18));
}
.slot.out .key, .slot.unknown .key { filter: none; }
/* glava kljuca */
.key .tag {
  margin-top: 0; width: 100%; max-width: none; min-height: 0; aspect-ratio: 1 / .94;
  border-radius: 44% 44% 40% 40% / 46% 46% 40% 40%;
  padding: 2.3rem .8rem 1.1rem; justify-content: center; gap: .3rem;
  position: relative; z-index: 1; transform-origin: 50% 0;
}
.key .tag::before { top: .75rem; width: 16px; height: 16px; }
.slot.in .key .tag { box-shadow: inset 0 0 0 5px color-mix(in srgb, var(--brass-edge) 35%, transparent); }
/* brada / steblo z zobci */
.blade { display: block; width: 56px; height: 128px; margin-top: -3px; overflow: visible; }
.blade-body { fill: var(--k-fill); stroke: var(--k-edge); stroke-width: var(--k-sw); stroke-dasharray: var(--k-dash); stroke-linejoin: round; }
.blade-groove { stroke: var(--k-edge); stroke-width: 2; stroke-linecap: round; opacity: .55; fill: none; }
.slot.out .blade-groove, .slot.unknown .blade-groove { opacity: 0; }
.slot.out.late .blade-groove { opacity: .5; stroke: #fff; }
/* animacija: cel kljuc zaniha ob vrnitvi */
.slot.in.just .tag { animation: none; }
.slot.in.just .key { animation: swing 1.1s cubic-bezier(.3,.6,.4,1); }
@media (prefers-reduced-motion: reduce) { .slot.just .key { animation: none !important; } }
@media (max-width: 700px) {
  .key { max-width: 150px; }
  .key .tag { min-height: 0; padding: 2rem .45rem .8rem; border-radius: 44% 44% 40% 40% / 46% 46% 40% 40%; }
  .blade { width: 46px; height: 104px; }
}
