/* ============================================================
   Imperial Auto · IT Helpdesk — vizuálna identita
   Grafit + imperiálna zlatá, mono „štítky“ ako evidenčné čísla
   ============================================================ */
:root {
  --ink:      #14161b;
  --ink-2:    #1b1e25;
  --ink-3:    #262a32;
  --gold:     #d8a33d;
  --gold-2:   #b9862a;
  --paper:    #eceef1;
  --card:     #ffffff;
  --line:     #e2e5ea;
  --line-2:   #d4d8df;
  --text:     #1c2027;
  --muted:    #6c7480;
  --muted-2:  #9aa1ab;

  --s-open:        #2563eb;
  --s-in_progress: #b7791f;
  --s-waiting:     #7c5cff;
  --s-resolved:    #159a48;
  --s-closed:      #6b7280;

  --p-urgent: #dc2626;
  --p-high:   #e07b17;
  --p-medium: #2563eb;
  --p-low:    #64748b;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20,22,27,.06), 0 6px 20px rgba(20,22,27,.06);
  --shadow-lg: 0 20px 60px rgba(20,22,27,.28);
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --display: 'Space Grotesk', var(--sans);
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  font-size: 14.5px;
  line-height: 1.5;
}
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------- generické prvky ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: 1px solid var(--line-2); background: var(--card); color: var(--text);
  padding: 9px 15px; border-radius: var(--radius-sm); font-weight: 600; font-size: 13.5px;
  transition: transform .12s ease, box-shadow .12s ease, background .15s ease, border-color .15s;
}
.btn:hover { border-color: var(--muted-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn-primary {
  background: var(--ink); border-color: var(--ink); color: #fff;
}
.btn-primary:hover { background: #000; border-color: #000; }
.btn-gold { background: var(--gold); border-color: var(--gold-2); color: #241a05; }
.btn-gold:hover { background: #e5b04a; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgba(20,22,27,.05); color: var(--text); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.input, .select, .textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); background: #fff; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(216,163,61,.18);
}
.textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--muted-2); margin-top: 5px; }

/* „Evidenčný štítok“ – podpisový prvok (číslo tiketu) */
.plate {
  font-family: var(--mono); font-weight: 600; font-size: 12px; letter-spacing: .04em;
  color: var(--ink); background: #f3f0e6; border: 1px solid #e2d6b4;
  padding: 2px 8px; border-radius: 5px; display: inline-block; white-space: nowrap;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.04);
}

/* odznaky stavu / priority / kategórie */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap; letter-spacing: .01em; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-status { color: #fff; }
.st-open        { background: var(--s-open); }
.st-in_progress { background: var(--s-in_progress); }
.st-waiting     { background: var(--s-waiting); }
.st-resolved    { background: var(--s-resolved); }
.st-closed      { background: var(--s-closed); }
.badge-prio { background: transparent; border: 1px solid currentColor; }
.pr-urgent { color: var(--p-urgent); }
.pr-high   { color: var(--p-high); }
.pr-medium { color: var(--p-medium); }
.pr-low    { color: var(--p-low); }
.badge-cat { background: rgba(20,22,27,.06); color: var(--muted); }

/* ============================================================
   PRIHLÁSENIE
   ============================================================ */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-brand {
  background: radial-gradient(120% 100% at 0% 0%, #23272f 0%, var(--ink) 55%);
  color: #fff; padding: 56px 60px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.auth-brand::after {
  content: ""; position: absolute; right: -120px; bottom: -140px; width: 420px; height: 420px;
  border-radius: 50%; background: radial-gradient(circle, rgba(216,163,61,.16), transparent 62%);
}
.auth-logo { display: flex; flex-direction: column; align-items: flex-start; gap: 11px; }
.auth-sub { font-family: var(--mono); font-size: 11px; letter-spacing: .28em; color: var(--muted-2); padding-left: 3px; }
.auth-hero { max-width: 420px; }
.auth-hero h1 { font-family: var(--display); font-weight: 600; font-size: 34px; line-height: 1.12; margin: 0 0 16px; }
.auth-hero p { color: #b7bcc5; font-size: 15px; line-height: 1.6; margin: 0; }
.auth-foot { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }

.auth-panel { display: grid; place-items: center; padding: 40px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-family: var(--display); font-size: 22px; margin: 0 0 4px; }
.auth-card .sub { color: var(--muted); margin: 0 0 26px; font-size: 14px; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 13.5px; color: var(--muted); }
.auth-switch button { background: none; border: none; color: var(--gold-2); font-weight: 600; padding: 0; }
.auth-demo { margin-top: 22px; border-top: 1px dashed var(--line-2); padding-top: 16px; font-size: 12.5px; color: var(--muted); }
.auth-demo b { color: var(--text); }
.auth-demo code { font-family: var(--mono); background: #f2f3f5; padding: 1px 6px; border-radius: 4px; font-size: 11.5px; }

.form-error { background: #fdecec; color: #b42318; border: 1px solid #f7c9c4; padding: 9px 12px;
  border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }

/* ============================================================
   APLIKAČNÝ RÁMEC
   ============================================================ */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }

.sidebar { background: var(--ink); color: #cfd3da; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; padding: 18px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.07); }
.side-sub { font-family: var(--mono); font-size: 9.5px; letter-spacing: .26em; color: var(--muted-2); padding-left: 2px; }

/* biela „placka“ pre logo – funguje na tmavom pozadí */
.logo-chip { background: #fff; border-radius: 10px; padding: 9px 13px; display: inline-flex; align-items: center; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.logo-chip img { display: block; height: 26px; width: auto; }
.logo-chip.lg { padding: 13px 18px; border-radius: 12px; }
.logo-chip.lg img { height: 40px; }

.nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); padding: 12px 12px 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 9px; color: #c3c8d0;
  font-weight: 500; font-size: 14px; border: none; background: none; width: 100%; text-align: left; transition: background .15s, color .15s; }
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active { background: rgba(216,163,61,.14); color: var(--gold); }
.nav-item .ico { width: 18px; height: 18px; flex: none; }
.nav-item .count { margin-left: auto; font-family: var(--mono); font-size: 11px; background: rgba(255,255,255,.08); color: #cfd3da; padding: 1px 7px; border-radius: 999px; }
.nav-item.active .count { background: rgba(216,163,61,.25); color: var(--gold); }

.side-user { margin-top: auto; padding: 14px; border-top: 1px solid rgba(255,255,255,.07); display: flex; align-items: center; gap: 11px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px;
  background: var(--ink-3); color: var(--gold); flex: none; }
.side-user .who { min-width: 0; }
.side-user .who .nm { color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .who .rl { font-size: 11px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .06em; }
.side-user .logout { margin-left: auto; background: none; border: none; color: var(--muted-2); padding: 6px; border-radius: 7px; }
.side-user .logout:hover { color: #fff; background: rgba(255,255,255,.06); }

/* hlavná plocha */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 20px 30px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.7); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-family: var(--display); font-size: 20px; margin: 0; font-weight: 600; }
.topbar .spacer { flex: 1; }
.content { padding: 26px 30px 60px; max-width: 1180px; width: 100%; }

/* karty štatistík */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat .k { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat .v { font-family: var(--display); font-size: 34px; font-weight: 700; margin-top: 8px; line-height: 1; }
.stat .rail { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.stat.acc-gold .rail { background: var(--gold); }
.stat.acc-blue .rail { background: var(--s-open); }
.stat.acc-amber .rail { background: var(--s-in_progress); }
.stat.acc-green .rail { background: var(--s-resolved); }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.panel-head { padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.panel-head h3 { margin: 0; font-family: var(--display); font-size: 15px; font-weight: 600; }
.panel-body { padding: 18px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* rozdelenie (bar) */
.dist { display: flex; flex-direction: column; gap: 12px; }
.dist-row { display: grid; grid-template-columns: 120px 1fr 34px; align-items: center; gap: 12px; font-size: 13px; }
.dist-row .lbl { color: var(--muted); font-weight: 500; }
.dist-row .track { height: 8px; background: #eef0f3; border-radius: 999px; overflow: hidden; }
.dist-row .fill { height: 100%; border-radius: 999px; }
.dist-row .num { font-family: var(--mono); font-size: 12.5px; text-align: right; color: var(--text); }

/* filtre */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.filters .search { position: relative; flex: 1; min-width: 220px; }
.filters .search .input { padding-left: 36px; }
.filters .search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted-2); }
.filters .select { width: auto; min-width: 130px; }

/* tabuľka tiketov */
.tickets { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.trow { display: grid; grid-template-columns: 96px 1fr 130px 120px 150px; gap: 14px; align-items: center; padding: 13px 18px; border-top: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.trow:first-child { border-top: none; }
.trow:hover { background: #f8f9fb; }
.trow .t-title { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .t-sub { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; align-items: center; }
.trow .t-assignee { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 7px; overflow: hidden; }
.thead { display: grid; grid-template-columns: 96px 1fr 130px 120px 150px; gap: 14px; padding: 11px 18px; background: #f6f7f9; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .big { font-family: var(--display); font-size: 17px; color: var(--text); margin-bottom: 6px; }

/* detail tiketu */
.detail-grid { display: grid; grid-template-columns: 1fr 300px; gap: 22px; align-items: start; }
.detail-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 6px; flex-wrap: wrap; }
.detail-head h1 { font-family: var(--display); font-size: 23px; font-weight: 600; margin: 0; flex: 1; min-width: 240px; }
.detail-desc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); white-space: pre-wrap; line-height: 1.6; margin: 16px 0 22px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item { display: flex; gap: 13px; padding-bottom: 18px; position: relative; }
.tl-item::before { content: ""; position: absolute; left: 16px; top: 34px; bottom: -4px; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; background: #eef0f3; color: var(--muted); z-index: 1; }
.tl-body { flex: 1; min-width: 0; }
.tl-meta { font-size: 12.5px; color: var(--muted); margin-bottom: 3px; }
.tl-meta b { color: var(--text); font-weight: 600; }
.comment { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; white-space: pre-wrap; line-height: 1.55; box-shadow: var(--shadow); }
.comment.internal { background: #fdf6e6; border-color: #efdca8; }
.comment.internal .tag { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; color: var(--gold-2); text-transform: uppercase; margin-bottom: 5px; }
.event-line { font-size: 13px; color: var(--muted); padding-top: 6px; }
.event-line b { color: var(--text); }

.reply { margin-top: 8px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.reply .row { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); user-select: none; }

.side-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 16px 18px; }
.side-card + .side-card { margin-top: 16px; }
.side-card h4 { font-family: var(--display); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 12px; }
.meta-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; font-size: 13.5px; border-top: 1px solid var(--line); }
.meta-row:first-of-type { border-top: none; }
.meta-row .lab { color: var(--muted); }

/* používatelia (admin) */
.utable { width: 100%; }
.urow { display: grid; grid-template-columns: 1fr 150px 120px 110px 84px; gap: 12px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); }
.urow:first-child { border-top: none; }
.uhead { display: grid; grid-template-columns: 1fr 150px 120px 110px 84px; gap: 12px; padding: 11px 18px; background: #f6f7f9; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.role-pill { font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; text-transform: capitalize; }
.role-admin { background: #efe6ff; color: #6b3fd4; }
.role-agent { background: #e6f0ff; color: #2258c9; }
.role-employee { background: #eef0f3; color: #5b6470; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(20,22,27,.55); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; z-index: 50; animation: fade .16s ease; }
.modal { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 540px; max-height: 90vh; overflow: auto; animation: pop .18s ease; }
.modal-head { padding: 20px 22px 6px; }
.modal-head h2 { font-family: var(--display); font-size: 20px; margin: 0; }
.modal-head p { color: var(--muted); margin: 6px 0 0; font-size: 13.5px; }
.modal-body { padding: 16px 22px; }
.modal-foot { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 10px; }

/* toasty */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13.5px; display: flex; align-items: center; gap: 10px; animation: slide .2s ease; max-width: 340px; }
.toast.err { background: #b42318; }
.toast.ok { border-left: 3px solid var(--gold); }

/* pomocné */
.row-flex { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes slide { from { opacity: 0; transform: translateX(14px); } }
.view-enter { animation: fade .18s ease; }

/* prílohy */
.attach-head { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; }
.attach-head h3 { margin: 0; font-family: var(--display); font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.attach-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 24px; }
.attach-card { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; box-shadow: var(--shadow); }
.attach-thumb { width: 46px; height: 46px; border-radius: 7px; flex: none; overflow: hidden; background: #f1f3f5; display: grid; place-items: center; color: var(--muted-2); }
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-thumb .thumb-load { display: grid; place-items: center; }
.attach-info { min-width: 0; flex: 1; }
.attach-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.attach-actions { display: flex; gap: 4px; flex: none; }
.icon-btn { border: none; background: none; color: var(--muted); padding: 6px; border-radius: 7px; display: grid; place-items: center; transition: background .15s, color .15s; }
.icon-btn:hover { background: rgba(20,22,27,.06); color: var(--text); }
.icon-btn.danger:hover { background: #fdecec; color: var(--p-urgent); }

/* prepínacie riadky v nastaveniach */
.switch-row { display: flex; align-items: flex-start; gap: 11px; font-size: 13.5px; line-height: 1.45; cursor: pointer; }
.switch-row input { margin-top: 3px; flex: none; width: 16px; height: 16px; accent-color: var(--gold-2); }

/* zálohovanie */
.backup-sched { border: 1px dashed var(--line-2); border-radius: var(--radius-sm); padding: 16px; }
.sched-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.backup-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); margin-bottom: 8px; }
.backup-ico { width: 36px; height: 36px; border-radius: 8px; background: #f1f3f5; color: var(--muted); display: grid; place-items: center; flex: none; }
.backup-info { min-width: 0; flex: 1; }
.backup-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.backup-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
@media (max-width: 720px) { .sched-grid { grid-template-columns: 1fr 1fr; } }

@media (max-width: 640px) { .attach-grid { grid-template-columns: 1fr; } }

/* responzívne */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; width: 250px; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 39; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col, .detail-grid { grid-template-columns: 1fr; }
  .thead, .trow { grid-template-columns: 80px 1fr 110px; }
  .trow .t-prio-col, .thead .h-prio, .trow .t-assignee, .thead .h-assignee { display: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .menu-btn { display: inline-flex !important; }
}
.menu-btn { display: none; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
