:root {
  --bg: #f6f7fb;
  --fg: #1f2430;
  --muted: #6b7280;
  --border: #e4e7ee;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #dbeafe;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --card: #ffffff;
  --code-bg: #f3f4f6;
}
body.theme-poster {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #dbeafe;
}
body.theme-taker {
  --primary: #16a34a;
  --primary-hover: #15803d;
  --primary-soft: #d1fae5;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: #fff; border-bottom: 1px solid var(--border);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; }
.topbar .brand a { color: var(--fg); font-weight: 700; font-size: 18px; }
.role-tag { font-size: 12px; padding: 2px 8px; border-radius: 4px; font-weight: 500; }
.role-tag-poster { background: #dbeafe; color: #1e40af; }
.role-tag-taker  { background: #d1fae5; color: #065f46; }
.role-switcher { margin: 0 6px; }
.btn-switch {
  background: var(--primary-soft); color: var(--primary); border: none;
  padding: 6px 12px; border-radius: 6px; cursor: pointer; font: inherit;
  font-size: 13px; font-weight: 500;
}
.btn-switch:hover { background: var(--primary); color: #fff; }
.nav { display: flex; align-items: center; gap: 16px; }
.nav .username { color: var(--muted); font-size: 14px; }
.nav .inline { display: inline; margin: 0; }
.nav .link {
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 0; font: inherit;
}
.nav .link:hover { color: var(--fg); }

.container { max-width: 920px; margin: 24px auto; padding: 0 16px; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 24px; margin-bottom: 16px;
}
.card h1 { margin: 0 0 16px; font-size: 22px; }
.card h2 { margin: 0 0 12px; font-size: 18px; }

.auth { max-width: 380px; margin: 48px auto; }
form label { display: block; margin-bottom: 14px; font-size: 14px; color: var(--muted); }
form input, form textarea, form select {
  display: block; width: 100%; margin-top: 6px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px;
  font: inherit; background: #fff; color: var(--fg);
}
form input:focus, form textarea:focus, form select:focus {
  outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary);
}
form textarea { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }
.req { color: var(--danger); }

button, .btn-primary, .btn-ghost, .btn-danger, .btn-success {
  display: inline-block; padding: 9px 18px; border-radius: 6px;
  border: 1px solid transparent; cursor: pointer; font: inherit;
  text-decoration: none; font-weight: 500;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { background: #f3f4f6; text-decoration: none; color: var(--fg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }

.actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; }
.alert {
  background: #fef2f2; color: #991b1b; border: 1px solid #fecaca;
  padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px;
}
.muted { color: var(--muted); font-size: 13px; }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 10px 16px; color: var(--muted); border-bottom: 2px solid transparent;
  font-size: 14px;
}
.tab:hover { color: var(--fg); text-decoration: none; }
.tab.active { color: var(--primary); border-color: var(--primary); font-weight: 500; }
.tab-count { display: none; }
.mobile-filter-drawer { display: none; }

table.orders { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.orders th, .orders td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
.orders th { background: #f9fafb; font-weight: 500; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
.orders tr:last-child td { border-bottom: none; }
.orders tr:hover { background: #fafbff; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-claimed { background: #dbeafe; color: #1e40af; }
.badge-disputed { background: #fee2e2; color: #991b1b; }
.badge-done { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #e5e7eb; color: #4b5563; }

.empty {
  text-align: center; padding: 48px 20px; color: var(--muted);
  background: #fff; border: 1px dashed var(--border); border-radius: 10px;
}

.order-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
.order-head h1 { margin: 0; flex: 1; }

.meta { display: grid; grid-template-columns: 100px 1fr; gap: 4px 16px; margin: 0 0 20px; font-size: 14px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }

.sensitive {
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px;
  padding: 14px 16px; margin-bottom: 16px;
}
.sensitive h3 { margin: 0 0 10px; font-size: 14px; }
.kv { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 8px; font-size: 14px; }
.kv .k { color: var(--muted); min-width: 70px; }
.kv .v { margin: 0; background: var(--code-bg); padding: 6px 10px; border-radius: 4px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; white-space: pre-wrap; word-break: break-all; flex: 1; }

.locked { padding: 18px; text-align: center; background: #f9fafb; border-radius: 8px; margin-bottom: 16px; }

.final-result { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 14px 16px; margin-bottom: 16px; }
.final-result h3 { margin: 0 0 8px; font-size: 14px; }
.final-result pre { margin: 0; white-space: pre-wrap; font-size: 13px; }

.feedback { list-style: none; padding: 0; margin: 0 0 16px; }
.fb { padding: 10px 12px; border-left: 3px solid var(--border); margin-bottom: 6px; background: #fafbfc; border-radius: 0 6px 6px 0; }
.fb-progress { border-left-color: var(--primary); }
.fb-result   { border-left-color: var(--success); }
.fb-note     { border-left-color: var(--warning); }
.fb-system   { border-left-color: var(--muted); background: #f3f4f6; font-style: italic; }
.fb-head { display: flex; gap: 10px; font-size: 12px; margin-bottom: 4px; align-items: center; }
.fb-author { font-weight: 500; }
.fb-kind { padding: 1px 6px; border-radius: 3px; background: #e5e7eb; color: var(--muted); font-size: 11px; }
.fb-body { font-size: 14px; white-space: pre-wrap; word-break: break-word; }

.feedback-form { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px; align-items: start; }
.feedback-form textarea { margin-top: 0; }
.feedback-form select { margin-top: 0; }
.feedback-form button { height: fit-content; }

/* Dashboard stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; }
.stat-n { font-size: 24px; font-weight: 600; color: var(--fg); }
.stat-l { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Filter bar */
.filter-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.filter-bar .filter-q { flex: 1; min-width: 200px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font: inherit; }
.filter-bar .filter-status { padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font: inherit; background: #fff; }
.filter-bar .filter-total { margin-left: auto; }

/* Pager */
.pager { display: flex; gap: 10px; justify-content: center; align-items: center; margin-top: 16px; }
.pager .btn-ghost.disabled { opacity: 0.4; pointer-events: none; }

/* Live indicator dot */
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #d1d5db; margin-left: 4px; transition: background 0.3s; }
.live-dot.live-on { background: var(--success); box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15); }

/* Hero banner on workspace dashboards */
.hero {
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(135deg, var(--primary-soft), #fff 70%);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 24px 28px; margin-bottom: 18px; gap: 16px; flex-wrap: wrap;
}
.hero h1 { margin: 0 0 6px; font-size: 22px; }
.hero p { margin: 0; }
.hero-cta { font-size: 15px; padding: 11px 22px; }
.hero-hint { display: flex; align-items: center; gap: 8px; }

.pulse-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--primary);
  box-shadow: 0 0 0 0 var(--primary); animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.6); }
  70%  { box-shadow: 0 0 0 10px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

/* Stat card as link variant */
.stat-link { display: block; color: inherit; text-decoration: none; transition: border-color 0.15s, transform 0.1s; }
.stat-link:hover { border-color: var(--primary); text-decoration: none; transform: translateY(-1px); }
.stat-active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.stat-hot .stat-n { color: var(--primary); }

/* Task grid (taker hall) */
.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.task-card {
  position: relative; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.task-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(0,0,0,0.04); }
.task-card .pin {
  position: absolute; top: 10px; right: 10px;
  background: var(--warning); color: #fff; font-size: 11px;
  padding: 2px 8px; border-radius: 10px; font-weight: 500;
}
.task-title { margin: 0; font-size: 16px; padding-right: 70px; }
.task-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.task-actions { display: flex; gap: 8px; margin-top: auto; }
.task-actions .btn-primary, .task-actions .btn-ghost { flex: 1; text-align: center; padding: 8px 12px; font-size: 13px; }

.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }

/* ---------- Ratings ---------- */
.rating-inline { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; vertical-align: middle; }
.stars {
  position: relative; display: inline-block;
  font-size: 13px; line-height: 1; letter-spacing: 2px;
  font-family: Arial, sans-serif;  /* consistent glyph width across OS */
}
.stars-bg { color: #d1d5db; }
.stars-fg {
  position: absolute; left: 0; top: 0;
  color: #facc15; overflow: hidden; white-space: nowrap;
}
.rating-num { font-weight: 600; color: var(--fg); }
.rating-count { font-size: 12px; }
.rating-empty { font-size: 12px; font-style: italic; }

.presence {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 5px;
  vertical-align: middle;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.presence-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 999px;
  background: #cbd5e1;
  box-shadow: 0 0 0 2px #f1f5f9;
}

.presence-online {
  color: #15803d;
}

.presence-online .presence-dot {
  background: #16a34a;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.16);
}

.presence-offline {
  color: #64748b;
}

/* Interactive star picker — row-reverse + sibling selectors for hover fill */
.star-picker {
  display: inline-flex; flex-direction: row-reverse;
  justify-content: flex-end; gap: 4px;
  margin-bottom: 12px;
}
.star-picker input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.star-picker label {
  cursor: pointer; font-size: 32px; line-height: 1;
  color: #d1d5db; transition: color 0.1s, transform 0.1s;
  margin: 0;
}
.star-picker label:hover { transform: scale(1.15); }
.star-picker input:checked ~ label,
.star-picker label:hover,
.star-picker label:hover ~ label { color: #facc15; }
.star-picker input:focus-visible + label { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Rating entry card (poster view after completion) */
.rate-card { border-left: 4px solid #facc15; }
.rate-card textarea { font-family: inherit; font-size: 14px; }
.rated-card { border-left: 4px solid var(--success); background: #fafffb; }
.rated-body { display: flex; align-items: center; gap: 14px; }
.rated-comment, .rr-comment, blockquote {
  margin: 10px 0 0; padding: 10px 14px;
  background: #f9fafb; border-left: 3px solid var(--border);
  color: var(--fg); font-style: italic; border-radius: 0 6px 6px 0;
}

/* Taker dashboard rating panel */
.hero-rating { margin-top: 8px; }
.rating-panel-head {
  display: grid; grid-template-columns: auto 1fr; gap: 32px;
  align-items: center; padding: 8px 4px 16px;
}
.rating-big { font-size: 44px; font-weight: 700; color: var(--primary); line-height: 1; }
.rating-breakdown { display: flex; flex-direction: column; gap: 4px; }
.br-row { display: grid; grid-template-columns: 30px 1fr 40px; gap: 10px; align-items: center; font-size: 13px; }
.br-label { color: var(--muted); font-weight: 500; }
.br-bar { height: 8px; background: #f3f4f6; border-radius: 4px; overflow: hidden; }
.br-fill { display: block; height: 100%; background: #facc15; transition: width 0.3s; }
.br-cnt { text-align: right; font-size: 12px; }

.rating-recent-h { font-size: 14px; margin: 16px 0 8px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 14px; }
.rating-recent { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.rating-recent li { padding: 0; }
.rr-head { display: flex; align-items: center; gap: 10px; font-size: 12px; }

/* ---------- M1: Priority, SLA, deadline, alerts ---------- */

/* Priority badge (only shown for non-normal values) */
.prio {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 12px; font-weight: 600; line-height: 1.4;
}
.prio-urgent { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.prio-high   { background: #ffedd5; color: #9a3412; border: 1px solid #fed7aa; }
.prio-low    { background: #f3f4f6; color: #6b7280; border: 1px solid var(--border); }

/* Row-level SLA tint on tables and task cards */
.orders tr.sla-overdue td      { background: #fef2f2; }
.orders tr.sla-overdue:hover td{ background: #fee2e2; }
.orders tr.sla-urgent td       { background: #fffbeb; }
.orders tr.sla-urgent:hover td { background: #fef3c7; }
.orders tr.sla-stale_pickup td { background: #fff7ed; }

.task-card.sla-overdue { border-color: #fca5a5; box-shadow: inset 3px 0 0 var(--danger); }
.task-card.sla-urgent  { border-color: #fcd34d; box-shadow: inset 3px 0 0 var(--warning); }
.task-card.sla-stale_pickup { border-color: #fdba74; }

/* Deadline text color mirrors SLA bucket */
.deadline { font-size: 13px; font-weight: 500; }
.deadline-overdue { color: var(--danger); }
.deadline-urgent  { color: var(--warning); }
.deadline-stale_pickup { color: var(--warning); }

/* Task card urgency pin variants */
.pin-urgent { background: var(--danger); }
.pin-high   { background: var(--warning); }
.pin-assign { background: var(--warning); }

/* Top alert strip shown above dashboards when urgent/overdue > 0 */
.alert-bar {
  padding: 12px 16px; border-radius: 8px; margin-bottom: 16px;
  font-size: 14px; border: 1px solid transparent;
}
.alert-bar a { text-decoration: underline; }
.alert-warn   { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-danger { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-inline { margin-top: 6px; margin-bottom: 16px; }

/* new_order.html form — 3-column row for priority / deadline / expected_hours */
.form-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin-bottom: 4px;
}
.form-row label { margin-bottom: 10px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* Secondary row text inside table cells (used for email under title) */
.row-sub { font-size: 12px; margin-top: 2px; }

/* ---------- M2: Admin panel, dispute, frozen ---------- */

.nav-admin {
  padding: 6px 10px; border-radius: 6px;
  background: #ede9fe; color: #6d28d9; font-weight: 500; font-size: 13px;
}
.nav-admin:hover { background: #ddd6fe; text-decoration: none; }

.admin-head { margin-bottom: 8px; }
.admin-head h1 { margin: 0 0 4px; font-size: 22px; }
.admin-tabs {
  display: flex; gap: 4px; margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.admin-tab {
  padding: 10px 20px; color: var(--muted); font-size: 14px;
  border-bottom: 2px solid transparent;
}
.admin-tab:hover { color: var(--fg); text-decoration: none; }
.admin-tab.active { color: #6d28d9; border-color: #6d28d9; font-weight: 500; }
.admin-note { margin: 8px 0 14px; font-size: 13px; }

.admin-table td { vertical-align: top; font-size: 13px; }
.admin-table .dispute-cell { max-width: 320px; color: var(--fg); }
.admin-table .dispute-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-table .action-cell { display: flex; gap: 6px; flex-wrap: wrap; white-space: nowrap; }
.admin-users-mobile-list { display: none; }
.admin-card-layout {
  display: grid;
  gap: 16px;
}
.admin-card-tool,
.admin-card-recent {
  margin-bottom: 0;
}
.admin-card-tool h2,
.admin-card-recent h2 {
  font-size: var(--text-lg);
  margin-bottom: 6px;
}
.admin-card-form {
  display: grid;
  gap: 12px;
}
.admin-generated-cards {
  display: grid;
  gap: 8px;
}
.admin-generated-cards p {
  margin: 0;
  color: #166534;
  font-size: var(--text-sm);
}
.admin-generated-cards textarea {
  min-height: 92px;
  margin: 0;
  color: var(--fg);
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.card-cancel-form {
  display: flex;
  gap: 6px;
  align-items: center;
}
.card-cancel-form input {
  width: 150px;
  height: 28px;
  margin: 0;
  padding: 0 8px;
  font-size: var(--text-xs);
}
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 5px; }

.user-frozen td { background: #fef9f9; }
.user-frozen strong { color: var(--danger); }

.reset-pw {
  display: inline-block; padding: 3px 8px; background: #fee2e2;
  color: #991b1b; border-radius: 4px; font-family: ui-monospace, monospace;
  font-size: 15px; font-weight: 600; letter-spacing: 0.5px;
}

/* Dispute reason quoted in order detail banner */
.dispute-reason {
  margin: 8px 0 6px; padding: 8px 12px;
  background: rgba(255,255,255,0.6); border-left: 3px solid var(--danger);
  color: #7f1d1d; font-style: normal; border-radius: 0 6px 6px 0;
}

/* Dispute button — keep muted so it doesn't feel punitive */
.btn-dispute { color: #9a3412; border-color: #fed7aa; }
.btn-dispute:hover { background: #fff7ed; color: #7c2d12; }

/* Audit table: compact + wrap long JSON payloads */
.audit-table td { font-size: 12px; }
.audit-table .audit-action {
  background: #f3f4f6; padding: 2px 6px; border-radius: 4px;
  font-size: 12px; color: var(--fg);
}
.audit-payload {
  max-width: 360px; white-space: pre-wrap; word-break: break-all;
  color: var(--muted); font-size: 11px;
}

/* ===== Mode badge ===== */
.mode-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 12px; font-weight: 500; letter-spacing: 0.5px;
}
.mode-badge-paste   { background: #e0f2fe; color: #075985; }
.mode-badge-forward { background: #fef3c7; color: #854d0e; }
.mode-badge-auto    { background: #f3e8ff; color: #6b21a8; }

.badge-soft {
  font-size: 10px; padding: 1px 6px; border-radius: 8px;
  background: #fef3c7; color: #854d0e; margin-left: 4px;
}

/* ===== New-order mode picker ===== */
.mode-picker { border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; margin-bottom: 12px; }
.mode-picker legend { padding: 0 6px; font-weight: 500; }
.mode-opt {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px;
  margin-bottom: 8px; cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.mode-opt:hover { border-color: var(--primary); }
.mode-opt input[type="radio"] { margin-top: 4px; }
.mode-opt input[type="radio"]:checked ~ .mode-body { color: var(--fg); }
.mode-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.mode-body strong { display: inline-block; margin-bottom: 2px; }
.mode-body .muted { font-size: 13px; line-height: 1.45; }

/* ===== Mode panel on detail page ===== */
.mode-panel {
  margin: 16px 0; padding: 14px 16px;
  border-radius: 8px; border: 1px solid var(--border);
  background: #fafbfc;
}
.mode-panel h3 { margin: 0 0 8px; font-size: 15px; }
.mode-panel-paste   { border-left: 4px solid #0ea5e9; }
.mode-panel-forward { border-left: 4px solid #f59e0b; }
.mode-panel-auto    { border-left: 4px solid #a855f7; }
.mode-panel .info-row { padding: 4px 0; }

.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input[type="text"], .inline-form input[type="email"],
.inline-form input[type="password"], .inline-form input:not([type]) {
  flex: 1; min-width: 200px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 6px; font: inherit;
}
.inline-form select {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font: inherit;
}
.paste-form input[name="content"] { font-family: ui-monospace, Menlo, monospace; }

.copybox {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin: 8px 0;
  background: #fff; border: 1px dashed var(--border); border-radius: 6px;
}
.copybox code, .copybox a {
  flex: 1; font-size: 16px; font-family: ui-monospace, Menlo, monospace;
  word-break: break-all; color: var(--fg);
}

/* ===== Timeline ===== */
.timeline {
  list-style: none; margin: 0; padding: 0;
  position: relative; padding-left: 22px;
}
.timeline::before {
  content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px;
  width: 2px; background: var(--border);
}
.tl-item {
  position: relative; padding: 8px 0 10px; display: flex; gap: 10px; align-items: flex-start;
}
.tl-dot {
  position: absolute; left: -18px; top: 11px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 2px solid var(--muted);
}
.tl-actor-system .tl-dot { border-color: #a855f7; }
.tl-actor-poster .tl-dot { border-color: #2563eb; }
.tl-actor-taker  .tl-dot { border-color: #16a34a; }
.tl-body { flex: 1; }
.tl-label { font-weight: 500; color: var(--fg); }
.tl-detail {
  font-size: 13px; color: var(--muted); margin-top: 2px;
  font-family: ui-monospace, Menlo, monospace;
  word-break: break-all;
}
.tl-time { font-size: 12px; margin-top: 2px; }
.tl-new { animation: tl-slide-in 0.35s ease-out; }
@keyframes tl-slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Toast notifications ===== */
.toast-stack {
  position: fixed; top: 68px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
  max-width: 360px; width: calc(100vw - 40px);
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; background: #fff;
  border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: 8px; box-shadow: 0 6px 16px rgba(0,0,0,0.08);
  font-size: 14px; line-height: 1.4; color: var(--fg);
  pointer-events: auto;
  opacity: 0; transform: translateX(20px);
  transition: opacity 0.25s ease-out, transform 0.25s ease-out;
}
.toast-in  { opacity: 1; transform: translateX(0); }
.toast-out { opacity: 0; transform: translateX(20px); }
.toast-text { flex: 1; word-break: break-word; }
.toast-clickable { cursor: pointer; }
.toast-clickable:hover { border-left-color: var(--primary-hover); background: #f8fafc; }
.toast-close {
  background: none; border: none; font-size: 18px; line-height: 1;
  color: var(--muted); cursor: pointer; padding: 0 4px;
}
.toast-close:hover { color: var(--fg); }

/* ===== Notify bell ===== */
.btn-bell {
  background: none; border: none; font-size: 18px; cursor: pointer;
  padding: 4px 6px; border-radius: 6px; line-height: 1;
  touch-action: manipulation;
}
.btn-bell:hover { background: var(--primary-soft); }
.btn-bell[data-perm="denied"] { opacity: 0.5; cursor: not-allowed; }
.btn-bell-alert {
  background: #fef2f2;
  color: #b91c1c;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14);
}

/* ===== Brand wordmark ===== */
.brand-name {
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  letter-spacing: -0.01em;
}
.brand-tld {
  color: var(--muted); font-weight: 400; margin-left: 1px;
}
.brand-name:hover .brand-tld { color: var(--primary); }

/* Auth page tagline */
.auth-tagline { margin-top: -6px; margin-bottom: 14px; font-size: 13px; }

/* ===== Task card live-update animations ===== */
.task-card.tl-new {
  animation: card-slide-in 0.5s ease-out;
  box-shadow: 0 0 0 2px var(--primary-soft);
}
@keyframes card-slide-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.task-card-leaving {
  transition: opacity 0.3s, transform 0.3s;
  opacity: 0; transform: translateX(20px);
  pointer-events: none;
}

/* ============================================================
   Landing page
   ============================================================ */
.hero-landing {
  margin: -20px -20px 0; padding: 60px 24px 56px;
  background: radial-gradient(1200px 500px at 50% -10%, rgba(37,99,235,0.12), transparent 70%),
              linear-gradient(180deg, #f5f7ff 0%, #fafbfc 100%);
  border-radius: 12px; text-align: center;
}
.hero-landing-inner { max-width: 780px; margin: 0 auto; }
.hero-landing-h1 {
  font-size: 42px; line-height: 1.2; margin: 0 0 16px;
  font-weight: 700; letter-spacing: -0.02em;
}
.hero-accent {
  background: linear-gradient(90deg, #2563eb, #16a34a);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-landing-sub { font-size: 17px; line-height: 1.6; color: var(--muted); margin: 0 0 28px; }
.hero-landing-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn-big { padding: 13px 28px; font-size: 15px; border-radius: 8px; font-weight: 500; }

.marketing-section { padding: 56px 0 20px; }
.marketing-section.alt {
  background: #fafbfc; margin: 20px -20px; padding: 56px 24px;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.section-title { font-size: 24px; text-align: center; margin: 0 0 8px; }
.section-sub   { text-align: center; font-size: 15px; margin: 0 0 28px; max-width: 620px; margin-left: auto; margin-right: auto; }

.feature-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px; margin-top: 24px;
}
.feature-card {
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 24px 22px; transition: transform 0.15s, box-shadow 0.15s;
}
.feature-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.05); }
.feature-icon { font-size: 32px; margin-bottom: 12px; }
.feature-card h3 { margin: 0 0 8px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.feature-paste   { border-top: 3px solid #0ea5e9; }
.feature-forward { border-top: 3px solid #f59e0b; }
.feature-auto    { border-top: 3px solid #a855f7; }
.tag-good     { background: #dcfce7; color: #166534; font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 500; }
.tag-neutral  { background: #e0e7ff; color: #3730a3; font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 500; }
.tag-advanced { background: #fae8ff; color: #86198f; font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 500; }
.feature-flow { list-style: none; padding: 0; margin: 16px 0 0; color: var(--muted); font-size: 14px; }
.feature-flow li { padding: 4px 0; }

.timeline-demo {
  max-width: 480px; margin: 24px auto 0; padding: 20px 24px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
}
.td-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0; font-size: 14px;
}
.td-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.td-sys .td-dot    { background: #a855f7; }
.td-poster .td-dot { background: #2563eb; }
.td-taker .td-dot  { background: #16a34a; }
.td-label { flex: 1; }
.td-t { font-size: 12px; }

.trust-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px; margin-top: 20px;
}
.trust-card {
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 20px 18px;
}
.trust-icon { font-size: 24px; margin-bottom: 8px; }
.trust-card h4 { margin: 0 0 6px; font-size: 15px; }
.trust-card p { margin: 0; font-size: 13px; line-height: 1.5; }

.marketing-cta {
  text-align: center; padding: 56px 24px 40px; margin-top: 12px;
  background: linear-gradient(135deg, var(--primary-soft) 0%, #fff 100%);
  border-radius: 12px;
}
.marketing-cta h2 { margin: 0 0 8px; font-size: 22px; }
.marketing-cta .btn-primary { margin-top: 16px; }

.landing-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 30px 0 20px; font-size: 13px;
  border-top: 1px solid var(--border); margin-top: 20px;
}

/* ============================================================
   Mobile responsive pass
   ============================================================ */
@media (max-width: 720px) {
  .container { padding: 12px 14px; }

  /* Topbar: stack brand + nav; shrink gaps; allow wrap */
  .topbar {
    padding: 10px 14px;
  }
  .topbar-inner {
    flex-wrap: wrap;
    gap: 10px;
  }
  .topbar .brand { flex: 1; min-width: 0; }
  .nav {
    width: 100%;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .nav-cluster {
    gap: 6px;
    padding: 5px 6px;
    flex-wrap: wrap;
  }
  .nav .username { display: none; }          /* low-value on mobile */
  .role-switcher { margin: 0; }
  .nav .btn-switch { padding: 0 10px; font-size: 12px; }
  .role-tag { height: 24px; font-size: 10px; padding: 0 8px; }
  .nav a, .nav button { font-size: 14px; }

  .card {
    padding: 20px 22px;
    margin-bottom: 16px;
  }

  .page-header {
    margin: 14px 0 20px;
  }

  .page-crumb {
    margin-bottom: 8px;
  }

  /* Toast full width with safe margins */
  .toast-stack { top: auto; bottom: 12px; right: 10px; left: 10px; max-width: none; }
  .toast { padding: 10px 12px; font-size: 13px; }

  /* Landing hero tighter */
  .hero-landing { padding: 38px 18px 36px; margin: -12px -14px 0; }
  .hero-landing-h1 { font-size: 28px; }
  .hero-landing-sub { font-size: 15px; }
  .marketing-section { padding: 40px 0 14px; }
  .marketing-section.alt { margin: 14px -14px; padding: 40px 18px; }

  /* Cards / grids → single column (grid-auto-fit already handles most) */
  .task-grid { grid-template-columns: 1fr; }
  .feature-grid, .trust-grid { grid-template-columns: 1fr; }

  /* Tables: horizontal scroll instead of breaking layout */
  .orders { display: block; overflow-x: auto; }
  .orders thead, .orders tbody, .orders tr { display: table; width: 100%; table-layout: fixed; }

  /* Detail meta list: stack dt/dd instead of grid side-by-side */
  dl.meta { grid-template-columns: 1fr; gap: 4px 0; }
  dl.meta dt { padding-top: 10px; }

  /* New-order form: stack rows */
  .form-row { grid-template-columns: 1fr; }

  /* Mode picker cards: a bit tighter */
  .mode-opt { padding: 10px; }

  /* KPI stats: 2 cols on narrow */
  .stats { grid-template-columns: repeat(2, 1fr); }

  /* Hero banner in dashboards: stack */
  .hero { padding: 18px 20px; }
  .hero h1 { font-size: 18px; }
  .hero-cta { width: 100%; text-align: center; }

  /* Landing footer: stack */
  .landing-footer { flex-direction: column; gap: 6px; text-align: center; }
}

@media (max-width: 460px) {
  .topbar {
    padding: 9px 10px;
  }
  .topbar-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }
  .nav {
    width: auto;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .nav-cluster {
    width: auto;
    max-width: 100%;
    padding: 4px 5px;
  }
  .topbar .brand {
    gap: 8px;
  }
  .role-tag {
    display: none;
  }
  .topbar .brand a {
    font-size: 16px;
  }
  .nav .btn-primary {
    height: 32px;
    padding: 0 12px;
  }
  .nav .btn-switch,
  .nav .btn-bell,
  .nav .nav-admin,
  .nav .link {
    height: 30px;
  }
  .nav .btn-switch {
    padding: 0 10px;
  }
  .container {
    padding: 10px;
  }
  .card {
    padding: 16px;
    margin-bottom: 14px;
    border-radius: 14px;
  }
  .page-header {
    margin: 10px 0 16px;
  }
  .hero-landing-h1 { font-size: 24px; }
  .btn-big { padding: 11px 20px; font-size: 14px; width: 100%; }
  .hero-landing-cta { flex-direction: column; }
  .nav a, .nav button { font-size: 13px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-n { font-size: 22px; }
}

/* ============================================================
   Accessibility
   ============================================================ */
.skip-link {
  position: absolute; left: -9999px; top: 8px;
  background: var(--primary); color: #fff;
  padding: 8px 14px; border-radius: 6px; z-index: 10000;
  font-size: 14px; text-decoration: none;
}
.skip-link:focus { left: 8px; }

/* Stronger focus outline for keyboard users; mouse users unaffected */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 3px;
}
button:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
/* Don't clobber button border-radius with the default box */
.btn-primary:focus-visible, .btn-ghost:focus-visible,
.btn-danger:focus-visible, .btn-success:focus-visible {
  outline-offset: 3px;
}

/* Screen-reader-only utility */
.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;
}

/* main content should not show its focus outline (it's programmatic-focus only) */
main[tabindex="-1"]:focus { outline: none; }

/* ===== Error page ===== */
.error-page { text-align: center; padding: 80px 20px 40px; max-width: 520px; margin: 0 auto; }
.error-code {
  font-size: 72px; font-weight: 700; color: var(--primary);
  letter-spacing: -0.03em; margin-bottom: 8px; line-height: 1;
}
.error-title { font-size: 22px; margin: 0 0 10px; }
.error-hint  { font-size: 15px; margin: 0 0 24px; }
.error-actions { display: flex; gap: 10px; justify-content: center; }

/* Toast variants */
.toast-success { border-left-color: var(--success); }
.toast-danger  { border-left-color: var(--danger); }
.toast-warn    { border-left-color: var(--warning); }

/* ============================================================
   Motion polish — entrances, micro-interactions, hover depth
   ============================================================ */

/* Respect users who opt out of motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Hero on landing: slide up + fade */
.hero-landing-inner {
  animation: hero-rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes hero-rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Feature cards staggered entrance */
.feature-grid .feature-card {
  animation: card-rise 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.feature-grid .feature-card:nth-child(1) { animation-delay: 0.10s; }
.feature-grid .feature-card:nth-child(2) { animation-delay: 0.22s; }
.feature-grid .feature-card:nth-child(3) { animation-delay: 0.34s; }
@keyframes card-rise {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Trust cards same treatment but quicker cascade */
.trust-grid .trust-card {
  animation: card-rise 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.trust-grid .trust-card:nth-child(1) { animation-delay: 0.06s; }
.trust-grid .trust-card:nth-child(2) { animation-delay: 0.14s; }
.trust-grid .trust-card:nth-child(3) { animation-delay: 0.22s; }
.trust-grid .trust-card:nth-child(4) { animation-delay: 0.30s; }

/* Timeline demo rows cascade */
.timeline-demo .td-row {
  animation: row-slide 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.timeline-demo .td-row:nth-child(1) { animation-delay: 0.05s; }
.timeline-demo .td-row:nth-child(2) { animation-delay: 0.15s; }
.timeline-demo .td-row:nth-child(3) { animation-delay: 0.25s; }
.timeline-demo .td-row:nth-child(4) { animation-delay: 0.35s; }
.timeline-demo .td-row:nth-child(5) { animation-delay: 0.45s; }
@keyframes row-slide {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Button press-down micro-interaction */
.btn-primary, .btn-ghost, .btn-success, .btn-danger, .btn-switch, .btn-big {
  transition: transform 0.08s ease-out, background 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out, box-shadow 0.15s ease-out;
}
.btn-primary:active, .btn-ghost:active, .btn-success:active, .btn-danger:active, .btn-switch:active, .btn-big:active {
  transform: translateY(1px) scale(0.985);
}

/* Hero CTA gets a subtle lift on hover */
.hero-landing-cta .btn-big:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.25);
}

/* Nav links — underline slides in from left */
.nav a:not(.btn-primary):not(.nav-admin) {
  position: relative;
  padding-bottom: 2px;
}
.nav a:not(.btn-primary):not(.nav-admin)::after {
  content: "";
  position: absolute; left: 0; bottom: 0;
  height: 2px; width: 100%;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease-out;
}
.nav a:not(.btn-primary):not(.nav-admin):hover::after,
.nav a:not(.btn-primary):not(.nav-admin):focus-visible::after {
  transform: scaleX(1);
}

/* Toast — entry uses cubic spring easing */
.toast-in { transition: opacity 0.28s ease-out, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* Feature card hover gets a bit more personality */
.feature-card {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease-out, border-color 0.2s ease-out;
}
.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
}

/* Marketing CTA section pulse (subtle) */
.marketing-cta .btn-primary {
  position: relative;
  overflow: hidden;
}
.marketing-cta .btn-primary::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255,255,255,0.35), transparent 60%);
  opacity: 0; transition: opacity 0.2s;
  pointer-events: none;
}
.marketing-cta .btn-primary:hover::after { opacity: 1; }

/* Form inputs — smoother focus */
input:focus, select:focus, textarea:focus {
  transition: border-color 0.15s, box-shadow 0.15s;
}

/* Stats cards on dashboards — subtle lift on hover */
.stat-link {
  transition: transform 0.18s ease-out, border-color 0.15s, box-shadow 0.2s;
}
.stat-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.06);
}

/* Mode panel cards entrance on detail page */
.mode-panel {
  animation: card-rise 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ============================================================
   Typography: Inter (variable) + refined scale
   ============================================================ */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;          /* variable axis */
  font-display: swap;
  src: url("/static/fonts/Inter.woff2") format("woff2-variations"),
       url("/static/fonts/Inter.woff2") format("woff2");
  font-feature-settings: "cv11", "ss01", "ss03";  /* single-story a, open digits */
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display",
               "Segoe UI", "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", system-ui, sans-serif;
  font-feature-settings: "cv11" 1, "ss01" 1, "ss03" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-size: 15.5px;
  line-height: 1.55;
  letter-spacing: -0.005em;
}

h1, h2, h3, h4 {
  letter-spacing: -0.02em;
  font-weight: 650;              /* between semibold and bold, Inter looks great here */
}

.brand-name { letter-spacing: -0.03em; font-weight: 700; }
.hero-landing-h1 {
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.035em;
}
.hero-accent { font-weight: 700; }

.section-title { font-size: clamp(20px, 2.5vw, 26px); letter-spacing: -0.025em; }
.muted { letter-spacing: 0; }

code, pre, .mono, .brand-name .brand-tld {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code", Menlo, monospace;
  font-feature-settings: "zero" 1, "ss02" 1;  /* slashed zero */
}

/* Stat numbers — tabular figures so counter-up doesn't shift width */
.stat-n, .rating-big, .error-code {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: -0.02em;
}

/* ============================================================
   Input focus glow — subtle ring instead of OS default
   ============================================================ */
input:not([type="radio"]):not([type="checkbox"]),
select, textarea {
  border-radius: 6px;
}
input:focus:not([type="radio"]):not([type="checkbox"]),
select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ============================================================
   Word-by-word hero headline reveal
   ============================================================ */
.hero-landing-h1 .w {
  display: inline-block;
  opacity: 0;
  transform: translateY(8px);
  animation: word-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes word-in {
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   KPI number entrance — slight blur resolves
   ============================================================ */
.stat-n {
  animation: num-in 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes num-in {
  from { opacity: 0; filter: blur(4px); transform: translateY(6px); }
  to   { opacity: 1; filter: blur(0);   transform: translateY(0); }
}

/* ============================================================
   Dashboard v2 — poster.html + taker.html visual redesign
   These rules come AFTER the originals so they override via cascade.
   ============================================================ */

/* ---- Hero: lighter, flatter, with accent bar ---- */
.hero {
  padding: 28px 32px;
  background: #fff;
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
  margin-bottom: 20px;
  gap: 24px;
  animation: card-rise 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.hero h1 {
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.025em;
  margin: 0 0 6px;
}
.hero p { font-size: 14px; color: var(--muted); margin: 0; }
.hero-cta {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  white-space: nowrap;
}

.hero-hint {
  background: var(--primary-soft);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--primary-hover);
}

/* ---- KPI stats ---- */
.stats {
  gap: 14px;
  margin-bottom: 24px;
}
.stat {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  animation: card-rise 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.stats .stat:nth-child(1) { animation-delay: 0.05s; }
.stats .stat:nth-child(2) { animation-delay: 0.10s; }
.stats .stat:nth-child(3) { animation-delay: 0.15s; }
.stats .stat:nth-child(4) { animation-delay: 0.20s; }
.stats .stat:nth-child(5) { animation-delay: 0.25s; }
.stats .stat:nth-child(6) { animation-delay: 0.30s; }

.stat-n {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--fg);
}
.stat-l {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}
.stat-link:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(17, 24, 39, 0.06);
}
.stat-link:hover .stat-n { color: var(--primary); }
.stat-hot .stat-n { color: var(--primary); }
.stat-hot::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--primary);
}
.stat-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), 0 4px 12px rgba(37, 99, 235, 0.12);
}

/* ---- Filter bar: card-like container ---- */
.filter-bar {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  gap: 10px;
  margin-bottom: 14px;
}
.filter-bar .filter-q,
.filter-bar .filter-status {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  background: #fcfcfd;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.filter-bar .filter-q:focus,
.filter-bar .filter-status:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  outline: none;
}
.filter-bar .filter-total {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---- Tabs: sliding pill indicator ---- */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding: 0 2px;
}
.tab {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  position: relative;
  transition: color 0.15s;
  border-radius: 6px 6px 0 0;
}
.tab:hover { color: var(--fg); background: #f9fafb; }
.tab.active { color: var(--primary); font-weight: 600; }
.tab.active::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: -1px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
  animation: tab-slide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes tab-slide {
  from { transform: scaleX(0); opacity: 0; }
  to   { transform: scaleX(1); opacity: 1; }
}

/* ---- Orders table v2 ---- */
.orders {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.03);
  animation: card-rise 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.1s;
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}
.orders th {
  background: #fafbfc;
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
}
.orders td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.orders tr:last-child td { border-bottom: none; }
.orders tr:hover td { background: #fafbff; }
.row-sub { font-size: 12px; margin-top: 2px; }

/* ---- Task cards v2 (hall grid) ---- */
.task-grid {
  gap: 16px;
  margin-bottom: 16px;
}
.task-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  gap: 12px;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.03);
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
  animation: card-rise 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.task-card:nth-child(1) { animation-delay: 0.05s; }
.task-card:nth-child(2) { animation-delay: 0.10s; }
.task-card:nth-child(3) { animation-delay: 0.15s; }
.task-card:nth-child(4) { animation-delay: 0.20s; }
.task-card:nth-child(n+5) { animation-delay: 0.25s; }
.task-card:hover {
  border-color: var(--primary);
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.08);
  transform: translateY(-2px);
}
.task-card .task-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
  padding-right: 80px;
  margin: 0;
}
.task-card .task-meta {
  font-size: 13px;
  color: var(--muted);
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.task-card .task-meta strong { color: var(--fg); font-weight: 600; }
.task-card .pin {
  position: absolute; top: 12px; right: 12px;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.task-card .pin-urgent { background: #fef2f2; color: #b91c1c; }
.task-card .pin-high   { background: #fff7ed; color: #c2410c; }
.task-card .pin-assign { background: #fef3c7; color: #92400e; }
.task-card .task-actions { margin-top: 4px; gap: 10px; }
.task-card .task-actions .btn-primary,
.task-card .task-actions .btn-ghost { padding: 9px 14px; font-size: 13px; }

/* ---- Empty state ---- */
.empty {
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

/* ---- Rating panel on taker dashboard ---- */
.rating-panel {
  padding: 24px 28px;
  margin-bottom: 20px;
  animation: card-rise 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.08s;
}
.rating-panel-head {
  display: flex;
  gap: 32px;
  align-items: center;
  flex-wrap: wrap;
}
.rating-big {
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--primary);
}
.rating-breakdown { flex: 1; min-width: 220px; }
.br-row { display: flex; align-items: center; gap: 10px; padding: 3px 0; font-size: 13px; }
.br-label { width: 24px; color: var(--muted); font-weight: 500; }
.br-bar { flex: 1; height: 6px; background: #f3f4f6; border-radius: 999px; overflow: hidden; }
.br-fill {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-hover));
  animation: bar-fill 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes bar-fill { from { width: 0 !important; } }
.br-cnt { width: 32px; text-align: right; font-variant-numeric: tabular-nums; }
.rating-recent-h {
  font-size: 13px; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  margin: 20px 0 10px;
}
.rating-recent { list-style: none; padding: 0; margin: 0; }
.rating-recent li {
  padding: 10px 0;
  border-top: 1px solid var(--border);
  font-size: 14px;
}
.rating-recent li:first-child { border-top: none; }
.rr-head { display: flex; align-items: center; gap: 10px; }
.rr-comment {
  margin: 6px 0 0;
  padding: 8px 12px;
  border-left: 3px solid var(--primary-soft);
  background: #fafbfc;
  color: var(--fg);
  font-size: 13px;
  border-radius: 0 6px 6px 0;
  font-style: normal;
}

/* ---- SLA-colored rows: softer tints so they don't scream ---- */
.orders tr.sla-overdue td       { background: #fef7f7; }
.orders tr.sla-overdue:hover td { background: #fef2f2; }
.orders tr.sla-urgent td        { background: #fffcf5; }
.orders tr.sla-urgent:hover td  { background: #fff7ed; }

/* ---- Alert bar refinement ---- */
.alert-bar {
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  animation: card-rise 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ---- Pager refinement ---- */
.pager {
  display: flex; gap: 6px; align-items: center; justify-content: center;
  margin-top: 18px;
  font-size: 14px;
}
.pager .btn-ghost {
  padding: 7px 14px;
  font-size: 13px;
  border-radius: 6px;
}
.pager .disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Mode badge refinement ---- */
.mode-badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* ---- Deadline badge ---- */
.deadline {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  padding: 2px 8px;
  border-radius: 6px;
  background: #f3f4f6;
  color: var(--muted);
}
.deadline.deadline-urgent     { background: #fff7ed; color: #c2410c; }
.deadline.deadline-overdue    { background: #fef2f2; color: #b91c1c; font-weight: 600; }

/* ---- Priority pill ---- */
.prio {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.prio-urgent { background: #fef2f2; color: #b91c1c; }
.prio-high   { background: #fff7ed; color: #c2410c; }
.prio-low    { background: #f3f4f6; color: var(--muted); }

/* ---- Status badge (top-right of rows/cards) ---- */
.badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.04em;
  display: inline-block;
}
.badge-pending    { background: #fef3c7; color: #92400e; }
.badge-claimed    { background: #dbeafe; color: #1e40af; }
.badge-disputed   { background: #fef2f2; color: #b91c1c; }
.badge-done       { background: #dcfce7; color: #166534; }
.badge-cancelled  { background: #f3f4f6; color: var(--muted); }

/* ============================================================
   ============================================================
   DESIGN SYSTEM v3 — minimal, confident, international-grade
   Everything below supersedes earlier rules by cascade order.
   Principles: one accent color · grayscale neutrals · generous
   whitespace · restrained motion · no decoration without purpose.
   ============================================================
   ============================================================ */

:root {
  /* Neutral palette — Zinc (Tailwind-compatible) */
  --gray-50:  #fafafa;
  --gray-100: #f4f4f5;
  --gray-200: #e4e4e7;
  --gray-300: #d4d4d8;
  --gray-400: #a1a1aa;
  --gray-500: #71717a;
  --gray-600: #52525b;
  --gray-700: #3f3f46;
  --gray-800: #27272a;
  --gray-900: #18181b;
  --gray-950: #09090b;

  /* Single accent — kept per-theme so poster=blue, taker=green */
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;

  /* Semantic reassignment */
  --fg: var(--gray-900);
  --muted: var(--gray-500);
  --border: var(--gray-200);
  --bg: #ffffff;
  --bg-subtle: var(--gray-50);

  /* Legacy tokens still referenced in old rules */
  --primary: var(--accent);
  --primary-hover: var(--accent-hover);
  --primary-soft: var(--accent-soft);
  --success: #16a34a;
  --danger:  #dc2626;
  --warning: #d97706;
  --card: var(--bg);

  /* Type scale */
  --text-xs: 12px;   --text-sm: 13px;  --text-base: 14px;
  --text-md: 15px;   --text-lg: 17px;  --text-xl: 20px;
  --text-2xl: 24px;  --text-3xl: 32px; --text-4xl: 44px;
  --text-5xl: 56px;  --text-6xl: 72px;

  /* Radius */
  --r-sm: 4px; --r: 6px; --r-md: 8px; --r-lg: 10px; --r-xl: 14px;

  /* Shadow (subtle) */
  --shadow-sm: 0 1px 2px rgba(9, 9, 11, 0.04);
  --shadow:    0 1px 3px rgba(9, 9, 11, 0.05), 0 1px 2px rgba(9, 9, 11, 0.03);
  --shadow-md: 0 4px 12px rgba(9, 9, 11, 0.06);
}

body.theme-poster {
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --primary: var(--accent);
  --primary-hover: var(--accent-hover);
  --primary-soft: var(--accent-soft);
}
body.theme-taker {
  --accent: #16a34a;
  --accent-hover: #15803d;
  --accent-soft: #f0fdf4;
  --primary: var(--accent);
  --primary-hover: var(--accent-hover);
  --primary-soft: var(--accent-soft);
}

body {
  background: var(--bg);
  color: var(--fg);
  font-size: var(--text-md);
  line-height: 1.55;
}

.container { padding: 24px 20px; max-width: 1200px; margin: 0 auto; }

h1, h2, h3, h4 { letter-spacing: -0.022em; color: var(--fg); font-weight: 650; margin: 0; }

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

/* -------- Top bar -------- */
.topbar {
  display: block;
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.topbar .brand a { font-size: 17px; font-weight: 700; letter-spacing: -0.03em; color: var(--fg); }
.topbar .brand a .brand-tld { color: var(--muted); font-weight: 500; }
.role-tag {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--gray-700);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}
.nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  font-size: var(--text-base);
  flex: 1 1 auto;
  min-width: 0;
}
.nav-cluster {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}
.nav-primary {
  padding-right: 10px;
}
.nav-utility {
  background: var(--bg-subtle);
}
.nav a { color: var(--gray-700); text-decoration: none; font-weight: 500; }
.nav a:hover { color: var(--fg); }
.nav .inline {
  display: inline-flex;
  align-items: center;
  margin: 0;
}
.nav .username {
  color: var(--muted);
  font-size: var(--text-sm);
  padding: 0 2px 0 4px;
  white-space: nowrap;
}
.nav .btn-primary {
  height: 34px;
  padding: 0 14px;
  font-size: var(--text-sm);
  border-radius: 999px;
}
.nav .link {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--gray-700);
}
.nav .link:hover {
  background: rgba(15, 23, 42, 0.04);
  color: var(--fg);
}
.nav .btn-switch {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: var(--text-sm);
}
.nav .btn-switch:hover {
  background: var(--accent-soft);
  color: var(--accent-hover);
}
.nav .btn-bell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
}
.nav .btn-bell:hover {
  background: #fff;
  border-color: var(--border);
}
.nav .btn-bell.btn-bell-alert {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14);
}
.btn-bell {
  position: relative;
}
.notify-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
}
.notification-panel {
  position: fixed;
  top: 58px;
  right: 18px;
  z-index: 90;
  width: min(380px, calc(100vw - 24px));
  max-height: min(620px, calc(100vh - 82px));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--shadow-lg);
  contain: layout paint style;
}
.notification-panel[hidden] {
  display: none;
}
.notification-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.notification-panel-head strong {
  font-size: var(--text-sm);
}
.notification-mark-all {
  display: inline-flex;
  min-width: 0;
  height: 30px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  touch-action: manipulation;
}
.notification-mark-all:hover {
  background: var(--accent-soft);
  color: var(--accent-hover);
}
.notification-enable {
  width: calc(100% - 24px);
  margin: 10px 12px 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--gray-50);
  color: var(--fg);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  touch-action: manipulation;
}
.notification-enable:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-hover);
}
.notification-list {
  max-height: 500px;
  overflow-y: auto;
  padding: 8px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.notification-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 9px;
  padding: 10px;
  border-radius: var(--r);
  color: var(--fg);
  text-decoration: none;
}
.notification-item:hover {
  background: var(--gray-50);
  text-decoration: none;
}
.notification-unread {
  background: #f8fbff;
}
.notification-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 999px;
  border: 1px solid var(--gray-300);
  background: transparent;
}
.notification-unread .notification-dot {
  border-color: transparent;
  background: var(--accent);
}
.notification-unread.notification-p0 .notification-dot { background: #dc2626; }
.notification-unread.notification-p1 .notification-dot { background: #f59e0b; }
.notification-unread.notification-p2 .notification-dot { background: var(--accent); }
.notification-main {
  min-width: 0;
}
.notification-text {
  display: block;
  font-size: var(--text-sm);
  line-height: 1.4;
}
.notification-unread .notification-text {
  font-weight: 600;
}
.notification-item:not(.notification-unread) .notification-text {
  color: var(--gray-600);
}
.notification-time {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}
.notification-empty {
  padding: 28px 14px;
  color: var(--muted);
  text-align: center;
  font-size: var(--text-sm);
}
.critical-alert {
  position: fixed;
  top: 72px;
  left: 50%;
  z-index: 10040;
  width: min(560px, calc(100vw - 24px));
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #fecaca;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 48px rgba(127, 29, 29, 0.22);
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
}
.critical-alert[hidden] {
  display: none !important;
}
.critical-alert-mark {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #dc2626;
  box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.14);
  animation: critical-alert-pulse 1.25s ease-out infinite;
}
.critical-alert-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.critical-alert-copy strong {
  color: #991b1b;
  font-size: 13px;
  line-height: 1.2;
}
.critical-alert-copy span {
  overflow: hidden;
  color: var(--fg);
  font-size: var(--text-sm);
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.critical-alert-copy small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}
.critical-alert-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.critical-alert-actions .btn-primary,
.critical-alert-actions .btn-ghost {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  white-space: nowrap;
}
body.has-critical-alert .toast-stack {
  top: 148px;
}
@keyframes critical-alert-pulse {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.25); }
  100% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); }
}
.mobile-alert-rail {
  display: none;
}
.mobile-alert-rail[hidden] {
  display: none !important;
}
.nav .nav-admin {
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 999px;
  background: #ede9fe;
  border: 1px solid #ddd6fe;
}
.nav .nav-settings {
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 500;
}
.nav .nav-settings:hover {
  color: var(--fg);
  text-decoration: none;
}

.settings-shell {
  max-width: 760px;
  margin: 0 auto;
}
.settings-card {
  padding: 20px;
}
.settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.settings-head h1 {
  margin-bottom: 4px;
}
.notice-success {
  margin-bottom: 16px;
  padding: 10px 14px;
  border: 1px solid #bbf7d0;
  border-radius: var(--r);
  background: #f0fdf4;
  color: #166534;
  font-size: var(--text-sm);
}
.settings-form {
  display: grid;
  gap: 12px;
}
.settings-card-section {
  margin-bottom: 18px;
}
.settings-channel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: #fff;
}
.settings-channel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.settings-channel-head strong {
  display: block;
  color: var(--fg);
  font-size: var(--text-md);
  line-height: 1.25;
}
.settings-channel-head span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--text-xs);
}
.status-pill {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.status-ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}
.status-muted {
  background: var(--gray-50);
  color: var(--muted);
}
.status-warn {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  color: var(--fg);
}
.check-row input {
  width: auto;
  margin: 0;
}
.settings-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}
.settings-push-card {
  margin-bottom: 0;
}
.settings-push-status {
  margin: -2px 0 0;
}
.settings-push-enable {
  justify-self: start;
}
.service-card-message {
  margin-bottom: 0;
}
.service-credit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.service-credit-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--gray-50);
}
.service-credit-item span {
  min-width: 0;
  color: var(--gray-700);
  font-size: var(--text-xs);
  line-height: 1.35;
}
.service-credit-item strong {
  color: var(--fg);
  font-size: var(--text-lg);
  font-variant-numeric: tabular-nums;
}
.service-card-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}
.service-card-form label {
  margin-bottom: 0;
}
.service-card-form .btn-success {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}
.service-card-form .btn-success:hover {
  background: #15803d;
  border-color: #15803d;
}

/* Settings on phones should read like a native settings stack, not a card inside
   another card. Keep desktop unchanged and tighten only the constrained layout. */
@media (max-width: 720px), (pointer: coarse) {
  .settings-shell {
    max-width: none;
    margin: 0;
  }

  .settings-shell .settings-card {
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    margin-bottom: 0;
  }

  .settings-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px 10px;
    margin: 0 0 12px;
  }

  .settings-head h1 {
    margin: 0;
    font-size: 20px;
    line-height: 1.2;
  }

  .settings-head p {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
  }

  .settings-head .btn-ghost {
    height: 32px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
  }

  .settings-card-section {
    margin-bottom: 10px;
  }

  .settings-form {
    gap: 10px;
  }

  .settings-channel {
    gap: 11px;
    padding: 12px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }

  .settings-channel-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px;
  }

  .settings-channel-head > div {
    min-width: 0;
  }

  .settings-channel-head strong {
    font-size: 14px;
    line-height: 1.25;
  }

  .settings-channel-head > div > span {
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.4;
  }

  .settings-channel-head > .status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: end;
    max-width: 132px;
    min-height: 24px;
    margin-top: 0;
    padding: 3px 7px;
    overflow: hidden;
    font-size: 10px;
    line-height: 1.2;
    text-overflow: ellipsis;
  }

  .settings-channel label {
    margin-bottom: 0;
    font-size: 13px;
  }

  .settings-channel input:not([type="checkbox"]) {
    height: 42px;
    background: #fff;
    font-size: 16px;
  }

  .check-row {
    min-height: 42px;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--gray-50);
  }

  .check-row input {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
  }

  .check-row span {
    min-width: 0;
    font-size: 13px;
    line-height: 1.35;
  }

  .settings-push-status {
    margin: 0;
    line-height: 1.45;
  }

  .settings-push-enable,
  .service-card-form .btn-success,
  .settings-actions .btn-primary {
    width: 100%;
    height: 42px;
  }

  .service-credit-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .service-credit-item {
    min-height: 38px;
    padding: 8px 10px;
  }

  .service-credit-item span {
    font-size: 12px;
  }

  .service-credit-item strong {
    font-size: 18px;
  }

  .service-card-form {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .service-card-form label {
    margin-bottom: 0;
  }

  .service-card-form input {
    height: 42px;
    font-size: 16px;
  }

  .settings-actions {
    padding-top: 0;
  }

  .settings-shell .alert,
  .settings-shell .notice-success {
    margin-bottom: 10px;
    padding: 9px 11px;
    font-size: 13px;
  }
}

@media (max-width: 720px), (pointer: coarse) {
  .mobile-alert-rail {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 10020;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: stretch;
    padding: 8px;
    border: 1px solid #bfdbfe;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.2);
    backdrop-filter: blur(14px);
  }
  .mobile-alert-rail[data-priority="p0"] {
    border-color: #fecaca;
    box-shadow: 0 16px 44px rgba(127, 29, 29, 0.24);
  }
  .mobile-alert-rail[data-priority="p1"] {
    border-color: #fed7aa;
  }
	  .mobile-alert-main {
	    min-width: 0;
	    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto;
    gap: 9px;
    align-items: center;
    padding: 8px 4px 8px 8px;
    border: 0;
    background: transparent;
	    color: var(--fg);
	    text-align: left;
	    cursor: pointer;
	    touch-action: manipulation;
	  }
  .mobile-alert-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
  }
  .mobile-alert-rail[data-priority="p0"] .mobile-alert-dot {
    background: #dc2626;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12);
  }
  .mobile-alert-rail[data-priority="p1"] .mobile-alert-dot {
    background: #f59e0b;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.16);
  }
  .mobile-alert-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
  }
  .mobile-alert-copy strong {
    color: var(--fg);
    font-size: 12px;
    line-height: 1.25;
  }
  .mobile-alert-copy span {
    overflow: hidden;
    color: var(--gray-700);
    font-size: 12px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-alert-count {
    align-self: center;
    padding: 2px 6px;
    border-radius: 999px;
    background: var(--gray-100);
    color: var(--gray-700);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
  }
	  .mobile-alert-enable,
	  .mobile-alert-close {
	    align-self: center;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
	    color: var(--gray-700);
	    font-size: 12px;
	    font-weight: 600;
	    touch-action: manipulation;
	  }
  .mobile-alert-enable {
    grid-column: 1 / -1;
    width: 100%;
  }
  .mobile-alert-enable[hidden] {
    display: none;
  }
	  .mobile-alert-close {
	    width: 32px;
	    padding: 0;
	    color: var(--muted);
	  }
	  .critical-alert {
	    top: auto;
	    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
	    width: calc(100vw - 20px);
	    grid-template-columns: 10px minmax(0, 1fr);
	    gap: 10px;
	    padding: 11px;
	    border-radius: 14px;
	    transform: translateX(-50%);
	  }
	  .critical-alert-copy span {
	    display: -webkit-box;
	    overflow: hidden;
	    white-space: normal;
	    -webkit-box-orient: vertical;
	    -webkit-line-clamp: 2;
	  }
	  .critical-alert-actions {
	    grid-column: 1 / -1;
	    display: grid;
	    grid-template-columns: 1fr 1fr;
	    gap: 8px;
	  }
	  .critical-alert-actions .btn-primary,
	  .critical-alert-actions .btn-ghost {
	    width: 100%;
	  }
		  .notification-panel {
		    top: auto;
	    left: 10px;
	    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 10030;
	    width: auto;
	    max-height: min(72vh, 560px);
	    border-radius: 16px;
	    transform: translateZ(0);
	  }
	  .notification-list {
	    max-height: calc(72vh - 104px);
	  }
	  .settings-head,
	  .settings-channel-head {
	    flex-direction: column;
	  }
	  .settings-actions {
	    justify-content: stretch;
	  }
	  .settings-actions .btn-primary {
	    width: 100%;
	  }
	  .service-credit-grid,
	  .service-card-form {
	    grid-template-columns: 1fr;
	  }
	  .service-card-form .btn-success {
	    width: 100%;
	  }
	  body.has-mobile-alert .toast-stack {
	    bottom: calc(86px + env(safe-area-inset-bottom, 0px));
	  }
}

/* -------- Buttons — one scale -------- */
.btn-primary, .btn-ghost, .btn-success, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center;
  height: 36px; padding: 0 16px;
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s, transform 0.08s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-ghost {
  background: var(--bg);
  color: var(--gray-700);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--gray-50); border-color: var(--gray-300); color: var(--fg); }
.btn-success { background: var(--gray-900); color: #fff; border-color: var(--gray-900); }
.btn-success:hover { background: var(--gray-800); border-color: var(--gray-800); color: #fff; }
.btn-danger { background: var(--bg); color: var(--danger); border-color: var(--border); }
.btn-danger:hover { background: #fef2f2; color: #b91c1c; }
.btn-primary:active, .btn-ghost:active, .btn-success:active, .btn-danger:active { transform: translateY(1px); }

.btn-big { height: 46px; padding: 0 22px; font-size: var(--text-md); border-radius: var(--r-lg); }
.btn-sm { height: 28px; padding: 0 12px; font-size: var(--text-xs); border-radius: var(--r); }

/* -------- Form controls — unified -------- */
input, select, textarea {
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 9px 12px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
label { display: block; font-size: var(--text-sm); color: var(--gray-700); font-weight: 500; margin-bottom: 14px; }
label > input, label > select, label > textarea { width: 100%; display: block; margin-top: 6px; }
label > small.muted { display: block; margin-top: 5px; font-size: var(--text-xs); color: var(--muted); font-weight: 400; }
.req { color: var(--danger); font-weight: 600; }

/* -------- Card primitive -------- */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 28px 32px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

/* -------- LANDING — hero: huge confident type -------- */
.hero-landing {
  background: var(--bg);
  padding: 76px 24px 44px;
  margin: 0 -20px 0;
  border-radius: 0;
  text-align: left;
}
.hero-landing-inner { max-width: 960px; margin: 0 auto; }
.hero-landing-h1 {
  font-size: clamp(42px, 6vw, 72px);
  line-height: 1.04;
  letter-spacing: -0.04em;
  font-weight: 700;
  margin: 0 0 20px;
  color: var(--fg);
}
.hero-accent {
  /* No gradient — use the accent token flat */
  background: none;
  -webkit-text-fill-color: currentColor;
  color: var(--accent);
}
.hero-landing-sub {
  font-size: var(--text-xl);
  color: var(--gray-600);
  line-height: 1.5;
  margin: 0 0 28px;
  max-width: 640px;
}
.hero-landing-cta { justify-content: flex-start; }
.hero-landing-cta .btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--gray-700);
}
.hero-landing-cta .btn-ghost:hover { color: var(--fg); background: transparent; text-decoration: underline; text-underline-offset: 3px; }

/* Sections */
.marketing-section { padding: 68px 0 0; }
.marketing-section.alt {
  background: var(--gray-50);
  margin: 40px -20px 0;
  padding: 68px 24px;
  border: none;
}
.section-title {
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 700;
  letter-spacing: -0.03em;
  text-align: left;
  margin: 0 0 12px;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 4px;
}
.section-sub {
  text-align: left;
  font-size: var(--text-lg);
  color: var(--gray-600);
  margin: 0 auto 24px;
  max-width: 960px;
  padding: 0 4px;
}

/* Feature cards — stripped */
.feature-grid {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 4px;
  margin-top: 16px;
}
.feature-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 28px;
  box-shadow: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  border-top: 1px solid var(--border);   /* kill the colored accent bar */
}
.feature-card:hover {
  border-color: var(--gray-300);
  box-shadow: var(--shadow);
  transform: none;
}
.feature-paste, .feature-forward, .feature-auto { border-top: 1px solid var(--border); }
.feature-icon { font-size: 22px; margin-bottom: 14px; filter: saturate(0.6); opacity: 0.85; }
.feature-card h3 { font-size: var(--text-lg); margin-bottom: 8px; }
.feature-card p { color: var(--gray-600); }
.tag-good, .tag-neutral, .tag-advanced {
  background: var(--gray-100);
  color: var(--gray-700);
  font-weight: 600;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.feature-flow { margin-top: 18px; color: var(--muted); font-size: var(--text-sm); }

/* Timeline demo — cleaner */
.timeline-demo {
  max-width: 560px; margin: 40px auto 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 28px 32px;
}
.td-dot { width: 6px; height: 6px; }
.td-sys .td-dot    { background: var(--gray-400); }
.td-poster .td-dot { background: var(--accent); }
.td-taker .td-dot  { background: #16a34a; }

/* Trust cards — stripped */
.trust-grid { max-width: 960px; margin: 0 auto; padding: 0 4px; }
.trust-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 28px;
  box-shadow: none;
}
.trust-icon { font-size: 20px; opacity: 0.7; margin-bottom: 12px; filter: saturate(0.5); }
.trust-card h4 { font-size: var(--text-md); font-weight: 600; }
.trust-card p { color: var(--gray-600); font-size: var(--text-sm); }

/* Marketing CTA — simpler */
.marketing-cta {
  background: var(--gray-50);
  border: none;
  border-radius: 0;
  padding: 68px 24px;
  margin: 40px -20px 0;
  text-align: center;
}
.marketing-cta h2 { font-size: clamp(28px, 3vw, 40px); letter-spacing: -0.03em; margin-bottom: 14px; }
.marketing-cta p { color: var(--gray-600); font-size: var(--text-lg); margin-bottom: 22px; }
.marketing-cta .btn-primary::after { display: none; }      /* kill radial gradient */

.landing-footer {
  max-width: 1200px; margin: 0 auto;
  padding: 28px 4px;
  color: var(--muted);
  font-size: var(--text-sm);
  border-top: 1px solid var(--border);
}

/* -------- DASHBOARD — strip the hero banner, replace with simple header -------- */
.hero {
  background: transparent;
  border: none;
  border-top: none;
  box-shadow: none;
  padding: 28px 0 20px;
  margin: 0 0 24px;
  border-bottom: 1px solid var(--border);
  gap: 24px;
  display: flex; justify-content: space-between; align-items: flex-start;
}
.hero h1 { font-size: var(--text-3xl); font-weight: 700; letter-spacing: -0.03em; margin: 0 0 6px; }
.hero p { font-size: var(--text-md); color: var(--muted); }
.hero-cta { height: 40px; padding: 0 18px; }
.hero-hint { background: transparent; padding: 0; font-size: var(--text-sm); color: var(--muted); }
.pulse-dot { display: none; }            /* dashboard-level decoration */

/* KPI cards — cleaner */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 0 0 32px;
}
.stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: none;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.stat::before { display: none; }          /* kill hot-accent bar */
.stat-n {
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.stat-l {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: 8px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
.stat-link { color: inherit; text-decoration: none; display: block; }
.stat-link:hover {
  border-color: var(--gray-300);
  transform: none;
  box-shadow: none;
  background: var(--gray-50);
}
.stat-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.stat-hot .stat-n { color: var(--fg); }  /* stop the red/blue highlight */

/* Filter bar — plain row */
.filter-bar {
  background: transparent;
  border: none;
  padding: 0 0 16px;
  gap: 10px;
}

/* Tabs */
.tabs {
  gap: 0;
  margin-bottom: 24px;
  padding: 0;
  border-bottom: 1px solid var(--border);
}
.tab {
  padding: 10px 0;
  margin-right: 24px;
  border-radius: 0;
  color: var(--muted);
  font-weight: 500;
}
.tab:hover { background: transparent; color: var(--fg); }
.tab.active { color: var(--fg); font-weight: 600; }
.tab.active::after {
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--fg);
  animation: none;
}

/* Tables — minimalist */
.orders {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: none;
}
.orders th {
  background: transparent;
  color: var(--muted);
  font-size: var(--text-xs);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.orders td { padding: 14px 16px; font-size: var(--text-base); }
.orders tr:hover td { background: var(--gray-50); }

/* Task cards — single neutral style */
.task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.task-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 20px 22px;
  gap: 14px;
  box-shadow: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.task-card:hover {
  border-color: var(--gray-300);
  box-shadow: var(--shadow);
  transform: none;
}
.task-card .task-title { font-size: var(--text-md); font-weight: 600; letter-spacing: -0.015em; padding-right: 72px; }
.task-card .pin {
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: var(--gray-100); color: var(--gray-700);
  letter-spacing: 0;
}
.task-card .pin-urgent { background: #fef2f2; color: #b91c1c; }
.task-card .pin-high   { background: var(--gray-100); color: var(--gray-700); }
.task-card .pin-assign { background: var(--accent-soft); color: var(--accent-hover); }
.task-card .task-meta { font-size: var(--text-sm); color: var(--muted); }

/* Mode badges — one neutral style (remove the 3-color thing) */
.mode-badge {
  background: var(--gray-100);
  color: var(--gray-700);
  padding: 2px 8px; border-radius: var(--r-sm);
  font-size: 11px; font-weight: 600; letter-spacing: 0;
}
.mode-badge-paste, .mode-badge-forward, .mode-badge-auto {
  background: var(--gray-100);
  color: var(--gray-700);
}

/* Badges (status) — one style, subtle */
.badge {
  padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: 0;
}
.badge-pending   { background: #fef3c7; color: #854d0e; }
.badge-claimed   { background: var(--accent-soft); color: var(--accent-hover); }
.badge-disputed  { background: #fef2f2; color: #b91c1c; }
.badge-done      { background: var(--gray-100); color: var(--gray-700); }
.badge-cancelled { background: var(--gray-100); color: var(--gray-400); }

/* Priority — only urgent still warns */
.prio {
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.prio-urgent { background: #fef2f2; color: #b91c1c; }
.prio-high   { background: var(--gray-100); color: var(--gray-700); }
.prio-low    { display: none; }

/* Auth pages */
.card.auth { max-width: 440px; margin: 64px auto; padding: 40px 44px; }
.card.auth h1 { font-size: var(--text-2xl); margin-bottom: 8px; }
.auth-tagline { color: var(--gray-600); font-size: var(--text-base); margin-bottom: 28px; }
.card.auth .btn-primary { width: 100%; }

/* Alert */
.alert { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; padding: 10px 14px; border-radius: var(--r); font-size: var(--text-sm); margin-bottom: 16px; }
.alert-bar { border-radius: var(--r-md); padding: 12px 16px; font-size: var(--text-sm); border: 1px solid var(--border); background: var(--bg); box-shadow: none; }

/* Error page — bigger, calmer */
.error-page { padding: 120px 20px 80px; max-width: 520px; margin: 0 auto; text-align: center; }
.error-code { font-size: 88px; font-weight: 700; letter-spacing: -0.05em; color: var(--gray-300); margin-bottom: 16px; }
.error-title { font-size: var(--text-2xl); font-weight: 650; margin-bottom: 10px; }

/* Rating panel — restrained */
.rating-panel { padding: 28px 32px; }
.rating-big { font-size: 48px; font-weight: 700; letter-spacing: -0.04em; color: var(--fg); }

/* Empty state */
.empty { background: var(--bg); border: 1px dashed var(--border); border-radius: var(--r-lg); padding: 56px 24px; color: var(--muted); }

/* ------------------------------------------------------------
   Motion: final curated set
   - hero / card rise on first paint (one subtle entrance)
   - focus ring transition
   - button press
   - tab underline appearing when active
   - toast slide
   Everything else: removed.
   ------------------------------------------------------------ */

/* Kill old cascading delays + decorative animations */
.stats .stat:nth-child(n),
.feature-grid .feature-card:nth-child(n),
.trust-grid .trust-card:nth-child(n),
.task-card:nth-child(n),
.timeline-demo .td-row:nth-child(n) {
  animation-delay: 0s !important;
}
.hero-landing-h1 .w { animation: none; opacity: 1; transform: none; }
.stat-n { animation: none; }

/* Keep section entrances gentle; hero copy must be visible without animation. */
.hero-landing-inner { animation: none; opacity: 1; transform: none; }
.feature-card, .trust-card, .stat, .task-card, .orders, .card {
  animation: card-rise 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes card-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Responsive tweaks for the new spacing */
@media (max-width: 720px) {
  .container { padding: 16px 16px; }
  .hero-landing { padding: 36px 16px 24px; margin: 0 -16px; }
  .hero-landing-sub { font-size: var(--text-md); }
  .marketing-section { padding: 36px 0 0; }
  .marketing-section.alt { margin: 24px -16px 0; padding: 36px 16px; }
  .marketing-cta { margin: 28px -16px 0; padding: 40px 16px; }
  .hero { flex-direction: column; padding: 20px 0; }
  .hero-cta { width: 100%; }
  .stats { grid-template-columns: 1fr 1fr; }
  .section-title, .section-sub { padding: 0 16px; }
}

/* ============================================================
   Landing v3 — eyebrow, hero stats, how-it-works, FAQ, scroll reveal
   ============================================================ */

/* Eyebrow badge above h1 */
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px;
  background: var(--gray-100);
  color: var(--gray-700);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 999px;
  margin-bottom: 20px;
  border: 1px solid var(--gray-200);
}
.hero-eyebrow::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Bigger hero h1 */
.hero-landing-h1 { font-size: clamp(44px, 7vw, 88px); line-height: 1.02; }
.hero-landing-sub { max-width: 680px; }

/* Hero bottom stats row */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 28px 40px;
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  max-width: 720px;
}
.hero-stat .hs-n {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.hero-stat .hs-l { font-size: var(--text-sm); color: var(--muted); margin-top: 8px; }

/* Arrow in CTA */
.btn-arrow {
  display: inline-block;
  margin-left: 6px;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-primary:hover .btn-arrow { transform: translateX(3px); }

/* ---- How it works ---- */
.how-steps {
  list-style: none; padding: 0; margin: 28px auto 0;
  max-width: 880px;
  display: grid; gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
}
.how-step {
  display: flex; gap: 24px; align-items: flex-start;
  padding: 24px 28px;
  background: var(--bg);
}
.how-n {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--gray-300);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  min-width: 60px;
}
.how-body h3 { font-size: var(--text-lg); margin: 4px 0 8px; font-weight: 600; }
.how-body p { margin: 0; color: var(--gray-600); font-size: var(--text-base); line-height: 1.55; }

/* ---- FAQ ---- */
.faq-list {
  max-width: 880px; margin: 18px auto 0;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
}
.faq-item {
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.faq-item:first-child { border-top: none; }
.faq-item summary {
  list-style: none;
  padding: 19px 26px;
  cursor: pointer;
  font-size: var(--text-md);
  font-weight: 600;
  display: flex; justify-content: space-between; align-items: center;
  gap: 20px;
  color: var(--fg);
  user-select: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-size: 20px; font-weight: 400;
  color: var(--muted);
  transition: transform 0.2s ease-out;
  line-height: 1;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item summary:hover { background: var(--gray-50); }
.faq-item p {
  padding: 0 26px 20px;
  margin: 0;
  color: var(--gray-600);
  font-size: var(--text-base);
  line-height: 1.6;
}

/* ---- Scroll reveal ---- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}
/* Disable the shared card-rise on landing sections — reveal handles it */
.hero-landing ~ section .card,
.hero-landing ~ section .feature-card,
.hero-landing ~ section .trust-card,
.hero-landing ~ section .timeline-demo,
.hero-landing ~ section .how-step,
.hero-landing ~ section .faq-item {
  animation: none;
}

/* CTA card CTA button gets specific accent */
.marketing-cta {
  background: var(--fg);
  color: #fff;
}
.marketing-cta h2 { color: #fff; }
.marketing-cta p { color: var(--gray-400); }
.marketing-cta .btn-primary {
  background: #fff;
  color: var(--fg);
  border-color: #fff;
}
.marketing-cta .btn-primary:hover {
  background: var(--gray-100);
  color: var(--fg);
}

@media (max-width: 720px) {
  .hero-eyebrow { margin-bottom: 14px; }
  .hero-landing-h1 { margin-bottom: 14px; }
  .hero-landing-sub { margin-bottom: 20px; }
  .hero-stats {
    gap: 18px 20px;
    margin-top: 30px;
    padding-top: 20px;
  }
  .hero-stat .hs-l { margin-top: 5px; }
  .feature-grid, .trust-grid { margin-top: 14px; }
  .feature-card, .trust-card { padding: 20px; }
  .section-sub { margin-bottom: 18px; }
  .how-steps { margin-top: 20px; }
  .how-step {
    gap: 16px;
    padding: 20px;
  }
  .faq-list { margin-top: 14px; }
  .faq-item summary { padding: 17px 20px; }
  .faq-item p { padding: 0 20px 17px; }
  .landing-footer { padding: 22px 0 14px; }
}

/* ---- Auth pages refinement ---- */
.auth-brand {
  display: block;
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--fg);
  text-decoration: none;
  margin-bottom: 32px;
}
.auth-brand .brand-tld { color: var(--muted); font-weight: 500; }
.card.auth h1 { font-size: var(--text-2xl); font-weight: 650; letter-spacing: -0.025em; }
.card.auth .btn-primary { width: 100%; margin-top: 8px; }
.card.auth label { margin-top: 16px; }
.card.auth p.muted {
  margin-top: 24px;
  font-size: var(--text-sm);
  text-align: center;
  color: var(--muted);
}
.card.auth p.muted a {
  color: var(--fg);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--gray-300);
}
.card.auth p.muted a:hover { text-decoration-color: var(--fg); }

/* ---- Page header pattern (dashboards) ---- */
.page-header { margin: 20px 0 28px; }
.page-crumb {
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 12px;
  color: var(--muted);
}
.page-title-row {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.page-title-row h1 {
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 6px;
}
.page-sub { font-size: var(--text-base); color: var(--muted); margin: 0; max-width: 560px; }
.page-header-meta {
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  font-size: var(--text-sm);
}
@media (max-width: 720px) {
  .page-title-row { flex-direction: column; align-items: flex-start; }
  .page-header-meta { flex-direction: row; align-items: center; gap: 14px; flex-wrap: wrap; }
}

/* ---- Order detail — 2-column on wide screens ---- */
@media (min-width: 960px) {
  .detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 28px;
    align-items: flex-start;
  }
  .detail-sidebar {
    position: sticky;
    top: 20px;
  }
  .detail-sidebar .card { margin-bottom: 16px; padding: 20px 22px; }
}
.detail-main .card { animation: card-rise 0.4s ease-out both; }

/* Metadata card (sidebar) — cleaner dl display */
.detail-sidebar dl.meta {
  display: block;
  margin: 0;
}
.detail-sidebar dl.meta dt {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 500;
  margin-top: 16px;
}
.detail-sidebar dl.meta dt:first-child { margin-top: 0; }
.detail-sidebar dl.meta dd { margin: 4px 0 0; font-size: var(--text-sm); color: var(--fg); word-break: break-all; }

/* Order head refinement */
.order-head {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  margin-bottom: 20px; padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.order-head h1 { font-size: var(--text-2xl); font-weight: 650; letter-spacing: -0.025em; margin: 0; flex: 1; min-width: 200px; }

/* ---- Advanced collapsible group on new order form ---- */
.advanced-group {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  margin: 20px 0;
}
.advanced-group summary {
  list-style: none;
  padding: 14px 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  user-select: none;
}
.advanced-group summary::-webkit-details-marker { display: none; }
.advanced-group summary::after {
  content: "⌃";
  color: var(--muted);
  transition: transform 0.2s;
  font-size: 14px;
}
.advanced-group[open] summary::after { transform: rotate(180deg); }
.advanced-group .adv-title { font-weight: 600; font-size: var(--text-sm); }
.advanced-group .adv-hint { font-size: var(--text-xs); flex: 1; text-align: right; }
.advanced-group .advanced-body {
  padding: 4px 18px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  border-radius: 0 0 var(--r-md) var(--r-md);
}
@media (max-width: 560px) {
  .advanced-group .adv-hint { display: none; }
}

/* ============================================================
   Order detail v4 — waiting card, ghost timeline, share button,
   sidebar grouping, richer visuals.
   ============================================================ */

/* ---- Order head: share button alignment ---- */
.order-head h1 { min-width: 0; }        /* allow shrink */
.share-btn { margin-left: auto; gap: 4px; }
.share-btn .share-ico { font-size: 14px; transform: rotate(-45deg); display: inline-block; }

/* ---- Waiting card (pending state) ---- */
.waiting-card {
  display: flex; gap: 20px; align-items: center;
  padding: 20px 24px;
  background: linear-gradient(180deg, var(--accent-soft), var(--bg));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin: 20px 0;
  animation: card-rise 0.4s ease-out both;
}
.waiting-icon {
  position: relative; flex-shrink: 0;
  width: 48px; height: 48px;
}
.pulse-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.25;
  animation: ring-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
.pulse-dot-x {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.9);
}
@keyframes ring-pulse {
  0%   { transform: scale(0.6); opacity: 0.45; }
  100% { transform: scale(1.25); opacity: 0; }
}
.waiting-body { flex: 1; }
.waiting-body h3 { font-size: var(--text-lg); font-weight: 650; margin: 0 0 4px; }
.waiting-body p { margin: 0; font-size: var(--text-base); color: var(--gray-600); }
.waiting-meta { margin-top: 8px !important; font-size: var(--text-sm); color: var(--muted); }

/* ---- Timeline v2 ---- */
.timeline-title {
  margin: 0 0 10px;
  font-size: var(--text-md);
  font-weight: 650;
  letter-spacing: -0.015em;
}

.timeline-sub {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.timeline {
  list-style: none; margin: 0; padding: 4px 0 0 0;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 7px; top: 14px; bottom: 8px;
  width: 2px;
  background: var(--border);
  border-radius: 2px;
}
.tl-item {
  position: relative;
  padding: 2px 0 10px 24px;
  font-size: var(--text-xs);
}
.tl-dot {
  position: absolute; left: 1px; top: 7px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--gray-300);
  transition: all 0.2s;
}
/* Done steps: filled dot in actor color */
.tl-done .tl-dot {
  border-color: var(--gray-700);
  background: var(--gray-700);
}
.tl-done.tl-actor-system .tl-dot { border-color: #a855f7; background: #a855f7; }
.tl-done.tl-actor-poster .tl-dot { border-color: #2563eb; background: #2563eb; }
.tl-done.tl-actor-taker  .tl-dot { border-color: #16a34a; background: #16a34a; }
/* Future / pending steps: empty ring, subdued text */
.tl-future { opacity: 0.55; }
.tl-future .tl-dot { background: var(--bg); border-color: var(--gray-300); border-style: dashed; }
.tl-future .tl-label { color: var(--muted); font-weight: 500; }
/* The last done step is the current active one — gentle pulse */
.tl-item.tl-done:not(.tl-future) + .tl-future ~ .tl-future,    /* future after active */
.tl-item.tl-done:last-of-type .tl-dot,
.tl-item.tl-done:nth-last-child(1 of .tl-done) .tl-dot {
  /* the last done item's dot gets a ring */
}
.tl-done + .tl-future { /* first future item after the last done */ }

/* Simpler: use JS to add .tl-active to the last done */
.tl-active .tl-dot {
  box-shadow: 0 0 0 3px var(--accent-soft);
  animation: tl-pulse 2.2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes tl-pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--accent-soft); }
  50%      { box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.08); }
}

.tl-label { font-weight: 600; color: var(--fg); line-height: 1.35; font-size: 13px; }
.tl-future .tl-label { color: var(--muted); font-weight: 500; }
.tl-detail {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  font-family: ui-monospace, Menlo, monospace;
  line-height: 1.4;
  word-break: break-all;
}
.tl-time {
  font-size: 11px;
  margin-top: 2px;
  letter-spacing: 0;
  color: var(--muted);
}
.tl-new { animation: tl-appear 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes tl-appear {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: translateX(0); }
}

@media (max-width: 560px) {
  .timeline-sub {
    display: block;
    margin: 3px 0 0;
  }

  .tl-item {
    padding-left: 22px;
  }
}

/* ---- Sidebar grouping ---- */
.detail-sidebar dl.meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
.detail-sidebar dl.meta dt {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  margin-top: 14px;
}
.detail-sidebar dl.meta dt:first-child { margin-top: 0; }
.detail-sidebar dl.meta dd {
  margin: 2px 0 0;
  font-size: var(--text-sm);
  color: var(--fg);
  font-weight: 500;
  word-break: break-all;
}
.detail-sidebar dl.meta dd code {
  font-size: 12px;
  background: var(--gray-100);
  padding: 1px 6px;
  border-radius: 4px;
}

/* Mode panel — refined */
.mode-panel {
  margin: 18px 0;
  padding: 18px 20px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--bg);
}
.mode-panel h3 { font-size: var(--text-md); font-weight: 600; margin: 0 0 10px; }
.mode-panel p { font-size: var(--text-sm); color: var(--gray-600); margin: 0 0 12px; }
.mode-panel .info-row { font-size: var(--text-sm); padding: 4px 0; }

.copybox {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  margin: 10px 0;
  background: var(--gray-50);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.copybox code, .copybox a {
  flex: 1;
  font-size: var(--text-lg);
  font-family: ui-monospace, Menlo, monospace;
  font-weight: 600;
  color: var(--fg);
  word-break: break-all;
  letter-spacing: 0.02em;
}

/* Action bar refinement */
.actions { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 16px; border-top: 1px solid var(--border); margin-top: 16px; }

/* ============================================================
   New Order page v2 — 2-column, live preview, quick-fill chips
   ============================================================ */
.new-order-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  align-items: flex-start;
}
.new-order-form { padding: 28px 32px; margin: 0; }
.new-order-aside { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 14px; }
.new-order-aside .card { padding: 20px 22px; margin: 0; }
.aside-head { margin-bottom: 14px; }
.aside-head h3 { font-size: var(--text-md); font-weight: 650; letter-spacing: -0.015em; margin: 0 0 4px; }
.aside-head p { font-size: var(--text-sm); color: var(--muted); margin: 0; }

.field-group { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.field-group:last-of-type { border-bottom: none; }

/* Quick-fill chips */
.quick-fill {
  margin-bottom: 16px;
  padding: 10px 12px;
  background: var(--gray-50);
  border-radius: var(--r-md);
}
.service-entitlement-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
}
.service-entitlement-empty {
  border-color: #fecaca;
  background: #fef2f2;
}
.no-credit-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px;
  margin-bottom: 16px;
}
.no-credit-banner .no-credit-text { flex: 1 1 240px; min-width: 0; }
.no-credit-banner strong { display: block; font-size: var(--text-md); }
.no-credit-banner p { margin: 4px 0 0; line-height: 1.4; }
.no-credit-banner .btn-primary { flex-shrink: 0; }
.service-entitlement-panel strong,
.service-entitlement-panel span {
  display: block;
}
.service-entitlement-panel strong {
  font-size: var(--text-sm);
  line-height: 1.35;
}
.service-entitlement-panel .muted {
  margin-top: 2px;
  line-height: 1.35;
}
.qf-label { font-size: var(--text-xs); display: block; margin-bottom: 6px; }
.qf-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.qf-chip {
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--gray-700);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.qf-chip span {
  display: inline-block;
  vertical-align: middle;
}
.qf-balance {
  margin-left: 6px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.qf-chip:hover,
.qf-chip.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.qf-chip:disabled,
.qf-chip.qf-chip-empty {
  cursor: not-allowed;
  color: var(--gray-400);
  background: var(--gray-50);
}
.qf-chip:disabled:hover {
  border-color: var(--border);
  color: var(--gray-400);
  background: var(--gray-50);
}
.qf-chip:active { transform: translateY(1px); }

/* Mode picker — keep compact */
.mode-picker {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin: 0;
}
.mode-picker legend {
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 0 6px;
  color: var(--fg);
}
.mode-opt {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  margin: 0 0 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.mode-opt:last-child { margin-bottom: 0; }
.mode-opt:hover { border-color: var(--gray-400); }
.mode-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.mode-opt input[type="radio"] { margin-top: 3px; accent-color: var(--accent); }
.mode-body strong { display: block; font-size: var(--text-base); font-weight: 600; margin-bottom: 2px; color: var(--fg); }
.mode-body .muted { font-size: var(--text-sm); line-height: 1.5; color: var(--gray-600); }
.field-legend {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 10px;
}
.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.mode-card {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  grid-template-areas:
    "icon name"
    "icon badge"
    "icon hint";
  column-gap: 10px;
  align-items: start;
  min-height: 92px;
  padding: 13px 40px 13px 13px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
  color: var(--gray-700);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}
.mode-card:hover { border-color: var(--gray-400); }
.mode-card:has(input:checked) {
  border-color: var(--accent);
  background: linear-gradient(180deg, #fff, var(--accent-soft));
  box-shadow: inset 0 0 0 1px var(--accent-soft);
}
.mode-card input[type="radio"] {
  position: absolute;
  top: 15px;
  right: 14px;
  display: block;
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  border: 0;
  accent-color: var(--accent);
}
.mode-card .mc-check { display: none; }
.mode-card .mc-icon {
  grid-area: icon;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--gray-100);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
}
.mode-card:has(input:checked) .mc-icon { background: #fff; }
.mode-card .mc-badge {
  grid-area: badge;
  justify-self: start;
  min-height: 16px;
  margin: 4px 0 2px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.4;
}
.mode-card .mc-name {
  grid-area: name;
  min-width: 0;
  color: var(--fg);
  font-size: var(--text-base);
  font-weight: 650;
  line-height: 1.35;
}
.mode-card .mc-hint {
  grid-area: hint;
  min-width: 0;
  margin-top: 3px;
  color: var(--gray-600);
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: 1.45;
}
.badge-soft {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Form row: two columns on wider, stacked on narrow */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 10px;
}

/* Footer */
.form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}
.publish-block { display: flex; align-items: center; gap: 14px; }
.kbd-hint {
  font-size: var(--text-xs);
  color: var(--muted);
  font-family: ui-monospace, Menlo, monospace;
}

/* Preview card (sidebar) */
.preview-card-wrap { background: var(--gray-50); }
.preview-card {
  margin: 0 !important;
  animation: none !important;
  transition: none !important;
  box-shadow: var(--shadow-sm);
  cursor: default;
  position: relative;
}
.preview-card:hover { border-color: var(--border); transform: none; box-shadow: var(--shadow-sm); }
.preview-pin { position: absolute; top: 16px; right: 16px; }
.preview-card .task-title { padding-right: 70px; transition: color 0.15s; }

/* Mini steps (what happens next) */
.mini-steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.mini-steps li { display: flex; gap: 12px; align-items: flex-start; }
.mini-n {
  flex-shrink: 0;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--gray-900); color: #fff;
  font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}
.mini-steps strong { display: block; font-size: var(--text-sm); font-weight: 600; color: var(--fg); margin-bottom: 2px; }
.mini-steps p { margin: 0; font-size: var(--text-xs); color: var(--muted); line-height: 1.5; }

/* Security list */
.security-card { background: var(--gray-50); border-color: var(--border); }
.security-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.security-list li {
  position: relative;
  padding-left: 22px;
  font-size: var(--text-sm);
  color: var(--gray-700);
  line-height: 1.5;
}
.security-list li::before {
  content: "✓";
  position: absolute; left: 0; top: 0;
  color: #16a34a;
  font-weight: 700;
}

/* Responsive: stack at < 960px */
@media (max-width: 960px) {
  .new-order-layout { grid-template-columns: 1fr; }
  .new-order-aside { position: static; }
}
@media (max-width: 560px) {
  .new-order-form { padding: 18px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .service-entitlement-panel {
    align-items: stretch;
    flex-direction: column;
  }
  .service-entitlement-panel .btn-ghost {
    width: 100%;
  }
  .mode-picker { padding: 12px; }
  .mode-grid { grid-template-columns: 1fr; }
  .mode-card {
    min-height: 0;
    grid-template-columns: 30px minmax(0, 1fr);
    column-gap: 10px;
    padding: 11px 38px 11px 12px;
    border-radius: var(--r-md);
  }
  .mode-card input[type="radio"] {
    top: 50%;
    right: 13px;
    transform: translateY(-50%);
  }
  .mode-card .mc-icon {
    align-self: center;
    width: 28px;
    height: 28px;
  }
  .mode-card .mc-name {
    font-size: var(--text-sm);
    line-height: 1.3;
  }
  .mode-card .mc-hint {
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.35;
  }
  .mode-card .mc-badge {
    margin: 2px 0 1px;
    min-height: 14px;
    padding: 1px 5px;
    font-size: 9px;
    line-height: 1.25;
  }
}

/* ---- Taker in-progress cards ---- */
.active-task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.active-task-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 178px;
  gap: 14px;
  align-items: stretch;
  padding: 14px 16px 14px 18px;
  background: #fff;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.active-task-card::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 0;
  width: 2px;
  border-radius: 0 999px 999px 0;
  background: #cbd5e1;
}

.active-task-card.active-priority-high::before,
.active-task-card.sla-urgent::before,
.active-task-card.needs-attention::before,
.active-task-card.attention-warn::before { background: #0f766e; }
.active-task-card.active-priority-urgent::before,
.active-task-card.sla-overdue::before,
.active-task-card.attention-danger::before { background: #be123c; }

.active-task-card.sla-urgent {
  border-color: #99f6e4;
  background: #fff;
}

.active-task-card.sla-overdue {
  border-color: #fecdd3;
  background: #fff;
}

.active-task-main,
.active-task-action {
  min-width: 0;
}

.active-task-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.active-task-kicker {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.active-task-id {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid #dbe3ef;
  background: #f8fafc;
  color: #475569;
}

.active-task-title {
  margin: 0;
  font-size: var(--text-base);
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.active-task-mobile-meta {
  display: none;
}

.active-task-subline {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 8px;
  align-items: baseline;
  font-size: var(--text-xs);
  color: var(--muted);
}

.active-task-sep {
  color: #cbd5e1;
}

.active-task-subline strong {
  color: var(--fg);
}

.active-task-email {
  font-size: inherit;
  color: var(--fg);
  overflow-wrap: anywhere;
}

.active-task-flow {
  display: flex;
  align-items: center;
  gap: 6px 8px;
  flex-wrap: wrap;
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.active-task-flow-copy {
  font-size: var(--text-xs);
  line-height: 1.4;
  color: var(--fg);
}

.active-task-flow-proof {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2f7;
  font-size: var(--text-xs);
  color: var(--muted);
}

.active-task-action {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 7px;
  padding-left: 14px;
  border-left: 1px solid #edf2f7;
}

.active-task-action-copy {
  display: none;
  margin: 0;
  font-size: var(--text-xs);
  line-height: 1.4;
  color: var(--fg);
  text-align: right;
  max-width: 100%;
}

.active-task-cta {
  width: auto;
  min-width: 104px;
  text-align: center;
  justify-content: center;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .active-task-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .active-task-action {
    padding-left: 0;
    align-items: flex-start;
  }

  .active-task-action-copy {
    text-align: left;
  }

  .active-task-cta {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 560px) {
  .active-task-card {
    gap: 7px;
    padding: 10px 11px;
    border-radius: var(--r-md);
  }

  .active-task-list {
    gap: 7px;
  }

  .active-task-main {
    gap: 5px;
  }

  .active-task-kicker {
    gap: 5px;
    row-gap: 4px;
  }

  .active-task-kicker .badge-claimed {
    display: none;
  }

  .active-task-kicker .mode-badge,
  .active-task-kicker .prio,
  .active-task-kicker .deadline,
  .active-task-kicker .attention-badge {
    flex: 0 0 auto;
  }

  .active-task-title {
    font-size: 15px;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .active-task-subline {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    gap: 5px;
    align-items: center;
    font-size: 11px;
    line-height: 1.2;
  }

  .active-task-sep,
  .active-task-claimed {
    display: none;
  }

  .active-task-party,
  .active-task-email-wrap {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .active-task-email {
    font-size: 11px;
  }

  .active-task-subline .presence {
    margin-left: 3px;
    font-size: 10px;
  }

  .attention-line {
    padding: 4px 7px;
    font-size: 11px;
  }

  .active-task-flow {
    gap: 5px;
    padding: 5px 7px;
    flex-wrap: nowrap;
    overflow: hidden;
    font-size: 11px;
  }

  .active-task-flow-copy {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
  }

  .active-task-flow-proof {
    flex: 0 0 auto;
    padding: 2px 6px;
    font-size: 11px;
  }

  .active-task-action {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 0 0;
    border-top: 1px solid var(--border);
  }

  .active-task-action-copy {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    line-height: 1.25;
    text-align: left;
  }

  .active-task-cta {
    flex: 0 0 auto;
    width: auto;
    min-width: 82px;
    height: 30px;
    padding: 0 9px;
    font-size: 12px;
  }
}

/* ---- Order detail chat ---- */
.chat-card {
  padding: 18px 20px;
}

.chat-title {
  margin: 0 0 12px;
  font-size: var(--text-lg);
  font-weight: 650;
  letter-spacing: -0.02em;
}

.chat-shell {
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    linear-gradient(180deg, #fbfcfd 0%, #f6f8fb 100%);
  overflow: hidden;
}

.chat-scroll {
  list-style: none;
  margin: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 580px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
}

.chat-msg-self {
  align-items: flex-end;
}

.chat-msg-other {
  align-items: flex-start;
}

.chat-msg-system {
  align-items: center;
}

.chat-author {
  font-size: var(--text-xs);
  color: var(--muted);
  padding: 0 12px;
}

.chat-bubble {
  width: fit-content;
  max-width: min(78%, 640px);
  padding: 12px 14px 10px;
  border-radius: 18px 18px 18px 8px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.chat-msg-self .chat-bubble {
  border-radius: 18px 18px 8px 18px;
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}

.chat-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.55;
  color: inherit;
}

.chat-original {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  font-size: var(--text-xs);
  line-height: 1.45;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-msg-self .chat-original {
  border-top-color: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.8);
}

.chat-original-label {
  font-weight: 600;
  color: inherit;
}

.chat-time {
  margin-top: 7px;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}

.chat-msg-self .chat-time {
  color: rgba(255, 255, 255, 0.72);
}

.chat-image-link {
  display: inline-grid;
  place-items: center;
  margin-top: 10px;
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 12px;
  line-height: 0;
  background:
    linear-gradient(45deg, rgba(148, 163, 184, 0.08) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148, 163, 184, 0.08) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.08) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.08) 75%);
  background-color: #fff;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.chat-image {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 320px);
  max-height: min(64vh, 520px);
  object-fit: contain;
  object-position: center;
}

.chat-bubble-media .chat-time {
  margin-top: 8px;
}

.proof-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.proof-card {
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.proof-card:hover {
  text-decoration: none;
}

.proof-card-preview {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: #fff;
}

.proof-card-preview:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.proof-label {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--fg);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proof-preview {
  display: inline-grid;
  place-items: center;
  justify-self: center;
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 10px;
  line-height: 0;
  background:
    linear-gradient(45deg, rgba(148, 163, 184, 0.08) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148, 163, 184, 0.08) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.08) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.08) 75%);
  background-color: #fff;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.proof-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(70vh, 560px);
  object-fit: contain;
  object-position: center;
}

.image-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 86px;
  padding: 12px;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
}

.proof-card-missing {
  display: flex;
  min-height: 86px;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
}

.proof-card-missing .proof-label {
  color: var(--fg);
  font-weight: 700;
}

.chat-sys {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  max-width: min(100%, 720px);
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(203, 213, 225, 0.9);
  font-size: var(--text-xs);
  color: var(--muted);
}

.chat-sys-body {
  overflow-wrap: anywhere;
}

.chat-sys-time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chat-composer {
  padding: 10px;
  background: #f3f4f6;
  border-top: 1px solid #dde3eb;
}

.chat-composer textarea {
  margin-top: 0;
}

.chat-compose-shell {
  min-width: 0;
  display: flex;
  align-items: stretch;
  gap: 7px;
}

.chat-compose-shell:focus-within {
  border-color: transparent;
  box-shadow: none;
}

.chat-compose-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid #d9dfe8;
  border-radius: 22px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.chat-compose-main:focus-within {
  border-color: #c6ced9;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 0 0 3px rgba(7, 193, 96, 0.12);
}

.chat-composer textarea {
  flex: 1 1 auto;
  width: 100%;
  height: 36px;
  min-height: 36px;
  max-height: 36px;
  resize: none;
  overflow-y: auto;
  padding: 6px 0 5px;
  line-height: 1.25;
  font-family: inherit;
  font-size: 16px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.chat-composer textarea:focus,
.chat-composer textarea:focus-visible {
  outline: none;
  border-color: transparent;
  box-shadow: none;
}

.chat-compose-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 36px;
}

form .chat-attach {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  border: 1px solid #d9dfe8;
  border-radius: 12px;
  background: #f5f7fa;
  color: #6b7280;
  font-size: 24px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
}

.chat-attach:hover {
  border-color: #c6ced9;
  background: #edf1f5;
}

.chat-attach-name {
  min-width: 0;
  max-width: 180px;
  font-size: 12px;
  color: #7b8594;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-attach-name.is-empty {
  display: none;
}

.chat-send {
  min-width: 58px;
  height: auto;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  flex: 0 0 auto;
  align-self: stretch;
  margin: 0;
  border-color: #07c160;
  background: #07c160;
  box-shadow: none;
  font-size: 14px;
  font-weight: 600;
}

.chat-send:hover {
  border-color: #06ad56;
  background: #06ad56;
}

.chat-send:focus-visible {
  outline-color: rgba(7, 193, 96, 0.28);
}

@media (max-width: 720px) {
  .order-head {
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 16px;
  }

  .order-head h1 {
    font-size: 26px;
  }

  .waiting-card {
    gap: 14px;
    padding: 16px 18px;
    margin: 14px 0;
  }

  .chat-card {
    padding: 16px;
  }

  .chat-scroll {
    padding: 14px;
    height: 480px;
  }

  .chat-bubble {
    max-width: 92%;
  }

  .chat-composer {
    padding: 8px;
  }

  .chat-compose-shell {
    gap: 6px;
  }

  .chat-compose-main {
    gap: 6px;
    padding: 5px 7px;
  }

  .chat-composer textarea {
    height: 34px;
    min-height: 34px;
    max-height: 34px;
    font-size: 16px;
  }

  .chat-send {
    min-width: 54px;
    height: auto;
    width: auto;
    padding: 0 10px;
  }
}

@media (max-width: 480px) {
  .detail-main > .card:first-child {
    padding-top: 14px;
  }

  .order-head {
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 12px;
  }

  .order-head h1 {
    font-size: 20px;
    line-height: 1.2;
  }

  .share-btn {
    margin-left: 0;
  }

  .waiting-card {
    gap: 12px;
    padding: 14px;
  }

  .waiting-icon {
    width: 40px;
    height: 40px;
  }

  .waiting-body h3 {
    font-size: 15px;
  }

  .chat-card {
    padding: 12px;
  }

  .chat-scroll {
    padding: 10px;
    gap: 12px;
    height: 340px;
  }

  .chat-bubble {
    max-width: 100%;
    padding: 10px 12px 9px;
  }

  .chat-image {
    max-width: 100%;
    max-height: min(68vh, 520px);
  }

  .chat-author {
    padding: 0 8px;
  }

  .chat-composer {
    padding: 6px;
  }

  .chat-compose-shell {
    gap: 4px;
  }

  .chat-compose-main {
    gap: 4px;
    padding: 4px 6px;
    border-radius: 18px;
  }

  .chat-composer textarea {
    height: 32px;
    min-height: 32px;
    max-height: 32px;
    font-size: 16px;
  }

  .chat-compose-tools {
    gap: 4px;
  }

  .chat-send {
    min-width: 48px;
    height: auto;
    width: auto;
    padding: 0 8px;
    border-radius: 18px;
  }

  form .chat-attach {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    font-size: 20px;
  }

  .chat-attach-name {
    max-width: 72px;
  }
}

/* Final mobile header pass: keep navigation compact after all base rules. */
@media (max-width: 720px) {
  .topbar {
    padding: 8px 12px;
  }

  .topbar-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand utility"
      "primary primary";
    align-items: center;
    gap: 8px 10px;
    max-width: none;
  }

  .topbar .brand {
    grid-area: brand;
    min-width: 0;
  }

  .nav {
    display: contents;
  }

  .nav-primary {
    grid-area: primary;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    width: 100%;
    gap: 4px;
    padding: 4px;
    border-radius: 14px;
    background: var(--bg-subtle);
    box-shadow: none;
  }

  .nav-primary a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    height: 34px;
    padding: 0 10px;
    border-radius: 11px;
    font-size: 13px;
    white-space: nowrap;
  }

  .nav-primary .btn-primary {
    height: 34px;
    color: #fff;
  }

  .nav-utility {
    grid-area: utility;
    gap: 4px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .nav-utility .username {
    display: none;
  }

  .nav-utility .btn-switch,
  .nav-utility .btn-bell,
  .nav-utility .nav-admin,
  .nav-utility .link {
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    font-size: 12px;
  }
}

@media (max-width: 460px) {
  .topbar {
    padding: 8px 10px;
  }

  .topbar-inner {
    gap: 7px 8px;
  }

  .topbar .brand a {
    font-size: 18px;
  }

  .role-tag {
    display: none;
  }

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

  .nav-primary a,
  .nav-primary .btn-primary {
    height: 33px;
    padding: 0 8px;
  }

  .nav-utility {
    justify-self: end;
  }

  .nav-utility .btn-switch,
  .nav-utility .btn-bell,
  .nav-utility .nav-admin,
  .nav-utility .link {
    height: 28px;
    min-width: 28px;
    padding: 0 7px;
  }

  .detail-main > .card {
    padding: 14px;
    margin-bottom: 12px;
    border-radius: 16px;
  }

  .order-head {
    display: grid;
    grid-template-columns: auto auto auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
  }

  .order-head h1 {
    grid-column: 1 / -1;
    width: 100%;
    overflow-wrap: anywhere;
  }

  .order-head .live-dot {
    justify-self: end;
  }

  .mode-panel {
    margin: 12px 0;
    padding: 12px 14px;
    border-radius: 12px;
  }

  .order-head .badge,
  .order-head .mode-badge,
  .order-head .pill,
  .order-head .status-badge {
    font-size: 11px;
  }
}

/* Structural app cards should never depend on entrance animation to become visible. */
.detail-main .card,
.detail-sidebar .card,
.new-order-form,
.new-order-aside .card,
.chat-card,
.mode-panel,
.waiting-card {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}

/* Order detail final redesign: summary + chat as primary workspace, timeline/meta as rail. */
.detail-layout {
  align-items: start;
}

.detail-main,
.detail-sidebar {
  min-width: 0;
}

.detail-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-main > .card,
.detail-sidebar > .card {
  margin-bottom: 0;
}

@media (min-width: 960px) {
  .detail-layout {
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 24px;
  }

  .detail-sidebar {
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow: auto;
    padding-right: 2px;
  }
}

.order-summary-card {
  padding: 22px 24px;
}

.order-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 16px;
}

.order-title-block {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  flex-direction: column;
  gap: 9px;
}

.order-head h1 {
  min-width: 0;
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.order-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.order-summary-card .mode-panel {
  margin: 14px 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--bg-subtle);
}

.order-summary-card .mode-panel h3 {
  margin-bottom: 6px;
  font-size: 15px;
  line-height: 1.35;
  letter-spacing: 0;
}

.order-summary-card .mode-panel .muted,
.order-summary-card .mode-panel .info-row {
  line-height: 1.55;
}

.order-summary-card .inline-form {
  margin-top: 10px;
}

.order-summary-card .actions {
  margin-top: 14px;
  padding-top: 14px;
  gap: 8px;
}

.timeline-card,
.order-meta-card {
  padding: 18px;
}

.timeline-title {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.3;
  letter-spacing: 0;
}

.timeline-sub {
  display: block;
  margin: 3px 0 0;
  font-size: 12px;
  line-height: 1.35;
}

.timeline-card .timeline {
  max-height: 380px;
  overflow: auto;
  padding-right: 4px;
}

.timeline-card .tl-item {
  padding-bottom: 11px;
}

.timeline-card .tl-label {
  font-size: 13px;
  line-height: 1.35;
}

.timeline-card .tl-time,
.timeline-card .tl-detail {
  font-size: 11px;
}

.order-meta-card .copybox {
  padding: 10px 12px;
}

.order-meta-card .copybox code,
.order-meta-card .copybox a {
  font-size: 13px;
}

.chat-card {
  padding: 0;
  overflow: hidden;
}

.chat-title {
  margin: 0;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  letter-spacing: 0;
}

.chat-shell {
  border: 0;
  border-radius: 0;
}

.chat-scroll {
  height: min(52vh, 560px);
  min-height: 360px;
}

@media (max-width: 959px) {
  .detail-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .detail-main,
  .detail-sidebar {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .detail-main,
  .detail-sidebar {
    gap: 12px;
  }

  .order-summary-card,
  .timeline-card,
  .order-meta-card {
    padding: 16px;
    border-radius: 16px;
  }

  .order-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 12px;
  }

  .order-title-block {
    gap: 8px;
  }

  .order-head h1 {
    font-size: 21px;
    line-height: 1.24;
  }

  .order-badges {
    gap: 6px;
  }

  .share-btn {
    margin-left: 0;
    align-self: flex-start;
  }

  .order-summary-card .mode-panel {
    margin: 12px 0;
    padding: 12px;
    border-radius: 12px;
  }

  .order-summary-card .inline-form,
  .proof-form,
  .paste-form {
    align-items: stretch;
  }

  .order-summary-card .inline-form input,
  .order-summary-card .inline-form select,
  .order-summary-card .inline-form button {
    width: 100%;
  }

  .order-summary-card .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-summary-card .actions > * {
    width: 100%;
  }

  .chat-card {
    border-radius: 16px;
  }

  .chat-title {
    padding: 14px 14px 10px;
  }

  .chat-scroll {
    height: 360px;
    min-height: 320px;
  }

  .timeline-card .timeline {
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 460px) {
  .detail-layout {
    gap: 12px;
  }

  .order-summary-card,
  .timeline-card,
  .order-meta-card {
    padding: 14px;
  }

  .order-head {
    display: flex;
  }

  .order-head h1 {
    grid-column: auto;
    font-size: 20px;
  }

  .order-summary-card .actions {
    grid-template-columns: 1fr;
  }

  .chat-scroll {
    height: 330px;
    min-height: 300px;
  }
}

/* Workspace order display redesign: compact KPIs, scannable order cards, stable mobile flow. */
.workspace-page .card,
.workspace-page .stat,
.workspace-page .orders,
.workspace-page .task-card,
.workspace-page .poster-order-card,
.workspace-page .rating-panel {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}

.workspace-page .page-header {
  margin: 18px 0 20px;
}

.workspace-page .page-title-row {
  gap: 18px;
}

.workspace-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.workspace-stats .stat {
  padding: 14px 16px;
  min-height: 78px;
}

.workspace-stats .stat-n {
  font-size: 28px;
}

.workspace-stats .stat-l {
  margin-top: 6px;
  line-height: 1.25;
}

.workspace-filter {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 170px auto auto auto minmax(90px, auto);
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.taker-workspace .workspace-filter {
  grid-template-columns: minmax(220px, 1fr) auto auto auto minmax(90px, auto);
}

.workspace-filter .filter-q,
.workspace-filter .filter-status {
  min-height: 36px;
  margin: 0;
}

.workspace-filter .filter-total {
  grid-column: -2 / -1;
  justify-self: end;
  white-space: nowrap;
}

.attention-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.attention-toggle input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #d97706;
}

.attention-toggle strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 12px;
}

.attention-toggle.is-active {
  border-color: #fdba74;
  background: #fffbeb;
  color: #92400e;
}

.poster-order-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.poster-order-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 16px;
  align-items: stretch;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.poster-order-card.sla-urgent {
  border-color: #fed7aa;
  background:
    linear-gradient(90deg, rgba(251, 191, 36, 0.08), rgba(255, 255, 255, 0) 34%),
    #fff;
}

.poster-order-card.sla-overdue {
  border-color: #fecaca;
  background:
    linear-gradient(90deg, rgba(239, 68, 68, 0.07), rgba(255, 255, 255, 0) 34%),
    #fff;
}

.poster-order-card.needs-attention {
  border-color: #fdba74;
  box-shadow: inset 3px 0 0 #d97706, var(--shadow-sm);
}

.poster-order-card.attention-danger {
  border-color: #fecaca;
  box-shadow: inset 3px 0 0 #dc2626, var(--shadow-sm);
}

.poster-order-card.attention-warn {
  border-color: #fde68a;
  box-shadow: inset 3px 0 0 #f59e0b, var(--shadow-sm);
}

.active-task-card.needs-attention,
.active-task-card.attention-warn {
  border-color: #99f6e4;
}

.active-task-card.attention-danger {
  border-color: #fecdd3;
}

.attention-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.attention-badge-danger {
  background: #fef2f2;
  color: #b91c1c;
}

.attention-badge-warn {
  background: #fef3c7;
  color: #92400e;
}

.attention-line {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 7px;
  max-width: 100%;
  padding: 5px 9px;
  border: 1px solid #fed7aa;
  border-radius: 7px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}

.attention-line::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 999px;
  background: currentColor;
}

.attention-line-danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.attention-line-warn {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.active-task-card .badge,
.active-task-card .mode-badge {
  border: 1px solid #dbe3ef;
  background: #f8fafc;
  color: #475569;
}

.active-task-card .prio-high,
.active-task-card .deadline-urgent,
.active-task-card .attention-badge,
.active-task-card .attention-line,
.active-task-card .attention-line-warn {
  border-color: #99f6e4;
  background: #f0fdfa;
  color: #0f766e;
}

.active-task-card .prio-urgent,
.active-task-card .deadline-overdue,
.active-task-card .attention-badge-danger,
.active-task-card .attention-line-danger {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #be123c;
}

/* Quiet active task cards: keep structure, remove visual noise from badges. */
.active-task-card.active-priority-high::before,
.active-task-card.sla-urgent::before {
  background: #cbd5e1;
}

.active-task-card.needs-attention::before,
.active-task-card.attention-warn::before {
  background: #5b7f95;
}

.active-task-card.active-priority-urgent::before,
.active-task-card.sla-overdue::before,
.active-task-card.attention-danger::before {
  background: #9f5f6f;
}

.active-task-card.sla-urgent,
.active-task-card.needs-attention,
.active-task-card.attention-warn {
  border-color: #dbe3ef;
}

.active-task-card.sla-overdue,
.active-task-card.attention-danger {
  border-color: #e7c4cb;
}

.active-task-card .badge-claimed,
.active-task-card .attention-badge,
.active-task-card .prio-high,
.active-task-card .prio-low {
  display: none;
}

.active-task-card .mode-badge,
.active-task-card .deadline {
  height: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.active-task-card .prio-urgent,
.active-task-card .deadline-overdue {
  padding: 0;
  border: 0;
  background: transparent;
  color: #9f5f6f;
  font-size: 11px;
  font-weight: 700;
}

.active-task-card .deadline-urgent {
  color: #5b7f95;
}

.active-task-card .attention-line,
.active-task-card .attention-line-warn {
  padding: 0;
  border: 0;
  background: transparent;
  color: #5b7f95;
}

.active-task-card .attention-line-danger {
  color: #9f5f6f;
}

.active-task-card .active-task-flow {
  padding: 0;
  border: 0;
  background: transparent;
}

.active-task-card .active-task-flow-proof {
  padding: 0;
  background: transparent;
}

.active-task-card .active-task-cta {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  box-shadow: none;
}

.active-task-card .active-task-cta:hover {
  background: #eef2f7;
  color: #0f172a;
}

.poster-order-main,
.poster-order-side {
  min-width: 0;
}

.poster-order-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.poster-order-kicker,
.poster-order-subline,
.poster-order-progress {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
}

.poster-order-id {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--muted);
  font-size: 12px;
}

.poster-order-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: 0;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.poster-order-subline {
  font-size: 12px;
  color: var(--muted);
}

.poster-order-email {
  color: var(--fg);
  overflow-wrap: anywhere;
}

.poster-order-sep {
  color: #cbd5e1;
}

.poster-order-progress {
  align-self: flex-start;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  color: var(--fg);
  font-size: 12px;
  line-height: 1.4;
}

.poster-order-proof {
  color: var(--muted);
}

.poster-order-side {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-content: center;
  align-items: center;
  padding-left: 16px;
  border-left: 1px solid var(--border);
}

.poster-order-person,
.poster-order-deadline {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.poster-order-person {
  grid-column: 1 / -1;
}

.poster-order-label {
  font-size: 11px;
  color: var(--muted);
}

.poster-order-person strong {
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.poster-order-cta {
  justify-self: end;
}

.taker-workspace .rating-panel {
  margin-bottom: 18px;
  padding: 16px 18px;
}

.taker-workspace .rating-panel-head {
  gap: 18px;
}

.taker-workspace .rating-big {
  font-size: 36px;
}

.taker-workspace .tabs {
  margin-bottom: 14px;
}

.taker-workspace .task-grid {
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 12px;
}

.taker-workspace .task-card {
  display: flex;
  flex-direction: column;
  min-height: 224px;
  padding: 16px;
  border-radius: var(--r-lg);
}

.task-card-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-head {
  position: relative;
  min-width: 0;
  padding-right: 76px;
}

.task-card .task-title {
  padding-right: 0;
  margin: 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.task-card .pin {
  top: 0;
  right: 0;
}

.task-note {
  margin: 0;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  color: var(--fg);
  font-size: 13px;
  line-height: 1.45;
}

.task-card-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.task-view-link {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.active-task-list {
  gap: 12px;
}

.active-task-card {
  grid-template-columns: minmax(0, 1fr) 180px;
  padding: 16px 18px;
  border-radius: var(--r-lg);
}

.active-task-action {
  justify-content: center;
}

@media (max-width: 860px) {
  .workspace-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-filter,
  .taker-workspace .workspace-filter {
    grid-template-columns: 1fr auto;
  }

  .workspace-filter .filter-q,
  .workspace-filter .filter-status {
    grid-column: 1 / -1;
  }

  .workspace-filter .filter-total {
    justify-self: end;
  }

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

  .poster-order-side {
    grid-template-columns: 1fr auto;
    padding-left: 0;
    padding-top: 12px;
    border-left: 0;
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 520px) {
  .workspace-page .page-header {
    margin: 12px 0 16px;
  }

  .workspace-page .page-title-row {
    align-items: stretch;
  }

  .workspace-page .page-title-row .btn-primary {
    width: 100%;
  }

  .workspace-stats {
    gap: 8px;
    margin-bottom: 14px;
  }

  .workspace-stats .stat {
    min-height: 68px;
    padding: 12px;
  }

  .workspace-stats .stat-n {
    font-size: 24px;
  }

  .workspace-filter,
  .taker-workspace .workspace-filter {
    grid-template-columns: 1fr;
  }

  .workspace-filter button,
  .workspace-filter .btn-ghost,
  .workspace-filter .attention-toggle {
    width: 100%;
  }

  .workspace-filter .filter-total {
    justify-self: start;
  }

  .poster-order-card {
    padding: 14px;
    gap: 12px;
  }

  .poster-order-title {
    font-size: 16px;
  }

  .poster-order-side {
    grid-template-columns: 1fr;
  }

  .poster-order-cta {
    width: 100%;
    justify-self: stretch;
  }

  .taker-workspace .task-grid {
    grid-template-columns: 1fr;
  }

  .taker-workspace .task-card {
    min-height: 0;
    padding: 14px;
  }

  .task-card-action {
    align-items: stretch;
    flex-direction: column;
  }

  .task-card-action .btn-primary,
  .task-card-action .task-view-link {
    width: 100%;
    text-align: center;
  }

  .active-task-card {
    padding: 14px;
  }
}

/* Admin mobile: dense back-office tables become scan-friendly record cards. */
@media (max-width: 720px) {
  .admin-head {
    margin: 18px 0 10px;
  }

  .admin-head h1 {
    font-size: 20px;
    line-height: 1.2;
  }

  .admin-tabs {
    margin: 0 -14px 16px;
    padding: 0 14px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
    scrollbar-width: none;
  }

  .admin-tabs::-webkit-scrollbar {
    display: none;
  }

  .admin-tab {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 10px 14px;
    white-space: nowrap;
  }

  .admin-filter {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 14px;
  }

  .admin-filter .filter-q,
  .admin-filter .filter-status,
  .admin-filter button,
  .admin-filter .btn-ghost {
    width: 100%;
    min-height: 42px;
    margin: 0;
  }

  .admin-filter .filter-total {
    margin: 0;
    text-align: right;
  }

  .admin-table.orders {
    display: block;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .admin-table thead {
    display: none;
  }

  .admin-table tbody,
  .admin-table tr,
  .admin-table td {
    display: block;
    width: 100%;
  }

  .admin-table tr {
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }

  .admin-table tr:last-child {
    margin-bottom: 0;
  }

  .admin-table tr.sla-overdue,
  .admin-table tr.user-frozen {
    border-left: 4px solid var(--danger);
  }

  .admin-table tr.sla-urgent {
    border-left: 4px solid var(--warning);
  }

  .admin-table td {
    min-width: 0;
    padding: 5px 0;
    border: 0;
    background: transparent !important;
    font-size: 13px;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }

  .admin-table td[data-label] {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
  }

  .admin-table td[data-label]::before {
    content: attr(data-label);
    min-width: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
  }

  .admin-table .order-title-cell .order-title {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .admin-table .row-sub,
  .admin-table .mono,
  .admin-table code,
  .admin-table .audit-payload {
    max-width: none;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .admin-table td.action-cell[data-label],
  .admin-table td.dispute-actions[data-label] {
    display: block;
    padding-top: 9px;
  }

  .admin-table td.action-cell[data-label]::before,
  .admin-table td.dispute-actions[data-label]::before {
    display: block;
    margin-bottom: 6px;
  }

  .admin-table .action-cell,
  .admin-table .dispute-actions {
    gap: 8px;
    white-space: normal;
  }

  .admin-table .action-cell form,
  .admin-table .dispute-actions form {
    flex: 1 1 128px;
  }

  .admin-table .action-cell .btn-sm,
  .admin-table .dispute-actions .btn-sm,
  .admin-table td[data-label] > .btn-sm {
    width: 100%;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .admin-table .card-cancel-form {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .admin-table .card-cancel-form input {
    width: 100%;
    height: 36px;
    font-size: 16px;
  }

  .admin-card-tool,
  .admin-card-recent {
    padding: 18px;
  }

  .admin-card-form .form-row {
    gap: 10px;
  }
}

/* Admin mobile density pass: summarize rows instead of listing every field. */
@media (max-width: 720px) {
  .admin-tabs {
    margin-bottom: 12px;
  }

  .admin-tab {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 13px;
  }

  .admin-filter {
    gap: 6px;
    margin-bottom: 10px;
  }

  .admin-filter .filter-q,
  .admin-filter .filter-status,
  .admin-filter button,
  .admin-filter .btn-ghost {
    min-height: 36px;
  }

  .admin-filter .filter-total {
    font-size: 12px;
  }

  .admin-table tr {
    margin-bottom: 6px;
    padding: 7px 9px;
    border-radius: 8px;
    box-shadow: none;
  }

  .admin-table td {
    padding: 2px 0;
    font-size: 12px;
    line-height: 1.3;
  }

  .admin-table .row-sub {
    font-size: 11px;
    line-height: 1.25;
  }

  .admin-table .badge,
  .admin-table .prio,
  .admin-table .status-pill {
    padding: 1px 6px;
    font-size: 10.5px;
    line-height: 1.5;
  }

  .admin-table .btn-sm,
  .admin-table td[data-label] > .btn-sm {
    min-height: 26px;
    padding: 2px 8px;
    font-size: 11px;
  }

  .admin-users-table tr {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 46px 88px;
    gap: 2px 7px;
    align-items: center;
  }

  .admin-users-table td[data-label],
  .admin-orders-table td[data-label],
  .admin-audit-table td[data-label],
  .admin-invites-table td[data-label],
  .admin-cards-table td[data-label],
  .admin-disputes-table td[data-label] {
    display: block;
  }

  .admin-users-table td[data-label]::before,
  .admin-orders-table td[data-label]::before,
  .admin-audit-table td[data-label]::before,
  .admin-invites-table td[data-label]::before,
  .admin-cards-table td[data-label]::before,
  .admin-disputes-table td[data-label]::before {
    display: none;
  }

  .admin-table td.mobile-empty {
    display: none !important;
  }

  .admin-users-table td:nth-child(1) {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: start;
    color: var(--muted);
    font-weight: 600;
  }

  .admin-users-table td:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .admin-users-table td:nth-child(3) {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
  }

  .admin-users-table td:nth-child(4) {
    grid-column: 2;
    grid-row: 2;
    color: var(--muted);
  }

  .admin-users-table td:nth-child(5) {
    grid-column: 3;
    grid-row: 2;
    justify-self: end;
  }

  .admin-users-table td:nth-child(6) {
    grid-column: 2 / 4;
    grid-row: 3;
    color: var(--muted);
  }

  .admin-users-table td:nth-child(7) {
    display: none;
  }

  .admin-users-table td.action-cell:nth-child(8) {
    grid-column: 4;
    grid-row: 1 / span 3;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 0;
    align-self: center;
  }

  .admin-users-table td.action-cell[data-label]:nth-child(8)::before {
    display: none !important;
  }

  .admin-users-table td.action-cell:nth-child(8) form,
  .admin-users-table td.action-cell:nth-child(8) .btn-sm {
    width: 100%;
  }

  .admin-users-table td.action-cell:nth-child(8) form {
    flex: 0 0 auto;
  }

  .admin-users-table td.action-cell:nth-child(8) .btn-sm {
    min-height: 23px;
    padding: 1px 6px;
  }

  .admin-orders-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(72px, auto);
    gap: 2px 8px;
    align-items: start;
  }

  .admin-orders-table td:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
    color: var(--muted);
    font-weight: 700;
  }

  .admin-orders-table td:nth-child(3) {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .admin-orders-table td:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
  }

  .admin-orders-table td:nth-child(4),
  .admin-orders-table td:nth-child(5),
  .admin-orders-table td:nth-child(6),
  .admin-orders-table td:nth-child(7) {
    color: var(--muted);
    font-size: 11.5px;
  }

  .admin-orders-table td:nth-child(4),
  .admin-orders-table td:nth-child(5) {
    grid-column: 1;
  }

  .admin-orders-table td:nth-child(6),
  .admin-orders-table td:nth-child(7) {
    grid-column: 2;
    justify-self: end;
    text-align: right;
  }

  .admin-orders-table td[data-label]:nth-child(4)::before,
  .admin-orders-table td[data-label]:nth-child(5)::before,
  .admin-orders-table td[data-label]:nth-child(6)::before,
  .admin-orders-table td[data-label]:nth-child(7)::before,
  .admin-audit-table td[data-label]:nth-child(5)::before,
  .admin-audit-table td[data-label]:nth-child(6)::before {
    display: inline;
    content: attr(data-label) " ";
    color: var(--muted);
    font-size: 10.5px;
  }

  .admin-orders-table td:nth-child(8) {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    align-self: start;
    padding-top: 0;
  }

  .admin-orders-table td:nth-child(8) .btn-sm {
    width: auto;
    min-width: 52px;
    min-height: 24px;
    padding-inline: 10px;
  }

  .admin-audit-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(110px, auto);
    gap: 2px 8px;
  }

  .admin-audit-table td:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
  }

  .admin-audit-table td:nth-child(3) {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    max-width: 100%;
  }

  .admin-audit-table td:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
  }

  .admin-audit-table td:nth-child(4) {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    text-align: right;
  }

  .admin-audit-table td:nth-child(5),
  .admin-audit-table td:nth-child(6) {
    grid-column: 1 / -1;
    color: var(--muted);
  }

  .admin-audit-table .audit-action {
    display: inline-block;
    max-width: 136px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
  }

  .admin-invites-table tr,
  .admin-cards-table tr,
  .admin-disputes-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 8px;
  }

  .admin-invites-table td:nth-child(1),
  .admin-cards-table td:nth-child(1),
  .admin-disputes-table td:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
    font-weight: 700;
  }

  .admin-cards-table td:nth-child(4),
  .admin-disputes-table td:nth-child(3) {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .admin-invites-table td:nth-child(5) {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .admin-invites-table td:nth-child(2),
  .admin-invites-table td:nth-child(3),
  .admin-invites-table td:nth-child(4),
  .admin-invites-table td:nth-child(6),
  .admin-invites-table td:nth-child(7),
  .admin-cards-table td:nth-child(2),
  .admin-cards-table td:nth-child(3),
  .admin-cards-table td:nth-child(5),
  .admin-cards-table td:nth-child(6),
  .admin-disputes-table td:nth-child(2),
  .admin-disputes-table td:nth-child(4),
  .admin-disputes-table td:nth-child(5),
  .admin-disputes-table td:nth-child(6) {
    grid-column: 1 / -1;
    color: var(--muted);
  }

  .admin-cards-table td:nth-child(7),
  .admin-disputes-table td:nth-child(7) {
    grid-column: 1 / -1;
    padding-top: 5px;
  }

  .admin-invites-table td:nth-child(8) {
    grid-column: 1 / -1;
    padding-top: 5px;
  }

  .admin-invites-table td.action-cell:nth-child(8),
  .admin-cards-table td.action-cell:nth-child(7),
  .admin-disputes-table td.dispute-actions:nth-child(7) {
    display: flex;
  }

  .admin-users-table-wrap {
    display: none;
  }

  .admin-users-mobile-list {
    display: grid;
    gap: 6px;
  }

  .admin-user-mobile-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 8px;
    align-items: center;
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
  }

  .admin-user-mobile-card.is-frozen {
    border-left: 4px solid var(--danger);
  }

  .admin-user-mobile-main {
    min-width: 0;
  }

  .admin-user-mobile-title {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 6px;
    line-height: 1.25;
  }

  .admin-user-mobile-title strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
  }

  .admin-user-id {
    flex: 0 0 auto;
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    font-weight: 700;
  }

  .admin-user-chip {
    flex: 0 0 auto;
    display: inline-flex;
    min-height: 18px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 1px 6px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.2;
  }

  .admin-user-chip-admin {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #9a3412;
  }

  .admin-user-chip-danger {
    border-color: #fecaca;
    background: #fef2f2;
    color: #dc2626;
  }

  .admin-user-mobile-meta {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    gap: 2px 9px;
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
  }

  .admin-user-created {
    display: none;
  }

  .admin-user-mobile-meta span {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .admin-user-mobile-actions {
    display: flex;
    gap: 4px;
    align-self: center;
  }

  .admin-user-mobile-actions form {
    margin: 0;
  }

  .admin-user-mobile-actions .btn-sm {
    min-width: 52px;
    min-height: 26px;
    padding: 2px 7px;
    font-size: 11px;
    white-space: nowrap;
  }

  .admin-user-self {
    display: block;
    text-align: center;
    font-size: 11px;
  }
}

/* Workspace compact pass. */
.workspace-page .page-header {
  margin: 14px 0 16px;
}

.workspace-page .page-title-row {
  padding-bottom: 16px;
}

.workspace-stats {
  gap: 8px;
  margin-bottom: 14px;
}

.workspace-stats .stat {
  min-height: 66px;
  padding: 11px 14px;
}

.workspace-stats .stat-n {
  font-size: 25px;
}

.workspace-stats .stat-l {
  margin-top: 5px;
}

.workspace-filter {
  gap: 7px;
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.poster-order-list {
  gap: 8px;
}

.poster-order-card {
  grid-template-columns: minmax(0, 1fr) 224px;
  gap: 12px;
  padding: 13px 15px;
}

.poster-order-main {
  gap: 7px;
}

.poster-order-title {
  font-size: 16px;
  line-height: 1.25;
}

.poster-order-progress {
  padding: 6px 9px;
}

.poster-order-side {
  padding-left: 12px;
  gap: 6px 10px;
}

.taker-workspace .rating-panel {
  padding: 14px 16px;
}

.taker-workspace .task-grid {
  gap: 10px;
}

.taker-workspace .task-card {
  min-height: 198px;
  padding: 14px;
}

.task-card-main {
  gap: 8px;
}

.task-note {
  min-height: 38px;
  padding: 8px 10px;
}

.task-card-action {
  padding-top: 10px;
}

.active-task-list {
  gap: 10px;
}

.active-task-card {
  padding: 13px 15px;
}

@media (max-width: 520px) {
  .workspace-page .page-header {
    margin: 10px 0 14px;
  }

  .workspace-page .page-title-row {
    padding-bottom: 14px;
  }

  .workspace-stats {
    margin-bottom: 12px;
  }

  .workspace-stats .stat {
    min-height: 60px;
    padding: 10px 11px;
  }

  .poster-order-card,
  .taker-workspace .task-card,
  .active-task-card {
    padding: 12px;
  }
}

@media (max-width: 860px) {
  .workspace-filter,
  .taker-workspace .workspace-filter {
    grid-template-columns: 1fr auto;
  }

  .workspace-filter .filter-q,
  .workspace-filter .filter-status {
    grid-column: 1 / -1;
  }

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

  .poster-order-side {
    grid-template-columns: 1fr auto;
    padding-left: 0;
    padding-top: 12px;
    border-left: 0;
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 520px) {
  .workspace-filter,
  .taker-workspace .workspace-filter {
    grid-template-columns: 1fr;
  }

  .workspace-filter button,
  .workspace-filter .btn-ghost,
  .workspace-filter .attention-toggle {
    width: 100%;
  }

  .workspace-filter .filter-total {
    justify-self: start;
  }

  .poster-order-side {
    grid-template-columns: 1fr;
  }
}

/* Poster "我的订单" cards should stay readable; the dense mobile queue below
   is only for the taker in-progress list. */
@media (max-width: 520px) {
  .poster-workspace .poster-order-card {
    gap: 12px;
    padding: 14px;
    border-radius: var(--r-lg);
  }

  .poster-workspace .poster-order-side {
    padding-top: 12px;
  }
}

@media (max-width: 520px) {
  .taker-workspace .page-crumb,
  .taker-workspace .page-sub,
  .taker-workspace .page-header-meta {
    display: none;
  }

  .taker-workspace .page-header {
    margin-bottom: 8px;
  }

  .taker-workspace .page-title-row {
    padding-bottom: 8px;
  }

  .taker-workspace .rating-panel {
    margin-bottom: 8px;
    padding: 8px 10px;
  }

  .taker-workspace .rating-panel-head {
    align-items: center;
  }

  .taker-workspace .rating-big {
    font-size: 22px;
    line-height: 1;
  }

  .taker-workspace .rating-breakdown,
  .taker-workspace .rating-recent-h,
  .taker-workspace .rating-recent {
    display: none;
  }

  .taker-workspace .taker-kpis {
    display: none;
  }

  .taker-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 8px;
  }

  .taker-kpis .stat {
    min-height: 42px;
    padding: 6px 4px;
    border-radius: 7px;
    text-align: center;
  }

  .taker-kpis .stat-n {
    font-size: 18px;
    line-height: 1.05;
  }

  .taker-kpis .stat-l {
    margin-top: 3px;
    font-size: 10px;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .taker-workspace .tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2px;
    margin-bottom: 8px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
  }

  .taker-workspace .tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 4px;
    border: 0;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.2;
    text-align: center;
  }

  .taker-workspace .tab.active {
    background: var(--accent-soft);
    color: var(--accent-hover);
  }

  .taker-workspace .tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--bg-subtle);
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
  }

  .taker-workspace .tab.active .tab-count {
    background: #fff;
    color: var(--accent-hover);
  }

  .taker-workspace .taker-filter {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px;
    padding-bottom: 8px;
    margin-bottom: 8px;
  }

  .taker-workspace .desktop-filter {
    display: none;
  }

  .mobile-filter-drawer {
    display: block;
    margin-bottom: 7px;
  }

  .mobile-filter-drawer summary {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 0 9px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--fg);
    font-size: 12px;
    font-weight: 650;
    line-height: 1;
    cursor: pointer;
    list-style: none;
  }

  .mobile-filter-drawer summary::-webkit-details-marker {
    display: none;
  }

  .mobile-filter-drawer summary::after {
    content: "";
    width: 7px;
    height: 7px;
    margin-left: auto;
    border-right: 1.5px solid var(--muted);
    border-bottom: 1.5px solid var(--muted);
    transform: rotate(45deg) translateY(-2px);
  }

  .mobile-filter-drawer[open] summary::after {
    transform: rotate(225deg) translateY(-1px);
  }

  .mobile-filter-drawer summary strong {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: #fff7ed;
    color: #9a3412;
    font-size: 10px;
  }

  .mobile-filter-drawer summary em {
    color: var(--muted);
    font-size: 11px;
    font-style: normal;
    font-weight: 500;
  }

  .mobile-filter-drawer .taker-filter {
    margin-top: 5px;
    border-bottom: 0;
  }

  .taker-filter .filter-q {
    grid-column: 1 / 2;
    min-height: 32px;
    padding: 6px 9px;
  }

  .taker-filter > button.btn-ghost {
    grid-column: 2 / 3;
    width: auto;
    min-height: 32px;
    padding: 0 10px;
  }

  .taker-filter .attention-toggle {
    grid-column: 1 / 2;
    justify-self: start;
    width: auto;
    min-height: 28px;
    padding: 0 8px;
    font-size: 12px;
  }

  .taker-filter > a.btn-ghost {
    width: auto;
    min-height: 28px;
    padding: 0 8px;
    font-size: 12px;
  }

  .taker-filter .filter-total {
    display: none;
  }

  .active-task-list {
    gap: 8px;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .active-task-card {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    column-gap: 10px;
    gap: 0;
    min-height: 64px;
    padding: 10px 10px 10px 13px;
    border: 1px solid #dbe3ef;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }

  .active-task-card::before {
    display: block;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: #e2e8f0;
  }

  .active-task-card.needs-attention::before,
  .active-task-card.attention-warn::before {
    background: #0f766e;
  }

  .active-task-card.attention-danger::before,
  .active-task-card.sla-overdue::before {
    background: #be123c;
  }

  .active-task-card:last-child {
    border-bottom: 1px solid #dbe3ef;
  }

  .active-task-card.needs-attention,
  .active-task-card.attention-danger,
  .active-task-card.attention-warn {
    box-shadow: none;
  }

  .active-task-card.attention-danger {
    box-shadow: none;
  }

  .active-task-card.attention-warn {
    box-shadow: none;
  }

  .active-task-main {
    gap: 5px;
  }

  .active-task-action {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    display: flex;
    align-items: center;
    align-self: stretch;
    padding: 0;
    padding-left: 10px;
    border-left: 1px solid #edf2f7;
    border-top: 0;
  }

  .active-task-kicker {
    display: none;
  }

  .active-task-id {
    height: 20px;
    padding: 0 6px;
    border-color: #cbd5e1;
    background: #f8fafc;
    color: #475569;
    font-size: 11px;
  }

  .active-task-kicker .mode-badge,
  .active-task-kicker .prio,
  .active-task-kicker .deadline,
  .active-task-kicker .attention-badge {
    display: none;
  }

  .active-task-kicker .prio-urgent,
  .active-task-kicker .deadline-overdue,
  .active-task-kicker .deadline-urgent {
    display: inline;
    padding: 0;
    background: transparent;
    border: 0;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
  }

  .active-task-kicker .prio-urgent,
  .active-task-kicker .deadline-overdue {
    color: #be123c;
  }

  .active-task-kicker .deadline-urgent {
    color: #0f766e;
  }

  .active-task-title {
    font-size: 14px;
    color: #111827;
    line-height: 1.22;
  }

  .active-task-mobile-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    color: #6b7280;
    font-size: 10.5px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
  }

  .active-task-mobile-meta > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .active-mobile-mode {
    flex: 0 0 auto;
    padding: 2px 5px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #f8fafc;
    color: #475569;
    line-height: 1;
  }

  .active-task-mobile-meta .presence {
    margin-left: 2px;
    font-size: 10px;
  }

  .active-mobile-alert {
    flex: 0 0 auto;
    color: #0f766e;
    font-weight: 700;
  }

  .active-task-card.sla-overdue .active-mobile-alert,
  .active-task-card.attention-danger .active-mobile-alert {
    color: #be123c;
  }

  .active-task-subline,
  .active-task-email-wrap {
    display: none;
  }

  .attention-line {
    display: block;
    max-width: 100%;
    padding: 5px 7px;
    border: 1px solid #99f6e4;
    border-radius: 7px;
    background: #f0fdfa;
    color: #0f766e;
    font-size: 11px;
    font-weight: 650;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .attention-line::before {
    display: none;
  }

  .attention-line-danger {
    color: #be123c;
    border-color: #fecdd3;
    background: #fff1f2;
  }

  .active-task-flow {
    display: none;
  }

  .active-task-action {
    padding-top: 0;
  }

  .active-task-action-copy {
    display: none;
  }

  .active-task-cta {
    min-width: 70px;
    height: 30px;
    padding: 0 9px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 700;
    box-shadow: none;
  }

  .active-task-cta:hover {
    background: #eef2f7;
    color: #0f172a;
  }
}

@media (max-width: 520px) {
  .active-task-card.needs-attention::before,
  .active-task-card.attention-warn::before {
    background: #5b7f95;
  }

  .active-task-card.attention-danger::before,
  .active-task-card.sla-overdue::before {
    background: #9f5f6f;
  }

  .active-mobile-alert {
    color: #5b7f95;
  }

  .active-task-card.sla-overdue .active-mobile-alert,
  .active-task-card.attention-danger .active-mobile-alert {
    color: #9f5f6f;
  }

  .attention-line,
  .attention-line-danger {
    padding: 0;
    border: 0;
    background: transparent;
    color: #5b7f95;
  }

  .attention-line-danger {
    color: #9f5f6f;
  }
}

/* Order detail meta card compact pass. */
.order-meta-card {
  padding: 14px 16px;
}

.order-meta-card dl.meta {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px 10px;
  align-items: start;
}

.order-meta-card dl.meta dt {
  margin: 0;
  padding-top: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  line-height: 1.45;
}

.order-meta-card dl.meta dd {
  margin: 0;
  min-width: 0;
  font-size: 13px;
  line-height: 1.45;
}

.order-meta-card .copybox {
  margin: 0;
  padding: 7px 8px;
  gap: 8px;
}

.order-meta-card .copybox code,
.order-meta-card .copybox a {
  font-size: 12px;
}

.order-meta-card .copybox .btn-ghost {
  height: 30px;
  padding: 0 10px;
}

.order-meta-card .meta-email-full {
  display: block;
  padding: 0;
  background: transparent;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .order-meta-card {
    padding: 12px;
  }

  .order-meta-card dl.meta {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 7px 9px;
  }
}

/* Mobile browsers auto-zoom focused form controls below 16px. */
@media (max-width: 720px) {
  input,
  select,
  textarea,
  form input,
  form select,
  form textarea,
  .filter-bar .filter-q,
  .filter-bar .filter-status,
  .workspace-filter .filter-q,
  .workspace-filter .filter-status,
  .chat-composer textarea {
    font-size: 16px;
  }
}

/* Dashboard order color rule: default white; urgent only is accented by role. */
.taker-workspace .task-card,
.taker-workspace .active-task-card,
.poster-workspace .poster-order-card {
  border-color: var(--border);
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.taker-workspace .task-card:hover,
.poster-workspace .poster-order-card:hover {
  border-color: var(--border);
  background: #fff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.taker-workspace .task-card .task-note {
  border-color: var(--border);
  background: #fff;
}

.taker-workspace .active-task-card::before {
  background: #e2e8f0;
}

.taker-workspace .task-card.task-priority-urgent,
.taker-workspace .active-task-card.active-priority-urgent {
  border-color: #bbf7d0;
  background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
  box-shadow: inset 3px 0 0 #16a34a, 0 1px 2px rgba(15, 23, 42, 0.04);
}

.taker-workspace .task-card.task-priority-urgent:hover {
  border-color: #16a34a;
  box-shadow: inset 3px 0 0 #16a34a, 0 6px 16px rgba(22, 163, 74, 0.10);
}

.taker-workspace .task-card.task-priority-urgent .task-note {
  border-color: #dcfce7;
  background: #f7fef9;
}

.taker-workspace .active-task-card.active-priority-urgent::before {
  background: #16a34a;
}

.taker-workspace .task-card-action .btn-primary,
.taker-workspace .active-task-card .active-task-cta,
.taker-workspace .active-task-card.active-priority-urgent .active-task-cta {
  border-color: #16a34a;
  background: #16a34a;
  color: #fff;
}

.taker-workspace .task-card-action .btn-primary:hover,
.taker-workspace .active-task-card .active-task-cta:hover,
.taker-workspace .active-task-card.active-priority-urgent .active-task-cta:hover {
  border-color: #15803d;
  background: #15803d;
  color: #fff;
}

.taker-workspace .active-task-card .active-task-cta-request-code,
.code-request-submit {
  border-color: #16a34a;
  background: #16a34a;
  color: #fff;
}

.taker-workspace .active-task-card .active-task-cta-request-code:hover,
.code-request-submit:hover {
  border-color: #15803d;
  background: #15803d;
  color: #fff;
}

.taker-workspace .orders tbody td {
  background: #fff;
}

.taker-workspace .orders tbody td:first-child {
  border-left: 3px solid transparent;
}

.taker-workspace .orders tr:hover td {
  background: #f8fafc;
}

.taker-workspace .orders tr.order-priority-urgent td {
  background: #f7fef9;
}

.taker-workspace .orders tr.order-priority-urgent td:first-child {
  border-left-color: #16a34a;
}

.taker-workspace .orders tr.order-priority-urgent:hover td {
  background: #ecfdf3;
}

.poster-workspace .poster-order-card.poster-priority-urgent {
  border-color: #bfdbfe;
  background: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%);
  box-shadow: inset 3px 0 0 #2563eb, 0 1px 2px rgba(15, 23, 42, 0.04);
}

.poster-workspace .poster-order-card.poster-priority-urgent:hover {
  border-color: #2563eb;
  box-shadow: inset 3px 0 0 #2563eb, 0 6px 16px rgba(37, 99, 235, 0.10);
}

.poster-workspace .poster-order-card.poster-priority-urgent .poster-order-cta {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.poster-workspace .poster-order-card.poster-priority-urgent .poster-order-cta:hover {
  border-color: #1d4ed8;
  background: #1d4ed8;
  color: #fff;
}

/* Poster order cards use the same card layout as the taker hall. */
.poster-workspace .poster-order-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 12px;
}

.poster-workspace .poster-order-card {
  display: flex;
  flex-direction: column;
  min-height: 224px;
  padding: 16px;
  border-radius: var(--r-lg);
}

.poster-workspace .poster-order-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.poster-workspace .poster-order-kicker,
.poster-workspace .poster-order-subline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
}

.poster-workspace .poster-order-kicker {
  font-size: var(--text-sm);
  color: var(--muted);
}

.poster-workspace .poster-order-title {
  padding-right: 0;
  margin: 0;
  font-size: var(--text-md);
  line-height: 1.35;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.poster-workspace .poster-order-note {
  display: flex;
  min-height: 44px;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
}

.poster-workspace .poster-order-focus {
  display: block;
  max-width: 100%;
  color: var(--fg);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.poster-workspace .poster-order-focus-action {
  color: #1d4ed8;
}

.poster-workspace .poster-order-email-line {
  display: flex;
  max-width: 100%;
  min-width: 0;
  align-items: baseline;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.poster-workspace .poster-order-email-label {
  flex: 0 0 auto;
}

.poster-workspace .poster-order-email {
  min-width: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.poster-workspace .poster-order-note-extra {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.poster-workspace .poster-order-subline {
  margin-top: auto;
  font-size: 13px;
  color: var(--muted);
}

.poster-workspace .poster-order-subline strong {
  color: var(--fg);
  font-weight: 600;
}

.poster-workspace .poster-order-side {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
  border-left: 0;
}

.poster-workspace .poster-order-cta {
  width: 100%;
  justify-content: center;
  text-align: center;
}

.taker-workspace .taker-order-note,
.taker-workspace .active-task-note {
  display: flex;
  min-height: 44px;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
}

.taker-workspace .taker-order-focus {
  display: block;
  max-width: 100%;
  color: var(--fg);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.taker-workspace .taker-order-focus-action {
  color: #15803d;
}

.taker-workspace .taker-order-email-line {
  display: flex;
  max-width: 100%;
  min-width: 0;
  align-items: baseline;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.taker-workspace .taker-order-email-label {
  flex: 0 0 auto;
}

.taker-workspace .taker-order-email {
  min-width: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.taker-workspace .active-task-flow {
  margin-top: 0;
}

.taker-order-collapse {
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.taker-history-groups {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.taker-history-groups .taker-order-collapse {
  margin-bottom: 0;
}

.taker-collapse-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 12px 14px;
  color: var(--fg);
  cursor: pointer;
  list-style: none;
}

.taker-collapse-summary::-webkit-details-marker {
  display: none;
}

.taker-collapse-summary::after {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
}

.taker-order-collapse[open] > .taker-collapse-summary {
  border-bottom: 1px solid var(--border);
}

.taker-order-collapse[open] > .taker-collapse-summary::after {
  transform: rotate(225deg) translateY(-1px);
}

.taker-collapse-heading {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 8px;
}

.taker-collapse-heading strong,
.taker-collapse-heading span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.taker-collapse-heading strong {
  color: var(--fg);
  font-size: 14px;
  font-weight: 700;
}

.taker-collapse-heading span {
  color: var(--muted);
  font-size: 12px;
}

.taker-collapse-pill {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.taker-collapse-pill-action {
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.taker-collapse-body {
  padding: 12px;
}

.taker-order-collapse-active .active-task-list {
  gap: 10px;
}

.taker-history-table-wrap {
  margin: 0;
}

.taker-history-table {
  border-radius: 8px;
}

.taker-history-group-cancelled:not([open]) .taker-collapse-summary {
  color: var(--muted);
}

@media (max-width: 520px) {
  .poster-workspace .poster-order-list {
    grid-template-columns: 1fr;
  }

  .poster-workspace .poster-order-card {
    min-height: 0;
    padding: 14px;
  }

  .poster-workspace .poster-order-side {
    align-items: stretch;
    flex-direction: column;
  }

  .taker-order-collapse {
    margin-bottom: 8px;
    border-radius: 8px;
  }

  .taker-collapse-summary {
    gap: 7px;
    min-height: 38px;
    padding: 8px 10px;
  }

  .taker-collapse-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .taker-collapse-heading strong {
    max-width: 100%;
    font-size: 13px;
    line-height: 1.2;
  }

  .taker-collapse-heading span {
    font-size: 11px;
    line-height: 1.2;
  }

  .taker-collapse-pill {
    height: 20px;
    padding: 0 7px;
    font-size: 10.5px;
  }

  .taker-collapse-body {
    padding: 7px;
  }

  .taker-order-collapse-active .active-task-list {
    gap: 7px;
  }

  .taker-history-table-wrap {
    overflow: visible;
  }

  .taker-history-table.orders {
    display: block;
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  .taker-history-table thead {
    display: none;
  }

  .taker-history-table tbody,
  .taker-history-table tr,
  .taker-history-table td {
    display: block;
    width: 100%;
  }

  .taker-history-table tr {
    margin-bottom: 7px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
  }

  .taker-history-table tr:last-child {
    margin-bottom: 0;
  }

  .taker-history-table td {
    display: flex;
    min-width: 0;
    align-items: baseline;
    gap: 8px;
    padding: 3px 0;
    border: 0;
    background: transparent !important;
    font-size: 12px;
    line-height: 1.35;
  }

  .taker-history-table td::before {
    content: attr(data-label);
    flex: 0 0 58px;
    color: var(--muted);
    font-size: 11px;
  }

  .taker-history-table td:first-child {
    color: var(--fg);
    font-weight: 700;
  }

  .taker-history-table td:last-child {
    padding-top: 7px;
  }

  .taker-history-table td:last-child::before {
    display: none;
  }

  .taker-history-table .order-title {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .taker-history-table .btn-ghost {
    width: 100%;
    min-height: 30px;
    text-align: center;
  }
}

/* Admin users mobile v2: remove irrelevant workspace nav and use record cards. */
@media (max-width: 720px) {
  body.page-admin .topbar-inner {
    grid-template-areas: "brand utility";
    gap: 6px 8px;
  }

  body.page-admin .nav-primary {
    display: none;
  }

  body.page-admin .nav-utility {
    justify-self: end;
  }

  body.page-admin .nav-utility .nav-admin {
    display: none;
  }

  body.page-admin .nav-utility .nav-settings {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--gray-700);
    font-size: 12px;
    line-height: 1;
  }

  body.page-admin .container {
    padding-top: 14px;
  }

  body.page-admin .admin-head {
    margin: 8px 0 10px;
  }

  body.page-admin .admin-head h1 {
    font-size: 21px;
    line-height: 1.2;
  }

  body.page-admin .admin-head .muted {
    display: none;
  }

  body.page-admin .admin-tabs {
    margin-bottom: 12px;
  }

  body.page-admin .admin-filter {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 9px;
    border-radius: 10px;
  }

  body.page-admin .admin-filter .filter-q {
    grid-column: 1;
  }

  body.page-admin .admin-filter button {
    grid-column: 2;
    width: auto;
    min-width: 72px;
    padding-inline: 14px;
  }

  body.page-admin .admin-filter > a.btn-ghost {
    grid-column: 1 / -1;
  }

  body.page-admin .admin-filter .filter-total {
    grid-column: 1 / -1;
    text-align: right;
  }

  .admin-users-mobile-list {
    gap: 9px;
  }

  .admin-user-mobile-card {
    display: block;
    padding: 11px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }

  .admin-user-mobile-card.is-frozen {
    padding-left: 9px;
    border-left: 3px solid var(--danger);
  }

  .admin-user-mobile-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 9px;
    align-items: start;
  }

  .admin-user-avatar {
    display: inline-flex;
    min-width: 34px;
    height: 26px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--gray-50);
    color: var(--gray-600);
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
  }

  .admin-user-identity {
    min-width: 0;
  }

  .admin-user-name-row {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 5px;
  }

  .admin-user-name-row strong {
    min-width: 0;
    overflow: hidden;
    color: var(--fg);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .admin-user-joined {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.3;
  }

  .admin-user-status {
    display: flex;
    max-width: 112px;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
  }

  .admin-user-chip {
    display: inline-flex;
    min-height: 20px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 7px;
    background: #fff;
    color: var(--gray-600);
    font-size: 10.5px;
    font-weight: 650;
    line-height: 1;
    white-space: nowrap;
  }

  .admin-user-chip-ok {
    border-color: #dcfce7;
    background: #f0fdf4;
    color: #166534;
  }

  .admin-user-chip-admin {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #9a3412;
  }

  .admin-user-chip-danger {
    border-color: #fecaca;
    background: #fef2f2;
    color: #b91c1c;
  }

  .admin-user-mobile-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    margin: 10px 0 0;
    padding: 0;
    overflow: hidden;
    border-radius: 8px;
    background: var(--gray-100);
  }

  .admin-user-mobile-facts > div {
    min-width: 0;
    padding: 8px;
    background: var(--gray-50);
  }

  .admin-user-mobile-facts dt {
    margin: 0 0 2px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.2;
  }

  .admin-user-mobile-facts dd {
    margin: 0;
    min-width: 0;
    overflow: hidden;
    color: var(--fg);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .admin-user-mobile-facts dd span {
    color: var(--muted);
    font-weight: 600;
  }

  .admin-user-mobile-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
  }

  .admin-user-mobile-actions.is-self {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
  }

  .admin-user-action-form {
    margin: 0;
  }

  .admin-user-action {
    display: inline-flex;
    width: 100%;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.1;
    white-space: nowrap;
  }

  .admin-user-action-neutral {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--gray-700);
  }

  .admin-user-action-neutral:hover {
    background: var(--gray-50);
  }

  .admin-user-action-danger {
    border: 1px solid #fecaca;
    background: #fff;
    color: #b91c1c;
  }

  .admin-user-action-danger:hover {
    background: #fef2f2;
  }

  .admin-user-action-success {
    border: 1px solid #bbf7d0;
    background: #fff;
    color: #166534;
  }

  .admin-user-action-success:hover {
    background: #f0fdf4;
  }

  .admin-user-self-note {
    color: var(--muted);
    font-size: 12px;
  }
}

@media (max-width: 360px) {
  .admin-user-mobile-head {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .admin-user-avatar {
    display: none;
  }

  .admin-user-status {
    max-width: 96px;
  }

  .admin-user-mobile-actions {
    grid-template-columns: 1fr;
  }
}
