/* ==========================================================================
   CryoLab · visual system
   ========================================================================== */
:root {
  --bg: #f3f6fa;
  --bg-2: #e9eff7;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-2: #1e293b;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-soft: #ccfbf1;
  --brand-ink: #134e4a;
  --blue: #1d4ed8;
  --blue-soft: #dbeafe;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --rose: #be123c;
  --rose-soft: #ffe4e6;
  --violet: #6d28d9;
  --violet-soft: #ede9fe;
  --green: #15803d;
  --green-soft: #dcfce7;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 28px rgba(15, 23, 42, .07);
  --shadow-lg: 0 24px 70px rgba(15, 23, 42, .22);
  --radius: 16px;
  --radius-sm: 10px;
  --header-h: 68px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
::selection { background: #99f6e4; color: #134e4a; }

/* --------------------------------------------------------------------------
   shell
   -------------------------------------------------------------------------- */
.app-shell { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 28px;
  background: rgba(255, 255, 255, .88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 210px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  color: #fff; font-size: 20px;
  background: linear-gradient(145deg, #0f766e, #0e7490);
  box-shadow: 0 6px 16px rgba(15, 118, 110, .28);
}
.brand-text strong { display: block; font-size: 15px; letter-spacing: .2px; line-height: 1.15; }
.brand-text span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; letter-spacing: .3px; }
.nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav a {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px; border-radius: 9px;
  color: var(--muted); font-size: 13px; font-weight: 600;
  transition: background .15s ease, color .15s ease;
}
.nav a:hover { background: #f1f5f9; color: var(--ink); }
.nav a.active { background: var(--brand-soft); color: var(--brand-dark); }
.nav .nav-dot {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--rose); color: #fff; font-size: 10px; font-weight: 700;
  display: inline-grid; place-items: center;
}
.userbox { display: flex; align-items: center; gap: 10px; }
.user-meta { text-align: right; line-height: 1.2; }
.user-meta strong { display: block; font-size: 12.5px; }
.user-meta span { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: #e2e8f0; color: #334155; font-weight: 800; font-size: 13px;
  border: 1px solid #fff; box-shadow: 0 0 0 1px var(--line);
}
.avatar.admin { background: #ccfbf1; color: #115e59; }

.main { max-width: 1440px; margin: 0 auto; padding: 26px 28px 70px; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 22px;
}
.page-head h1 { margin: 0; font-size: 24px; line-height: 1.2; letter-spacing: -.4px; }
.page-head p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.crumb { color: var(--muted-2); font-size: 12px; margin-bottom: 7px; }

/* --------------------------------------------------------------------------
   buttons / badges
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px; border-radius: 10px;
  border: 1px solid var(--line-2); background: #fff; color: var(--ink-2);
  font-size: 13px; font-weight: 650; white-space: nowrap;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover { background: #f8fafc; box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary {
  background: linear-gradient(145deg, #0f766e, #0d9488);
  border-color: #0f766e; color: #fff;
  box-shadow: 0 6px 16px rgba(15, 118, 110, .22);
}
.btn-primary:hover { background: linear-gradient(145deg, #115e59, #0f766e); }
.btn-danger { background: #fff; border-color: #fecdd3; color: var(--rose); }
.btn-danger:hover { background: #fff1f2; }
.btn-soft { background: var(--brand-soft); border-color: transparent; color: var(--brand-dark); }
.btn-soft:hover { background: #99f6e4; }
.btn-sm { height: 31px; padding: 0 11px; font-size: 12px; border-radius: 8px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 14px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon {
  width: 34px; height: 34px; padding: 0; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
}
.btn-icon:hover { color: var(--ink); background: #f8fafc; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .1px;
  background: #f1f5f9; color: #475569; white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge.no-dot::before { display: none; }
.badge-pending { background: var(--amber-soft); color: var(--amber); }
.badge-approved { background: var(--green-soft); color: var(--green); }
.badge-rejected { background: var(--rose-soft); color: var(--rose); }
.badge-cancelled { background: #f1f5f9; color: #64748b; }
.badge-cryo { background: var(--blue-soft); color: var(--blue); }
.badge-thaw { background: var(--violet-soft); color: var(--violet); }
.badge-teacher { background: var(--violet-soft); color: var(--violet); }
.badge-own { background: var(--brand-soft); color: var(--brand-dark); }

/* --------------------------------------------------------------------------
   stats / cards
   -------------------------------------------------------------------------- */
.stats-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.stat-card {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.stat-card::after {
  content: ""; position: absolute; right: -28px; top: -28px;
  width: 92px; height: 92px; border-radius: 50%;
  background: var(--tint, #f1f5f9); opacity: .7;
}
.stat-top { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 1; }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.stat-icon {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center; background: var(--tint, #f1f5f9); color: var(--tone, #475569);
}
.stat-value { position: relative; z-index: 1; margin-top: 8px; font-size: 27px; font-weight: 800; letter-spacing: -.8px; }
.stat-value small { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.stat-foot { position: relative; z-index: 1; margin-top: 5px; font-size: 11px; color: var(--muted); }
.stat-foot strong { color: var(--tone, var(--ink)); }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 17px 20px; border-bottom: 1px solid var(--line);
}
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; letter-spacing: -.1px; }
.card-head p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line); }

/* --------------------------------------------------------------------------
   tank overview
   -------------------------------------------------------------------------- */
.tank-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.tank-selector { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tank-tab {
  min-width: 108px; padding: 10px 13px; border-radius: 12px;
  background: #fff; border: 1px solid var(--line); text-align: left;
  transition: border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}
.tank-tab:hover { border-color: #99f6e4; box-shadow: var(--shadow-sm); }
.tank-tab.active { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 118, 110, .10); }
.tank-tab-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tank-tab strong { font-size: 14px; letter-spacing: .2px; }
.tank-tab small { color: var(--muted); font-size: 10.5px; }
.tank-bar { height: 4px; border-radius: 2px; background: #eef2f7; margin-top: 8px; overflow: hidden; }
.tank-bar span { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, #0f766e, #14b8a6); }
.tank-tab.teacher .tank-bar span { background: linear-gradient(90deg, #7c3aed, #a78bfa); }

.tank-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tank-title { display: flex; align-items: center; gap: 10px; }
.tank-title h2 { margin: 0; font-size: 17px; }
.tank-title p { margin: 3px 0 0; color: var(--muted); font-size: 11.5px; }
.tank-legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 11.5px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; border: 1px solid transparent; }
.legend-dot.free { background: #f8fafc; border-color: #cbd5e1; border-style: dashed; }
.legend-dot.occupied { background: #1d4ed8; }
.legend-dot.reserved { background: #d97706; }
.legend-dot.teacher { background: #c4b5fd; }

.tank-scroll { overflow-x: auto; padding: 4px 2px 8px; }
.tank-grid {
  display: grid;
  grid-template-columns: 26px repeat(var(--cols, 9), minmax(54px, 1fr));
  gap: 6px;
  min-width: 640px;
}
.tank-grid .corner { width: 26px; }
.tank-grid .axis {
  display: grid; place-items: center;
  color: var(--muted-2); font-size: 10px; font-weight: 700;
  user-select: none;
}
.tank-grid .axis.side { justify-content: end; padding-right: 2px; }
.hole {
  position: relative;
  min-height: 58px;
  padding: 7px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  display: flex; flex-direction: column; justify-content: center;
  overflow: hidden;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.hole.free { border-style: dashed; color: #94a3b8; }
.hole.free .hole-main { font-size: 10.5px; font-weight: 600; }
.hole.occupied {
  background: linear-gradient(145deg, #1e40af, #2563eb);
  border-color: #1e40af; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16);
}
.hole.reserved {
  background: linear-gradient(145deg, #d97706, #f59e0b);
  border-color: #d97706; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16);
}
.hole.teacher { opacity: .72; filter: saturate(.65); }
.hole.teacher.selectable { opacity: .95; filter: none; }
.hole.teacher.occupied { background: linear-gradient(145deg, #6d28d9, #7c3aed); border-color: #6d28d9; }
.hole.selectable { cursor: pointer; }
.hole.selectable:hover { transform: translateY(-1px); border-color: var(--brand); box-shadow: 0 6px 14px rgba(15, 118, 110, .18); }
.hole.selected {
  outline: 3px solid #14b8a6; outline-offset: 1px;
  background: linear-gradient(145deg, #0f766e, #14b8a6);
  border-color: #0f766e; color: #fff;
}
.hole .hole-label {
  position: absolute; top: 5px; left: 6px;
  font-size: 8.5px; font-weight: 700; opacity: .55; letter-spacing: .2px;
}
.hole .hole-main {
  font-size: 10.5px; font-weight: 750; line-height: 1.15;
  max-height: 2.35em; overflow: hidden; word-break: break-all;
  padding-top: 7px;
}
.hole .hole-sub { font-size: 8.5px; opacity: .78; margin-top: 3px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hole .hole-check {
  position: absolute; top: 5px; right: 5px;
  width: 15px; height: 15px; border-radius: 50%;
  background: #fff; color: var(--brand);
  display: grid; place-items: center; font-size: 9px; font-weight: 900;
}
.hole .hole-pulse {
  position: absolute; bottom: 5px; right: 6px;
  width: 5px; height: 5px; border-radius: 50%; background: #fff; opacity: .7;
}

.empty-state { padding: 46px 20px; text-align: center; color: var(--muted); }
.empty-state .empty-icon {
  width: 54px; height: 54px; border-radius: 16px; margin: 0 auto 12px;
  display: grid; place-items: center; background: #f1f5f9; color: #94a3b8;
}
.empty-state h3 { margin: 0 0 5px; color: var(--ink-2); font-size: 14px; }
.empty-state p { margin: 0; font-size: 12.5px; }

/* side panel */
.side-stack { display: grid; gap: 16px; }
.detail-card .card-body { padding: 16px 18px; }
.detail-empty { color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.detail-hole-code { font-size: 22px; font-weight: 800; letter-spacing: -.6px; }
.detail-cell { margin-top: 3px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.detail-rows { display: grid; gap: 9px; margin-top: 14px; }
.detail-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; font-size: 12px; }
.detail-row span { color: var(--muted); }
.detail-row strong { font-weight: 650; text-align: right; word-break: break-all; }
.side-note {
  background: linear-gradient(145deg, #f0fdfa, #ecfeff);
  border: 1px solid #ccfbf1;
}
.side-note .card-body { padding: 16px 18px; }
.side-note h3 { margin: 0 0 8px; font-size: 13px; color: var(--brand-dark); }
.side-note ol { margin: 0; padding-left: 17px; color: #475569; font-size: 12px; line-height: 1.8; }
.side-note li::marker { color: var(--brand); font-weight: 700; }

/* --------------------------------------------------------------------------
   apply page
   -------------------------------------------------------------------------- */
.apply-layout { display: grid; grid-template-columns: minmax(360px, 430px) minmax(0, 1fr); gap: 22px; align-items: start; }
.sticky { position: sticky; top: calc(var(--header-h) + 20px); }
.steps { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.step { display: flex; align-items: center; gap: 7px; color: var(--muted-2); font-size: 11px; font-weight: 700; }
.step b {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: #eef2f7; color: #94a3b8; font-size: 10px;
}
.step.active { color: var(--brand-dark); }
.step.active b { background: var(--brand); color: #fff; }
.step-line { height: 1px; flex: 1; background: var(--line); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 11.5px; font-weight: 700; color: #475569; }
.field label em { font-style: normal; color: var(--rose); margin-left: 2px; }
.field .hint { font-size: 10.5px; color: var(--muted-2); }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line-2); border-radius: 9px;
  background: #fff; padding: 9px 11px; font-size: 13px; color: var(--ink);
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: #2dd4bf; box-shadow: 0 0 0 3px rgba(45, 212, 191, .16);
}
.textarea { resize: vertical; min-height: 74px; }
.input[readonly] { background: #f8fafc; color: var(--muted); }
.input-group { display: flex; align-items: center; gap: 8px; }
.input-suffix { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.form-note {
  margin-top: 13px; padding: 10px 12px; border-radius: 9px;
  background: #f8fafc; border: 1px dashed var(--line-2);
  color: var(--muted); font-size: 11.5px; line-height: 1.6;
}

.selection-box { margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.selection-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 13px; background: #f8fafc; border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 700;
}
.selection-head span { color: var(--brand-dark); }
.selection-list { display: flex; flex-wrap: wrap; gap: 7px; padding: 11px 13px; min-height: 44px; }
.selection-empty { color: var(--muted-2); font-size: 11.5px; padding: 2px 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-dark);
  font-size: 11.5px; font-weight: 700;
}
.chip button {
  border: 0; background: transparent; color: var(--brand-dark);
  width: 15px; height: 15px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; line-height: 1; opacity: .6;
}
.chip button:hover { opacity: 1; background: rgba(15, 118, 110, .12); }
.selection-summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 13px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--muted);
}
.selection-summary strong { color: var(--ink); }

.picker-card .card-head { padding: 14px 18px; }
.picker-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.picker-hint { font-size: 11.5px; color: var(--muted); }
.picker-hint b { color: var(--brand-dark); }

/* --------------------------------------------------------------------------
   applications
   -------------------------------------------------------------------------- */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: #eef2f7; border-radius: 10px; }
.tabs button {
  border: 0; background: transparent; color: var(--muted);
  padding: 6px 13px; border-radius: 7px; font-size: 12px; font-weight: 700;
}
.tabs button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.tabs button .count {
  display: inline-grid; place-items: center; min-width: 17px; height: 17px;
  padding: 0 5px; margin-left: 5px; border-radius: 9px;
  background: #e2e8f0; color: #475569; font-size: 10px;
}
.tabs button.active .count { background: var(--brand-soft); color: var(--brand-dark); }

.app-list { display: grid; gap: 12px; }
.app-card {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px;
  padding: 17px 19px; border: 1px solid var(--line); border-radius: 13px;
  background: #fff; transition: border-color .15s ease, box-shadow .15s ease;
}
.app-card:hover { border-color: #bae6fd; box-shadow: var(--shadow-sm); }
.app-main { min-width: 0; }
.app-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.app-code { color: var(--muted); font-size: 10.5px; font-weight: 650; letter-spacing: .2px; }
.app-title { font-size: 15px; font-weight: 800; letter-spacing: -.2px; }
.app-title span { color: var(--muted); font-weight: 600; font-size: 12px; margin-left: 6px; }
.app-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 11.5px; margin-top: 5px; }
.app-meta b { color: var(--ink-2); font-weight: 650; }
.app-holes { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 10px; }
.hole-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 7px; border-radius: 6px;
  background: #f1f5f9; color: #475569; font-size: 10.5px; font-weight: 700;
}
.hole-pill.ok { background: var(--brand-soft); color: var(--brand-dark); }
.app-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 10px; }
.app-side .when { color: var(--muted-2); font-size: 10.5px; text-align: right; }

/* --------------------------------------------------------------------------
   table / inventory
   -------------------------------------------------------------------------- */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 15px; }
.filter-bar .search { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.filter-bar .search .input { padding-left: 34px; }
.filter-bar .search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted-2); }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; min-width: 760px; }
table.data th {
  text-align: left; font-size: 10.5px; color: var(--muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: #f8fafc;
  white-space: nowrap;
}
table.data td { padding: 11px 12px; border-bottom: 1px solid #eef2f7; font-size: 12.5px; vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #fafcff; }
table.data .mono { font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace; font-size: 11px; letter-spacing: -.1px; }
table.data .muted { color: var(--muted); }
table.data .check-cell { width: 34px; }
input[type="checkbox"].box {
  width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer;
}
.table-empty { padding: 48px; text-align: center; color: var(--muted); }

.bulkbar {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 35; display: flex; align-items: center; gap: 14px;
  padding: 10px 12px 10px 17px; border-radius: 14px;
  background: #0f172a; color: #fff; box-shadow: var(--shadow-lg);
}
.bulkbar strong { color: #5eead4; }
.bulkbar .btn { height: 34px; }
.bulkbar .btn-soft { background: #134e4a; color: #ccfbf1; }
.bulkbar .btn-soft:hover { background: #115e59; }

/* --------------------------------------------------------------------------
   audit
   -------------------------------------------------------------------------- */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: ""; position: absolute; left: 6px; top: 5px; bottom: 5px;
  width: 1px; background: var(--line);
}
.timeline-item { position: relative; padding: 0 0 18px 4px; }
.timeline-item::before {
  content: ""; position: absolute; left: -22px; top: 4px;
  width: 9px; height: 9px; border-radius: 50%;
  background: #fff; border: 2px solid var(--line-2);
}
.timeline-item.good::before { border-color: #10b981; }
.timeline-item.warn::before { border-color: #f59e0b; }
.timeline-item.bad::before { border-color: #e11d48; }
.timeline-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.timeline-top strong { font-size: 12.5px; }
.timeline-top time { color: var(--muted-2); font-size: 10.5px; }
.timeline-actor { color: var(--muted); font-size: 11.5px; }
.timeline-detail { margin-top: 3px; color: #475569; font-size: 11.5px; line-height: 1.6; }

/* --------------------------------------------------------------------------
   modal
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(15, 23, 42, .48);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fadeIn .16s ease both;
}
.modal {
  width: min(780px, 100%); max-height: min(88vh, 860px);
  background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
  animation: popIn .18s cubic-bezier(.2, .8, .2, 1) both;
}
.modal.wide { width: min(960px, 100%); }
.modal.small { width: min(520px, 100%); }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 20px 22px 16px; border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 18px; letter-spacing: -.3px; }
.modal-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 9px;
  padding: 14px 22px; border-top: 1px solid var(--line); background: #fafcff;
}
.icon-btn {
  width: 32px; height: 32px; border-radius: 9px; border: 0;
  background: #f1f5f9; color: var(--muted); display: grid; place-items: center;
}
.icon-btn:hover { background: #e2e8f0; color: var(--ink); }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; }
.detail-field label { display: block; color: var(--muted); font-size: 10.5px; font-weight: 700; margin-bottom: 2px; }
.detail-field div { font-size: 13px; font-weight: 600; word-break: break-word; }
.detail-field.full { grid-column: 1 / -1; }
.section-title {
  display: flex; align-items: center; gap: 8px;
  margin: 20px 0 10px; font-size: 12px; font-weight: 800; color: var(--ink-2);
}
.section-title::before { content: ""; width: 3px; height: 13px; border-radius: 2px; background: var(--brand); }
.item-table { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.item-table table { width: 100%; border-collapse: collapse; }
.item-table th { text-align: left; padding: 8px 11px; background: #f8fafc; color: var(--muted); font-size: 10px; font-weight: 700; }
.item-table td { padding: 9px 11px; border-top: 1px solid #eef2f7; font-size: 11.5px; }
.review-box { margin-top: 18px; padding: 14px; border-radius: 11px; background: #fffbeb; border: 1px solid #fde68a; }
.review-box h3 { margin: 0 0 8px; font-size: 12.5px; color: #92400e; }
.review-box .textarea { min-height: 62px; }
.modal-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 12px; }

/* --------------------------------------------------------------------------
   login
   -------------------------------------------------------------------------- */
.login-page {
  min-height: 100vh; display: grid; grid-template-columns: 1.12fr .88fr;
  background: #062c2b;
}
.login-visual {
  position: relative; overflow: hidden; padding: 54px 58px;
  display: flex; flex-direction: column; justify-content: space-between;
  color: #ecfeff;
  background:
    radial-gradient(900px 520px at 12% 8%, rgba(45, 212, 191, .30), transparent 62%),
    radial-gradient(700px 520px at 92% 92%, rgba(14, 116, 144, .38), transparent 60%),
    linear-gradient(150deg, #052e2b 0%, #064e4a 48%, #083344 100%);
}
.login-visual::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(153, 246, 228, .075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(153, 246, 228, .075) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.9), transparent 92%);
  pointer-events: none;
}
.login-visual > * { position: relative; z-index: 1; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand .brand-mark { width: 44px; height: 44px; font-size: 23px; background: rgba(255,255,255,.12); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.login-brand strong { display: block; font-size: 17px; letter-spacing: .3px; }
.login-brand span { display: block; font-size: 11px; color: #99f6e4; opacity: .8; margin-top: 2px; }
.login-copy { max-width: 560px; margin-top: 40px; }
.login-copy .kicker {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 10px; border-radius: 999px; font-size: 10.5px; font-weight: 700;
  background: rgba(153, 246, 228, .12); color: #99f6e4; border: 1px solid rgba(153, 246, 228, .18);
}
.login-copy h1 { margin: 17px 0 14px; font-size: clamp(30px, 4vw, 48px); line-height: 1.13; letter-spacing: -1.4px; }
.login-copy h1 em { font-style: normal; color: #5eead4; }
.login-copy p { margin: 0; color: #bae6e2; font-size: 14px; line-height: 1.85; max-width: 470px; }
.login-points { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 30px; }
.login-point { display: flex; align-items: center; gap: 9px; font-size: 12px; color: #ccfbf1; }
.login-point b { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: rgba(153,246,228,.10); color: #5eead4; font-size: 13px; }
.login-footer { color: #99f6e4; opacity: .55; font-size: 11px; }

.login-form-side { background: #fff; display: flex; align-items: center; justify-content: center; padding: 38px; }
.login-card { width: min(380px, 100%); }
.login-card h2 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.6px; }
.login-card > p { margin: 0 0 26px; color: var(--muted); font-size: 12.5px; }
.login-form { display: grid; gap: 14px; }
.login-form .field label { font-size: 12px; }
.login-form .input { height: 44px; padding: 0 13px; border-radius: 10px; }
.login-error { display: none; padding: 9px 11px; border-radius: 8px; background: #fff1f2; color: #be123c; font-size: 12px; }
.login-error.show { display: block; }
.demo-box { margin-top: 24px; padding-top: 18px; border-top: 1px dashed var(--line); }
.demo-box > span { display: block; color: var(--muted-2); font-size: 10.5px; font-weight: 700; margin-bottom: 9px; letter-spacing: .3px; }
.demo-accounts { display: grid; gap: 8px; }
.demo-account {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  background: #fafcff; text-align: left; font-size: 11.5px;
}
.demo-account:hover { border-color: #99f6e4; background: #f0fdfa; }
.demo-account b { font-size: 12px; }
.demo-account span { color: var(--muted); font-family: "Cascadia Code", Consolas, monospace; font-size: 10.5px; }
.login-hint { margin-top: 15px; color: var(--muted-2); font-size: 10.5px; line-height: 1.65; }
.login-switch {
  margin-top: 16px; text-align: center; color: var(--muted); font-size: 12px;
}
.login-switch button {
  border: 0; background: transparent; padding: 0 2px;
  color: var(--brand); font-weight: 700; font-size: 12px;
}
.login-switch button:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   toast
   -------------------------------------------------------------------------- */
#toast-root { position: fixed; top: 82px; right: 24px; z-index: 100; display: grid; gap: 8px; }
.toast {
  display: flex; align-items: flex-start; gap: 9px;
  min-width: 250px; max-width: 380px; padding: 11px 14px;
  border-radius: 11px; background: #0f172a; color: #f8fafc;
  box-shadow: var(--shadow-lg); font-size: 12px; line-height: 1.5;
  animation: slideIn .2s ease both;
}
.toast.good { background: #064e3b; }
.toast.bad { background: #7f1d1d; }
.toast .t-icon { flex: none; margin-top: 1px; color: #5eead4; }
.toast.bad .t-icon { color: #fda4af; }
.toast.hide { animation: fadeOut .18s ease both; }

/* --------------------------------------------------------------------------
   utilities / responsive
   -------------------------------------------------------------------------- */
.muted { color: var(--muted); }
.mono { font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace; font-size: 11.5px; letter-spacing: -.1px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.spacer { flex: 1; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(-4px); } }

@media (max-width: 1180px) {
  .tank-layout { grid-template-columns: minmax(0, 1fr); }
  .side-stack { grid-template-columns: 1fr 1fr; }
  .apply-layout { grid-template-columns: minmax(330px, 390px) minmax(0, 1fr); }
}
@media (max-width: 980px) {
  .topbar { gap: 14px; padding: 0 16px; }
  .brand { min-width: 0; }
  .brand-text span { display: none; }
  .nav { overflow-x: auto; }
  .main { padding: 18px 16px 70px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .apply-layout { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .login-page { grid-template-columns: 1fr; }
  .login-visual { display: none; }
}
@media (max-width: 720px) {
  .page-head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .page-head h1 { font-size: 20px; }
  .topbar { height: auto; min-height: 62px; flex-wrap: wrap; padding: 9px 14px; gap: 8px; }
  .nav { order: 3; width: 100%; padding-bottom: 2px; }
  .nav a { padding: 7px 10px; font-size: 12px; }
  .user-meta { display: none; }
  .side-stack { grid-template-columns: 1fr; }
  .stats-grid { gap: 10px; }
  .stat-card { padding: 13px 14px; }
  .stat-value { font-size: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .app-card { grid-template-columns: 1fr; }
  .app-side { flex-direction: row; align-items: center; }
  .detail-grid { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 10px; }
  .modal { max-height: 94vh; border-radius: 14px; }
  .modal-head, .modal-body, .modal-foot { padding-left: 16px; padding-right: 16px; }
  .bulkbar { left: 10px; right: 10px; bottom: 10px; transform: none; justify-content: space-between; }
  #toast-root { left: 14px; right: 14px; top: 76px; }
  .toast { max-width: none; }
  .login-form-side { padding: 24px; }
}
