/* =====================================================================
   syncalp — Design System
   ===================================================================== */

:root {
  color-scheme: light;
  --bg: #f4f5fa;
  --bg-soft: #eef0f7;
  --surface: #ffffff;
  --surface-soft: #fafbfe;
  --surface-muted: #eef0f6;
  --zebra: rgba(255, 255, 255, 0.5);
  --text: #131735;
  --ink: #131735;
  --muted: #565d7c;
  --muted-soft: #666e8c;
  --line: #e4e7f2;
  --line-strong: #cdd3fa;
  --accent: #4655e0;
  --accent-dark: #3846cd;
  --accent-soft: #edeffe;
  --accent-soft-border: #cdd3fa;
  --danger: #d13d3d;
  --danger-soft: #fdeaea;
  --danger-soft-border: #f3c6c6;
  --warn: #a86e0a;
  --warn-soft: #fcf2dd;
  --warn-soft-border: #f0dcb2;
  --ok: #0f8a5f;
  --ok-soft: #e2f6ec;
  --ok-soft-border: #b6e4cd;
  --info: #3d6adb;
  --info-soft: #e9effc;
  --info-soft-border: #c4d4f6;
  --ring: rgba(70, 85, 224, 0.22);
  --shadow-sm: 0 1px 2px rgba(19, 23, 53, 0.05);
  --shadow-md: 0 1px 2px rgba(19, 23, 53, 0.04), 0 10px 30px -12px rgba(19, 23, 53, 0.14);
  --shadow-lg: 0 1px 2px rgba(19, 23, 53, 0.04), 0 10px 30px -12px rgba(19, 23, 53, 0.14);
  --shadow-xl: 0 24px 90px -18px rgba(19, 23, 53, 0.35);
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --transition: 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

/* =====================================================================
   ORDERS
   ===================================================================== */

.orders-page main {
  display: grid;
  gap: 20px;
}











.connection-status {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: inline-flex;
  font-weight: 800;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 10px;
}

.connection-check {
  align-items: center;
  background: var(--surface-muted);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  height: 20px;
  justify-content: center;
  line-height: 1;
  width: 20px;
}

.connection-status[data-status="connected"] {
  background: var(--ok-soft);
  border-color: var(--ok-soft-border);
  color: var(--ok);
}

.connection-status[data-status="connected"] .connection-check {
  background: var(--ok);
  color: var(--bg);
}

.connection-status[data-status="missing"],
.connection-status[data-status="checking"] {
  background: var(--warn-soft);
  border-color: var(--warn-soft-border);
  color: var(--warn);
}















.switch-control {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  gap: 8px;
  padding: 7px 12px;
}

.switch-control input,
.workspace-pill input {
  accent-color: var(--accent);
}

.workspace-picker {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 10px;
  padding: 12px;
}

.workspace-picker-head {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}

.workspace-picker-head span {
  color: var(--ink);
  font-weight: 800;
}

.workspace-picker-head small {
  color: var(--muted);
}

.workspace-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.workspace-pill {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  gap: 7px;
  min-height: 34px;
  padding: 6px 10px;
}

.workspace-pill span {
  font-weight: 700;
}

.workspace-pill em {
  color: var(--muted);
  font-style: normal;
}









.profile-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-chip {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  cursor: pointer;
  display: inline-grid;
  gap: 3px;
  min-width: 152px;
  padding: 9px 11px;
  text-align: right;
}

.profile-chip[aria-selected="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-soft-border);
  box-shadow: inset 3px 0 0 var(--accent);
}

.profile-chip span {
  font-weight: 900;
}

.profile-chip small {
  color: var(--muted);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-chip em {
  color: var(--ok);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.profile-chip em.muted {
  color: var(--muted);
}

.profile-editor {
  display: grid;
  gap: 12px;
}



.danger-action {
  color: var(--danger);
}

.danger-action:hover {
  background: var(--danger-soft);
  border-color: var(--danger-soft-border);
}



.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 4px;
  min-height: 92px;
  padding: 14px;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
  font-size: 12px;
}

.metric-card strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1.15;
}





.order-status-refresh {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-inline-start: auto;
}

.order-status-refresh span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.orders-table-wrap {
  overflow: auto;
}

.orders-table {
  border-collapse: collapse;
  table-layout: auto;
  width: 100%;
}

.orders-table th,
.orders-table td {
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  padding: 10px 10px;
  text-align: right;
  vertical-align: middle;
}

.orders-table th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.orders-table td {
  color: var(--ink);
}

.orders-table tbody tr:hover {
  background: var(--surface-soft);
}

.orders-table th.col-actions,
.orders-table td.col-actions {
  text-align: left;
  white-space: nowrap;
  width: 1%;
}

.orders-table th.col-select,
.orders-table td.col-select {
  text-align: center;
  white-space: nowrap;
  width: 1%;
}

.orders-table .col-select input[type="checkbox"] {
  cursor: pointer;
  height: 16px;
  width: 16px;
}

.orders-table th.col-status,
.orders-table td.col-status {
  white-space: nowrap;
  width: 1%;
}

.orders-table th.col-numeric,
.orders-table td.col-numeric {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.orders-table td.col-customer {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.orders-table td.col-profile-agent {
  line-height: 1.25;
  max-width: 190px;
}

.orders-table td.col-profile-agent small {
  color: var(--muted);
  display: block;
  font-size: 11px;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.orders-table td.col-route bdi {
  display: inline-block;
  white-space: normal;
}

.orders-table td.col-price {
  line-height: 1.3;
}

.orders-table td.col-price .price-gross {
  color: var(--muted);
  display: block;
  font-size: 11px;
  text-decoration: line-through;
}

.orders-table td.col-time {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
}

.orders-table td.col-time .time-clock {
  color: var(--muted);
  display: block;
  font-size: 11px;
}

.orders-pagination {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  padding: 12px 4px 0;
}

.orders-pagination-summary {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.orders-pagination-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.orders-page-button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: 32px;
  justify-content: center;
  min-width: 32px;
  padding: 0 9px;
}

.orders-page-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.orders-page-button[aria-current="page"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.status-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 6px 9px;
}

.status-ok {
  background: var(--ok-soft);
  border-color: var(--ok-soft-border);
  color: var(--ok);
}

.status-warn {
  background: var(--warn-soft);
  border-color: var(--warn-soft-border);
  color: var(--warn);
}

.status-danger {
  background: var(--danger-soft);
  border-color: var(--danger-soft-border);
  color: var(--danger);
}

.status-info {
  background: var(--info-soft);
  border-color: var(--info-soft-border);
  color: var(--info);
}

.status-muted {
  background: var(--surface-muted);
  border-color: var(--line-strong);
  color: var(--muted);
}

.status-note {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 700;
  margin-top: 5px;
  white-space: normal;
}

.manual-import-badge {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  margin-inline-start: 6px;
  padding: 5px 8px;
  white-space: nowrap;
}

.compact-action {
  min-height: 32px;
  padding: 6px 10px;
}

.small-empty {
  font-size: 13px;
  padding: 10px;
}

















.order-events {
  display: grid;
  gap: 8px;
}

.order-events h3 {
  font-size: 15px;
}

.order-event {
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 2px;
  padding: 10px;
}

.order-event time {
  color: var(--muted);
  direction: ltr;
  font-size: 12px;
}

.order-event span {
  color: var(--ink);
}

.order-event-error {
  background: var(--danger-soft);
  border-color: var(--danger-soft-border);
}

.order-event-warn {
  background: var(--warn-soft);
  border-color: var(--warn-soft-border);
}

.order-event-success {
  background: var(--ok-soft);
  border-color: var(--ok-soft-border);
}



.order-activity-log {
  overflow: auto;
}

.order-log-grid {
  min-width: 1040px;
  width: 100%;
}

.order-log-grid-header,
.order-log-grid-row {
  display: grid;
  grid-template-columns: 150px 96px 120px 110px minmax(220px, 0.8fr) minmax(340px, 1.2fr);
}

.order-log-grid-header > div,
.order-log-grid-row > div {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  min-width: 0;
  padding: 10px 12px;
  text-align: right;
}

.order-log-grid-header > div {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.order-log-grid-row:hover > div {
  background: var(--surface-soft);
}

.order-log-message {
  color: var(--ink);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.order-log-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.order-log-action {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 6px 8px;
}

.order-log-grid-row > div:last-child {
  align-items: flex-start;
  display: grid;
  gap: 4px;
}

.order-log-grid-row > div:last-child .status-badge {
  width: fit-content;
}

.order-json-details {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.order-json-details summary {
  cursor: pointer;
  font-weight: 800;
}

.order-json-details pre {
  background: #0f172a;
  border-radius: var(--radius-sm);
  color: #e2e8f0;
  font-size: 12px;
  margin: 12px 0 0;
  max-height: 420px;
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
}



@media (max-width: 720px) {
  .orders-settings-head,
  .orders-ledger-head,
  .profile-toolbar,
  .order-status-refresh,
  .orders-filter-group {
    align-items: stretch;
    flex-direction: column;
  }

  

  
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 100% -100px, rgba(11, 138, 130, 0.06), transparent 60%),
    radial-gradient(900px 500px at -100px 100%, rgba(29, 108, 209, 0.05), transparent 65%);
  color: var(--text);
  direction: rtl;
  font-family: "Segoe UI", "Heebo", "Rubik", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  min-height: 100vh;
}

body.modal-open,
body.profile-open {
  overflow: hidden;
}

h1, h2, h3, h4 {
  color: var(--ink);
  margin: 0;
}

p {
  color: var(--muted);
  margin: 4px 0 0;
}

main {
  margin: 0 auto;
  max-width: 1480px;
  padding: 24px 32px 48px;
}

.eyebrow,
.section-label {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section-label {
  color: var(--muted);
}

.sr-only {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.muted {
  color: var(--muted);
}

/* =====================================================================
   TOPBAR
   ===================================================================== */

.topbar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-inner {
  align-items: center;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1480px;
  min-height: 72px;
  padding: 14px 32px;
}

.brand {
  align-items: center;
  display: flex;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  align-items: center;
  background: linear-gradient(135deg, var(--accent), #8b5bf0);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(11, 138, 130, 0.25);
  color: #ffffff;
  display: inline-flex;
  flex-shrink: 0;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.brand-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.brand-text h1 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-text p {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-side {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  gap: 10px;
}

/* TOTP card */
.totp-card {
  --otp-progress: 0%;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: inherit;
  column-gap: 10px;
  cursor: pointer;
  display: grid;
  font: inherit;
  grid-template-areas:
    "label    label"
    "code     countdown";
  grid-template-columns: auto 1fr;
  min-height: 0;
  overflow: hidden;
  padding: 6px 12px 8px;
  position: relative;
  row-gap: 1px;
  text-align: start;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.totp-card:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.totp-card:focus-visible {
  border-color: var(--accent);
  outline: 3px solid var(--ring);
  outline-offset: 1px;
}

.totp-card:active {
  transform: translateY(1px);
}

.totp-card.copied {
  background: var(--ok-soft);
  border-color: var(--ok-soft-border);
}

.totp-card.copied span {
  color: var(--ok);
}

.totp-card.copied span::after {
  content: " · הועתק ✓";
}

.totp-card.copied strong {
  color: var(--ok);
}

.totp-card.copied::after {
  background: var(--ok);
}

.totp-card::after {
  background: var(--accent);
  bottom: 0;
  content: "";
  height: 2px;
  inset-inline-start: 0;
  position: absolute;
  transition: width 200ms linear;
  width: var(--otp-progress);
}

.totp-card span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  grid-area: label;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
}

.totp-card em {
  align-self: end;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  grid-area: countdown;
  justify-self: end;
  line-height: 1;
  padding-bottom: 1px;
  white-space: nowrap;
}

.totp-card strong {
  color: var(--ink);
  direction: ltr;
  font-size: 16px;
  font-weight: 900;
  grid-area: code;
  letter-spacing: 0.6px;
  line-height: 1.1;
  text-align: left;
}

.totp-card.warning {
  background: var(--warn-soft);
  border-color: var(--warn-soft-border);
}

.totp-card.warning::after {
  background: var(--warn);
}

/* Status pill */
.status {
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-border);
  border-radius: var(--radius-md);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  min-width: 130px;
  padding: 8px 14px;
  text-align: center;
}

/* Topbar action group */
.topbar-actions {
  align-items: center;
  display: flex;
  gap: 6px;
}

.icon-button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  position: relative;
  transition: background var(--transition), border-color var(--transition), transform var(--transition), color var(--transition);
}

.icon-button:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
  color: var(--accent-dark);
}

.icon-button:focus-visible {
  border-color: var(--accent);
  outline: 3px solid var(--ring);
  outline-offset: 1px;
}

.icon-button:active {
  transform: translateY(1px);
}

.icon-button svg {
  color: var(--accent);
  flex-shrink: 0;
}

.icon-button-label {
  font-size: 13px;
}

.icon-button-badge {
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-border);
  border-radius: 999px;
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  margin-inline-start: 2px;
  max-width: 220px;
  overflow: hidden;
  padding: 3px 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button-badge.muted {
  background: var(--surface-muted);
  border-color: var(--line);
  color: var(--muted);
}

.icon-button-badge.warning {
  background: var(--warn-soft);
  border-color: var(--warn-soft-border);
  color: var(--warn);
}

/* User menu */
.user-menu {
  position: relative;
}

.user-chip {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  gap: 9px;
  min-height: 38px;
  padding: 3px 12px 3px 4px;
  transition: background var(--transition), border-color var(--transition);
}

.user-chip:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.user-chip:focus-visible {
  border-color: var(--accent);
  outline: 3px solid var(--ring);
  outline-offset: 1px;
}

.user-avatar {
  align-items: center;
  background: linear-gradient(135deg, var(--accent), #8b5bf0);
  border-radius: 50%;
  color: #ffffff;
  display: inline-flex;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 800;
  height: 30px;
  justify-content: center;
  text-transform: uppercase;
  width: 30px;
}

.user-chip-text {
  display: grid;
  line-height: 1.15;
  text-align: start;
}

.user-chip-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.user-chip-email {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-popover {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 2px;
  inset-inline-end: 0;
  margin-top: 8px;
  min-width: 220px;
  padding: 6px;
  position: absolute;
  top: 100%;
  z-index: 40;
}

.user-menu-popover[hidden] {
  display: none;
}

.user-menu-item {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  font: inherit;
  font-weight: 700;
  gap: 10px;
  min-height: 36px;
  padding: 0 12px;
  text-align: start;
  transition: background var(--transition);
  width: 100%;
}

.user-menu-item:hover {
  background: var(--surface-muted);
}

.user-menu-item svg {
  color: var(--muted);
  flex-shrink: 0;
}

.user-menu-item-danger {
  color: var(--danger);
}

.user-menu-item-danger:hover {
  background: var(--danger-soft);
}

.user-menu-item-danger svg {
  color: var(--danger);
}

/* =====================================================================
   TOOLBAR
   ===================================================================== */

.toolbar {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 4px;
  padding: 14px 16px;
}

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

.toolbar-workspace {
  align-items: center;
}

.toolbar-button-group {
  align-items: stretch;
  display: inline-flex;
  gap: 6px;
}

.toolbar-actions {
  margin-inline-start: auto;
}

.toolbar-workspace .workspace-field.field {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 8px;
  min-width: 0;
}

.toolbar-workspace .workspace-field.field > label {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0;
  text-transform: uppercase;
  white-space: nowrap;
}

.workspace-field select {
  min-width: 220px;
}

.workspace-switcher {
  align-items: center;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: inline-flex;
  gap: 4px;
  min-height: 38px;
  padding: 3px;
}

.workspace-tab {
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  min-height: 30px;
  padding: 0 16px;
  transition: background var(--transition), color var(--transition);
}

.workspace-tab:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.workspace-tab.active {
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--accent-dark);
}

/* =====================================================================
   BUTTONS
   ===================================================================== */

button {
  align-items: center;
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  gap: 8px;
  justify-content: center;
  min-height: 38px;
  padding: 0 18px;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

a.primary-button,
a.secondary-button,
a.danger-button,
a.ghost-button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  gap: 8px;
  justify-content: center;
  min-height: 38px;
  padding: 0 18px;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

button[hidden],
[hidden] {
  display: none !important;
}

button:hover {
  background: var(--accent-dark);
}

button:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button svg {
  flex-shrink: 0;
}

.primary-button {
  background: var(--accent);
}

.primary-button:hover {
  background: var(--accent-dark);
  box-shadow: 0 4px 14px rgba(11, 138, 130, 0.32);
}

.secondary-button {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.secondary-button:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.secondary-button:disabled {
  background: var(--surface);
  color: var(--muted);
  cursor: not-allowed;
}

.secondary-button.loading {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.secondary-button.loading::before {
  animation: spin 800ms linear infinite;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  border-top-color: #ffffff;
  content: "";
  height: 14px;
  width: 14px;
}

.ghost-button {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 700;
  min-height: 34px;
  padding: 0 12px;
}

.ghost-button:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.ghost-button:focus-visible {
  border-color: var(--accent);
  outline: 3px solid var(--ring);
}

.ghost-button:disabled {
  background: var(--surface);
  color: var(--muted);
  cursor: not-allowed;
}

.danger-button {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}

.danger-button:hover {
  background: #912018;
  border-color: #912018;
}

.danger-button.active {
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.18);
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.danger-button.loading::before {
  animation: spin 800ms linear infinite;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  border-top-color: #ffffff;
  content: "";
  height: 14px;
  width: 14px;
}

.nav-button {
  text-decoration: none;
}







.filter-button {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  min-height: 32px;
  padding: 0 12px;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}

.filter-button:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.filter-button:active {
  transform: scale(0.98);
}

.filter-button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =====================================================================
   FORMS
   ===================================================================== */

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

label,
.field label {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  font-weight: 700;
  gap: 6px;
  letter-spacing: 0.01em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  min-height: 38px;
  min-width: 220px;
  padding: 8px 11px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
  outline: none;
}

textarea {
  line-height: 1.5;
  min-height: 82px;
  resize: vertical;
}

select {
  cursor: pointer;
}

input[type="checkbox"] {
  accent-color: var(--accent);
  height: 16px;
  width: 16px;
}

.toggle {
  align-items: center;
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  gap: 9px;
  min-height: 38px;
}

.toggle span {
  color: var(--ink);
}

.compact-field input,
.compact-field select {
  min-width: 140px;
}

.secret-status {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  text-transform: uppercase;
}

.secret-status.configured {
  background: var(--ok-soft);
  border-color: var(--ok-soft-border);
  color: var(--ok);
}

/* =====================================================================
   APP MODAL SYSTEM
   ===================================================================== */

.app-modal {
  align-items: flex-start;
  display: flex;
  inset: 0;
  justify-content: center;
  overflow-y: auto;
  padding: 48px 24px;
  position: fixed;
  z-index: 50;
}

.app-modal[hidden] {
  display: none;
}

.app-modal-backdrop {
  background: rgba(15, 23, 42, 0.45);
  cursor: pointer;
  inset: 0;
  position: fixed;
  z-index: 0;
}

.app-modal-card {
  animation: modalIn 200ms cubic-bezier(0.16, 1, 0.3, 1);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  margin-block: auto;
  max-height: calc(100vh - 96px);
  overflow: hidden;
  position: relative;
  width: 100%;
  z-index: 1;
}

.app-modal-card-small { max-width: 560px; }
.app-modal-card-medium { max-width: 820px; }
.app-modal-card-large { max-width: 1100px; }

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.app-modal-head {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-shrink: 0;
  gap: 16px;
  justify-content: space-between;
  padding: 22px 28px 18px;
}

.app-modal-head-text {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.app-modal-head-text h2 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0;
}

.app-modal-head-text p {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.icon-close {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  flex-shrink: 0;
  height: 36px;
  justify-content: center;
  padding: 0;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  width: 36px;
}

.icon-close:hover {
  background: var(--surface-muted);
  border-color: var(--line-strong);
  color: var(--ink);
}

.icon-close:focus-visible {
  border-color: var(--accent);
  outline: 3px solid var(--ring);
}

.app-modal-body {
  overflow: visible;
  padding: 22px 28px;
}

.app-modal-body-scroll {
  overflow-y: auto;
}

.app-modal-footer {
  align-items: center;
  background: var(--surface-soft);
  border-top: 1px solid var(--line);
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
  padding: 16px 28px;
}

.app-modal-footer span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-inline-end: auto;
}

/* =====================================================================
   USER SETTINGS (inside modal)
   ===================================================================== */

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

.user-settings-grid .field input {
  min-width: 0;
  width: 100%;
}

/* =====================================================================
   MONITOR (inside modal)
   ===================================================================== */

#monitorBody {
  display: grid;
  gap: 18px;
}

.monitor-section {
  display: grid;
  gap: 14px;
}

/* --- General settings --- */

.monitor-general {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
}

.monitor-power {
  align-items: center;
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  gap: 12px;
  min-height: 68px;
  padding: 12px 14px;
  transition: background var(--transition), border-color var(--transition);
}

.monitor-power:hover {
  border-color: var(--accent);
}

.monitor-power input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.monitor-power-mark {
  background: var(--surface);
  border: 1px solid var(--accent-soft-border);
  border-radius: 999px;
  flex-shrink: 0;
  height: 24px;
  position: relative;
  transition: background var(--transition), border-color var(--transition);
  width: 42px;
}

.monitor-power-mark::after {
  background: var(--muted-soft);
  border-radius: 50%;
  content: '';
  height: 16px;
  inset-block-start: 3px;
  inset-inline-start: 3px;
  position: absolute;
  transition: transform var(--transition), background var(--transition);
  width: 16px;
}

.monitor-power input:checked + .monitor-power-mark {
  background: var(--accent);
  border-color: var(--accent-dark);
}

.monitor-power input:checked + .monitor-power-mark::after {
  background: #ffffff;
  transform: translateX(-18px);
}

.monitor-power input:focus-visible + .monitor-power-mark {
  box-shadow: 0 0 0 3px var(--ring);
}

.monitor-power-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.monitor-power-text strong {
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 800;
}

.monitor-power-text small {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

.monitor-general-fields {
  display: grid;
  gap: 12px;
  grid-template-columns: 130px minmax(0, 1fr);
}

.monitor-general-fields .field input {
  min-width: 0;
  width: 100%;
}

/* --- Section head --- */

.monitor-section-head {
  align-items: flex-end;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  padding-top: 16px;
}

.monitor-section-head-text h3 {
  font-size: 15px;
  font-weight: 800;
  margin: 0;
}

.monitor-section-head-text p {
  color: var(--muted);
  font-size: 12.5px;
  margin: 2px 0 0;
}

.monitor-section-head-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.monitor-count-badge {
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-border);
  border-radius: 999px;
  color: var(--accent-dark);
  font-size: 11.5px;
  font-weight: 800;
  padding: 5px 11px;
  white-space: nowrap;
}

.monitor-count-badge.is-empty {
  background: var(--warn-soft);
  border-color: var(--warn-soft-border);
  color: var(--warn);
}

/* --- Defaults --- */

.monitor-defaults {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.monitor-defaults summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  list-style: none;
  padding: 12px 14px;
}

.monitor-defaults summary::-webkit-details-marker {
  display: none;
}

.monitor-defaults summary::after {
  color: var(--muted);
  content: '▾';
  font-size: 12px;
  transition: transform var(--transition);
}

.monitor-defaults[open] summary::after {
  transform: rotate(180deg);
}

.monitor-defaults summary:focus-visible {
  border-radius: var(--radius-md);
  outline: 3px solid var(--ring);
}

.monitor-defaults-title {
  font-size: 13px;
  font-weight: 800;
}

.monitor-defaults-summary {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  margin-inline-start: auto;
  margin-inline-end: 10px;
}

.monitor-defaults-body {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  justify-items: start;
  padding: 14px;
}

.monitor-hint {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

/* --- Project cards --- */

.monitor-projects {
  display: grid;
  gap: 10px;
}

.monitor-project {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: grid;
  gap: 12px;
  padding: 14px;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.monitor-project.is-selected {
  border-color: var(--accent-soft-border);
  box-shadow: var(--shadow-sm);
}

.monitor-project:not(.is-selected) {
  background: var(--surface-soft);
}

.monitor-project-head {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
}

.monitor-project-toggle {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.monitor-project-toggle input {
  flex-shrink: 0;
  height: 18px;
  width: 18px;
}

.monitor-project-identity {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.monitor-project-identity strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.monitor-project-identity small {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

.monitor-project-meta {
  align-items: center;
  display: flex;
  gap: 8px;
}

.monitor-tag {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 3px 9px;
  white-space: nowrap;
}

.monitor-tag-custom {
  background: var(--info-soft);
  border-color: var(--info-soft-border);
  color: var(--info);
}

.monitor-fix-count {
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-border);
  border-radius: var(--radius-xs);
  color: var(--accent-dark);
  font-size: 11.5px;
  font-weight: 800;
  min-width: 40px;
  padding: 4px 8px;
  text-align: center;
}

.monitor-fix-count.is-zero {
  background: var(--surface-muted);
  border-color: var(--line);
  color: var(--muted);
}

.monitor-project-reset {
  background: none;
  border: none;
  color: var(--info);
  cursor: pointer;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  justify-self: start;
  min-height: 0;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.monitor-project-reset:hover {
  color: var(--accent-dark);
}

/* --- Fix chips --- */

.monitor-fix-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.monitor-fix-chip {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  gap: 7px;
  min-height: 32px;
  padding: 5px 12px 5px 10px;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.monitor-fix-chip:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--ink);
}

.monitor-fix-chip:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 1px;
}

.monitor-fix-chip-mark {
  align-items: center;
  background: var(--surface-muted);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  display: inline-flex;
  flex-shrink: 0;
  height: 16px;
  justify-content: center;
  position: relative;
  transition: background var(--transition), border-color var(--transition);
  width: 16px;
}

.monitor-fix-chip-mark::after {
  border-bottom: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  content: '';
  height: 4px;
  opacity: 0;
  transform: rotate(-45deg) translate(0.5px, -1px);
  transition: opacity var(--transition);
  width: 8px;
}

.monitor-fix-chip.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.monitor-fix-chip.is-active .monitor-fix-chip-mark {
  background: var(--accent);
  border-color: var(--accent-dark);
}

.monitor-fix-chip.is-active .monitor-fix-chip-mark::after {
  opacity: 1;
}

.monitor-fix-chip.is-risky.is-active {
  background: var(--warn-soft);
  border-color: var(--warn);
  color: var(--warn);
}

.monitor-fix-chip.is-risky.is-active .monitor-fix-chip-mark {
  background: var(--warn);
  border-color: var(--warn);
}

.monitor-fix-chip:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.monitor-empty {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
  padding: 18px 0;
  text-align: center;
}

/* =====================================================================
   WORKSPACE MANAGER (inside modal)
   ===================================================================== */

.workspace-manager-toolbar {
  align-items: end;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
}

.workspace-manager-search-field {
  flex: 1 1 240px;
  min-width: 0;
}

.workspace-manager-search-field input {
  min-width: 0;
  width: 100%;
}

.workspace-manager-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding-bottom: 10px;
  white-space: nowrap;
}

.workspace-manager-list {
  display: grid;
  gap: 10px;
}

.workspace-card {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
  padding: 14px 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.workspace-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.workspace-card.is-confirming {
  background: var(--danger-soft);
  border-color: var(--danger-soft-border);
}

.workspace-card-main {
  display: grid;
  gap: 4px;
  min-width: 0;
  flex: 1 1 320px;
}

.workspace-card-identity {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.workspace-card-identity h4 {
  font-size: 15px;
  font-weight: 800;
  margin: 0;
}

.workspace-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.workspace-tag {
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 9px;
  white-space: nowrap;
}

.workspace-tag-active {
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-border);
  color: var(--accent-dark);
}

.workspace-tag-monitor {
  background: var(--info-soft);
  border: 1px solid var(--info-soft-border);
  color: var(--info);
}

.workspace-card-facts {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  margin: 0;
}

.workspace-card-api {
  color: var(--muted-soft);
  font-size: 11.5px;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.workspace-danger-button {
  color: var(--danger);
}

.workspace-danger-button:hover {
  background: var(--danger-soft);
  border-color: var(--danger-soft-border);
  color: var(--danger);
}

.workspace-delete-confirm {
  background: var(--surface);
  border: 1px solid var(--danger-soft-border);
  border-radius: var(--radius-md);
  display: grid;
  gap: 8px;
  flex: 1 1 340px;
  padding: 12px 14px;
}

.workspace-delete-question {
  color: var(--danger);
  font-size: 13px;
  font-weight: 800;
  margin: 0;
}

.workspace-delete-warnings {
  color: var(--muted);
  display: grid;
  font-size: 11.5px;
  gap: 3px;
  line-height: 1.45;
  margin: 0;
  padding-inline-start: 18px;
}

.workspace-manager-empty {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
  padding: 26px 0;
  text-align: center;
}

/* =====================================================================
   WORKSPACE EDITOR (inside modal)
   ===================================================================== */

.workspace-editor-section {
  border-bottom: 1px solid var(--line);
  padding: 18px 0 22px;
}

.workspace-editor-section:first-child {
  padding-top: 0;
}

.workspace-editor-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.workspace-section-title {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin: 0 0 12px;
}

.workspace-editor-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.workspace-editor-grid .field {
  min-width: 0;
}

.workspace-editor-grid .field input {
  min-width: 0;
  width: 100%;
}

.workspace-name-field {
  grid-column: span 2;
}

.workspace-api-field {
  grid-column: span 2;
}

.workspace-class-field input {
  text-transform: uppercase;
}

.workspace-restriction-code-field {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
}

.workspace-restriction-code-toggle {
  min-height: 42px;
  width: fit-content;
}

.workspace-editor-grid .workspace-restriction-code-toggle input {
  height: 16px;
  min-width: 16px;
  width: 16px;
}

.workspace-restriction-code-toggle strong {
  background: var(--surface-muted);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  padding: 4px 7px;
}

.workspace-restriction-code-toggle:has(input:checked) strong {
  background: var(--accent-soft);
  color: var(--accent);
}

.workspace-status-desc-field,
.workspace-airline-mappings-field {
  grid-column: span 2;
}

.workspace-status-desc-field textarea,
.workspace-airline-mappings-field textarea {
  min-height: 74px;
  min-width: 0;
  width: 100%;
}

.workspace-detect-button {
  margin-top: 14px;
}

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

.workspace-direction-filter {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.workspace-rule-panel {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.workspace-rule-head {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 12px 14px;
}

.workspace-rule-head h3 {
  font-size: 14px;
  margin: 0;
}

.workspace-rule-head p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  margin: 4px 0 0;
}

.rule-column-head,
.direction-column-head,
.baggage-normalization-column-head {
  background: var(--surface-muted);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  display: grid;
  font-size: 11px;
  font-weight: 800;
  gap: 8px;
  letter-spacing: 0.04em;
  padding: 8px 12px;
  text-transform: uppercase;
}

.rule-column-head {
  grid-template-columns: 72px 72px minmax(116px, 1fr) minmax(116px, 1fr) 68px;
}

.direction-column-head {
  grid-template-columns: minmax(120px, 1fr) 68px;
}

.baggage-normalization-column-head {
  grid-template-columns: minmax(88px, 0.45fr) minmax(180px, 1.55fr) 68px;
}

.rule-list,
.direction-list,
.baggage-normalization-list {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.rule-row,
.direction-row,
.baggage-normalization-row {
  align-items: center;
  display: grid;
  gap: 8px;
}

.rule-row {
  grid-template-columns: 72px 72px minmax(116px, 1fr) minmax(116px, 1fr) 68px;
}

.direction-row {
  grid-template-columns: minmax(120px, 1fr) 68px;
}

.baggage-normalization-row {
  grid-template-columns: minmax(88px, 0.45fr) minmax(180px, 1.55fr) 68px;
}

.rule-row input,
.direction-row input,
.baggage-normalization-row input {
  min-width: 0;
  width: 100%;
}

.rule-field,
.direction-field,
.baggage-normalization-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.rule-field span,
.direction-field span,
.baggage-normalization-field span {
  color: var(--muted);
  display: none;
  font-size: 11px;
  font-weight: 800;
}

.rule-row .remove-rule,
.direction-row .remove-ignored-direction,
.baggage-normalization-row .remove-baggage-normalization {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--danger);
  min-height: 36px;
  padding: 0 10px;
}

.rule-row .remove-rule:hover,
.direction-row .remove-ignored-direction:hover,
.baggage-normalization-row .remove-baggage-normalization:hover {
  background: var(--danger-soft);
  border-color: var(--danger-soft-border);
}

.rule-empty {
  color: var(--muted);
  font-weight: 600;
  padding: 14px;
  text-align: center;
}

/* =====================================================================
   PROCESS PANEL
   ===================================================================== */

.process-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-top: 16px;
  overflow: hidden;
}

.process-head {
  align-items: center;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 14px 18px;
}

.process-head h2 {
  font-size: 16px;
  margin: 0;
}

.process-head-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.process-state {
  align-items: center;
  display: flex;
  gap: 10px;
}

.process-state span {
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-border);
  border-radius: 999px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  max-width: 360px;
  overflow: hidden;
  padding: 5px 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.process-state strong {
  background: var(--ink);
  border-radius: var(--radius-xs);
  color: #ffffff;
  display: inline-grid;
  font-size: 13px;
  font-weight: 900;
  min-width: 52px;
  padding: 5px 8px;
  place-items: center;
}

.process-toggle {
  min-height: 32px;
  padding-inline: 12px;
  white-space: nowrap;
}

.process-stop {
  min-height: 32px;
  padding-inline: 14px;
  white-space: nowrap;
}

.process-progress {
  background: var(--surface-muted);
  height: 5px;
  overflow: hidden;
}

.process-progress span {
  background: linear-gradient(90deg, var(--accent) 0%, #2db8b0 55%, #e0a12b 100%);
  display: block;
  height: 100%;
  transition: width 240ms cubic-bezier(0.23, 1, 0.32, 1);
  width: 0%;
}

.process-terminal {
  background:
    radial-gradient(circle at top left, rgba(11, 138, 130, 0.18), transparent 35%),
    #0f1620;
  color: #d6e3dc;
  direction: ltr;
  font-family: Consolas, "SFMono-Regular", "Cascadia Code", monospace;
  font-size: 12px;
  height: 200px;
  line-height: 1.55;
  overflow-y: auto;
  padding: 12px 16px;
  scrollbar-gutter: stable;
}

.process-panel.collapsed .process-terminal {
  display: none;
}

.terminal-line {
  align-items: baseline;
  display: grid;
  gap: 9px;
  grid-template-columns: 72px 70px minmax(0, 1fr);
  min-height: 22px;
}

.terminal-time {
  color: #7f91a1;
  font-variant-numeric: tabular-nums;
}

.terminal-prompt {
  color: #69d3c8;
  font-weight: 800;
}

.terminal-prompt::before {
  color: #e0a12b;
  content: ">";
  margin-right: 5px;
}

.terminal-message {
  color: #dbe7e2;
  overflow-wrap: anywhere;
  text-align: right;
}

.terminal-info .terminal-message,
.terminal-info .terminal-prompt {
  color: #a9e0f6;
}

.terminal-success .terminal-message,
.terminal-success .terminal-prompt {
  color: #93e2ad;
}

.terminal-error .terminal-message,
.terminal-error .terminal-prompt {
  color: #ffb4ac;
}

.process-panel[data-status="completed"] .process-state strong {
  background: var(--ok);
}

.process-panel[data-status="cancelling"] .process-state strong,
.process-panel[data-status="cancelled"] .process-state strong {
  background: var(--warn);
}

.process-panel[data-status="failed"] .process-state strong {
  background: var(--danger);
}

/* =====================================================================
   METRICS
   ===================================================================== */

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

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  min-height: 92px;
  padding: 16px 18px;
  position: relative;
  transition: transform var(--transition), box-shadow var(--transition);
}

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

.metric.success {
  border-color: var(--ok-soft-border);
}

.metric.success::before {
  background: var(--ok);
}

.metric.warning {
  border-color: var(--warn-soft-border);
}

.metric.warning::before {
  background: var(--warn);
}

.metric.danger {
  border-color: var(--danger-soft-border);
}

.metric.danger::before {
  background: var(--danger);
}

.metric::before {
  background: var(--accent);
  border-radius: 999px;
  content: "";
  display: block;
  height: 4px;
  margin-bottom: 12px;
  width: 28px;
}

.metric strong {
  color: var(--ink);
  display: block;
  font-size: 28px;
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 6px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

/* =====================================================================
   WORKSPACE / PROJECT
   ===================================================================== */

.workspace {
  margin-top: 16px;
}

.project {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
}

.project-header {
  align-items: center;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
  border-bottom: 1px solid var(--line);
  column-gap: 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  padding: 10px 16px;
  row-gap: 8px;
}

.project-heading {
  display: flex;
  align-items: baseline;
  flex-shrink: 0;
  gap: 8px;
}

.project-heading .section-label {
  color: var(--muted);
  font-size: 10px;
}

.project-header h2 {
  font-size: 15px;
  font-weight: 800;
  margin: 0;
}

.project-side {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  justify-content: flex-end;
  margin-inline-start: auto;
}

.project-actions {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 700;
  gap: 8px;
}

.project-actions-info {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.delete-mode-note {
  background: var(--danger-soft);
  border: 1px solid var(--danger-soft-border);
  border-radius: 999px;
  color: #912018;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
}

.project-summary {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project-summary span {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 12px;
  padding: 3px 9px;
}

.project-summary strong {
  color: var(--ink);
  font-weight: 800;
}

.empty,
.error {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  color: var(--muted);
  padding: 32px;
  text-align: center;
}

.error {
  color: var(--danger);
}

.loading-state {
  align-items: center;
  display: grid;
  gap: 8px;
  justify-items: center;
}

.loading-state strong {
  color: var(--ink);
  font-size: 15px;
}

.loading-state small {
  color: var(--muted);
  font-size: 12px;
}

.loading-spinner {
  animation: spin 800ms linear infinite;
  border: 3px solid rgba(37, 99, 235, 0.16);
  border-radius: 999px;
  border-top-color: var(--accent);
  display: inline-block;
  height: 24px;
  width: 24px;
}

.clear-row {
  color: var(--ok);
  font-weight: 700;
  padding: 22px;
  text-align: center;
}

/* =====================================================================
   GRIDS / TABLES
   ===================================================================== */



.sync-grid-wrap {
  direction: rtl;
  overflow-x: auto;
}

.sync-grid {
  direction: rtl;
  min-width: 1116px;
  width: 100%;
}

.deals-grid {
  direction: rtl;
  min-width: 1180px;
  width: 100%;
}

.grid-header,
.grid-row {
  display: grid;
  grid-template-columns: 92px minmax(96px, 1.1fr) minmax(100px, 1fr) minmax(86px, 0.85fr) minmax(72px, 0.75fr) minmax(82px, 0.8fr) 88px 132px minmax(94px, 0.9fr) 76px 58px minmax(104px, 0.85fr);
}

.deals-grid-header,
.deals-grid-row {
  display: grid;
  grid-template-columns: 92px minmax(140px, 0.95fr) 94px minmax(100px, 0.85fr) minmax(148px, 1fr) 70px 72px 118px 142px 118px minmax(112px, 0.9fr);
}

.grid-header > div,
.grid-row > div,
.deals-grid-header > div,
.deals-grid-row > div {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  min-height: 44px;
  min-width: 0;
  overflow: hidden;
  padding: 10px 10px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grid-header > div,
.deals-grid-header > div {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.grid-header > .revivo-zone,
.grid-header > .alp-zone,
.deals-grid-header > .revivo-zone,
.deals-grid-header > .alp-zone {
  align-items: flex-start;
  flex-direction: column;
  justify-content: center;
}

.grid-header span,
.deals-grid-header span {
  color: var(--ink);
  direction: ltr;
  display: block;
  font-size: 11px;
  line-height: 1.1;
  margin-bottom: 2px;
}

.grid-row:hover > div,
.deals-grid-row:hover > div {
  background: var(--surface-muted);
}

.flight-row,
.deal-row {
  cursor: pointer;
  transition: background var(--transition);
}

.row-number {
  color: var(--muted);
  font-weight: 800;
  justify-content: center;
  text-align: center;
}

.select-all-cell {
  justify-content: center;
}

.select-project-button,
.select-deals-project-button,
.select-ideas-project-button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  color: var(--ink);
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  gap: 5px;
  justify-content: center;
  line-height: 1;
  min-height: 28px;
  padding: 0 8px;
}

.select-project-button:hover,
.select-deals-project-button:hover,
.select-ideas-project-button:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.select-project-button[aria-pressed="true"],
.select-deals-project-button[aria-pressed="true"],
.select-ideas-project-button[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-soft-border);
  color: var(--accent-dark);
}

.select-project-button:disabled,
.select-deals-project-button:disabled,
.select-ideas-project-button:disabled {
  background: var(--surface-muted);
  color: var(--muted);
  cursor: not-allowed;
}

.select-all-box {
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  display: inline-flex;
  font-size: 11px;
  height: 14px;
  justify-content: center;
  line-height: 1;
  width: 14px;
}

.select-project-button[aria-pressed="true"] .select-all-box,
.select-deals-project-button[aria-pressed="true"] .select-all-box,
.select-ideas-project-button[aria-pressed="true"] .select-all-box {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.row-select-cell {
  gap: 7px;
}

.row-selector {
  cursor: pointer;
  flex: 0 0 auto;
  margin: 0;
}

.row-selector:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

table {
  border-collapse: collapse;
  direction: rtl;
  min-width: 1080px;
  table-layout: fixed;
  width: 100%;
}











th,
td {
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  padding: 10px 10px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

th span {
  color: var(--ink);
  direction: ltr;
  display: block;
  font-size: 11px;
  line-height: 1.1;
  margin-bottom: 2px;
}

/* Zones */
.revivo-zone { background-color: var(--info-soft); }
.alp-zone { background-color: var(--ok-soft); }
.control-zone { background-color: var(--warn-soft); }

td.revivo-zone,
td.alp-zone,
td.control-zone,
.grid-row > .revivo-zone,
.grid-row > .alp-zone,
.grid-row > .control-zone {
  border-right: 1px solid var(--line);
}

/* =====================================================================
   BADGES / STATUS
   ===================================================================== */

.badge {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
}

.deal-status-cell {
  align-items: center;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.availability-note-pill {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 2px 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.synced,
.deleted {
  background: var(--ok-soft);
  color: var(--ok);
}

.past_date {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  color: var(--muted);
}

.inventory_mismatch,
.airline_mismatch,
.time_mismatch,
.flight_details_mismatch,
.block_low_inventory,
.previous_block_relevant,
.price_mismatch,
.one_way_penalty_missing,
.flight_number_mismatch,
.missing_flight_number,
.price_range,
.price_missing {
  background: var(--warn-soft);
  color: var(--warn);
}

.missing,
.ambiguous,
.duplicate_deal,
.alp_error,
.missing_flight {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.ready {
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-border);
  color: var(--accent-dark);
}

.badge.created {
  background: var(--ok-soft);
  border: 1px solid var(--ok-soft-border);
  color: var(--ok);
}

.badge.create_error {
  background: var(--danger-soft);
  border: 1px solid var(--danger-soft-border);
  color: var(--danger);
}

.badge.existing_missing_flight_numbers {
  background: var(--warn-soft);
  border: 1px solid var(--warn-soft-border);
  color: var(--warn);
}



.code,
.number {
  direction: ltr;
  display: inline-block;
  font-family: "Segoe UI", Arial, sans-serif;
  text-align: left;
}

.number {
  min-width: 28px;
  text-align: center;
}

td.number {
  font-weight: 700;
}

.availability-pair,
.block-summary {
  align-items: center;
  direction: ltr;
  display: inline-flex;
  gap: 4px;
  justify-content: center;
  max-width: 100%;
}

.availability-main,
.block-count {
  font-weight: 800;
}

.availability-total {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.positive {
  color: var(--ok);
  font-weight: 800;
}

.negative {
  color: var(--danger);
  font-weight: 800;
}

.danger-text {
  color: var(--danger);
}

/* =====================================================================
   BLOCK POPOVER
   ===================================================================== */

.block-cell {
  justify-content: center;
  overflow: visible !important;
  position: relative;
}

.block-code-shell {
  align-items: center;
  direction: ltr;
  display: inline-flex;
  gap: 2px;
}

.block-code-button {
  background: transparent;
  border: 0;
  color: var(--accent-dark);
  cursor: pointer;
  direction: ltr;
  font: inherit;
  font-weight: 800;
  min-height: 0;
  padding: 0 2px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.block-code-button:hover,
.block-code-button[aria-expanded="true"] {
  background: transparent;
  color: var(--accent);
}

.block-code-text {
  direction: ltr;
  font-weight: 800;
}

.block-popover {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  direction: rtl;
  min-width: 250px;
  padding: 8px;
  position: absolute;
  right: 8px;
  text-align: right;
  top: calc(100% - 2px);
  white-space: normal;
  z-index: 12;
}

.block-popover-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 6px 8px;
}

.block-popover-row {
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(70px, 1fr) 72px 72px;
  min-height: 34px;
  padding: 6px 8px;
}

.block-popover-row.selected {
  background: var(--accent-soft);
  border-color: var(--accent-soft-border);
}

.block-popover-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.block-popover-row .code {
  color: var(--ink);
  font-weight: 800;
}

/* =====================================================================
   DRAWERS (Log, Profile)
   ===================================================================== */

.drawer-backdrop {
  background: rgba(15, 23, 42, 0.45);
  inset: 0;
  position: fixed;
  z-index: 20;
}

.update-log-drawer {
  animation: drawerIn 240ms cubic-bezier(0.16, 1, 0.3, 1);
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1040px;
  overflow: hidden;
  position: fixed;
  right: 0;
  top: 0;
  width: min(1040px, 96vw);
  z-index: 21;
}

.update-log-drawer[hidden] {
  display: none;
}

@keyframes drawerIn {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.update-log-panel {
  background: var(--surface);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.log-header {
  align-items: center;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-shrink: 0;
  gap: 16px;
  justify-content: space-between;
  padding: 18px 24px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.log-header h2 {
  font-size: 18px;
  margin: 0;
}

.log-header-actions {
  display: flex;
  gap: 8px;
}

.refresh-log,
.close-log {
  min-height: 34px;
}

.update-log {
  flex: 1;
  overflow: auto;
  padding: 0 4px 24px;
}

.update-log:not(.update-log-drawer .update-log) {
  overflow-x: auto;
}

.log-empty {
  color: var(--muted);
  font-weight: 600;
  padding: 24px;
  text-align: center;
}

.log-grid {
  min-width: 980px;
  width: 100%;
}

.log-grid-header,
.log-grid-row {
  display: grid;
  grid-template-columns: 140px 104px 78px 112px 132px 140px minmax(180px, 1fr);
}

.log-grid-header > div,
.log-grid-row > div {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  min-height: 42px;
  min-width: 0;
  overflow: hidden;
  padding: 9px 10px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-grid-header > div {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.log-grid-row:hover > div {
  background: var(--surface-muted);
}

.log-time {
  color: var(--muted);
  direction: ltr;
  font-weight: 700;
}

.log-grid-row small {
  color: var(--muted);
  display: inline-block;
  margin-right: 6px;
}

.log-grid-row > div:last-child {
  align-items: flex-start;
  flex-direction: column;
  gap: 5px;
  overflow: visible;
  white-space: normal;
}

.inventory-change {
  align-items: center;
  direction: ltr;
  display: inline-flex;
  gap: 7px;
}

.inventory-change b:last-child {
  color: var(--ok);
}

.log-entry-type {
  background: var(--ok-soft);
  border: 1px solid var(--ok-soft-border);
  border-radius: 999px;
  color: var(--ok);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 6px 9px;
}

.log-entry-type.error {
  background: var(--danger-soft);
  border-color: var(--danger-soft-border);
  color: var(--danger);
}

.log-entry-type.warn {
  background: var(--warn-soft);
  border-color: var(--warn-soft-border);
  color: var(--warn);
}

.log-entry-type.info {
  background: var(--info-soft);
  border-color: var(--info-soft-border);
  color: var(--info);
}

.log-entry-type.success {
  background: var(--ok-soft);
  border-color: var(--ok-soft-border);
  color: var(--ok);
}

.log-action-text {
  color: var(--ok);
  font-weight: 800;
}

.log-meta {
  color: var(--muted);
  font-weight: 700;
}

.log-error-text {
  color: var(--danger);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.log-error-change b:last-child {
  color: var(--danger);
}

.log-block-transition {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: grid;
  gap: 0;
  min-width: 0;
  overflow: hidden;
  width: 100%;
}

.block-transition-head {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 10px 12px;
}

.block-transition-arrow {
  align-items: center;
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-border);
  border-radius: 999px;
  color: var(--accent-dark);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  gap: 8px;
  padding: 4px 12px;
}

.block-transition-code {
  direction: ltr;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.block-transition-icon {
  flex-shrink: 0;
  height: 10px;
  width: 18px;
}

.block-transition-summary {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.deal-log-details {
  display: grid;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

.deal-log-details li {
  align-items: center;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  column-gap: 14px;
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  padding: 8px 12px;
  row-gap: 4px;
}

.deal-log-details li:last-child {
  border-bottom: 0;
}

.deal-log-details li:nth-child(even) {
  background: var(--zebra);
}

.deal-log-price {
  margin-inline-start: auto;
}

.deal-log-id {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.deal-log-id small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  margin-inline-end: 2px;
  text-transform: uppercase;
}

.deal-log-id .code {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.deal-log-route {
  color: var(--ink);
  font-weight: 700;
}

.deal-log-route .code {
  font-size: 12px;
  font-weight: 700;
}

.deal-log-date {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
}

.deal-log-price {
  align-items: center;
  direction: ltr;
  display: inline-flex;
  gap: 6px;
  justify-content: flex-end;
}

.price-old {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  text-decoration: line-through;
  text-decoration-color: rgba(100, 116, 139, 0.5);
}

.price-arrow {
  color: var(--muted);
  flex-shrink: 0;
  height: 10px;
  width: 18px;
}

.price-new {
  color: var(--ok);
  font-size: 13px;
  font-weight: 900;
}

.deal-log-details .deal-log-error {
  background: var(--danger-soft);
}

.deal-log-details .deal-log-error .price-new {
  color: var(--danger);
}

.deal-log-error-text {
  color: var(--danger);
  font-size: 11.5px;
  font-style: normal;
  font-weight: 700;
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
}

.log-time-transition {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  gap: 8px;
  padding: 5px 10px;
}

.log-time-transition small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.log-time-transition .code {
  color: var(--muted);
  direction: ltr;
  font-weight: 700;
}

.log-time-transition strong.code {
  color: var(--ok);
  font-weight: 900;
}

/* =====================================================================
   FLIGHT PROFILE
   ===================================================================== */

.flight-profile {
  animation: drawerInLeft 240ms cubic-bezier(0.16, 1, 0.3, 1);
  background: var(--surface-soft);
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow-xl);
  height: 100vh;
  left: 0;
  max-width: 760px;
  overflow-y: auto;
  position: fixed;
  top: 0;
  width: min(760px, 96vw);
  z-index: 21;
}

@keyframes drawerInLeft {
  from { transform: translateX(-40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.profile-shell {
  display: grid;
  gap: 18px;
  padding: 18px 24px 32px;
}

.profile-top {
  align-items: center;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin: -18px -24px 0;
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.profile-content {
  display: grid;
  gap: 16px;
}

/* Flight profile sections */
.fp-hero {
  background: linear-gradient(180deg, var(--surface) 0%, #f1f7f6 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 14px;
  padding: 20px 22px;
}

.fp-hero-main {
  display: grid;
  gap: 6px;
}

.fp-hero-eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.fp-hero-route {
  align-items: center;
  color: var(--ink);
  display: inline-flex;
  font-weight: 800;
  gap: 14px;
  letter-spacing: 0.02em;
}

.fp-airport {
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
}

.fp-arrow {
  color: var(--accent);
  flex-shrink: 0;
  height: 16px;
  width: 32px;
}

.fp-hero-meta {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}

.fp-meta-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: grid;
  gap: 4px;
  padding: 12px 14px;
}

.fp-meta-item dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.fp-meta-item dd {
  font-size: 15px;
  font-weight: 800;
  margin: 0;
}

.fp-hero-badges {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fp-chip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 11px;
}

.fp-compare {
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 0;
  grid-template-columns: 1fr auto 1fr;
  overflow: hidden;
}

.fp-compare-side {
  display: grid;
  gap: 4px;
  padding: 18px 20px;
}

.fp-side-revivo {
  background: var(--info-soft);
}

.fp-side-alp {
  background: var(--ok-soft);
}

.fp-side-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.fp-side-value {
  color: var(--ink);
  font-size: 26px;
  font-weight: 900;
  line-height: 1.1;
  word-break: break-word;
}

.fp-side-sub {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.fp-compare-delta {
  align-items: center;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  display: grid;
  gap: 4px;
  justify-items: center;
  min-width: 130px;
  padding: 18px 20px;
  text-align: center;
}

.fp-delta-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.fp-delta-value {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.fp-delta-caption {
  font-size: 12px;
  font-weight: 800;
}

.fp-delta-success {
  background: var(--ok-soft);
}

.fp-delta-success .fp-delta-value,
.fp-delta-success .fp-delta-caption {
  color: var(--ok);
}

.fp-delta-warning {
  background: var(--warn-soft);
}

.fp-delta-warning .fp-delta-value,
.fp-delta-warning .fp-delta-caption {
  color: var(--warn);
}

.fp-delta-neutral .fp-delta-value,
.fp-delta-neutral .fp-delta-caption {
  color: var(--muted);
}

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

.fp-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 12px;
  padding: 16px;
  position: relative;
}

.fp-panel::before {
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  content: "";
  height: 3px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.fp-panel-revivo::before {
  background: var(--info);
}

.fp-panel-alp::before {
  background: var(--accent);
}

.fp-panel-head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.fp-panel-head h3 {
  font-size: 15px;
  margin: 0;
}

.fp-panel-tag {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
}

.fp-edit-link {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.fp-edit-link:hover {
  text-decoration: underline;
}

.fp-stats {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.fp-stat {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: grid;
  gap: 4px;
  padding: 10px 12px;
}

.fp-stat dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.fp-stat dd {
  font-size: 15px;
  font-weight: 800;
  margin: 0;
  overflow-wrap: anywhere;
}

.fp-stat-hero {
  background: var(--surface);
  border-color: var(--info-soft-border);
}

.fp-panel-alp .fp-stat-hero {
  border-color: var(--accent-soft-border);
}

.fp-stat-hero dd {
  font-size: 20px;
}

.fp-stat-wide {
  grid-column: 1 / -1;
}

.fp-stat-wide dd {
  font-size: 13px;
  white-space: normal;
}

.fp-subhead {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.fp-blocks {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 12px;
  padding: 16px;
}

.fp-blocks-head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.fp-blocks-head h3 {
  font-size: 15px;
  margin: 0;
}

.fp-blocks-scroll {
  overflow-x: auto;
}

.fp-blocks-table {
  border-collapse: collapse;
  direction: rtl;
  min-width: 100%;
  table-layout: auto;
  width: 100%;
}

.fp-blocks-table th,
.fp-blocks-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: right;
}

.fp-blocks-table th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.fp-col-num { font-variant-numeric: tabular-nums; }
.fp-col-pnr,
.fp-col-internal {
  direction: ltr;
}

.fp-strong {
  font-weight: 800;
}

.soft-note {
  background: var(--warn-soft);
  border: 1px solid var(--warn-soft-border);
  border-radius: var(--radius-sm);
  color: var(--warn);
  padding: 10px 12px;
}



/* =====================================================================
   DEAL-RELATED COMPONENTS
   ===================================================================== */

/* SCENARIO LEG — structured leg display inside scenarios table */
.scenario-leg {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 5px;
  min-width: 180px;
  padding: 9px 11px;
  text-align: start;
}

.scenario-leg.is-unavailable {
  background: var(--danger-soft);
  border-color: var(--danger-soft-border);
}

.scenario-leg.is-missing {
  align-items: center;
  background: var(--surface-muted);
  border-style: dashed;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  font-style: italic;
  font-weight: 700;
  justify-content: center;
  min-height: 60px;
  text-align: center;
}

.scenario-leg-top {
  align-items: baseline;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.scenario-leg-route {
  color: var(--ink);
  direction: ltr;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.scenario-leg-flight {
  color: var(--accent-dark);
  direction: ltr;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.scenario-leg.is-unavailable .scenario-leg-flight {
  color: var(--danger);
}

.scenario-leg-when {
  align-items: baseline;
  color: var(--ink);
  direction: ltr;
  display: flex;
  font-size: 12px;
  font-weight: 700;
  gap: 8px;
  justify-content: space-between;
}

.scenario-leg-when .code {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.scenario-leg-time {
  color: var(--accent-dark);
  font-weight: 800;
}

.scenario-leg-foot {
  align-items: center;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: space-between;
  margin-top: 1px;
  padding-top: 6px;
}

.scenario-leg.is-unavailable .scenario-leg-foot {
  border-top-color: var(--danger-soft-border);
}

.scenario-leg-block {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  gap: 4px;
  padding: 2px 9px;
}

.scenario-leg-block .code {
  color: var(--ink);
  font-weight: 800;
}

.scenario-leg-avail {
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-border);
  border-radius: 999px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  padding: 2px 10px;
}

.scenario-leg-avail.is-empty {
  background: var(--danger-soft);
  border-color: var(--danger-soft-border);
  color: var(--danger);
}

.deal-note,
.idea-note {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.deal-notes,
.deal-notes-list {
  display: grid;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}



.deal-alert-panel {
  background: var(--warn-soft);
  border: 1px solid var(--warn-soft-border);
  border-radius: var(--radius-md);
  display: grid;
  gap: 8px;
  padding: 12px 14px;
}

.deal-alert-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.deal-alert-chip {
  background: var(--surface);
  border: 1px solid var(--warn-soft-border);
  border-radius: 999px;
  color: var(--warn);
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
}

.deal-alert-note {
  color: var(--warn);
  font-size: 12px;
  font-weight: 700;
}

.deal-scenarios-table {
  border-collapse: collapse;
  direction: rtl;
  min-width: 920px;
  table-layout: auto;
  width: 100%;
}

.deal-scenarios-table thead th {
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  text-align: right;
  text-transform: uppercase;
  white-space: nowrap;
}

.deal-scenarios-table tbody td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: right;
  vertical-align: middle;
}

.deal-scenarios-table tbody tr:last-child td {
  border-bottom: 0;
}

.deal-scenarios-table tbody tr:hover td {
  background: var(--surface-soft);
}

.deal-scenarios-table .fp-col-num {
  direction: ltr;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.deal-scenarios-table .fp-col-num.fp-strong {
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 900;
}

.deal-scenarios-table td:first-child {
  font-weight: 800;
  white-space: nowrap;
}

/* MINI-TABLE — small flat table inside profile panels */
.mini-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.mini-table {
  border-collapse: collapse;
  direction: rtl;
  table-layout: auto;
  width: 100%;
}

.mini-table thead th {
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 8px 12px;
  text-align: right;
  text-transform: uppercase;
  white-space: nowrap;
}

.mini-table tbody td {
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  padding: 8px 12px;
  text-align: right;
}

.mini-table tbody tr:last-child td {
  border-bottom: 0;
}

.mini-table tbody tr:hover td {
  background: var(--surface-soft);
}

.mini-table .number {
  direction: ltr;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  text-align: end;
}

.mini-table .code {
  color: var(--accent-dark);
  font-weight: 800;
}

.time-alert-panel {
  background: var(--warn-soft);
  border: 1px solid var(--warn-soft-border);
  border-radius: var(--radius-md);
  color: var(--warn);
  padding: 12px 14px;
}



/* =====================================================================
   DEAL-IDEAS PAGE EXTRAS
   ===================================================================== */

.template-manager-toolbar {
  align-items: end;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px 14px;
}

.template-manager-toolbar .field {
  flex: 1;
  min-width: 0;
}

.template-manager-toolbar select {
  min-width: 0;
  width: 100%;
}

.deal-template-form {
  display: grid;
  gap: 14px;
}

.deal-template-form input,
.deal-template-form select,
.deal-template-form textarea {
  min-width: 0;
  width: 100%;
}

.template-feature-control {
  display: flex;
  gap: 8px;
}

.template-feature-control select {
  flex: 1;
}

.template-feature-refresh {
  min-height: 40px;
  white-space: nowrap;
}

.template-message {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: start;
}

.template-choice-backdrop {
  background: rgba(15, 23, 42, 0.45);
  inset: 0;
  position: fixed;
  z-index: 50;
}

.template-choice-backdrop[hidden] {
  display: none;
}

.template-choice-dialog {
  align-items: center;
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 32px 24px;
  position: fixed;
  z-index: 51;
}

.template-choice-dialog[hidden] {
  display: none;
}

.template-choice-panel {
  animation: modalIn 200ms cubic-bezier(0.16, 1, 0.3, 1);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  display: grid;
  gap: 0;
  max-height: calc(100vh - 64px);
  max-width: 720px;
  overflow: hidden;
  width: 100%;
}

.template-choice-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 20px 24px 16px;
}

.template-choice-head h2 {
  font-size: 18px;
  margin: 0;
}

.template-choice-body {
  display: grid;
  gap: 14px;
  padding: 20px 24px;
}

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

.template-choice-preview > div {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: grid;
  gap: 6px;
  padding: 12px;
}

.template-choice-preview span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.template-choice-preview pre {
  color: var(--ink);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.template-choice-actions {
  align-items: center;
  background: var(--surface-soft);
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
  padding: 14px 24px;
}

.template-choice-actions span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-inline-end: auto;
}

.creation-log-grid {
  direction: rtl;
  min-width: 1280px;
  width: 100%;
}

.creation-log-grid-header,
.creation-log-grid-row {
  display: grid;
  grid-template-columns: 152px 104px 96px minmax(150px, 1fr) 96px minmax(160px, 1fr) minmax(180px, 1.2fr);
}

.creation-log-grid-header > div,
.creation-log-grid-row > div {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  min-height: 48px;
  min-width: 0;
  overflow: hidden;
  padding: 10px 10px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.creation-log-grid-header > div {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.creation-log-grid-row:hover > div {
  background: var(--surface-muted);
}

/* =====================================================================
   DEAL IDEAS — CARD LIST
   ===================================================================== */

.ideas-list {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  padding: 16px;
}

.idea-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 14px;
  overflow: hidden;
  padding: 14px 16px;
  position: relative;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.idea-card::before {
  background: var(--line);
  content: "";
  inset-inline-start: 0;
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
}

.idea-card.is-ready {
  border-color: var(--accent-soft-border);
}

.idea-card.is-ready::before {
  background: var(--accent);
}

.idea-card.is-created {
  border-color: var(--ok-soft-border);
  background: linear-gradient(180deg, var(--surface) 0%, var(--ok-soft) 220%);
}

.idea-card.is-created::before {
  background: var(--ok);
}

.idea-card.is-error {
  border-color: var(--danger-soft-border);
  background: linear-gradient(180deg, var(--surface) 0%, var(--danger-soft) 240%);
}

.idea-card.is-error::before {
  background: var(--danger);
}

.idea-card.is-warning {
  border-color: var(--warn-soft-border);
  background: linear-gradient(180deg, var(--surface) 0%, var(--warn-soft) 240%);
}

.idea-card.is-warning::before {
  background: var(--warn);
}

.idea-card.is-locked {
  background: var(--surface-soft);
  opacity: 0.94;
}

.idea-card.is-locked::before {
  background: var(--muted-soft);
}

.idea-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* HEAD: select + status/type + price */
.idea-card-head {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: auto 1fr auto;
}

.idea-card-select {
  align-items: center;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  gap: 8px;
  padding: 4px 12px 4px 8px;
  transition: background var(--transition), border-color var(--transition);
  user-select: none;
}

.idea-card-select:hover {
  background: var(--surface);
  border-color: var(--line-strong);
}

.idea-card-select input {
  cursor: pointer;
  height: 16px;
  margin: 0;
  width: 16px;
}

.idea-card-select input:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.idea-card-num {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.idea-card-tags {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.idea-card-type {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.idea-card-price {
  align-items: flex-end;
  display: grid;
  gap: 2px;
  justify-items: end;
  text-align: end;
}

.idea-card-price strong {
  color: var(--accent-dark);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.idea-card-price small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ROUTE */
.idea-card-route {
  border-block: 1px solid var(--line);
  display: grid;
  gap: 6px;
  padding: 12px 0;
}

.idea-card.is-locked .idea-card-route {
  border-color: var(--line);
}

.idea-card-airports {
  align-items: center;
  color: var(--ink);
  display: inline-flex;
  flex-wrap: wrap;
  font-weight: 800;
  gap: 8px;
  justify-content: flex-start;
}

.airport-code {
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1;
}

.airport-arrow {
  color: var(--accent);
  flex-shrink: 0;
  height: 14px;
  width: 28px;
}

.airport-return-mark {
  color: var(--muted);
  font-size: 16px;
  font-weight: 800;
}

.airport-return {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.idea-card-dates {
  align-items: center;
  color: var(--ink);
  display: inline-flex;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 700;
  gap: 8px;
}

.idea-date {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.idea-date-arrow {
  color: var(--muted);
}

.idea-date-nights {
  background: var(--accent-soft);
  border-radius: 999px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  margin-inline-start: 4px;
  padding: 2px 9px;
}

.idea-date-oneway {
  background: var(--surface-muted);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  padding: 2px 9px;
}

/* LEGS */
.idea-card-legs {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
}

.idea-card-legs.has-return {
  grid-template-columns: 1fr 1fr;
}

.idea-leg-card {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  position: relative;
}

.idea-leg-card[data-leg="outbound"] {
  border-color: var(--info-soft-border);
}

.idea-leg-card[data-leg="return"] {
  border-color: var(--accent-soft-border);
}

.idea-leg-head {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.idea-leg-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.idea-leg-card[data-leg="outbound"] .idea-leg-label {
  color: var(--info);
}

.idea-leg-card[data-leg="return"] .idea-leg-label {
  color: var(--accent-dark);
}

.idea-leg-tag {
  background: var(--warn-soft);
  border: 1px solid var(--warn-soft-border);
  border-radius: 999px;
  color: var(--warn);
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
}

.idea-leg-flight {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}

.idea-leg-num {
  color: var(--ink);
  direction: ltr;
  font-size: 14px;
  font-weight: 900;
}

.idea-leg-time {
  color: var(--ink);
  direction: ltr;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.idea-leg-route {
  color: var(--muted);
  direction: ltr;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.idea-leg-card.is-empty {
  align-items: center;
  background: var(--surface-muted);
  border-style: dashed;
  display: flex;
  justify-content: space-between;
}

.idea-leg-empty {
  color: var(--muted-soft);
  font-size: 16px;
  font-weight: 700;
}

/* FOOT */
.idea-card-foot {
  display: grid;
  gap: 10px;
}

.idea-card-info-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

.idea-card-info-item {
  align-items: baseline;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 6px 10px;
}

.idea-card-info-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.idea-card-info-value {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.idea-card-availability {
  color: var(--accent-dark);
  font-size: 15px;
  font-weight: 900;
}

.idea-card-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.idea-card-note {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 9px;
}

.idea-card.is-error .idea-card-note {
  background: var(--danger-soft);
  border-color: var(--danger-soft-border);
  color: var(--danger);
}

.idea-card.is-warning .idea-card-note {
  background: var(--warn-soft);
  border-color: var(--warn-soft-border);
  color: var(--warn);
}

.idea-card.is-created .idea-card-note {
  background: var(--ok-soft);
  border-color: var(--ok-soft-border);
  color: var(--ok);
}

.idea-card-note-link {
  color: var(--accent-dark);
  font-weight: 800;
  text-decoration: none;
}

.idea-card-note-link:hover {
  text-decoration: underline;
}

.creation-deal-link {
  color: var(--accent-dark);
  font-weight: 800;
  text-decoration: none;
}

.creation-deal-link:hover {
  text-decoration: underline;
}

.creation-log-legs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* =====================================================================
   LOGIN PAGE
   ===================================================================== */

.login-page {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 16px;
}

.login-shell {
  margin: auto;
  max-width: 420px;
  width: 100%;
}

.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 20px;
  padding: 32px 32px 28px;
}

.login-brand {
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
}

.login-brand .brand-mark {
  margin-bottom: 4px;
}

.login-brand h1 {
  font-size: 24px;
  font-weight: 800;
  margin: 0;
}

.login-brand p {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form input {
  min-width: 0;
  width: 100%;
}

.login-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 4px;
}

.login-actions span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-inline-end: auto;
  text-align: start;
}

.login-actions button {
  min-width: 120px;
}

/* =====================================================================
   RESPONSIVE — Tablet (≤ 1100px)
   ===================================================================== */

@media (max-width: 1100px) {
  main {
    padding: 20px 24px 40px;
  }

  .topbar-inner {
    flex-wrap: wrap;
    gap: 14px;
    padding: 14px 20px;
  }

  .toolbar {
    gap: 12px;
  }

  .toolbar-actions {
    margin-inline-start: 0;
  }

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

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

  .fp-panels {
    grid-template-columns: 1fr;
  }
}

/* =====================================================================
   RESPONSIVE — Tablet portrait / Large phone (≤ 820px)
   ===================================================================== */

@media (max-width: 820px) {
  html, body {
    overflow-x: hidden;
  }

  body {
    font-size: 14px;
  }

  main {
    padding: 16px 14px 80px;
  }

  /* TOPBAR — Compact two-row mobile layout */
  .topbar {
    background: var(--surface);
    backdrop-filter: none;
    position: static;
  }

  .topbar-inner {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    padding: 12px 14px;
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .brand {
    align-items: center;
    gap: 10px;
    justify-content: space-between;
  }

  .brand-mark {
    height: 36px;
    width: 36px;
  }

  .brand-text {
    flex: 1;
    gap: 1px;
  }

  .brand-text h1 {
    font-size: 16px;
    white-space: normal;
  }

  .brand-text p {
    display: none;
  }

  /* Topbar-side - TOTP gets the room, status shrinks to a small chip */
  .topbar-side {
    align-items: stretch;
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr auto;
  }

  .totp-card {
    grid-column: 1 / 2;
    padding: 6px 12px 7px;
  }

  .totp-card strong {
    font-size: 15px;
  }

  .status {
    align-items: center;
    display: inline-flex;
    grid-column: 2 / 3;
    justify-content: center;
    min-width: 0;
    padding: 6px 12px;
    white-space: nowrap;
  }

  .topbar-actions {
    display: flex;
    grid-column: 1 / -1;
    gap: 6px;
  }

  .topbar-actions > * {
    flex: 1 1 auto;
  }

  .icon-button {
    justify-content: center;
    min-height: 44px;
    padding: 0 10px;
  }

  .icon-button-label {
    font-size: 12px;
  }

  .icon-button-badge {
    display: none;
  }

  .user-menu {
    flex: 0 0 auto;
  }

  .user-chip {
    min-height: 44px;
    padding: 3px;
  }

  .user-chip-text {
    display: none;
  }

  .user-chip svg {
    display: none;
  }

  .user-menu-popover {
    inset-inline-end: 0;
    min-width: 200px;
  }

  /* TOOLBAR */
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    border-radius: var(--radius-md);
    padding: 12px;
  }

  .toolbar > *,
  .toolbar-group {
    width: 100%;
  }

  .toolbar-workspace {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace-field {
    width: 100%;
  }

  .workspace-field select {
    min-width: 0;
    width: 100%;
  }

  .toolbar-button-group {
    display: flex;
    gap: 6px;
    width: 100%;
  }

  .toolbar-button-group .ghost-button {
    flex: 1 1 0;
    justify-content: center;
    min-height: 42px;
  }

  .workspace-switcher {
    display: flex;
    min-height: 44px;
    padding: 4px;
    width: 100%;
  }

  .workspace-tab {
    flex: 1 1 0;
    font-size: 14px;
    min-height: 36px;
  }

  .toolbar-actions {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr 1fr;
  }

  .toolbar-actions > * {
    flex: unset;
    justify-content: center;
    min-height: 44px;
  }

  .toolbar-actions .primary-button {
    grid-column: 1 / -1;
  }

  /* FORMS - avoid iOS zoom */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="date"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px;
    max-width: 100%;
    min-height: 44px;
    min-width: 0;
    width: 100%;
  }

  /* MODALS - full screen on mobile */
  .app-modal {
    overflow: hidden;
    padding: 0;
  }

  .app-modal-card {
    animation: modalInMobile 240ms cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 0;
    box-shadow: none;
    height: 100dvh;
    margin: 0;
    max-height: 100dvh;
    max-width: 100%;
    width: 100%;
  }

  @keyframes modalInMobile {
    from { transform: translateY(20px); opacity: 0.7; }
    to { transform: translateY(0); opacity: 1; }
  }

  .app-modal-card-small,
  .app-modal-card-medium,
  .app-modal-card-large {
    max-width: 100%;
  }

  .app-modal-head {
    padding: 16px 18px 14px;
    padding-top: max(16px, env(safe-area-inset-top));
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .app-modal-head-text h2 {
    font-size: 18px;
  }

  .app-modal-head-text p {
    font-size: 12px;
  }

  .app-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
  }

  .app-modal-body-scroll {
    overflow-y: auto;
  }

  .app-modal-footer {
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 12px 18px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    position: sticky;
    bottom: 0;
    z-index: 2;
  }

  .app-modal-footer > * {
    flex: 1 1 auto;
  }

  .app-modal-footer span {
    flex: 1 1 100%;
    margin-inline-end: 0;
    text-align: start;
  }

  .app-modal-footer button {
    min-height: 44px;
  }

  /* User settings */
  .user-settings-grid {
    grid-template-columns: 1fr;
  }

  /* Monitor */
  .monitor-general {
    grid-template-columns: 1fr;
  }

  /* Workspace editor */
  .workspace-editor-section {
    padding: 16px 0 18px;
  }

  .workspace-section-title {
    font-size: 13px;
  }

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

  .workspace-name-field,
  .workspace-api-field,
  .workspace-airline-mappings-field,
  .workspace-status-desc-field {
    grid-column: 1 / -1;
  }

  .rule-row,
  .direction-row,
  .baggage-normalization-row {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    grid-template-columns: 1fr 1fr;
    padding: 10px;
    row-gap: 8px;
  }

  .direction-row {
    grid-template-columns: 1fr;
  }

  .baggage-normalization-row {
    grid-template-columns: 1fr;
  }

  .rule-field span,
  .direction-field span,
  .baggage-normalization-field span {
    display: block;
  }

  .rule-row .remove-rule,
  .direction-row .remove-ignored-direction,
  .baggage-normalization-row .remove-baggage-normalization {
    grid-column: 1 / -1;
    min-height: 40px;
    width: 100%;
  }

  .rule-column-head,
  .direction-column-head {
    display: none;
  }

  /* METRICS */
  .metrics {
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    min-height: 72px;
    padding: 12px 14px;
  }

  .metric strong {
    font-size: 22px;
  }

  /* PROJECT */
  .project-header {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
  }

  .project-heading {
    align-items: baseline;
    gap: 6px;
  }

  .project-header h2 {
    font-size: 14px;
  }

  .project-side {
    align-items: stretch;
    margin-inline-start: 0;
  }

  .project-actions {
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: space-between;
    width: 100%;
  }

  .project-actions-info {
    font-size: 11.5px;
  }

  .project-summary {
    flex-wrap: wrap;
    gap: 5px;
    justify-content: flex-start;
    width: 100%;
  }

  .project-summary span {
    flex: 0 1 auto;
    font-size: 11.5px;
    padding: 3px 8px;
  }

  /* TABLES & GRIDS - touch scroll with shadow indicators */
  .sync-grid-wrap,
  .table-wrap,
  .update-log,
  .fp-blocks-scroll {
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-gutter: stable;
  }

  .sync-grid-wrap,
  .table-wrap {
    background:
      linear-gradient(to left, var(--surface) 30%, rgba(255,255,255,0)) 0 0,
      linear-gradient(to right, var(--surface) 30%, rgba(255,255,255,0)) 100% 0,
      linear-gradient(to left, rgba(15,23,42,0.08), rgba(15,23,42,0)) 0 0,
      linear-gradient(to right, rgba(15,23,42,0.08), rgba(15,23,42,0)) 100% 0;
    background-attachment: local, local, scroll, scroll;
    background-repeat: no-repeat;
    background-size: 32px 100%, 32px 100%, 16px 100%, 16px 100%;
  }

  .grid-row > div,
  .grid-header > div,
  .deals-grid-row > div,
  .deals-grid-header > div,
  .creation-log-grid-row > div,
  .creation-log-grid-header > div,
  .log-grid-row > div,
  .log-grid-header > div {
    min-height: 48px;
  }

  .row-select-cell {
    justify-content: center;
  }

  .select-project-button,
  .select-deals-project-button,
  .select-ideas-project-button,
  .filter-button {
    min-height: 36px;
  }

  /* DEAL TEMPLATE */
  .deal-template-form {
    grid-template-columns: 1fr;
  }

  .template-feature-control {
    flex-direction: column;
  }

  .template-manager-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .template-manager-toolbar button {
    width: 100%;
  }

  /* TEMPLATE CHOICE */
  .template-choice-dialog {
    padding: 0;
  }

  .template-choice-panel {
    border-radius: 0;
    height: 100dvh;
    max-height: 100dvh;
    max-width: 100%;
    width: 100%;
  }

  .template-choice-head {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .template-choice-body {
    flex: 1;
    overflow-y: auto;
  }

  .template-choice-actions {
    bottom: 0;
    padding: 12px 18px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    position: sticky;
    z-index: 2;
  }

  .template-choice-actions span {
    flex: 1 1 100%;
    text-align: start;
  }

  .template-choice-actions button {
    flex: 1;
    min-height: 44px;
  }

  .template-choice-preview {
    grid-template-columns: 1fr;
  }

  /* DRAWERS */
  .update-log-drawer,
  .flight-profile {
    box-shadow: none;
    height: 100dvh;
    left: 0;
    max-width: none;
    right: 0;
    width: 100vw;
  }

  .update-log-drawer {
    animation: drawerInUp 240ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes drawerInUp {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }

  .log-header {
    padding: 14px 16px;
    padding-top: max(14px, env(safe-area-inset-top));
  }

  .log-header-actions {
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .log-header-actions button {
    min-height: 40px;
    width: 100%;
  }

  .log-grid-header,
  .log-grid-row,
  .creation-log-grid-header,
  .creation-log-grid-row {
    min-width: 980px;
  }

  /* DEAL IDEAS — single column card stack on mobile */
  .ideas-list {
    gap: 10px;
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .idea-card {
    padding: 12px 14px;
  }

  .idea-card-head {
    grid-template-columns: auto 1fr;
    row-gap: 8px;
  }

  .idea-card-price {
    align-items: flex-end;
    grid-column: 1 / -1;
    border-top: 1px dashed var(--line);
    padding-top: 8px;
    flex-direction: row;
    justify-content: space-between;
  }

  .idea-card-price strong {
    font-size: 20px;
  }

  .idea-card-route {
    padding: 10px 0;
  }

  .airport-code {
    font-size: 20px;
  }

  .idea-card-legs.has-return {
    grid-template-columns: 1fr;
  }

  .idea-leg-card {
    padding: 9px 11px;
  }

  .idea-leg-flight {
    justify-content: space-between;
  }

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

  /* FLIGHT PROFILE — mobile-friendly */
  .flight-profile {
    background: var(--bg);
  }

  .profile-shell {
    gap: 12px;
    padding: 0 14px 80px;
  }

  .profile-top {
    align-items: center;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin: 0 -14px 14px;
    padding: 12px 14px;
    padding-top: max(12px, env(safe-area-inset-top));
    position: sticky;
    top: 0;
    z-index: 5;
  }

  .profile-top .section-label {
    color: var(--accent);
    font-size: 11px;
  }

  .profile-top .close-profile {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    font-size: 13px;
    font-weight: 800;
    min-height: 38px;
    padding: 0 16px;
  }

  /* HERO — compact route card */
  .fp-hero {
    background: linear-gradient(135deg, #ffffff 0%, var(--accent-soft) 100%);
    border: 1px solid var(--accent-soft-border);
    padding: 16px 14px;
  }

  .fp-hero-eyebrow {
    font-size: 11px;
  }

  .fp-hero-route {
    gap: 10px;
    justify-content: center;
  }

  .fp-airport {
    font-size: 28px;
  }

  .fp-arrow {
    height: 14px;
    width: 26px;
  }

  .fp-hero-meta {
    gap: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .fp-meta-item {
    padding: 8px 10px;
  }

  .fp-meta-item dt {
    font-size: 10px;
  }

  .fp-meta-item dd {
    font-size: 13px;
  }

  .fp-hero-badges {
    gap: 6px;
    justify-content: center;
  }

  /* COMPARE — stacked with delta as separator */
  .fp-compare {
    grid-template-columns: 1fr;
    overflow: hidden;
  }

  .fp-compare-side {
    padding: 14px 16px;
  }

  .fp-side-value {
    font-size: 24px;
  }

  .fp-compare-delta {
    background: var(--surface-muted);
    border-bottom: 1px solid var(--line);
    border-left: 0;
    border-right: 0;
    border-top: 1px solid var(--line);
    flex-direction: row;
    gap: 8px;
    grid-template-columns: 1fr auto;
    justify-content: center;
    padding: 8px 16px;
  }

  .fp-compare-delta .fp-delta-label {
    font-size: 11px;
    margin-inline-end: auto;
  }

  .fp-delta-value {
    font-size: 18px;
  }

  .fp-delta-caption {
    font-size: 11px;
  }

  /* PANELS — single column compact */
  .fp-panels {
    grid-template-columns: 1fr;
  }

  .fp-panel {
    padding: 14px;
  }

  .fp-panel-head {
    gap: 8px;
  }

  .fp-panel-head h3 {
    font-size: 14px;
  }

  .fp-stats {
    gap: 6px;
    grid-template-columns: 1fr 1fr;
  }

  .fp-stat {
    padding: 8px 10px;
  }

  .fp-stat dt {
    font-size: 10px;
  }

  .fp-stat dd {
    font-size: 13px;
  }

  .fp-stat-hero dd {
    font-size: 17px;
  }

  /* BLOCKS — keep horizontal scroll but make table easier to read */
  .fp-blocks {
    padding: 14px;
  }

  .fp-blocks-head h3 {
    font-size: 14px;
  }

  .fp-blocks-table th,
  .fp-blocks-table td {
    font-size: 12px;
    padding: 8px 10px;
  }

  /* Deal scenarios table */
  .deal-scenarios-table th,
  .deal-scenarios-table td {
    font-size: 12px;
    padding: 8px 10px;
  }

  /* PROCESS PANEL */
  .process-head {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
  }

  .process-head-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .process-state {
    justify-content: space-between;
    width: 100%;
  }

  .process-state span {
    flex: 1;
    max-width: none;
  }

  .process-toggle {
    width: 100%;
  }

  .process-terminal {
    font-size: 11.5px;
    height: 230px;
    padding: 11px 12px;
  }

  .terminal-line {
    grid-template-columns: 64px 62px minmax(0, 1fr);
  }

  /* TOGGLES inside modals/panels */
  .toggle {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    min-height: 44px;
    padding: 8px 12px;
  }

  .monitor-power {
    min-height: 60px;
  }

  /* LOGIN */
  .login-page {
    align-items: stretch;
    padding: 0;
  }

  .login-shell {
    margin: 0;
    max-width: none;
  }

  .login-panel {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    margin: auto;
    max-width: 480px;
    padding: 28px 24px;
    padding-top: max(40px, env(safe-area-inset-top));
    padding-bottom: max(28px, env(safe-area-inset-bottom));
    width: 100%;
  }
}

/* =====================================================================
   RESPONSIVE — Phone portrait (≤ 480px)
   ===================================================================== */

@media (max-width: 480px) {
  main {
    padding: 14px 12px 80px;
  }

  .topbar-inner {
    padding: 10px 12px;
  }

  .brand-text h1 {
    font-size: 15px;
  }

  .totp-card span,
  .totp-card em {
    font-size: 9px;
  }

  .totp-card strong {
    font-size: 14px;
  }

  .status {
    font-size: 11px;
  }

  .topbar-actions {
    flex-wrap: nowrap;
  }

  .icon-button-label {
    display: none;
  }

  .icon-button {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 8px;
  }

  .user-menu {
    flex: 0 0 auto;
  }

  .toolbar {
    padding: 10px;
  }

  .toolbar-actions {
    grid-template-columns: 1fr;
  }

  .toolbar-actions > * {
    grid-column: 1 / -1;
  }

  .toolbar-button-group {
    flex-direction: column;
  }

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

  .metric {
    padding: 12px;
  }

  .metric strong {
    font-size: 20px;
  }

  .metric span {
    font-size: 11px;
  }

  .project-header {
    padding: 12px;
  }

  .project-header h2 {
    font-size: 16px;
  }

  .project-summary span {
    font-size: 12px;
    padding: 5px 8px;
  }

  .fp-hero {
    padding: 14px;
  }

  .fp-airport {
    font-size: 22px;
  }

  .fp-hero-meta,
  .fp-stats {
    grid-template-columns: 1fr;
  }

  .fp-side-value {
    font-size: 20px;
  }

  .app-modal-head {
    padding: 14px 16px 12px;
  }

  .app-modal-head-text h2 {
    font-size: 17px;
  }

  .app-modal-body {
    padding: 14px 16px;
  }

  .app-modal-footer {
    padding: 10px 16px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

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

  .monitor-general-fields {
    grid-template-columns: 1fr;
  }

  .workspace-card,
  .workspace-card-actions {
    width: 100%;
  }

  .workspace-card-actions button {
    flex: 1 1 auto;
    justify-content: center;
  }

  .monitor-section-head-actions {
    width: 100%;
  }

  .monitor-project-head {
    align-items: flex-start;
  }

  .rule-row,
  .direction-row,
  .baggage-normalization-row {
    grid-template-columns: 1fr;
  }

  .login-brand h1 {
    font-size: 22px;
  }
}

/* =====================================================================
   TOUCH-SPECIFIC ENHANCEMENTS
   ===================================================================== */

@media (hover: none) and (pointer: coarse) {
  /* Larger tap targets, no hover transforms */
  button:active,
  .icon-button:active,
  .ghost-button:active,
  .filter-button:active {
    transform: none;
  }

  .grid-row:hover > div,
  .deals-grid-row:hover > div,
  .deal-ideas-grid-row:hover > div,
  .creation-log-grid-row:hover > div,
  .log-grid-row:hover > div {
    background: transparent;
  }

  .grid-row:active > div,
  .deals-grid-row:active > div,
  .deal-ideas-grid-row:active > div {
    background: var(--surface-muted);
  }

  .metric:hover {
    transform: none;
  }
}

/* =====================================================================
   ORDERS — v2 REDESIGN (2026-05) — refined / less bulky
   Cleaner hierarchy, hero strip, sectioned settings, polished cards.
   ===================================================================== */



/* Settings tab contains the 2-col grid for engine + revivo */




/* ---- HERO ---- */












/* Engine switch in the hero */































/* ---- CARDS (settings + revivo + ledger) ---- */















/* ---- SUBSECTIONS inside settings card ---- */













/* ---- FIELD GRIDS (replaces the dense orders-settings-grid) ---- */













/* ---- FIELDSETS ---- */









/* ---- REVIVO CREDENTIALS card ---- */







.revivo-doc-status {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  margin: 0;
  padding: 10px 12px;
}



/* ---- METRIC CARDS upgraded with icon slot + accent border ---- */



.metric-card {
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: none;
  display: grid;
  gap: 2px 10px;
  grid-template-columns: 28px 1fr;
  grid-template-rows: auto auto auto;
  min-height: 0;
  padding: 10px 12px;
  position: relative;
  transition: border-color 160ms, background 160ms;
}

.metric-card:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
  transform: none;
}

.metric-card-icon {
  align-items: center;
  background: var(--surface-soft);
  border-radius: 6px;
  color: var(--muted);
  display: inline-flex;
  grid-row: 1 / span 3;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.metric-card-icon svg {
  height: 14px;
  width: 14px;
}

.metric-card .metric-card-label,
.metric-card .metric-card-helper {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.metric-card .metric-card-label {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.metric-card .metric-card-value {
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
  margin-top: 1px;
}

.metric-card-accent { border-color: var(--line); }

.metric-card-ok .metric-card-icon { background: var(--ok-soft); color: var(--ok); }
.metric-card-warn .metric-card-icon { background: var(--warn-soft); color: var(--warn); }
.metric-card-danger .metric-card-icon { background: var(--danger-soft); color: var(--danger); }
.metric-card-info .metric-card-icon { background: var(--info-soft); color: var(--info); }
.metric-card-accent .metric-card-icon { background: var(--accent-soft); color: var(--accent); }

.metric-card-accent { border-color: var(--accent-soft-border); }
.metric-card-ok .metric-card-value { color: var(--ok); }
.metric-card-warn .metric-card-value { color: var(--warn); }
.metric-card-danger .metric-card-value { color: var(--danger); }
.metric-card-info .metric-card-value { color: var(--info); }







.orders-table td.col-profit {
  font-weight: 800;
}

.orders-table td.col-profit small {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 600;
  margin-top: 3px;
}

.orders-table td.col-profit.profit-positive bdi {
  color: var(--ok);
}

.orders-table td.col-profit.profit-negative bdi,
.orders-table td.col-profit.profit-error bdi {
  color: var(--danger);
}

.orders-table td.col-profit.profit-muted bdi {
  color: var(--muted);
}

/* ---- LEDGER head v2 ---- */













.order-status-refresh {
  align-items: center;
  background: transparent;
  border: none;
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 10px;
  height: 34px;
  margin: 0;
  padding: 0;
}

.order-status-refresh span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.order-status-refresh .compact-action {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
  gap: 6px;
  height: 28px;
  min-height: 0;
  padding: 0 12px;
  transition: background var(--transition), border-color var(--transition);
}

.order-status-refresh .compact-action:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.order-status-refresh .compact-action svg {
  color: var(--muted);
}



















/* Profile chip polish */

.profile-list {
  margin: 0;
}

.profile-chip {
  transition: border-color 160ms, transform 160ms, box-shadow 160ms;
}

.profile-chip:hover {
  border-color: var(--accent-soft-border);
  transform: translateY(-1px);
}

.profile-chip[aria-selected="true"] {
  box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-sm);
}

/* Workspaces inside fieldset look tighter */



/* ---- PROFILES TAB (master-detail) ---- */

























































































.profile-delete-card .app-modal-head {
  border-bottom-color: var(--danger-soft-border);
}

.profile-delete-warning {
  background: var(--danger-soft);
  border: 1px solid var(--danger-soft-border);
  border-radius: var(--radius-sm);
  color: var(--danger);
  display: grid;
  gap: 6px;
  padding: 14px 16px;
}

.profile-delete-warning strong {
  color: var(--ink);
  font-size: 15px;
}

.profile-delete-warning span {
  font-size: 13px;
  font-weight: 700;
}



/* ---- TABS NAV + PANELS ---- */





















@keyframes ordersTabFade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scrollable region inside each panel so the page itself stops scrolling */


/* Tighten panel when process panel is visible (it pushes content down) */


/* Make the activity log scroll independently */
.order-activity-log {
  overflow: visible;
}

/* ---- RESPONSIVE ---- */







/* =====================================================================
   MOBILE — Orders ledger & activity log: table/grid → readable cards
   (≤ 720px) — no horizontal scrolling, one tap-friendly card per row.
   ===================================================================== */

@media (max-width: 720px) {
  /* ---- Orders tabs → 2×2 segmented control (all tabs visible, no scroll) ---- */
  

  

  

  /* ---- Orders ledger table → card stack ---- */
  .orders-table-wrap {
    overflow: visible;
  }

  .orders-table,
  .orders-table tbody,
  .orders-table tr,
  .orders-table td {
    display: block;
    min-width: 0;
    width: auto;
  }

  .orders-table thead {
    display: none;
  }

  .orders-table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }

  .orders-table tr {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 12px 14px 8px;
    position: relative;
  }

  .orders-table tbody tr:hover {
    background: var(--surface);
  }

  .orders-table td {
    align-items: baseline;
    border-bottom: 1px solid var(--line);
    display: flex;
    font-size: 13px;
    gap: 14px;
    justify-content: space-between;
    max-width: none;
    overflow: visible;
    padding: 8px 0;
    text-align: start;
    white-space: normal;
  }

  .orders-table td:last-child,
  .orders-table td.col-status {
    border-bottom: none;
  }

  .orders-table td::before {
    color: var(--muted);
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
  }

  .orders-table td > bdi {
    text-align: end;
  }

  /* Card header: status badge (start) + actions button pinned to the end */
  .orders-table td.col-status {
    border-bottom: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
    margin-bottom: 4px;
    padding: 0 0 10px;
    padding-inline-end: 76px;
  }

  .orders-table td.col-status::before {
    display: none;
  }

  .orders-table td.col-status .status-note {
    flex: 1 0 100%;
    white-space: normal;
  }

  .orders-table td.col-actions {
    border: none;
    inset-block-start: 11px;
    inset-inline-end: 14px;
    padding: 0;
    position: absolute;
    width: auto;
  }

  .orders-table td.col-actions::before {
    display: none;
  }

  .orders-table td.col-actions .compact-action {
    min-height: 34px;
  }

  /* Multi-line cells stack their values under the label */
  .orders-table td.col-profile-agent,
  .orders-table td.col-price,
  .orders-table td.col-time {
    align-items: stretch;
    flex-direction: column;
    gap: 3px;
  }

  .orders-table td.col-profile-agent::before,
  .orders-table td.col-price::before,
  .orders-table td.col-time::before {
    align-self: flex-start;
  }

  .orders-table td.col-profile-agent small {
    margin-top: 0;
  }

  .orders-table td.col-price .price-gross,
  .orders-table td.col-time .time-clock {
    display: inline;
    font-size: 12px;
  }

  /* ---- Activity log grid → card stack ---- */
  .order-log-grid {
    min-width: 0;
  }

  .order-log-grid-header {
    display: none;
  }

  .order-log-grid-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }

  .order-log-grid-row {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    padding: 12px 14px;
  }

  .order-log-grid-row:hover > div {
    background: transparent;
  }

  .order-log-grid-row > div {
    align-items: baseline;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 14px;
    justify-content: space-between;
    padding: 8px 0;
    text-align: start;
  }

  .order-log-grid-row > div:first-child {
    padding-top: 0;
  }

  .order-log-grid-row > div:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .order-log-grid-row > div::before {
    color: var(--muted);
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
  }

  /* Actions chips + summary stack under their label */
  .order-log-grid-row > div[data-label="פעולות שבוצעו"],
  .order-log-grid-row > div[data-label="סיכום טיפול"] {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
  }

  .order-log-grid-row > div[data-label="פעולות שבוצעו"]::before,
  .order-log-grid-row > div[data-label="סיכום טיפול"]::before {
    align-self: flex-start;
  }

  /* ---- Dashboard sync & deals grids → card stack ---- */
  .sync-grid-wrap {
    background: none;
    overflow-x: visible;
  }

  .sync-grid,
  .deals-grid {
    min-width: 0;
    width: auto;
  }

  .grid-header,
  .deals-grid-header {
    display: none;
  }

  .grid-body,
  .deals-grid-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }

  .grid-row,
  .deals-grid-row {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    padding: 10px 14px 12px;
  }

  .grid-row > div,
  .deals-grid-row > div {
    align-items: baseline;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 14px;
    justify-content: space-between;
    min-height: 0;
    padding: 7px 0;
    text-align: start;
  }

  .grid-row > div:last-child,
  .deals-grid-row > div:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .grid-row > div::before,
  .deals-grid-row > div::before {
    color: var(--muted);
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
  }

  /* Card header: selection checkbox + row number, full-width on top */
  .grid-row > .row-select-cell,
  .deals-grid-row > .row-select-cell {
    border-bottom: 1px solid var(--line);
    gap: 10px;
    justify-content: flex-start;
    margin-bottom: 4px;
    padding: 0 0 10px;
  }

  .grid-row > .row-select-cell::before,
  .deals-grid-row > .row-select-cell::before {
    display: none;
  }

  .grid-row > .row-select-cell > span,
  .deals-grid-row > .row-select-cell > span {
    color: var(--muted);
    font-weight: 800;
  }

  /* Cells whose value wraps get their value on a line below the label */
  .grid-row > .block-cell {
    align-items: stretch;
    flex-direction: column;
    gap: 4px;
  }

  .grid-row > .block-cell::before {
    align-self: flex-start;
  }

  .block-popover {
    inset-inline-start: 0;
  }

  /* ---- Update-log & creation-log grids → card stack ---- */
  .log-grid,
  .creation-log-grid {
    min-width: 0;
    width: auto;
  }

  .log-grid-header,
  .creation-log-grid-header {
    display: none;
  }

  .log-grid-body,
  .creation-log-grid-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }

  .log-grid-row,
  .creation-log-grid-row {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    min-width: 0;
    padding: 10px 14px 12px;
  }

  .log-grid-row > div,
  .creation-log-grid-row > div {
    align-items: baseline;
    border: none;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 14px;
    justify-content: space-between;
    min-height: 0;
    padding: 7px 0;
    text-align: start;
  }

  .log-grid-row > div:last-child,
  .creation-log-grid-row > div:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .log-grid-row > div::before,
  .creation-log-grid-row > div::before {
    color: var(--muted);
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
  }

  /* "תיקון" / "טיסות" detail cells stack their value under the label */
  .log-grid-row > div[data-label="תיקון"],
  .creation-log-grid-row > div[data-label="טיסות"] {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
  }

  .log-grid-row > div[data-label="תיקון"]::before,
  .creation-log-grid-row > div[data-label="טיסות"]::before {
    align-self: flex-start;
  }
}

.log-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 4px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.log-toolbar-field {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.log-toolbar-field input[type='date'] {
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 8px;
  padding: 4px 6px;
  font: inherit;
  background: transparent;
  color: inherit;
}

.log-toolbar-spacer {
  flex: 1;
}

.log-toolbar-range {
  min-width: 110px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

.log-toolbar .ghost-button:disabled {
  opacity: 0.4;
  cursor: default;
}

.log-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.log-loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(148, 163, 184, 0.35);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* =====================================================================
   LOADING STATES — skeletons ומצבי ביניים
   ===================================================================== */

@keyframes skeleton-shimmer {
  to {
    background-position: -200% 0;
  }
}

.skeleton-block {
  animation: skeleton-shimmer 1.4s linear infinite;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.14) 25%, rgba(148, 163, 184, 0.3) 50%, rgba(148, 163, 184, 0.14) 75%);
  background-size: 200% 100%;
  border-radius: 6px;
  color: transparent;
}

.metric-card-skeleton {
  pointer-events: none;
}

.metric-card-skeleton .metric-card-label {
  height: 11px;
  margin-top: 2px;
  width: 55%;
}

.metric-card-skeleton .metric-card-value {
  height: 18px;
  width: 38%;
}

.metric-card-skeleton .metric-card-helper {
  height: 10px;
  width: 75%;
}









/* =====================================================================
   WORK MODE FAB — הכפתור הצף של "חלוקת סטירות"
   ===================================================================== */

.wm-root {
  position: fixed;
  z-index: 120;
  width: 58px;
  height: 58px;
  --wm-grad: linear-gradient(140deg, #ffb35c 0%, #ff5e6c 52%, #d84fd4 100%);
  --wm-glow: rgba(255, 94, 108, 0.32);
  --wm-warm-soft: #fff3ea;
  --wm-warm-border: #ffc9a0;
}

.wm-fab {
  position: relative;
  width: 58px;
  height: 58px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--wm-grad) border-box;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.16), 0 2px 5px rgba(15, 23, 42, 0.08);
  display: grid;
  place-items: center;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 150ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.wm-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px var(--wm-glow), 0 3px 8px rgba(15, 23, 42, 0.1);
}

.wm-fab:active {
  transform: scale(0.96);
}

.wm-fab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px var(--wm-glow);
}

.wm-root.is-dragging .wm-fab {
  cursor: grabbing;
  transform: scale(1.07);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.26);
}

.wm-root.is-active .wm-fab {
  background: var(--wm-grad) border-box;
  box-shadow: 0 8px 22px var(--wm-glow);
  animation: wmBreathe 3.2s ease-in-out infinite;
}

@keyframes wmBreathe {
  0%, 100% { box-shadow: 0 8px 22px var(--wm-glow); }
  50% { box-shadow: 0 10px 30px rgba(216, 79, 212, 0.42); }
}

.wm-fab-emoji {
  font-size: 22px;
  line-height: 1;
  transition: transform 220ms cubic-bezier(0.34, 1.3, 0.64, 1), opacity 150ms;
}

.wm-root:not(.is-active) .wm-fab:hover .wm-fab-emoji {
  animation: wmWave 800ms ease-in-out;
}

@keyframes wmWave {
  0%, 100% { transform: rotate(0deg); }
  30% { transform: rotate(16deg); }
  65% { transform: rotate(-10deg); }
}

.wm-root.is-active .wm-fab-emoji {
  transform: translateY(-8px) scale(0.72);
}

.wm-fab-clock {
  position: absolute;
  inset-inline: 0;
  bottom: 9px;
  font-size: 11.5px;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  color: #fff;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 200ms, transform 200ms;
  pointer-events: none;
}

.wm-root.is-active .wm-fab-clock {
  opacity: 1;
  transform: none;
}

.wm-fab-check {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 800;
  color: var(--ok);
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 250ms, transform 250ms cubic-bezier(0.34, 1.4, 0.64, 1);
  pointer-events: none;
}

.wm-root.is-done .wm-fab {
  background: linear-gradient(var(--surface), var(--surface)) padding-box, linear-gradient(140deg, var(--ok), #34d399) border-box;
  box-shadow: 0 8px 22px rgba(4, 120, 87, 0.25);
  animation: none;
}

.wm-root.is-done .wm-fab-check {
  opacity: 1;
  transform: scale(1);
}

.wm-root.is-done .wm-fab-emoji,
.wm-root.is-done .wm-fab-clock {
  opacity: 0;
}

.wm-fab-dot {
  position: absolute;
  top: 3px;
  inset-inline-end: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--info);
  animation: wmDotPulse 2s ease-in-out infinite;
}

@keyframes wmDotPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}

.wm-fab-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  pointer-events: none;
}

.wm-fab-ring-track,
.wm-fab-ring-progress {
  fill: none;
  stroke-width: 3;
}

.wm-fab-ring-track {
  stroke: transparent;
}

.wm-root.is-active .wm-fab-ring-track {
  stroke: rgba(255, 255, 255, 0.28);
}

.wm-fab-ring-progress {
  stroke: #fff;
  stroke-linecap: round;
  opacity: 0;
  transition: stroke-dashoffset 600ms linear, opacity 200ms;
}

.wm-root.is-active .wm-fab-ring-progress {
  opacity: 1;
}

.wm-panel {
  position: absolute;
  left: 0;
  width: 276px;
  max-width: calc(100vw - 24px);
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  transform: scale(0.92) translateY(4px);
  transition: opacity 180ms cubic-bezier(0.4, 0, 0.2, 1), transform 220ms cubic-bezier(0.34, 1.3, 0.64, 1);
}

.wm-panel.is-open {
  opacity: 1;
  transform: none;
}

.wm-panel.is-closing {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 140ms ease-in, transform 140ms ease-in;
}

.wm-root.panel-above .wm-panel { bottom: calc(100% + 12px); }
.wm-root.panel-below .wm-panel { top: calc(100% + 12px); }
.wm-root.panel-above.panel-align-left .wm-panel { transform-origin: left bottom; }
.wm-root.panel-above.panel-align-right .wm-panel { transform-origin: right bottom; }
.wm-root.panel-below.panel-align-left .wm-panel { transform-origin: left top; }
.wm-root.panel-below.panel-align-right .wm-panel { transform-origin: right top; }

.wm-panel:focus {
  outline: none;
}

.wm-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wm-panel-emoji {
  font-size: 22px;
  line-height: 1;
}

.wm-panel-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wm-panel-titles strong {
  font-size: 15px;
}

.wm-panel-titles span {
  font-size: 12px;
  color: var(--muted);
}

.wm-panel-clock {
  font-size: 40px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  direction: ltr;
  color: var(--muted-soft);
  transition: color 300ms;
}

.wm-root.is-active .wm-panel-clock {
  background: var(--wm-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.wm-deferred {
  font-size: 12px;
  font-weight: 600;
  color: var(--info);
  background: var(--info-soft);
  border: 1px solid var(--info-soft-border);
  border-radius: 999px;
  padding: 5px 12px;
  text-align: center;
}

.wm-status {
  display: none;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}

.wm-status.is-visible {
  display: block;
}

.wm-status[data-tone="ok"] { color: var(--ok); }
.wm-status[data-tone="error"] { color: var(--danger); }

.wm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wm-preset,
.wm-extend,
.wm-release {
  flex: 1;
  padding: 9px 0;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: transform 75ms ease-out, background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
}

.wm-preset:hover:not(:disabled),
.wm-extend:hover:not(:disabled) {
  background: var(--wm-warm-soft);
  border-color: var(--wm-warm-border);
}

.wm-preset:active:not(:disabled),
.wm-extend:active:not(:disabled),
.wm-release:active:not(:disabled) {
  transform: scale(0.96);
}

.wm-preset:focus-visible,
.wm-extend:focus-visible,
.wm-release:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--wm-glow);
}

.wm-release {
  flex-basis: 100%;
  background: var(--surface-muted);
}

.wm-release:hover:not(:disabled) {
  background: var(--ok-soft);
  border-color: var(--ok-soft-border);
  color: var(--ok);
}

.wm-preset:disabled,
.wm-extend:disabled,
.wm-release:disabled {
  opacity: 0.55;
  cursor: default;
}

.wm-hint {
  font-size: 11px;
  color: var(--muted-soft);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .wm-fab,
  .wm-fab-emoji,
  .wm-fab-clock,
  .wm-fab-check,
  .wm-fab-dot,
  .wm-fab-ring-progress,
  .wm-panel {
    transition: none !important;
    animation: none !important;
  }
}

/* =====================================================================
   NOTIFICATION LOG
   ===================================================================== */

.notifications-main {
  margin: 0 auto;
  max-width: 1180px;
  padding: 24px 32px 48px;
}

.notification-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  padding: 20px 22px;
}

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

.notification-card-head h2 {
  font-size: 17px;
  margin: 0 0 4px;
}

.notification-card-head p {
  font-size: 13px;
  margin: 0;
}

.notification-lookup-row {
  display: flex;
  gap: 10px;
}

.notification-lookup-row input {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  letter-spacing: 0.08em;
  padding: 10px 12px;
  text-transform: uppercase;
}

.notification-lookup-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
  outline: none;
}

.notification-filters {
  align-items: center;
  display: flex;
  gap: 8px;
}

.notification-filters select {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 8px 10px;
}

.notification-row {
  cursor: pointer;
}

.notification-row code {
  background: var(--surface-muted);
  border-radius: 6px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 7px;
}

.badge.notify-ok {
  background: var(--ok-soft);
  border: 1px solid var(--ok-soft-border);
  color: var(--ok);
}

.badge.notify-warn {
  background: var(--warn-soft);
  border: 1px solid var(--warn-soft-border);
  color: var(--warn);
}

.badge.notify-error {
  background: var(--danger-soft);
  border: 1px solid var(--danger-soft-border);
  color: var(--danger);
}

.notification-pager {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
}

.notification-detail-summary {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-bottom: 16px;
}

.notification-detail-row {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 8px 12px;
}

.notification-detail-row span {
  color: var(--muted);
  font-size: 13px;
}

.notification-raw summary {
  cursor: pointer;
  font-weight: 700;
  padding: 6px 0;
}

.notification-raw pre {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 12px;
  max-height: 420px;
  overflow: auto;
  padding: 14px;
}

.token-form {
  align-items: flex-end;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.token-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.token-field-grow {
  flex: 1;
  min-width: 180px;
}

.token-field span {
  color: var(--muted);
  font-size: 13px;
}

.token-field select,
.token-field input {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 9px 11px;
  width: 100%;
}

.token-field select:focus,
.token-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
  outline: none;
}

.token-result {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  padding: 14px;
}

.token-result-warning {
  margin: 0 0 10px;
}

.token-copy-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

.token-copy-row input,
.token-copy-row textarea {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  min-width: 0;
  padding: 10px 12px;
  resize: vertical;
}

.token-snippet summary {
  cursor: pointer;
  font-weight: 700;
  padding: 6px 0;
}

@media (max-width: 720px) {
  .token-form {
    align-items: stretch;
    flex-direction: column;
  }

  .token-form .primary-button {
    width: 100%;
  }

  .token-copy-row {
    flex-direction: column;
  }
}

@media (min-width: 481px) {
  .monitor-telegram-section .monitor-general-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.monitor-telegram-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.monitor-telegram-section .badge {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  color: var(--muted);
}

.monitor-telegram-section .badge[data-state="ok"] {
  background: var(--ok-soft);
  border-color: var(--ok-soft-border);
  color: var(--ok);
}

.monitor-telegram-section .badge[data-state="warn"] {
  background: var(--warn-soft);
  border-color: var(--warn-soft-border);
  color: var(--warn);
}

.monitor-telegram-section .badge[data-state="error"] {
  background: var(--danger-soft);
  border-color: var(--danger-soft-border);
  color: var(--danger);
}

.monitor-telegram-actions .muted {
  font-size: 13px;
}
