:root {
  color-scheme: light;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --danger: #c0392b;
  --border: #d2d2d7;
  --ink: #1d1d1f;
  --ink-soft: #424245;
  --paper: #f5f5f7;
  --panel: #ffffff;
  --line: #d2d2d7;
  --line-strong: #c7c7cc;
  --muted: #6e6e73;
  /* Apple system blue, to match nicsfix.com */
  --brand: #0071e3;
  --brand-ink: #0066cc;
  --accent: #0071e3;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 980px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.05);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, "Cascadia Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-size: 15px;
  line-height: 1.5;
}

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

/* ---------- Apple-style translucent sticky top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(29,29,31,.72);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
/* Opaque fallback where backdrop-filter isn't supported. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar { background: #1d1d1f; }
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto; height: 48px;
  display: flex; align-items: center; gap: 16px;
  padding: 0 22px;
}
.tb-brand { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; text-decoration: none; }
.tb-brand:hover { text-decoration: none; }
.tb-mark {
  width: 24px; height: 24px; border-radius: 6px; background: var(--brand);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px;
}
.tb-name { color: #f5f5f7; font-weight: 600; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; }
.tb-logo { width: 24px; height: 24px; border-radius: 6px; object-fit: contain; display: block; }

.tb-nav {
  display: flex; align-items: center; gap: 2px;
  flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none;
}
.tb-nav::-webkit-scrollbar { display: none; }
.tb-nav a {
  color: rgba(245,245,247,.82); text-decoration: none; white-space: nowrap;
  font-size: 13px; font-weight: 450; line-height: 1;
  padding: 7px 11px; border-radius: 8px;
}
.tb-nav a:hover { color: #fff; background: rgba(255,255,255,.09); text-decoration: none; }
.tb-nav a.active { color: #fff; background: rgba(255,255,255,.15); }

.tb-right { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.tb-right form { margin: 0; }
.tb-burger { display: none; background: none; border: 0; cursor: pointer; padding: 6px; color: #f5f5f7; align-items: center; }
.tb-user { color: rgba(245,245,247,.55); font-size: 12px; white-space: nowrap; }
.tb-signout {
  background: none; border: 0; color: rgba(245,245,247,.82); cursor: pointer;
  font: inherit; font-size: 13px; padding: 6px 9px; border-radius: 8px;
}
.tb-signout:hover { color: #fff; background: rgba(255,255,255,.09); }

.main { max-width: 1120px; margin: 0 auto; padding: 26px 24px 70px; }

/* ---------- Headings ---------- */
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.pagehead h1 { margin: 0; font-size: 25px; font-weight: 650; letter-spacing: -.022em; }
.pagehead p { margin: 4px 0 0; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--brand); color: #fff;
  border: 0; border-radius: var(--radius-pill);
  padding: 9px 17px; font: inherit; font-weight: 590; font-size: 14px;
  cursor: pointer; text-decoration: none;
  transition: background .18s ease, opacity .18s ease;
}
.btn:hover { background: var(--brand-ink); text-decoration: none; }
.btn.ghost { background: var(--panel); color: var(--ink); border: 1px solid var(--line-strong); }
.btn.ghost:hover { background: #f5f5f7; }
.btn.danger { background: #d23f3f; }
.btn.danger:hover { background: #bb3535; }
.btn.sm { padding: 6px 13px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Cards / panels ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.panel.pad { padding: 20px 22px; }
.panel h2 { margin: 0 0 14px; font-size: 15px; letter-spacing: -.01em; }
.grid2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; align-items: start; }

/* ---------- Stat strip ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .n { font-size: 28px; font-weight: 680; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 13px; }

/* ---------- Tables ---------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar input[type=search], .toolbar select { height: 38px; }
.toolbar .grow { flex: 1; min-width: 160px; }

table.tickets { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.tickets th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 11px 16px; border-bottom: 1px solid var(--line); font-weight: 600; }
table.tickets td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tickets tr:last-child td { border-bottom: 0; }
table.tickets tbody tr:hover { background: #f5f5f7; cursor: pointer; }
.rnum { font-family: var(--mono); font-weight: 600; font-size: 13px; color: var(--ink); }
.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }

/* ---------- Status pills (indicator lights) ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 560; padding: 4px 10px 4px 8px;
  border-radius: 999px; border: 1px solid var(--line-strong); white-space: nowrap;
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.pill.slate { background:#f1f2f3; color:#444a52; border-color:#dfe1e4; }
.pill.slate .dot { background:#838a93; }
.pill.blue  { background:#eef3fe; color:#1c46b8; border-color:#d6e2fb; }
.pill.blue .dot { background:#2d6cdf; }
.pill.amber { background:#fdf3e3; color:#8a5a10; border-color:#f3e0bd; }
.pill.amber .dot { background:#d9920f; }
.pill.green { background:#e9f7ee; color:#15703f; border-color:#cdebd8; }
.pill.green .dot { background:#1f9d57; }
.pill.red   { background:#fdecec; color:#a82a2a; border-color:#f5d2d2; }
.pill.red .dot { background:#d23f3f; }
.pill.purple { background:#f3eefe; color:#5a2da8; border-color:#e2d6fb; }
.pill.purple .dot { background:#8b5cf6; }

/* ---------- Forms ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field .lab { display: block; font-size: 13px; font-weight: 560; margin-bottom: 5px; color: var(--ink-soft); }
input[type=text], input[type=password], input[type=email], input[type=tel],
input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; font: inherit;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 4px solid rgba(0,113,227,.28); outline-offset: 0; border-color: var(--brand); }
textarea { resize: vertical; min-height: 80px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.help { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* ---------- Flash ---------- */
.flash { padding: 11px 15px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; border: 1px solid; }
.flash.ok { background:#e9f7ee; border-color:#cdebd8; color:#15703f; }
.flash.error { background:#fdecec; border-color:#f5d2d2; color:#a82a2a; }

/* ---------- Repair detail ---------- */
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--line); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content:""; position:absolute; left:-6px; top:3px; width:10px; height:10px; border-radius:50%; background:var(--brand); box-shadow:0 0 0 3px var(--panel); }
.timeline .when { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline .what { font-size: 14px; }
.timeline .chan { font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); }

.qrwrap { text-align: center; }
.qrwrap img.qr { width: 168px; height: 168px; image-rendering: pixelated; border: 1px solid var(--line); border-radius: 8px; background:#fff; }
.qrwrap img.bar { max-width: 100%; margin-top: 10px; }

/* ---------- Public portal ---------- */
.portal { max-width: 560px; margin: 0 auto; padding: 40px 20px 60px; }
.portal-head { text-align: center; margin-bottom: 26px; }
.portal-head .mark { width: 46px; height: 46px; border-radius: 12px; background: var(--brand); color:#fff; display:inline-grid; place-items:center; font-weight:700; font-size:20px; margin-bottom:12px; }
.portal-head h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.portal-head p { margin: 6px 0 0; color: var(--muted); }
.portal .panel.pad { padding: 26px; }
.portal .alt { text-align: center; margin-top: 18px; font-size: 14px; }

.status-hero { text-align: center; padding: 8px 0 18px; }
.status-hero .num { font-family: var(--mono); font-size: 14px; color: var(--muted); letter-spacing: .02em; }
.status-hero .pill { font-size: 15px; padding: 7px 16px 7px 12px; margin-top: 10px; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 360px; }

/* ---------- Banner ---------- */
.banner { display:flex; gap:10px; align-items:flex-start; padding:11px 14px; border-radius:var(--radius-sm); font-size:13.5px; margin-bottom:16px; }
.banner.warn { background:#fdf3e3; border:1px solid #f3e0bd; color:#8a5a10; }

@media (max-width: 820px) {
  .topbar-inner { gap: 10px; padding: 0 14px; }
  .tb-name { display: none; }
  .tb-user { display: none; }
  .tb-burger { display: inline-flex; }
  /* Collapse the nav into a dropdown panel toggled by the hamburger. */
  .tb-nav {
    position: absolute; top: 48px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: #1d1d1f; border-bottom: 1px solid rgba(255,255,255,.12);
    padding: 8px 14px 12px; overflow: visible; display: none;
    box-shadow: 0 12px 24px rgba(0,0,0,.28);
  }
  .topbar.nav-open .tb-nav { display: flex; }
  .tb-nav a { padding: 11px 12px; font-size: 15px; border-radius: 10px; }
  .main { padding: 20px 16px 50px; }
  .grid2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .stat .n { font-size: 22px; }
  .row { grid-template-columns: 1fr; }
  table.tickets .hide-sm { display: none; }
}

/* Issue / association checkbox grids (Devices, new repair, request form) */
.checks { display:flex; flex-wrap:wrap; gap:8px; margin:6px 0 4px; }
.check {
  display:inline-flex; align-items:center; gap:7px;
  background: var(--surface-2, #f5f5f7);
  border: 1px solid var(--border, #e3e3e8);
  border-radius: 10px; padding: 8px 12px; font-size: 14px; cursor: pointer;
  line-height: 1.2;
}
.check:hover { border-color: var(--accent, #2f6fed); }
.check input { width:auto; margin:0; }
.btn.danger.sm { background:#d23f3f; }

/* ---------- Theme toggle ---------- */
.i-dark { display: none; }
[data-theme="dark"] .i-light { display: none; }
[data-theme="dark"] .i-dark { display: inline; }

.theme-toggle {
  display: inline-grid; place-items: center; width: 32px; height: 32px;
  background: none; border: 0; border-radius: 999px; cursor: pointer;
  color: rgba(245,245,247,.82);
}
.theme-toggle:hover { color: #fff; background: rgba(255,255,255,.1); }
.theme-toggle svg { display: block; }

.theme-fab {
  position: fixed; top: 14px; right: 16px; z-index: 1200;
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
  color: var(--ink); cursor: pointer;
}
.theme-fab:hover { background: var(--surface-2); }
.theme-fab svg { display: block; }

/* ---------- Dark theme (Apple-style) ---------- */
[data-theme="dark"] {
  color-scheme: dark;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --panel: #1c1c1e;
  --paper: #000000;
  --ink: #f5f5f7;
  --ink-soft: #d1d1d6;
  --muted: #98989f;
  --border: #3a3a3c;
  --line: #3a3a3c;
  --line-strong: #48484a;
  --brand: #0a84ff;
  --brand-ink: #409cff;
  --accent: #0a84ff;
  --shadow: 0 1px 2px rgba(0,0,0,.5), 0 8px 24px rgba(0,0,0,.55);
}
[data-theme="dark"] input[type=text],
[data-theme="dark"] input[type=password],
[data-theme="dark"] input[type=email],
[data-theme="dark"] input[type=tel],
[data-theme="dark"] input[type=search],
[data-theme="dark"] input[type=number],
[data-theme="dark"] select,
[data-theme="dark"] textarea { background: #1c1c1e; color: var(--ink); }
[data-theme="dark"] .btn.ghost:hover { background: #2c2c2e; }
[data-theme="dark"] table.tickets tbody tr:hover { background: #2c2c2e; }
[data-theme="dark"] .media-thumb { background: #2c2c2e; }

/* ---------- Easter egg: "Liquid Glass" top bar (type shutupstefan) ---------- */
.topbar.liquid-glass {
  margin: 10px 16px 0;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.28);
  overflow: hidden;
  /* Mostly clear so the page shows through - the frost comes from backdrop-filter, not a white fill. */
  background: linear-gradient(120deg,
    rgba(255,255,255,.07), rgba(170,205,255,.05) 28%,
    rgba(255,255,255,.02) 50%, rgba(255,180,235,.05) 72%, rgba(255,255,255,.07));
  background-size: 220% 100%;
  -webkit-backdrop-filter: blur(20px) saturate(180%) brightness(1.04);
  backdrop-filter: blur(20px) saturate(180%) brightness(1.04);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.45),
    inset 0 -1px 0 rgba(255,255,255,.08),
    0 8px 28px rgba(0,0,0,.18);
  animation: lg-flow 9s ease-in-out infinite;
  transition: margin .35s ease, border-radius .35s ease;
}
/* Moving specular sheen sweeping across the glass. */
.topbar.liquid-glass::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: linear-gradient(115deg, transparent 34%, rgba(255,255,255,.30) 48%, transparent 60%);
  transform: translateX(-120%);
  animation: lg-sheen 5.5s ease-in-out infinite;
}
/* Subtle refractive highlight along the top edge. */
.topbar.liquid-glass::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 45%; pointer-events: none; z-index: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,.16), rgba(255,255,255,0));
}
.topbar.liquid-glass .topbar-inner { position: relative; z-index: 1; }
.topbar.liquid-glass .tb-name,
.topbar.liquid-glass .tb-nav a,
.topbar.liquid-glass .tb-signout,
.topbar.liquid-glass .tb-user,
.topbar.liquid-glass .theme-toggle { color: #000; text-shadow: 0 1px 1px rgba(255,255,255,.5); }
.topbar.liquid-glass .tb-nav a:hover,
.topbar.liquid-glass .tb-signout:hover,
.topbar.liquid-glass .theme-toggle:hover {
  background: rgba(255,255,255,.20);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55);
}
.topbar.liquid-glass .tb-nav a.active {
  background: rgba(255,255,255,.28);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 1px 3px rgba(0,0,0,.12);
}
.topbar.liquid-glass .tb-mark {
  background: rgba(255,255,255,.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), inset 0 -1px 3px rgba(0,0,0,.15);
}

/* Stream-preference panel has a light-pink background in light mode, so its text stays dark. */
.stream-panel, .stream-panel summary, .stream-panel .check { color: #2a2118; }
.stream-panel .lab { color: #5a4a42; }
.stream-panel .muted { color: #8a6f6f; }
/* In dark mode, darken the panel so the radio-button text (and the rest) can go white and
   stay readable instead of washing out on the pink. */
[data-theme="dark"] .stream-panel { background: #3a2326 !important; }
[data-theme="dark"] .stream-panel,
[data-theme="dark"] .stream-panel summary,
[data-theme="dark"] .stream-panel .check { color: #f5f5f7; }
[data-theme="dark"] .stream-panel .lab { color: #e6c2c2; }
[data-theme="dark"] .stream-panel .muted { color: #cb9b9b; }

@keyframes lg-flow {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes lg-sheen {
  0%   { transform: translateX(-120%); }
  55%  { transform: translateX(120%); }
  100% { transform: translateX(120%); }
}
@media (prefers-reduced-motion: reduce) {
  .topbar.liquid-glass { animation: none; }
  .topbar.liquid-glass::before { animation: none; opacity: 0; }
}
