/* A6 — login, app shell, ticket list.
   Design language: the service counter of a helmet shop. Steel neutrals,
   one safety-orange accent, label-like status chips whose shape and glyph
   carry meaning as much as their colour. */

:root {
  --ink: #101a26;
  --ink-soft: #354456;
  --muted: #62718a;
  --line: #d5dce5;
  --line-strong: #b9c3d0;
  --paper: #ffffff;
  --canvas: #edf1f6;
  --canvas-deep: #e2e8f0;
  --accent: #c2410c;
  --accent-strong: #9a3412;
  --accent-soft: #fff1e8;
  --focus: #1d4ed8;
  --ok-ink: #14532d;
  --ok-bg: #e7f6ec;
  --wait-ink: #78350f;
  --wait-bg: #fdf3dd;
  --info-ink: #1e3a8a;
  --info-bg: #e8eefc;
  --done-ink: #1f2937;
  --done-bg: #e5e7eb;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 26, 38, 0.06), 0 8px 24px rgba(16, 26, 38, 0.05);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--info-ink); }
a:hover { color: var(--accent-strong); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Login ---------- */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem 1rem;
  background:
    radial-gradient(1200px 500px at 15% -10%, #dbe4ef 0%, transparent 60%),
    var(--canvas);
}

.login-card {
  width: 100%;
  max-width: 26rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.login-head {
  padding: 1.5rem 1.5rem 1rem;
  border-top: 4px solid var(--accent);
}

.login-mark {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.login-head h1 {
  margin: 0.35rem 0 0.25rem;
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.login-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.login-form { padding: 0.5rem 1.5rem 1.5rem; }

.field { margin-bottom: 1rem; }

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
  color: var(--ink-soft);
}

.field input[type="text"],
.field input[type="password"],
.field input[type="search"],
.field input[type="date"],
.field select {
  width: 100%;
  min-height: 2.65rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

.field input:focus,
.field select:focus {
  border-color: var(--focus);
  outline: 3px solid rgba(29, 78, 216, 0.18);
  outline-offset: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.65rem;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-strong); color: #fff; }

.btn-primary[aria-disabled="true"],
.btn-primary:disabled {
  opacity: 0.7;
  cursor: progress;
}

.btn-ghost {
  border-color: var(--line-strong);
  background: transparent;
}

.btn-ghost:hover { background: var(--canvas); }

.btn-block { width: 100%; }

.form-error {
  margin: 0 0 1rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid #f0b4a4;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: #7c2d12;
  font-size: 0.92rem;
}

.form-note {
  margin: 0 0 1rem;
  padding: 0.6rem 0.8rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.form-success {
  border-style: solid;
  border-color: #4d9e6a;
  background: var(--ok-bg);
  color: var(--ok-ink);
}

.account-page {
  max-width: 36rem;
  margin: 0 auto;
}

.password-form { padding: 1.25rem; }
.password-form .field input { min-height: 2.75rem; }
.password-help { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.9rem; }
.password-actions { display: flex; flex-wrap: wrap; gap: 0.65rem; }
.password-actions .btn { min-height: 2.75rem; }

.login-foot {
  margin: 1.1rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

/* ---------- App shell ---------- */

.topbar {
  background: var(--ink);
  color: #e8eef6;
  border-bottom: 3px solid var(--accent);
}

.topbar-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand small {
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9fb1c6;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-sm);
  color: #c8d5e3;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.94rem;
  white-space: nowrap;
}

.main-nav a:hover { background: #1d2b3d; color: #fff; }

.main-nav a[aria-current="page"] {
  background: #223247;
  color: #fff;
  box-shadow: inset 0 -2px 0 var(--accent);
}

.user-area {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.user-name {
  font-size: 0.9rem;
  color: #dbe5f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 12rem;
}

.user-role {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0.05rem 0.4rem;
  border: 1px solid #4a5d75;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #b7c7da;
}

.logout-form { margin: 0; }

.logout-btn {
  min-height: 2.2rem;
  padding: 0.3rem 0.65rem;
  background: transparent;
  border-color: #4a5d75;
  color: #e8eef6;
  font-size: 0.88rem;
}

.logout-btn:hover { background: #223247; color: #fff; }

.page {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.25rem;
  min-width: 0;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.page-head h1 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.page-head .sub {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* ---------- Filters ---------- */

.filters {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
}

.filters-grid {
  display: grid;
  grid-template-columns: minmax(14rem, 2fr) repeat(3, minmax(8rem, 1fr)) auto;
  gap: 0.75rem;
  align-items: end;
}

.filters .field { margin: 0; min-width: 0; }

.filters .field label {
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.filters-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.filters-actions .btn { white-space: nowrap; }

.filter-summary {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

/* ---------- Ticket list ---------- */

.list-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

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

.tickets-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.tickets-table th,
.tickets-table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.tickets-table thead th {
  background: #f7f9fc;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
  white-space: nowrap;
}

.tickets-table tbody tr:hover { background: #f7f9fc; }
.tickets-table tbody tr:last-child td { border-bottom: 0; }

.tickets-table .code {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}

.tickets-table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.tickets-table .muted { color: var(--muted); }
.tickets-table .ticket-branch { min-width: 10rem; max-width: 14rem; overflow-wrap: anywhere; }
.ticket-card .ticket-branch { display: block; }

.ticket-link {
  color: var(--info-ink);
  text-decoration: none;
  font-weight: 600;
}

.ticket-link:hover { text-decoration: underline; }

/* Mobile cards replace the table under 900 px. */
.ticket-cards { display: none; }

.ticket-card {
  display: block;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

.ticket-card:last-child { border-bottom: 0; }

.ticket-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.ticket-card .code {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.ticket-card .card-main {
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.ticket-card .card-sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.15rem;
  overflow-wrap: anywhere;
}

/* ---------- Status chips ---------- */

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  border: 1px solid;
}

.status .glyph {
  font-size: 0.85em;
  line-height: 1;
}

.status-received {
  color: var(--info-ink);
  background: var(--info-bg);
  border-color: #93b4ec;
  border-style: solid;
}

.status-processing {
  color: var(--wait-ink);
  background: var(--wait-bg);
  border-color: #d9a83a;
  border-style: dashed;
}

.status-sent_to_manufacturer {
  color: #4c1d95;
  background: #f0e9fd;
  border-color: #a78bfa;
  border-style: double;
  border-width: 3px;
}

.status-completed {
  color: var(--ok-ink);
  background: var(--ok-bg);
  border-color: #4d9e6a;
  border-style: solid;
  box-shadow: inset 0 0 0 1px #bfe3cc;
}

.status-handed_over {
  color: var(--done-ink);
  background: var(--done-bg);
  border-color: #6b7280;
  border-style: solid;
}

/* ---------- Empty / pagination ---------- */

.empty {
  padding: 2.5rem 1.25rem;
  text-align: center;
  color: var(--ink-soft);
}

.empty h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.empty p { margin: 0 0 1rem; color: var(--muted); }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
  font-size: 0.88rem;
}

.pager-info { color: var(--muted); font-variant-numeric: tabular-nums; }

.pager-links { display: flex; gap: 0.5rem; align-items: center; }

.pager-links .btn { min-height: 2.2rem; padding: 0.3rem 0.75rem; }

.pager-links .btn[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
  cursor: default;
}

/* ---------- Loading hint (HTMX) ---------- */

.htmx-request .list-panel { opacity: 0.6; transition: opacity 120ms ease-out; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .filters-grid { grid-template-columns: 1fr 1fr; }
  .filters-grid .search-field { grid-column: 1 / -1; }
  .filters-actions { justify-content: flex-start; grid-column: 1 / -1; }

  .table-wrap { display: none; }
  .ticket-cards { display: block; }
}

@media (max-width: 640px) {
  .topbar-inner { padding: 0.6rem 0.85rem; gap: 0.6rem; }
  .brand small { display: none; }
  .main-nav { order: 3; width: 100%; flex-wrap: wrap; }
  .main-nav a { padding: 0.4rem 0.55rem; }
  .user-area { gap: 0.45rem; }
  .user-name { max-width: 8.5rem; }
  .user-role { display: none; }
  .page { padding: 0.9rem; }
  .page-head h1 { font-size: 1.3rem; }
  .page-head .btn-primary { width: 100%; }
  .filters-grid { grid-template-columns: 1fr; }
  .filters-actions .btn { flex: 1 1 auto; }
  .pager { justify-content: center; }
  .pager-info { width: 100%; text-align: center; }
}

@media (max-width: 380px) {
  .topbar-inner { padding: 0.55rem 0.65rem; }
  .page { padding: 0.65rem; }
  .login-page { padding: 0.9rem 0.65rem; }
  .login-head { padding: 1.1rem 1rem 0.75rem; }
  .login-form { padding: 0.35rem 1rem 1.1rem; }
  .user-name { max-width: 6.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- A8 — ticket detail ---------- */

.detail {
  max-width: 62rem;
  margin: 0 auto;
  display: grid;
  gap: 0.9rem;
}

.detail-head { margin-bottom: 0; }

.back-link {
  display: inline-block;
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
  color: var(--muted);
}

.back-link:hover { color: var(--accent-strong); }

.detail-code {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.6rem;
  letter-spacing: 0.01em;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.version-tag {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82rem;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  background: var(--paper);
}

.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid #f0b4a4;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  color: #7c2d12;
  font-size: 0.95rem;
}

.banner[hidden] { display: none; }

.banner p { margin: 0; font-weight: 600; }

.status-message {
  margin: 0;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--info-bg);
  color: var(--info-ink);
  font-weight: 600;
  font-size: 0.92rem;
}

.status-message.danger {
  background: var(--accent-soft);
  color: #7c2d12;
}

.status-message.warning {
  background: var(--wait-bg);
  color: var(--wait-ink);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
}

.panel h2 {
  margin: 0 0 0.7rem;
  font-size: 1rem;
  color: var(--ink-soft);
}

.fact-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
  margin: 0;
}

.fact-wide { grid-column: 1 / -1; }

.fact dt {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.fact dd {
  margin: 0.1rem 0 0;
  overflow-wrap: anywhere;
}

.fact .code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92rem;
}

.num { font-variant-numeric: tabular-nums; }

.prewrap { white-space: pre-wrap; }

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.action-hint {
  margin: 0.6rem 0 0;
  font-size: 0.85rem;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.thumb {
  display: block;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--canvas);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.timeline-item {
  display: grid;
  grid-template-columns: 1rem 1fr;
  gap: 0.5rem;
  position: relative;
}

.timeline-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 0.42rem;
  top: 1.1rem;
  bottom: -0.85rem;
  width: 2px;
  background: var(--line);
}

.timeline-dot {
  width: 0.7rem;
  height: 0.7rem;
  margin-top: 0.32rem;
  border-radius: 999px;
  border: 2px solid var(--accent);
  background: var(--paper);
}

.timeline-body p { margin: 0; }

.timeline-head { font-size: 0.95rem; }

.timeline-sub {
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.timeline-note {
  margin-top: 0.2rem !important;
  font-size: 0.9rem;
  color: var(--ink-soft);
  white-space: pre-wrap;
}

.dialog {
  width: min(30rem, calc(100vw - 2rem));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: 0 12px 40px rgba(16, 26, 38, 0.25);
}

.dialog::backdrop { background: rgba(16, 26, 38, 0.35); }

.dialog h2 { margin: 0 0 0.4rem; font-size: 1.1rem; }

.dialog-text { margin: 0 0 0.8rem; color: var(--muted); font-size: 0.9rem; }

.dialog .field textarea {
  width: 100%;
  min-height: 4.5rem;
  padding: 0.55rem 0.7rem;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  resize: vertical;
}

.dialog .field [aria-invalid="true"] {
  border-color: var(--accent);
  border-width: 2px;
}

.field-error {
  margin: 0.3rem 0 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-strong);
}

.field-error::before { content: "Lỗi: "; }

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.4rem;
}

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

@media (max-width: 640px) {
  .detail-code { font-size: 1.3rem; }
  .fact-list { grid-template-columns: 1fr; }
  .action-row .btn { flex: 1 1 100%; }
  .dialog-actions .btn { flex: 1 1 auto; }
}

/* ---------- Status picker (F3 danh sách, F4 chi tiết) ---------- */

.status-picker {
  position: relative;
  display: inline-block;
  vertical-align: middle;
}

.status-button {
  font-family: inherit;
  cursor: pointer;
}

.status-button .caret {
  width: 0;
  height: 0;
  margin-left: 0.28rem;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.75;
}

.status-button:hover { filter: brightness(0.96); }

.status-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.status-button[aria-expanded="true"] {
  box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.18);
}

.status-picker-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 0.4rem);
  left: 0;
  width: 23rem;
  max-width: calc(100vw - 2rem);
  padding: 0.7rem;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 14px 36px rgba(16, 26, 38, 0.2);
}

.status-picker-panel[hidden] { display: none; }

.status-picker-title {
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.status-options {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.1rem;
  max-height: 17rem;
  overflow-y: auto;
}

.status-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.4rem 0.45rem;
  border-radius: 6px;
  cursor: pointer;
}

.status-option:hover { background: var(--canvas); }

.status-option:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.62;
}

.status-option[data-mode="current"] {
  background: var(--accent-soft);
  opacity: 1;
}

.status-option input {
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0.12rem 0 0;
  accent-color: var(--accent);
}

.status-option-body { display: block; min-width: 0; }

.status-option-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
}

.status-option-note {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.status-option-note[hidden] { display: none; }

.status-picker-field { margin-top: 0.55rem; }

.status-picker-field[hidden] { display: none; }

.status-picker-field label {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.status-picker-field textarea,
.status-picker-field input[type="text"] {
  width: 100%;
  padding: 0.45rem 0.55rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.status-picker-field textarea { min-height: 3.6rem; resize: vertical; }

.status-picker-field [aria-invalid="true"] {
  border-color: var(--accent);
  border-width: 2px;
}

.status-picker-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

@media (max-width: 640px) {
  .status-picker { display: block; }

  .status-picker-panel {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-width: none;
    max-height: 82vh;
    overflow-y: auto;
    border-radius: 14px 14px 0 0;
    padding: 0.9rem 0.9rem 1.1rem;
  }

  .status-options { max-height: none; }

  .status-picker-actions .btn { flex: 1 1 auto; }
}

/* ---------- Cột "quá hạn chuyển trạng thái" (NHA-79) ---------- */

.stale-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid #f0b48a;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.tickets-table td[data-stale="1"] { background: #fff8f2; }
.tickets-table th[data-testid="th-stale"],
.tickets-table td[data-testid="td-stale"] { text-align: center; }

.ticket-card .stale-badge { margin-top: 0.25rem; }
