:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #fff7f7;
  --surface-3: #fff1f1;
  --ink: #17191f;
  --muted: #5f6674;
  --line: #e2e8f0;
  --primary: #b91c1c;
  --primary-strong: #7f1016;
  --primary-soft: #fee2e2;
  --accent: #f59e0b;
  --accent-soft: #fff7dd;
  --danger: #b42318;
  --danger-soft: #ffe1e4;
  --ok: #18885f;
  --ok-soft: #ddf6e8;
  --info: #315ab8;
  --info-soft: #e7edff;
  --sidebar-bg: #8f1018;
  --sidebar-bg-2: #56070d;
  --sidebar-text: #ffffff;
  --sidebar-muted: #ffdfe2;
  --nav-hover: rgba(255, 255, 255, 0.14);
  --input-bg: #ffffff;
  --table-head: #fdf2f2;
  --auth-left: rgba(148, 21, 29, 0.96);
  --auth-right: rgba(23, 25, 31, 0.92);
  --auth-panel-bg: rgba(250, 251, 252, 0.96);
  --shadow: 0 16px 36px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 10px 22px rgba(15, 23, 42, 0.05);
  --shadow-strong: 0 22px 48px rgba(127, 16, 22, 0.12);
  --radius-sm: 6px;
  --radius: 8px;
  --font-body: "Manrope", "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "Segoe UI", sans-serif;
  --motion-fast: 160ms;
  --motion-base: 260ms;
  --motion-slow: 420ms;
}

html[data-theme="night"] {
  color-scheme: dark;
  --bg: #0a0608;
  --surface: #14090b;
  --surface-2: #1e0d10;
  --surface-3: #261015;
  --ink: #fff3f4;
  --muted: #d0b2b7;
  --line: #4b1c24;
  --primary: #ff3347;
  --primary-strong: #ff6473;
  --primary-soft: #3a0f17;
  --accent: #ff9f1c;
  --accent-soft: #331d09;
  --danger: #ff5363;
  --danger-soft: #3b1017;
  --ok: #35d38b;
  --ok-soft: #0d2b20;
  --info: #8bb4ff;
  --info-soft: #101f3d;
  --sidebar-bg: #080203;
  --sidebar-bg-2: #2a060d;
  --sidebar-text: #fff3f4;
  --sidebar-muted: #d69ca5;
  --nav-hover: rgba(255, 51, 71, 0.18);
  --input-bg: #0e0708;
  --table-head: #210b0f;
  --auth-left: rgba(11, 3, 4, 0.96);
  --auth-right: rgba(193, 18, 31, 0.72);
  --auth-panel-bg: rgba(8, 5, 6, 0.96);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --shadow-soft: 0 10px 22px rgba(0, 0, 0, 0.2);
  --shadow-strong: 0 26px 56px rgba(255, 51, 71, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--ink);
  scrollbar-color: color-mix(in srgb, var(--primary) 42%, transparent) transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--primary) 7%, transparent), transparent 260px),
    repeating-linear-gradient(90deg, transparent 0 35px, color-mix(in srgb, var(--primary) 4%, transparent) 35px 36px),
    repeating-linear-gradient(0deg, transparent 0 35px, color-mix(in srgb, var(--primary) 3%, transparent) 35px 36px);
  opacity: 0.45;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(130deg, color-mix(in srgb, var(--primary) 10%, transparent) 0, transparent 38%),
    linear-gradient(320deg, color-mix(in srgb, var(--ink) 4%, transparent) 0, transparent 44%);
  opacity: 0.7;
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

button {
  border: 0;
  cursor: pointer;
  transition:
    transform var(--motion-fast) ease,
    background var(--motion-fast) ease,
    border-color var(--motion-fast) ease,
    color var(--motion-fast) ease,
    box-shadow var(--motion-fast) ease,
    opacity var(--motion-fast) ease;
}

.app-loading {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}

.app-shell {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  min-height: 100vh;
  position: relative;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 18%),
    linear-gradient(135deg, var(--sidebar-bg), var(--sidebar-bg-2));
  color: var(--sidebar-text);
  padding: 22px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid color-mix(in srgb, var(--sidebar-text) 10%, transparent);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 4px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background:
    linear-gradient(145deg, #ffffff, color-mix(in srgb, #ffffff 70%, var(--primary-soft)));
  color: var(--primary);
  font-weight: 800;
  font-family: var(--font-display);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 8px 20px rgba(0, 0, 0, 0.18);
  animation: emberPulse 7s ease-in-out infinite;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-subtitle {
  color: var(--sidebar-muted);
  font-size: 12px;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  width: 100%;
  min-height: 46px;
  color: var(--sidebar-muted);
  background: transparent;
  border-radius: var(--radius);
  text-align: left;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
  font-weight: 700;
}

.nav button:hover,
.nav button.active {
  background: var(--nav-hover);
  color: var(--sidebar-text);
  transform: translateX(2px);
}

.nav button.active::before {
  content: "";
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 0;
  width: 3px;
  border-radius: 999px;
  background: #ffffff;
}

.sidebar-note {
  margin-top: auto;
  color: var(--sidebar-muted);
  font-size: 13px;
  line-height: 1.45;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  padding: 14px 12px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
}

.user-card {
  display: grid;
  gap: 6px;
  padding: 14px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-soft);
}

.user-card span {
  color: var(--sidebar-muted);
  font-size: 12px;
  line-height: 1.35;
}

.user-card .btn {
  width: 100%;
  margin-top: 4px;
  color: var(--sidebar-text);
  border-color: rgba(255, 255, 255, 0.2);
}

.main {
  min-width: 0;
  padding: 26px clamp(14px, 2.8vw, 36px) 52px;
  position: relative;
  z-index: 1;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
  background:
    linear-gradient(135deg, var(--auth-left), var(--auth-right)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 34px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 34px);
}

.auth-brand {
  position: relative;
  min-height: 100vh;
  padding: clamp(28px, 5vw, 72px);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
}

.auth-theme-action {
  position: absolute;
  top: 22px;
  left: clamp(28px, 5vw, 72px);
}

.theme-toggle {
  gap: 7px;
  backdrop-filter: blur(8px);
}

.auth-brand .brand-mark {
  color: var(--primary);
  margin-bottom: 24px;
}

.auth-brand .eyebrow {
  color: #ffe0e3;
}

.auth-brand h1 {
  max-width: 620px;
  font-family: var(--font-display);
  font-size: clamp(38px, 5vw, 64px);
  line-height: 0.98;
}

.auth-brand p {
  max-width: 560px;
  color: #ffe8eb;
  line-height: 1.55;
  font-size: 18px;
}

.auth-highlights {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.auth-highlights span {
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 7px 10px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  font-size: 13px;
  font-weight: 760;
}

.auth-panel {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(18px, 4vw, 64px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 18%),
    var(--auth-panel-bg);
  backdrop-filter: blur(12px);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-width: 680px;
  margin: 0 auto 12px;
  width: 100%;
}

.auth-tabs button {
  min-height: 44px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-3) 82%, transparent);
  color: var(--ink);
  font-weight: 820;
  border: 1px solid var(--line);
}

.auth-tabs button.active {
  color: #ffffff;
  background: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 90%, black 10%);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 22%, transparent);
}

.auth-form {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  display: grid;
  gap: 14px;
  padding: 22px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--primary) 2%, var(--surface)), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-strong);
  animation: riseIn var(--motion-slow) ease both;
}

.scan-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 0.78fr);
  background: var(--bg);
}

.scan-public-panel {
  padding: clamp(20px, 4vw, 58px);
  display: grid;
  align-content: start;
  gap: 24px;
}

.scan-topline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.scan-topline .brand {
  color: var(--ink);
  border-bottom: 0;
  padding: 0;
}

.scan-topline .brand-subtitle {
  color: var(--muted);
}

.scan-card {
  max-width: 920px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--primary) 2%, var(--surface)), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-strong);
  padding: clamp(18px, 3vw, 32px);
  animation: riseIn var(--motion-slow) ease both;
}

.scan-card h1 {
  font-family: var(--font-display);
  font-size: clamp(30px, 4vw, 56px);
  line-height: 0.98;
}

.scan-status-line {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.scan-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.scan-grid > div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface-2);
}

.scan-grid .full {
  grid-column: 1 / -1;
}

.scan-grid p {
  margin: 4px 0 0;
}

.scan-login-panel {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(18px, 4vw, 54px);
  background:
    linear-gradient(180deg, rgba(185, 28, 28, 0.08), transparent 34%),
    var(--surface);
  border-left: 1px solid var(--line);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
  padding: 20px 20px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 4%, var(--surface)), var(--surface));
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: riseIn var(--motion-slow) ease both;
}

.topbar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--accent) 62%, var(--primary)), transparent 92%);
}

.topbar-copy {
  min-width: 0;
}

.topbar-actions {
  align-self: center;
}

.topbar-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.topbar-chip {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
  font-family: var(--font-display);
}

h1 {
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1;
}

h2 {
  font-size: 22px;
  line-height: 1.2;
}

h3 {
  font-size: 16px;
  line-height: 1.25;
}

.subtle {
  color: var(--muted);
  margin: 8px 0 0;
  line-height: 1.5;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.btn {
  min-height: 42px;
  border-radius: var(--radius);
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  color: var(--ink);
  background: color-mix(in srgb, var(--primary-soft) 68%, var(--surface));
  border: 1px solid transparent;
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.45) inset;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.btn.primary {
  color: #ffffff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 92%, white 8%), var(--primary-strong));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 24%, transparent);
}

.btn.accent {
  color: #ffffff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 86%, white 14%), color-mix(in srgb, var(--accent) 78%, black 22%));
}

.btn.danger {
  color: #ffffff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--danger) 86%, white 14%), color-mix(in srgb, var(--danger) 80%, black 20%));
}

.btn.ghost {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--line);
}

.btn.icon {
  width: 42px;
  padding: 0;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--primary) 1.5%, var(--surface)), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: riseIn var(--motion-slow) ease both;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--primary) 22%, transparent), transparent 72%);
}

.panel-header {
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.panel-body {
  padding: 18px;
}

.metric {
  padding: 18px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 90%, var(--primary-soft)), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 118px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: riseIn var(--motion-slow) ease both;
}

.metric::after {
  content: "";
  position: absolute;
  inset: auto 18px 0 18px;
  height: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 70%, transparent);
}

.metric[data-tone="info"]::after {
  background: linear-gradient(90deg, var(--info), color-mix(in srgb, var(--info) 40%, transparent));
}

.metric[data-tone="warning"]::after {
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 40%, transparent));
}

.metric[data-tone="danger"]::after {
  background: linear-gradient(90deg, var(--danger), color-mix(in srgb, var(--danger) 40%, transparent));
}

.metric[data-tone="ok"]::after {
  background: linear-gradient(90deg, var(--ok), color-mix(in srgb, var(--ok) 40%, transparent));
}

.metric[data-tone="primary"]::after {
  background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 40%, transparent));
}

.metric-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.metric-value {
  font-family: var(--font-display);
  font-size: clamp(34px, 4vw, 42px);
  line-height: 0.95;
  font-weight: 820;
  margin: 14px 0 10px;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-signal {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 22%, transparent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--muted) 10%, transparent);
}

.metric[data-tone="info"] .metric-signal {
  background: var(--info);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--info) 18%, transparent);
}

.metric[data-tone="warning"] .metric-signal {
  background: var(--accent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent);
}

.metric[data-tone="danger"] .metric-signal {
  background: var(--danger);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--danger) 18%, transparent);
}

.metric[data-tone="ok"] .metric-signal {
  background: var(--ok);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--ok) 18%, transparent);
}

.metric[data-tone="primary"] .metric-signal {
  background: var(--primary);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--primary) 18%, transparent);
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--ink);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 760;
}

.pill.ok {
  color: #07503c;
  background: var(--ok-soft);
}

.pill.warning {
  color: #7a3a00;
  background: var(--accent-soft);
}

.pill.danger {
  color: #7a231e;
  background: var(--danger-soft);
}

.pill.info {
  color: #123f91;
  background: var(--info-soft);
}

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface);
  display: grid;
  gap: 8px;
  box-shadow: var(--shadow-soft);
  transition:
    transform var(--motion-fast) ease,
    border-color var(--motion-fast) ease,
    box-shadow var(--motion-fast) ease,
    background var(--motion-fast) ease;
}

.list-item.selectable {
  cursor: pointer;
}

.list-item.selectable:hover,
.list-item.selected {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary-soft) 66%, var(--surface));
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.search-result {
  text-align: left;
}

.note-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 80%, var(--surface));
  padding: 14px;
  display: grid;
  gap: 6px;
}

.note-box.warning {
  background: var(--accent-soft);
}

.schedule-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.schedule-chip {
  min-width: 160px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 92%, var(--surface-2));
  padding: 10px;
  display: grid;
  gap: 3px;
  box-shadow: var(--shadow-soft);
}

.schedule-chip span,
.schedule-chip small {
  color: var(--muted);
}

.category-tabs {
  max-height: 136px;
  overflow: auto;
}

.template-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 42px;
}

.template-chip {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 84%, var(--surface));
  color: var(--ink);
  min-height: 36px;
  padding: 7px 10px;
  font-weight: 720;
  text-align: left;
}

.template-chip:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.empty.compact {
  min-height: 42px;
  padding: 10px;
}

.split {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 760;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--input-bg);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.52);
  transition:
    border-color var(--motion-fast) ease,
    box-shadow var(--motion-fast) ease,
    background var(--motion-fast) ease,
    transform var(--motion-fast) ease;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid color-mix(in srgb, var(--primary) 22%, transparent);
  border-color: var(--primary);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--primary) 24%, transparent),
    0 10px 20px color-mix(in srgb, var(--primary) 10%, transparent);
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--table-head);
}

.number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.quote-line {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 86px 86px 128px 42px;
  gap: 8px;
  align-items: end;
}

.touch-board {
  display: grid;
  gap: 12px;
}

.asset-card {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--primary) 1.5%, var(--surface)), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  box-shadow: var(--shadow);
}

.asset-meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 5px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  min-width: min(430px, 100%);
}

.segmented button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 780;
}

.segmented button.active[data-status="ok"] {
  background: var(--ok);
  color: #ffffff;
  border-color: var(--ok);
}

.segmented button.active[data-status="issue"] {
  background: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
}

.segmented button.active[data-status="blocked"] {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.signature-pad {
  width: 100%;
  height: 180px;
  border: 1px dashed color-mix(in srgb, var(--muted) 58%, transparent);
  border-radius: var(--radius);
  background: var(--input-bg);
  touch-action: none;
}

.document-preview {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 88%, var(--surface-2)), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.document-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 14px;
  margin-bottom: 18px;
}

.document-title {
  font-size: 24px;
  font-weight: 820;
}

.document-logo,
.logo-preview {
  max-width: 150px;
  max-height: 80px;
  object-fit: contain;
  display: block;
  margin-bottom: 10px;
}

.document-footer {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.print-only {
  display: none;
}

.asset-label {
  width: 104mm;
  min-height: 66mm;
  border: 1.2px solid #111827;
  background: #ffffff;
  color: #111827;
  padding: 6mm;
  display: grid;
  gap: 3mm;
  break-inside: avoid;
  position: relative;
}

.asset-label-head {
  display: flex;
  justify-content: space-between;
  gap: 6mm;
  border-bottom: 1px solid #111827;
  padding-bottom: 3mm;
}

.asset-label-head div:first-child,
.asset-label-details {
  display: grid;
  gap: 1mm;
}

.asset-label-id {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  font-weight: 820;
  white-space: nowrap;
}

.asset-label-codes {
  display: grid;
  gap: 4mm;
  align-items: center;
}

.asset-label-codes.single {
  grid-template-columns: 1fr;
  justify-items: start;
}

.asset-label-codes.single .barcode-block {
  width: 100%;
}

.asset-label-codes.dual {
  grid-template-columns: 30mm 1fr;
}

.asset-code-block {
  min-width: 0;
}

.asset-label-codes small {
  display: block;
  margin-top: 1mm;
  text-align: center;
  color: #4b5563;
  font-size: 8px;
}

.qr-code svg {
  width: 28mm;
  height: 28mm;
  display: block;
}

.barcode svg {
  width: 100%;
  height: 22mm;
  display: block;
}

.asset-label-main {
  display: grid;
  grid-template-columns: 1fr 15mm;
  gap: 4mm;
  align-items: center;
}

.asset-label-details {
  font-size: 11px;
}

.inspection-sticker-date {
  width: 15mm;
  height: 15mm;
  border: 1.3px solid #b91c1c;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  color: #b91c1c;
  background: #fff;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  line-height: 1.05;
  text-align: center;
}

.inspection-sticker-date span {
  font-size: 7px;
  font-weight: 760;
}

.inspection-sticker-date strong {
  font-size: 8px;
}

.asset-label-foot {
  display: flex;
  justify-content: space-between;
  gap: 4mm;
  align-items: flex-end;
  border-top: 1px solid #d1d5db;
  padding-top: 2mm;
  color: #4b5563;
  font-size: 8px;
}

.asset-label-foot > span {
  word-break: break-all;
}

.asset-label-brand {
  min-width: 22mm;
  text-align: right;
  color: #111827;
}

.asset-label-brand strong,
.asset-label-brand span {
  display: block;
}

.asset-label-brand strong {
  color: #b91c1c;
  font-size: 12px;
  line-height: 1;
}

.asset-label-brand span {
  font-size: 8px;
}

.totals {
  margin-left: auto;
  max-width: 360px;
  display: grid;
  gap: 8px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.total-row.strong {
  font-size: 20px;
  font-weight: 820;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.empty {
  min-height: 160px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.mini {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

code {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.92em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 5px;
}

.license-steps {
  display: grid;
  gap: 10px;
}

.license-steps div {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 94%, var(--surface-2));
}

.license-steps strong {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--primary);
  border-radius: 999px;
  font-size: 13px;
}

.photo-thumb {
  width: 96px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.metric:nth-child(1),
.panel:nth-of-type(1),
.list-item:nth-child(1) {
  animation-delay: 20ms;
}

.metric:nth-child(2),
.panel:nth-of-type(2),
.list-item:nth-child(2) {
  animation-delay: 60ms;
}

.metric:nth-child(3),
.panel:nth-of-type(3),
.list-item:nth-child(3) {
  animation-delay: 100ms;
}

.metric:nth-child(4),
.list-item:nth-child(4) {
  animation-delay: 140ms;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes emberPulse {
  0%,
  100% {
    transform: translateY(0);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 8px 20px rgba(0, 0, 0, 0.18);
  }

  50% {
    transform: translateY(-1px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 12px 26px rgba(185, 28, 28, 0.26);
  }
}

.bottom-tabs {
  display: none;
}

@media (max-width: 1080px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .scan-shell {
    grid-template-columns: 1fr;
  }

  .auth-brand,
  .auth-panel,
  .scan-login-panel {
    min-height: auto;
  }

  .auth-brand {
    padding-bottom: 24px;
  }

  .auth-panel {
    padding-top: 24px;
  }

  .scan-login-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .grid.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .main {
    padding-bottom: 98px;
  }

  .topbar {
    display: grid;
    padding: 18px 16px;
  }

  .scan-topline {
    display: grid;
  }

  .scan-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .grid.two,
  .grid.three,
  .grid.four,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .quote-line {
    grid-template-columns: 1fr 1fr;
  }

  .quote-line .remove-line {
    grid-column: 1 / -1;
    width: 100%;
  }

  .asset-card {
    grid-template-columns: 1fr;
  }

  .segmented {
    min-width: 0;
  }

  .bottom-tabs {
    position: fixed;
    z-index: 20;
    left: 10px;
    right: 10px;
    bottom: 10px;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 1px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
    border-radius: var(--radius);
    box-shadow: var(--shadow-strong);
    backdrop-filter: blur(14px);
    overflow: hidden;
  }

  .bottom-tabs button {
    min-height: 62px;
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    color: var(--ink);
    font-size: 11px;
    display: grid;
    place-items: center;
    gap: 3px;
    padding: 4px;
  }

  .bottom-tabs button.active {
    color: var(--primary);
    font-weight: 820;
    background: color-mix(in srgb, var(--primary-soft) 72%, var(--surface));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  @page {
    margin: 12mm;
  }

  body {
    background: #ffffff;
  }

  body::before,
  body::after {
    display: none !important;
  }

  .sidebar,
  .topbar,
  .no-print,
  .bottom-tabs,
  .panel:not(.print-panel) {
    display: none !important;
  }

  .app-shell,
  .main {
    display: block;
    padding: 0;
  }

  .document-preview {
    border: 0;
    border-radius: 0;
    padding: 0;
  }

  .document-footer {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    background: #ffffff;
  }

  .print-only {
    display: block !important;
  }

  .asset-label-page {
    border: 0;
    box-shadow: none;
  }
}
