:root {
  --navy: #071a2c;
  --navy-2: #0e2b42;
  --ink: #102638;
  --muted: #657987;
  --bg: #eaf1f4;
  --card: #ffffff;
  --line: #d6e1e6;
  --cyan: #20b8c5;
  --blue: #4a8df6;
  --green: #39b978;
  --amber: #e7a33e;
  --red: #dd5b68;
  --purple: #8b6dde;
  --shadow: 0 14px 36px rgba(11, 37, 55, 0.09);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--ink);
  background:
    radial-gradient(circle at 10% -15%, rgba(32, 184, 197, .17), transparent 34rem),
    linear-gradient(180deg, #eff5f7, var(--bg));
  font: 500 15px/1.45 Inter, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  color: #fff;
  background: var(--navy);
  font-weight: 800;
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }
:where(a, button, input, select, textarea):focus-visible {
  outline: 4px solid #ffbf47;
  outline-offset: 3px;
}

.brand-logo.icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 64px;
  height: 64px;
  padding: 6px;
  border: 1px solid rgba(74,141,246,.18);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(33,124,188,.2);
}
.brand-logo.icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.brand-logo.full {
  display: block;
  width: min(340px, 100%);
  height: auto;
  margin: 0 auto;
}
.eyebrow {
  color: var(--cyan);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.muted { color: var(--muted); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 15px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #fff;
  background: var(--navy);
  font-weight: 850;
}
.button:hover { filter: brightness(1.07); }
.button.primary { color: #062a2d; background: var(--cyan); }
.button.secondary { color: var(--ink); background: #f2f7f8; border-color: var(--line); }
.button.danger { background: var(--red); }
.button:disabled { opacity: .55; cursor: wait; }
.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #f5f8f9;
  font-size: 20px;
}

.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  color: var(--ink);
  background: #fff;
}
.input, .select { height: 44px; padding: 0 12px; }
.textarea { min-height: 100px; padding: 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(32, 184, 197, .13);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 24px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: 12px;
  color: #fff;
  background: var(--navy);
  box-shadow: var(--shadow);
  transform: translate(-50%, 130px);
  transition: transform .2s ease;
}
.toast.show { transform: translate(-50%, 0); }
.toast.error { background: #9f3340; }

/* Admin */
.signin {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 28% 12%, rgba(32,184,197,.22), transparent 32rem),
    var(--navy);
}
.signin-card {
  width: min(460px, 100%);
  padding: 38px;
  border-radius: 26px;
  text-align: center;
  background: #fff;
  box-shadow: 0 35px 90px rgba(0,0,0,.3);
}
.signin-card .brand-logo.full { width: min(300px, 100%); }
.kiosk-intro .brand-logo.full { width: min(420px, 100%); margin: 0; }
.signin-card h1 { margin: 20px 0 8px; font-size: 31px; letter-spacing: -.04em; }
.signin-card p { margin: 0 0 24px; color: var(--muted); }
.signin-card .button { width: 100%; }
.signin-note { margin-top: 15px !important; font-size: 12px; }

.app-header {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px clamp(16px, 3vw, 42px);
  color: #fff;
  background: rgba(7, 26, 44, .97);
  box-shadow: 0 9px 28px rgba(7, 26, 44, .2);
}
.app-brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
.app-brand h1 { margin: 3px 0 0; font-size: clamp(20px, 2.3vw, 29px); line-height: 1; letter-spacing: -.04em; }
.account { display: flex; align-items: center; gap: 10px; }
.account-copy { text-align: right; }
.account-copy strong, .account-copy small { display: block; }
.account-copy small { color: #a9bbc7; }
.app-header .button.secondary {
  color: #fff;
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.15);
}
.admin-main { padding: 24px clamp(16px, 3vw, 42px) 56px; }
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.page-heading h2 { margin: 0; font-size: 26px; letter-spacing: -.04em; }
.page-heading p { margin: 4px 0 0; color: var(--muted); }
.live { display: flex; align-items: center; gap: 8px; color: #23734e; font-size: 12px; font-weight: 850; }
.live::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(57,185,120,.13); }

.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 12px; margin-bottom: 15px; }
.kpi {
  padding: 16px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--tone, var(--cyan));
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}
.kpi span { color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.kpi strong { display: block; margin-top: 6px; font-size: 32px; line-height: 1; letter-spacing: -.05em; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 13px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
}
.filters { display: flex; flex: 1; gap: 9px; }
.filters .input { max-width: 400px; }
.filters .select { width: auto; min-width: 160px; }
.ticket-list { display: grid; gap: 10px; }
.ticket-row {
  display: grid;
  grid-template-columns: 125px minmax(170px, 1.1fr) minmax(230px, 1.5fr) 150px 135px 125px 44px;
  align-items: center;
  gap: 14px;
  padding: 15px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--tone, var(--cyan));
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(14,43,66,.055);
}
.ticket-number { color: var(--muted); font-size: 12px; font-weight: 900; letter-spacing: .04em; }
.ticket-title { font-size: 17px; font-weight: 850; letter-spacing: -.025em; }
.ticket-sub { margin-top: 3px; color: var(--muted); font-size: 12px; }
.ticket-issue { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cell-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; color: var(--tone); background: color-mix(in srgb, var(--tone) 13%, white); font-size: 11px; font-weight: 900; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tone); }
.empty { padding: 52px 20px; border: 1px dashed #b9c9d1; border-radius: 16px; color: var(--muted); text-align: center; }

.backdrop {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  background: rgba(4, 16, 26, .64);
  backdrop-filter: blur(5px);
}
.drawer {
  width: min(650px, 100%);
  height: 100%;
  overflow: auto;
  padding: 24px;
  background: #fff;
  box-shadow: -25px 0 70px rgba(0,0,0,.27);
}
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.drawer-head h2 { margin: 4px 0 0; font-size: 28px; letter-spacing: -.04em; }
.drawer-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin: 22px -24px -24px;
  padding: 15px 24px;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.97);
}
.activity-list { display: grid; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.activity-item { padding: 10px 12px; border-radius: 11px; background: #f3f7f8; font-size: 12px; }
.activity-item strong { display: block; }

/* TV board */
.tv-board {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: clamp(9px, .8vw, 16px);
  width: 100%;
  height: 100vh;
  overflow: hidden;
  padding: clamp(16px, 1.5vw, 30px) clamp(18px, 2vw, 42px) clamp(12px, 1vw, 20px);
}
.tv-topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 65px; }
.tv-brand { display: flex; align-items: center; gap: clamp(12px, 1vw, 18px); }
.tv-brand h1 { margin: 3px 0 0; font-size: clamp(23px, 1.8vw, 36px); line-height: 1; letter-spacing: -.045em; }
.tv-meta { display: flex; align-items: center; gap: 14px; }
.connection, .fullscreen {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #246b50;
  background: #e4f5eb;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.connection.error { color: #a45e14; background: #fff0d7; }
.fullscreen { color: var(--ink); background: #fff; }
.clock { min-width: 150px; text-align: right; }
.clock strong { display: block; font-size: clamp(27px, 2vw, 40px); line-height: 1; letter-spacing: -.055em; }
.clock small { color: var(--muted); font-size: 11px; font-weight: 700; }
.tv-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(7px, .7vw, 14px); }
.tv-kpis .kpi { min-height: clamp(75px, 5.5vw, 105px); }
.tv-kpis .kpi strong { font-size: clamp(30px, 2.6vw, 50px); }
.alerts { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(7px, .7vw, 14px); }
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: clamp(48px, 3.7vw, 70px);
  padding: 9px 13px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 12px;
}
.alert b { font-size: 14px; }
.alert.good { color: #267c50; background: #e3f4e9; border-color: #cce8d7; }
.alert.warning { color: #955a13; background: #fff0d7; border-color: #f1d8ae; }
.alert.info { color: #275e9c; background: #e5eefb; border-color: #cedcf0; }
.pipeline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(8px, .8vw, 16px); min-height: 0; }
.lane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  padding: clamp(9px, .75vw, 15px);
  border: 1px solid rgba(202,216,223,.9);
  border-radius: 16px;
  background: rgba(244,248,249,.83);
}
.lane-head { display: flex; align-items: center; justify-content: space-between; min-height: 40px; padding: 0 2px 9px; border-bottom: 2px solid var(--tone); }
.lane-head span { color: var(--tone); font-size: 9px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.lane-head h2 { margin: 1px 0 0; font-size: clamp(14px, 1vw, 20px); letter-spacing: -.02em; }
.lane-head b { display: grid; min-width: 27px; height: 24px; place-items: center; padding: 0 7px; border-radius: 99px; color: var(--tone); background: #fff; }
.lane-cards { display: grid; grid-template-rows: repeat(3, minmax(0, 1fr)); gap: clamp(7px, .58vw, 11px); min-height: 0; padding-top: clamp(8px, .7vw, 13px); }
.tv-ticket {
  min-height: 0;
  overflow: hidden;
  padding: clamp(9px, .72vw, 14px);
  border: 1px solid #d8e2e7;
  border-left: 4px solid var(--tone);
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(22,51,65,.055);
}
.tv-ticket.overdue { border-color: #efb5b7; border-left-color: var(--red); background: #fffafa; }
.tv-ticket-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tv-ticket-top > span { color: #687f8b; font-size: 10px; font-weight: 900; }
.priority { padding: 3px 7px; border-radius: 5px; color: #637985; background: #e9eef1; font-size: 8px; font-weight: 950; letter-spacing: .07em; text-transform: uppercase; }
.priority.High { color: #a45b0d; background: #fff0d7; }
.priority.Critical { color: #b52f37; background: #fde0e1; }
.priority.Low { color: #397a61; background: #e5f4eb; }
.tv-ticket h3 { margin: 6px 0 0; overflow: hidden; font-size: clamp(14px, 1.05vw, 20px); line-height: 1.08; letter-spacing: -.03em; text-overflow: ellipsis; white-space: nowrap; }
.tv-ticket .asset, .tv-ticket .issue { overflow: hidden; color: #58707d; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.tv-ticket .issue { margin: 6px 0; color: #71848e; }
.tv-ticket-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tech-pill { display: flex; align-items: center; gap: 7px; min-width: 0; }
.avatar { display: grid; flex: none; width: 25px; height: 25px; place-items: center; border-radius: 50%; color: #176a7c; background: #dff0f3; font-size: 8px; font-weight: 900; }
.tv-ticket-meta small { display: block; color: #899aa3; font-size: 7px; font-weight: 800; text-transform: uppercase; }
.tv-ticket-meta b { display: block; overflow: hidden; max-width: 130px; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.due { text-align: right; }
.lane-empty { grid-row: 1 / -1; display: grid; place-items: center; align-content: center; color: #8ca0aa; border: 1px dashed #cbd8de; border-radius: 11px; font-size: 11px; }
.tv-footer { display: flex; align-items: center; justify-content: space-between; color: #71858f; font-size: 10px; }
.tv-footer strong { color: #267d50; }

/* Kiosk */
.kiosk-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(280px, .8fr) minmax(520px, 1.2fr);
  background: #f4f8f9;
}
.kiosk-intro {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(30px, 5vw, 70px);
  color: #fff;
  background:
    radial-gradient(circle at 20% 10%, rgba(32,184,197,.3), transparent 27rem),
    linear-gradient(145deg, var(--navy), #102f49);
}
.kiosk-intro h1 { max-width: 560px; margin: 24px 0 14px; font-size: clamp(42px, 5vw, 76px); line-height: .95; letter-spacing: -.065em; }
.kiosk-intro p { max-width: 520px; color: #c1d1da; font-size: clamp(16px, 1.4vw, 22px); }
.kiosk-steps { display: grid; gap: 12px; margin-top: 30px; }
.kiosk-steps div { display: flex; align-items: center; gap: 12px; color: #e7f0f4; font-size: 16px; }
.step-number { display: grid; flex: 0 0 36px; width: 36px; height: 36px; place-items: center; border-radius: 50%; color: var(--navy); background: #6ee7ef; font-weight: 900; }
.privacy-note { margin: 32px 0 0; color: #d6e3e9 !important; font-size: 16px !important; }
.kiosk-form-wrap { display: grid; place-items: center; padding: clamp(24px, 4vw, 64px); }
.kiosk-card { width: min(760px, 100%); padding: clamp(25px, 3vw, 44px); border: 1px solid var(--line); border-radius: 24px; background: #fff; box-shadow: var(--shadow); }
.kiosk-card h2 { margin: 0; font-size: 32px; line-height: 1.2; letter-spacing: -.035em; }
.kiosk-card #formView > p { margin: 10px 0 24px; color: #465d6b; font-size: 16px; }
.kiosk-page .form-grid { gap: 22px 18px; }
.kiosk-page .field { align-content: start; gap: 8px; }
.kiosk-page .field label { color: #243e50; font-size: 16px; line-height: 1.3; letter-spacing: 0; text-transform: none; }
.kiosk-page .input,
.kiosk-page .select { min-height: 56px; height: auto; padding: 12px 14px; font-size: 18px; }
.kiosk-page .textarea { min-height: 132px; padding: 14px; font-size: 18px; }
.kiosk-page .input::placeholder,
.kiosk-page .textarea::placeholder { color: #627682; opacity: 1; }
.kiosk-page [aria-invalid="true"] { border: 3px solid #b42318; }
.field-hint { color: #4d6370; font-size: 14px; }
.field-error { min-height: 0; color: #a51d15; font-size: 15px; font-weight: 800; }
.field-error:empty { display: none; }
.error-summary { margin: 0 0 24px; padding: 18px 20px; border: 3px solid #b42318; border-radius: 12px; color: #68130e; background: #fff3f2; }
.error-summary h3 { margin: 0 0 8px; font-size: 20px; }
.error-summary ul { margin: 0; padding-left: 22px; }
.error-summary a { text-decoration: underline; text-underline-offset: 3px; }
.kiosk-page .button { min-height: 56px; padding: 13px 18px; font-size: 18px; }
.kiosk-page #submitBtn { width: 100%; }
.success { padding: 36px 12px; text-align: center; }
.success-icon { display: grid; width: 72px; height: 72px; margin: 0 auto 18px; place-items: center; border-radius: 50%; color: #fff; background: var(--green); font-size: 36px; }
.success h2 { font-size: 35px; }
.success .ticket-ref { display: inline-block; margin: 14px 0 22px; padding: 9px 14px; border-radius: 10px; color: #246b50; background: #e4f5eb; font-weight: 900; }

@media (max-width: 1120px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .ticket-row { grid-template-columns: 110px 1fr 1.4fr 135px 110px 44px; }
  .ticket-row .assigned { display: none; }
  .tv-board { height: auto; min-height: 100vh; overflow: visible; }
  .tv-kpis { grid-template-columns: repeat(3, 1fr); }
  .pipeline { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .lane { min-height: 500px; }
  .kiosk-shell { grid-template-columns: 1fr; }
  .kiosk-intro { min-height: 370px; }
}

@media (max-width: 720px) {
  .app-header { position: static; align-items: flex-start; }
  .app-header .brand-logo.icon { width: 48px; height: 48px; border-radius: 12px; }
  .account-copy, .tv-link { display: none; }
  .admin-main { padding-top: 17px; }
  .page-heading { align-items: flex-start; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .toolbar { align-items: stretch; }
  .filters { display: grid; grid-template-columns: 1fr 1fr; }
  .filters .input { grid-column: 1 / -1; max-width: none; }
  .filters .select { width: 100%; min-width: 0; }
  .ticket-row { grid-template-columns: 1fr auto; gap: 9px; }
  .ticket-row > div { grid-column: 1; }
  .ticket-row .status-cell { grid-column: 2; grid-row: 2; }
  .ticket-row .due-cell { grid-column: 2; grid-row: 3; }
  .ticket-row .assigned { display: block; }
  .ticket-row .edit-ticket { grid-column: 2; grid-row: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .tv-meta .fullscreen, .clock small { display: none; }
  .clock { min-width: 84px; }
  .alerts { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: 1fr; }
  .lane { min-height: 500px; }
  .kiosk-intro { min-height: 320px; padding: 28px; }
  .kiosk-intro h1 { font-size: 48px; }
  .kiosk-form-wrap { padding: 16px; }
  .kiosk-card { padding: 22px; border-radius: 18px; }
}

@media (max-width: 400px) {
  .kiosk-intro { min-height: auto; padding: 24px 18px; }
  .kiosk-intro h1 { margin-top: 20px; font-size: 40px; }
  .kiosk-form-wrap { padding: 12px; }
  .kiosk-card { padding: 20px 16px; border-radius: 14px; }
  .kiosk-card h2 { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (forced-colors: active) {
  .button, .input, .select, .textarea, .error-summary, .kiosk-card { border: 2px solid CanvasText; }
  .step-number, .success-icon { border: 2px solid CanvasText; }
}
