:root {
  color-scheme: light;
  --bg: #f2f4f7;
  --surface: #ffffff;
  --surface-strong: #f7fbfc;
  --ink: #111827;
  --muted: #6d7882;
  --line: #d8e5ea;
  --line-strong: #c7d0d8;
  --brand: #0f766e;
  --brand-dark: #0b5f59;
  --brand-soft: #e7f4f2;
  --accent: #2563eb;
  --accent-soft: #eaf0fd;
  --warning: #a16207;
  --warning-soft: #fff6db;
  --danger: #bd2b2b;
  --danger-soft: #fdeaea;
  --ok: #13845e;
  --ok-soft: #e5f6ee;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.09);
  --shadow-soft: 0 8px 30px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

.hidden {
  display: none !important;
}

body[data-portal="client"] #repositoryUpdatePanel,
body[data-portal="client"] #quotaNavItem,
body[data-portal="client"] #quotaView,
body[data-portal="client"] #accountsNavItem,
body[data-portal="client"] #accountsView,
body[data-portal="client"] #usersNavItem,
body[data-portal="client"] #usersView,
body[data-portal="client"] .nav-item[data-view="docs"],
body[data-portal="client"] #docsView,
body[data-portal="client"] #proxyConfigPanel,
body[data-portal="client"] #modelConfigPanel,
body[data-portal="client"] #packageConfigPanel,
body[data-portal="client"] #emailConfigPanel,
body[data-portal="client"] .admin-message-center,
body[data-portal="client"] .admin-password-panel,
body[data-portal="client"] .page-header-meta {
  display: none !important;
}

body[data-portal="admin"] .client-credential-field,
body[data-portal="admin"] .client-auth-tabs,
body[data-portal="admin"] .client-token-card,
body[data-portal="admin"] #pointsNavItem,
body[data-portal="admin"] #pointsView,
body[data-portal="admin"] #membershipNavItem,
body[data-portal="admin"] #membershipView,
body[data-portal="admin"] #submitBalance,
body[data-portal="admin"] .client-password-panel,
body[data-portal="admin"] .client-email-panel,
body[data-portal="admin"] .client-message-center,
body[data-portal="client"] .admin-token-field,
body[data-portal="client"] .admin-credential-field,
body[data-portal="client"] .login-token-hint { display: none !important; }

body[data-portal="admin"] .admin-token-field,
body[data-portal="admin"] .login-token-hint { display: none !important; }

body[data-portal="admin"] .admin-token-field,
body[data-portal="admin"] .login-token-hint { display: none !important; }
body[data-portal="client"] .login-portal-label { display: none !important; }
body[data-portal="admin"] .admin-token-field,
body[data-portal="admin"] .login-token-hint { display: none !important; }
body[data-portal="client"] .client-nav-empty { min-height: 20px; }

.nav-count {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  margin-left: auto;
  padding: 0 6px;
  place-items: center;
  color: #fff;
  background: var(--danger);
  border-radius: 8px;
  font-size: 11px;
  line-height: 1;
}

.message-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(96px, 1fr));
  padding: 4px;
  background: #e8edf1;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.segmented-control button {
  min-height: 36px;
  padding: 0 16px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-weight: 800;
}

.segmented-control button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .08);
}

.message-panel {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.message-panel-header,
.recipient-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.message-panel-header {
  margin-bottom: 20px;
}

.message-panel-header h2,
.message-panel-header p {
  margin: 0;
}

.message-panel-header p {
  margin-top: 5px;
  color: var(--muted);
}

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

.message-card {
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.message-card.unread {
  border-left: 4px solid var(--accent);
  background: #f8fbff;
}

.message-card.compact {
  padding: 14px;
}

.message-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.message-card-head > div {
  display: grid;
  gap: 4px;
}

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

.message-card > p,
.admin-reply p {
  margin: 12px 0 0;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.admin-reply {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--ok-soft);
  border-radius: 6px;
}

.admin-reply.empty {
  background: #f4f6f8;
}

.admin-reply > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.message-status {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}

.message-status.pending { color: var(--warning); background: var(--warning-soft); }
.message-status.reviewing { color: #1d4ed8; background: #e8eefc; }
.message-status.resolved { color: var(--ok); background: var(--ok-soft); }
.message-status.closed { color: var(--muted); background: #eef1f4; }

.message-table textarea {
  min-width: 220px;
  min-height: 76px;
  resize: vertical;
}

.feedback-status-actions {
  display: grid;
  gap: 8px;
  min-width: 104px;
}

.compact-button {
  min-height: 34px;
  padding: 7px 12px;
}

.message-admin-grid {
  display: grid;
  grid-template-columns: minmax(360px, .8fr) minmax(420px, 1.2fr);
  gap: 16px;
  align-items: start;
}

.notification-compose,
.notification-history {
  min-width: 0;
}

.notification-compose {
  display: grid;
  gap: 15px;
}

.notification-compose textarea {
  min-height: 120px;
  resize: vertical;
}

.recipient-header label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  white-space: nowrap;
}

.recipient-header input,
.recipient-option input {
  width: 16px;
  height: 16px;
  min-width: 16px;
  margin: 0;
}

.recipient-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 280px;
  padding: 4px;
  overflow: auto;
}

.recipient-option {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 10px;
  background: #f7f9fa;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.recipient-option span {
  display: grid;
  min-width: 0;
}

.recipient-option strong,
.recipient-option small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipient-option small {
  color: var(--muted);
}

.notification-history .message-list {
  max-height: 680px;
  overflow: auto;
}

@media (max-width: 980px) {
  .message-admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .message-toolbar,
  .message-panel-header { align-items: stretch; flex-direction: column; }
  .segmented-control { width: 100%; }
  .recipient-list { grid-template-columns: 1fr; }
}

.client-auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: #edf3f5; border-radius: 12px; }
.client-auth-tabs button { padding: 9px; background: transparent; border: 0; border-radius: 9px; font-weight: 800; }
.client-auth-tabs button.active { color: var(--brand-dark); background: white; box-shadow: var(--shadow-soft); }
.client-token-card { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 18px; }
.token-display { display: flex; gap: 8px; width: min(520px, 55%); }
.token-display input { flex: 1; min-width: 0; }
.purchase-panel { max-width: 780px; margin: auto; padding: 36px; }
.purchase-balance { display: flex; align-items: end; gap: 10px; margin: 28px 0; }
.purchase-balance strong { color: var(--brand-dark); font-size: 58px; line-height: 1; }
.purchase-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px 0; }
.purchase-options button { display: grid; align-content: center; gap: 9px; min-height: 104px; padding: 14px 12px; color: var(--brand-dark); background: var(--brand-soft); border: 1px solid rgba(109, 93, 252, .2); border-radius: 14px; font-size: 14px; font-weight: 900; }
.purchase-options button strong { color: var(--ink); font-size: 25px; line-height: 1.1; letter-spacing: -.03em; }
.purchase-options button span { font-size: 13px; }
.purchase-options button small { color: var(--muted); font-size: 12px; }
.purchase-bonus { display: flex; align-items: baseline; justify-content: center; gap: 4px; color: var(--brand-dark); }
.purchase-bonus b { font-size: 11px; line-height: 1; letter-spacing: 0; }
.purchase-options .purchase-bonus small { color: var(--muted); font-size: 10px; font-weight: 800; }
.points-bonus-notice { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding: 14px 16px; color: #6b4c05; background: var(--warning-soft); border: 1px solid rgba(161, 98, 7, .18); border-radius: 12px; }
.points-bonus-notice strong { flex: 0 0 auto; }
.points-bonus-notice span { color: #84691e; font-size: 13px; }
.chip.failed { color: #fff !important; background: #ef233c !important; border-color: #ef233c !important; box-shadow: 0 0 0 4px rgba(239,35,60,.12); }
.online-dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; background: #18a66a; border-radius: 50%; box-shadow: 0 0 0 4px rgba(24,166,106,.12); }

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

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  background: rgba(16, 19, 29, 0.97);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  height: 100vh;
  overflow: hidden;
  backdrop-filter: blur(20px);
}

.nav-item {
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.nav-item:hover {
  transform: translateX(2px);
}

.panel,
.metric-card,
.submit-composer {
  box-shadow: var(--shadow-soft);
}

.submit-balance { display: flex; width: min(100%, 1040px); align-items: center; gap: 16px; margin-bottom: 12px; padding: 10px 14px; color: var(--muted); background: rgba(255, 255, 255, .92); border: 1px solid rgba(119, 174, 160, .34); border-radius: 16px; box-shadow: 0 8px 22px rgba(17, 76, 62, .06); }
.balance-item { display: flex; align-items: baseline; gap: 7px; }
.balance-item span { font-size: 12px; font-weight: 800; }
.balance-item strong { color: var(--ink); font-size: 15px; }
.balance-item.free strong { color: var(--brand-dark); }
.balance-divider { width: 1px; height: 24px; background: rgba(22, 122, 97, .18); }
.balance-cost { margin-left: auto; padding: 5px 10px; color: var(--brand-dark); background: var(--brand-soft); border-radius: 999px; font-size: 12px; font-weight: 800; }
#settingsContent { display: grid; gap: 16px; }
.node-selection-panel { padding: 26px; border: 0; background: linear-gradient(145deg, #fff 0%, #f7f8ff 100%); }
.node-selection-panel > .panel-header { align-items: flex-start; gap: 24px; }
.node-selection-panel > .panel-header p { max-width: 680px; margin: 7px 0 0; color: var(--muted); line-height: 1.6; }
.node-toolbar { display: flex; align-items: center; gap: 8px; }
.node-controls { display: grid; grid-template-columns: repeat(3, minmax(160px, 1fr)) auto; align-items: end; gap: 12px; margin-top: 22px; padding: 16px; background: rgba(255,255,255,.76); border: 1px solid var(--line); border-radius: 16px; }
.node-controls .field { min-width: 190px; }
.node-summary { display: flex; justify-content: space-between; margin-top: 18px; color: var(--muted); font-size: 12px; font-weight: 700; }
.node-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 10px; }
.proxy-node-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; min-height: 104px; padding: 16px; text-align: left; color: var(--ink); background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color 160ms ease, transform 160ms ease, background 160ms ease; }
.proxy-node-card:hover { transform: translateY(-2px); border-color: var(--brand); }
.proxy-node-card.selected { border-color: var(--brand-dark); background: var(--brand-soft); box-shadow: 0 0 0 2px rgba(22, 122, 97, .14); }
.proxy-node-name { overflow: hidden; font-size: 14px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.proxy-node-country { grid-column: 1; color: var(--muted); font-size: 12px; }
.proxy-node-latency { grid-column: 2; grid-row: 1 / 3; align-self: center; color: var(--muted); font-size: 14px; }
.proxy-node-latency.good { color: #16825f; }
.users-panel { padding: 22px; }
.users-table-wrap { margin-top: 14px; border-radius: 16px; }
.users-table { width: 100%; min-width: 1340px; border-collapse: collapse; table-layout: fixed; }
.users-table .user-col { width: 14%; }
.users-table .token-col { width: 25%; }
.users-table .time-col { width: 13%; }
.users-table .status-col { width: 8%; }
.users-table .balance-col { width: 11%; }
.users-table .actions-col { width: 16%; }
.users-table th { padding: 14px 16px; color: #46535b; background: var(--surface-strong); font-size: 12px; text-align: left; }
.users-table td { padding: 16px; border-top: 1px solid var(--line); vertical-align: middle; }
.users-table tbody tr { transition: background .18s ease; }
.users-table tbody tr:hover { background: rgba(22, 122, 97, .035); }
.user-token-cell { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; max-width: none; }
.user-token-cell code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.users-table .user-point-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(64px, 1fr));
  align-items: stretch;
  justify-content: stretch;
  gap: 8px;
  width: 100%;
}
.users-table .user-point-actions button {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 0 10px;
}

#dashboardView {
  position: relative;
  min-height: calc(100vh - 128px);
  padding-bottom: 80px;
}

.dashboard-actions {
  position: absolute;
  right: 0;
  bottom: 0;
}

.sidebar-footer {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.sidebar-version {
  padding: 0 12px;
  color: rgba(201, 203, 212, 0.68);
  font-size: 12px;
  font-weight: 700;
}

.sidebar-footer .sidebar-status {
  margin-top: 0;
}

.sidebar-logout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 12px;
  color: #c9cbd4;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  font-weight: 750;
}

.sidebar-logout:hover {
  color: #ffffff;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(248, 113, 113, 0.3);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(203, 213, 225, 0.72);
}

.page-header h1 {
  margin-top: 4px;
  font-size: 27px;
  letter-spacing: -0.035em;
}

.page-kicker {
  color: #8b93a5;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.18em;
}

.page-header-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  color: #566071;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(203, 213, 225, 0.7);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
}

.dashboard-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 18px;
  padding: 28px 30px;
  overflow: hidden;
  color: #ffffff;
  background: radial-gradient(circle at 85% 20%, rgba(129, 140, 248, 0.6), transparent 32%), linear-gradient(135deg, #171a2b, #27214c 64%, #4d3dd7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(45, 37, 105, 0.2);
}

.dashboard-hero .eyebrow { color: #b8b0ff; }
.dashboard-hero h2 { margin-top: 8px; font-size: clamp(24px, 3vw, 36px); letter-spacing: -0.04em; }
.dashboard-hero p { margin: 10px 0 0; color: #cdd0df; }
.dashboard-hero .primary-button { flex: 0 0 auto; background: #ffffff; border-color: #ffffff; color: #302888; }

.settings-layout {
  display: block;
}

.settings-intro {
  position: sticky;
  top: 24px;
  padding: 28px;
  color: #f7f7fb;
  background: linear-gradient(155deg, #171923, #252036);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(20, 20, 35, 0.16);
}

.settings-intro h2 { margin-top: 8px; font-size: 28px; }
.settings-intro p { margin: 12px 0 28px; color: #b7b8c5; line-height: 1.7; }
.settings-session { display: flex; align-items: center; gap: 12px; padding: 16px 0; border-top: 1px solid rgba(255, 255, 255, 0.1); border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.settings-session div { display: grid; gap: 3px; }
.settings-session span:last-child { color: #9d9eaa; font-size: 12px; }
.settings-stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.settings-stack .config-panel { max-width: none; padding: 18px; border-radius: 16px; }
.settings-stack .settings-featured { grid-column: 1 / -1; }
.admin-password-form { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.admin-password-form .config-actions { grid-column: 1 / -1; margin-top: 0; }
.settings-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.settings-card-header > div { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; }
.settings-card-header h2 { align-self: center; font-size: 18px; }
.settings-card-header p { grid-column: 2; margin: 4px 0 0; color: var(--muted); line-height: 1.55; }
.settings-icon { display: grid; place-items: center; grid-row: 1 / 3; width: 38px; height: 38px; color: var(--brand-dark); background: var(--brand-soft); border-radius: 12px; font-size: 18px; font-weight: 900; }
.settings-state { flex: 0 0 auto; padding: 6px 9px; color: #667085; background: #f5f6f8; border-radius: 999px; font-size: 11px; font-weight: 800; }
.settings-card-value { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; min-height: 62px; padding-top: 14px; border-top: 1px solid var(--line); }
.settings-card-value > div { display: grid; gap: 7px; min-width: 0; }
.settings-card-value span { color: var(--muted); font-size: 12px; }
.settings-card-value strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.repository-update-error {
  max-height: 190px;
  margin: 14px 0 0;
  padding: 12px 14px;
  overflow: auto;
  color: #7b2424;
  background: #fff7f7;
  border: 1px solid #ead2d2;
  border-radius: 6px;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.feedback-content { max-width: 420px; white-space: pre-wrap; word-break: break-word; }
.modal-panel.settings-model-modal { grid-template-rows: auto minmax(0, 1fr) auto; width: min(calc(100vw - 48px), 1320px); height: min(calc(100vh - 48px), 900px); max-height: calc(100vh - 48px); padding: 0; overflow: hidden; border: 0; border-radius: 22px; }
.model-modal-header { padding: 24px 26px 20px; color: #fff; background: radial-gradient(circle at 82% 10%, rgba(129, 140, 248, .62), transparent 34%), linear-gradient(135deg, #171a2b, #342b72); }
.model-modal-header > div { display: grid; gap: 5px; }
.model-modal-header h2 { margin: 0; font-size: 24px; }
.model-modal-header p { margin: 0; color: #d4d2ea; }
.model-modal-header .modal-close { color: #fff; background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .24); }
.danger-outline-button { width: 100%; min-height: 42px; margin-top: 18px; color: #fda4af; background: rgba(244, 63, 94, 0.08); border: 1px solid rgba(251, 113, 133, 0.24); border-radius: 11px; font-weight: 800; }
.danger-outline-button:hover { color: #ffffff; background: rgba(244, 63, 94, 0.18); }

.dashboard-logout {
  color: var(--danger);
  border-color: rgba(189, 43, 43, 0.24);
}

.eyebrow {
  color: var(--brand);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.prompt-manager-panel {
  min-height: calc(100vh - 80px);
}

.prompt-manager-header {
  align-items: flex-end;
}

.prompt-manager-header h2 {
  margin: 5px 0 6px;
  font-size: 28px;
}

.prompt-manager-header p {
  margin: 0;
  color: var(--muted);
}

.prompt-editor {
  display: grid;
  grid-template-columns: minmax(180px, 0.35fr) minmax(280px, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin: 18px 0;
  padding: 18px;
  background: linear-gradient(135deg, var(--brand-soft), #f8fbff);
  border: 1px solid rgba(22, 122, 97, 0.16);
  border-radius: 16px;
}

.prompt-editor-actions {
  display: flex;
  gap: 8px;
  padding-bottom: 1px;
}

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

.prompt-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  min-height: 170px;
  padding: 18px;
  background: linear-gradient(145deg, #fff, #f9fbfc);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.prompt-card:hover {
  transform: translateY(-3px);
  border-color: rgba(22, 122, 97, 0.3);
  box-shadow: 0 18px 42px rgba(19, 39, 48, 0.11);
}

.prompt-card-index {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 13px;
  font-weight: 900;
}

.prompt-card-body {
  min-width: 0;
}

.prompt-card-body strong { font-size: 16px; }
.prompt-card-body p { display: -webkit-box; overflow: hidden; margin: 10px 0; color: #46545c; line-height: 1.65; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.prompt-card-body time { color: var(--muted); font-size: 12px; }
.prompt-card-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.prompt-card-actions button { padding: 6px 10px; color: var(--brand-dark); background: transparent; border: 0; border-radius: 8px; font-weight: 800; }
.prompt-card-actions button:hover { background: var(--brand-soft); }
.prompt-card-actions .danger-text { color: var(--danger); }
.drag-handle { margin-left: auto; color: var(--muted); cursor: grab; font-size: 18px; letter-spacing: -4px; }
.prompt-pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 24px; }
.prompt-empty { grid-column: 1 / -1; min-height: 220px; }
.prompt-save-button { background: var(--brand-soft); }

@media (max-width: 900px) {
  .prompt-grid { grid-template-columns: 1fr; }
  .prompt-editor { grid-template-columns: 1fr; }
}

.login-screen {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  overflow-x: hidden;
  overflow-y: auto;
  background:
    linear-gradient(135deg, rgba(22, 122, 97, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(38, 98, 217, 0.08), transparent 34%),
    var(--bg);
}

.login-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 22px;
  width: min(100%, 430px);
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.login-light-field {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.login-light-field span {
  position: absolute;
  width: 42vw;
  height: 42vw;
  border-radius: 50%;
  opacity: 0;
  filter: blur(2px);
}

body[data-portal="client"] .login-screen {
  background: linear-gradient(145deg, #f8fafc 0%, #edf1f7 48%, #f7f5ff 100%);
}

body[data-portal="client"] .login-light-field span {
  opacity: 0.72;
  animation: loginLightDrift 14s ease-in-out infinite alternate;
}

body[data-portal="client"] .login-light-field span:nth-child(1) {
  top: -28%;
  left: -10%;
  background: radial-gradient(circle, rgba(81, 69, 215, 0.2), rgba(81, 69, 215, 0) 68%);
}

body[data-portal="client"] .login-light-field span:nth-child(2) {
  right: -14%;
  bottom: -30%;
  background: radial-gradient(circle, rgba(47, 125, 199, 0.18), rgba(47, 125, 199, 0) 68%);
  animation-delay: -5s;
}

body[data-portal="client"] .login-light-field span:nth-child(3) {
  top: 34%;
  left: 30%;
  width: 34vw;
  height: 34vw;
  background: radial-gradient(circle, rgba(140, 112, 255, 0.12), rgba(140, 112, 255, 0) 66%);
  animation-delay: -9s;
}

body[data-portal="client"] .login-panel {
  width: min(100%, 446px);
  padding: 34px;
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 30px 90px rgba(27, 31, 52, 0.14), 0 1px 0 rgba(255, 255, 255, 0.9) inset;
  backdrop-filter: blur(24px) saturate(130%);
}

body[data-portal="client"] .login-panel.register-mode {
  gap: 15px;
  margin: 24px 0;
  padding: 28px 34px;
}

.email-address-row,
.registration-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.email-address-row select {
  min-width: 118px;
  height: 40px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}

.registration-code-row button {
  min-width: 112px;
  white-space: nowrap;
}

.email-domain-editor { display: grid; gap: 10px; }
.email-domain-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.email-domain-item input { min-width: 0; }
.email-domain-item button { min-width: 68px; }
.email-domain-add { justify-self: start; margin-top: 10px; }

body[data-portal="client"] .login-panel::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  padding: 1px;
  background: linear-gradient(125deg, rgba(91, 76, 225, 0.5), rgba(255, 255, 255, 0.15) 38%, rgba(52, 122, 197, 0.42) 72%, rgba(255, 255, 255, 0.5));
  border-radius: inherit;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: loginBorderGlow 7s linear infinite;
}

body[data-portal="client"] .login-heading h1 {
  font-size: 31px;
  letter-spacing: -0.04em;
}

@keyframes loginLightDrift {
  from { transform: translate3d(-3%, -2%, 0) scale(0.94); }
  to { transform: translate3d(9%, 7%, 0) scale(1.08); }
}

@keyframes loginBorderGlow {
  0% { filter: hue-rotate(0deg); opacity: 0.72; }
  50% { opacity: 1; }
  100% { filter: hue-rotate(22deg); opacity: 0.72; }
}

@media (prefers-reduced-motion: reduce) {
  body[data-portal="client"] .login-light-field span,
  body[data-portal="client"] .login-panel::before {
    animation: none;
  }
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.login-heading h1 {
  margin-top: 4px;
}

.login-actions {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.login-token-hint {
  display: grid;
  gap: 8px;
  padding: 12px;
  color: #5f4a11;
  background: var(--warning-soft);
  border: 1px solid #e8ca6b;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.login-command-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
}

.login-command-row input {
  min-width: 0;
  height: 34px;
  padding: 8px 10px;
  overflow: hidden;
  color: #27343b;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(161, 98, 7, 0.22);
  border-radius: 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: text;
}

.copy-command-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: #5f4a11;
  background: #ffffff;
  border: 1px solid rgba(161, 98, 7, 0.28);
  border-radius: 8px;
}

.copy-command-button:hover {
  background: #fffaf0;
}

.copy-command-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 24px 18px;
  color: #f4f7f5;
  background: linear-gradient(180deg, #151720 0%, #101219 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(17, 29, 49, 0.08);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(5, 14, 31, 0.16);
  overflow: hidden;
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.28);
}

.brand-monogram svg {
  width: 36px;
  height: 36px;
  overflow: visible;
  fill: #101c30;
}

.brand-monogram .monogram-letter {
  font-family: Didot, "Bodoni MT", "Times New Roman", serif;
  font-size: 56px;
  font-weight: 400;
  letter-spacing: -3px;
}

.brand-monogram .monogram-h {
  transform: scaleX(0.82);
  transform-origin: 5px 53px;
}

.brand-monogram .monogram-s {
  transform: scaleX(0.84);
  transform-origin: 27px 53px;
}

.login-brand .brand-mark {
  width: 52px;
  height: 52px;
  border-color: rgba(18, 29, 49, 0.1);
  box-shadow: 0 12px 34px rgba(17, 29, 49, 0.12);
}

.login-brand .brand-monogram svg {
  width: 45px;
  height: 45px;
}

.brand-name {
  font-size: 16px;
  font-weight: 800;
}

.brand-subtitle {
  margin-top: 2px;
  color: #aeb9b5;
  font-size: 12px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 16px;
  color: #aeb2c0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 11px;
  text-align: left;
}

.nav-item > span {
  font-weight: 760;
  letter-spacing: 0.01em;
}

.nav-item:hover,
.nav-item.active {
  color: #ffffff;
  background: linear-gradient(90deg, rgba(109, 93, 252, 0.22), rgba(109, 93, 252, 0.08));
  border-color: rgba(139, 126, 255, 0.2);
}

.nav-symbol {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: #b5c4bf;
  font-size: 11px;
  font-weight: 800;
}

.nav-item.active .nav-symbol {
  background: #7465ff;
  color: #ffffff;
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #c7d2ce;
  background: rgba(255, 255, 255, 0.05);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #87918d;
}

.status-dot.ok {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(19, 132, 94, 0.16);
}

.status-dot.bad {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(189, 43, 43, 0.16);
}

.main {
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 24px clamp(22px, 3vw, 44px) 40px;
}

.eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  margin-top: 4px;
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 17px;
  line-height: 1.3;
}

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

.token-strip {
  display: grid;
  grid-template-columns: minmax(220px, 340px) auto auto;
  align-items: end;
  gap: 8px;
  width: min(100%, 560px);
  margin-top: 14px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(23, 32, 38, 0.04);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.toolbar,
.panel-header,
.table-tools,
.submit-actions,
.config-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.toolbar {
  margin-bottom: 16px;
}

.section-side-label {
  color: #38454d;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric-card,
.panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(203, 213, 225, 0.8);
  border-radius: 16px;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.055);
}

.metric-card {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  width: 32px;
  height: 2px;
  margin-left: 20px;
  background: linear-gradient(90deg, var(--brand), #9d8fff);
  border-radius: 999px;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-card strong {
  overflow-wrap: anywhere;
  font-size: 30px;
  line-height: 1.1;
}

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

.metric-card strong.bad {
  color: var(--danger);
}

.metric-note {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-note-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.metric-edit-button {
  min-height: 28px;
  padding: 0 6px;
  font-size: 12px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 14px;
}

.panel {
  padding: 18px;
}

.code-line {
  margin-top: 16px;
  padding: 14px;
  overflow-wrap: anywhere;
  color: #10241e;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  line-height: 1.55;
}

.mini-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.mini-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mini-item code {
  overflow: hidden;
  max-width: 210px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.field span {
  color: #38454d;
  font-size: 12px;
  font-weight: 800;
}

.field.compact {
  gap: 5px;
}

input,
textarea {
  width: 100%;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input {
  height: 40px;
  padding: 0 12px;
}

textarea {
  min-height: 120px;
  padding: 12px;
  resize: vertical;
  line-height: 1.55;
}

input:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(109, 93, 252, 0.12);
}

.primary-button,
.secondary-button,
.danger-button,
.text-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 800;
  white-space: nowrap;
}

.primary-button {
  color: #ffffff;
  background: var(--brand);
  border-color: var(--brand-dark);
  box-shadow: 0 7px 18px rgba(85, 70, 232, 0.18);
}

.primary-button:hover {
  background: var(--brand-dark);
}

.secondary-button,
.icon-button {
  color: #27343b;
  background: #ffffff;
  border-color: var(--line-strong);
}

.secondary-button:hover,
.icon-button:hover {
  background: #f7f9fa;
}

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

.danger-button:hover {
  background: #9f2222;
}

.text-button {
  min-height: 34px;
  padding: 0 8px;
  color: var(--brand);
  background: transparent;
}

.text-button:hover {
  background: var(--brand-soft);
}

.submit-layout {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 14px;
  width: 100%;
  min-height: auto;
  padding: 18px 0 32px;
}

.submit-composer {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 0;
  width: min(100%, 1100px);
  min-height: 0;
  padding: 0;
  overflow: visible;
  background: #ffffff;
  border: 1px solid rgba(160, 174, 192, 0.34);
  border-radius: 28px;
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.08);
}

.submit-layout.is-submitting .submit-composer {
  border-color: rgba(109, 93, 252, 0.3);
  box-shadow: 0 20px 54px rgba(15, 23, 42, 0.08);
}

.composer-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 26px 16px;
  border-bottom: 1px solid rgba(216, 229, 234, 0.76);
}

.composer-heading h2 {
  margin: 6px 0 0;
  font-size: clamp(20px, 2vw, 26px);
  letter-spacing: -0.025em;
}

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

.submit-layout.is-submitting .reference-button,
.submit-layout.is-submitting .ratio-picker,
.submit-layout.is-submitting .image-item {
  cursor: not-allowed;
  opacity: 0.56;
}

.submit-layout.is-submitting .reference-button {
  pointer-events: none;
}

.composer-main {
  display: grid;
  grid-template-rows: auto auto;
  align-content: stretch;
  gap: 16px;
  min-width: 0;
  padding: 18px 26px;
}

.composer-main textarea {
  width: 100%;
  min-height: 150px;
  max-height: 280px;
  padding: 16px 18px;
  color: #202a31;
  background: #f8fafb;
  border: 1px solid rgba(203, 213, 225, 0.76);
  border-radius: 14px;
  box-shadow: 0 1px 0 #ffffff inset;
  resize: vertical;
  font-size: 16px;
  line-height: 1.7;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.composer-main textarea:focus {
  background: #ffffff;
  border-color: rgba(109, 93, 252, 0.58);
  box-shadow: 0 0 0 4px rgba(109, 93, 252, 0.09), 0 14px 34px rgba(15, 23, 42, 0.05);
  outline: none;
}

.composer-main textarea::placeholder {
  color: #a8b0b8;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 70px;
  padding: 12px 18px 12px 26px;
  background: #f8fafb;
  border-top: 1px solid rgba(216, 229, 234, 0.82);
  border-radius: 0 0 28px 28px;
}

.composer-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.composer-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 6px 0 13px;
  color: var(--muted);
  background: #ffffff;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 13px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.composer-select select {
  min-width: 150px;
  height: 34px;
  padding: 0 30px 0 8px;
  color: var(--ink);
  background-color: transparent;
  border: 0;
  box-shadow: none;
  font-size: 13px;
  font-weight: 800;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px;
  width: fit-content;
  max-width: 100%;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.segmented button {
  min-width: 58px;
  min-height: 34px;
  padding: 0 12px;
  color: #4f5c64;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 800;
}

.segmented button.active {
  color: var(--brand-dark);
  background: #ffffff;
  border-color: var(--line-strong);
  box-shadow: 0 5px 14px rgba(23, 32, 38, 0.08);
}

.reference-button {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 13px;
  color: #151f26;
  background: #ffffff;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 13px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.reference-button:hover {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(59, 130, 246, 0.3);
}

.plus-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 12px;
  height: 16px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.ratio-picker {
  position: relative;
}

.ratio-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 42px;
  padding: 0 13px;
  color: #151f26;
  background: #ffffff;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 13px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.deduct-button {
  color: #9a5b0a;
  background: #fffaf0;
  border-color: #efd7ad;
}

.deduct-button:hover {
  color: #7c4600;
  background: #fff3dc;
  border-color: #e5bd78;
}

.user-point-actions {
  flex-wrap: wrap;
}

.ratio-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.ratio-trigger::after {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  margin-left: 1px;
  transform: translateY(-1px) rotate(45deg);
}

#ratioValue {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.ratio-trigger:hover,
.ratio-picker.open .ratio-trigger {
  color: var(--accent);
  background: var(--accent-soft);
}

.ratio-options {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 5;
  display: none;
  min-width: 118px;
  padding: 6px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow);
}

.ratio-picker.open .ratio-options {
  display: grid;
  gap: 4px;
}

.ratio-options button {
  min-height: 32px;
  padding: 0 10px;
  color: #38454d;
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-weight: 800;
  text-align: left;
}

.ratio-options button:hover,
.ratio-options button.active {
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.image-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.image-list:empty {
  display: none;
}

.image-item {
  position: relative;
  display: flex;
  align-items: center;
  width: 76px;
  height: 76px;
  padding: 0;
  background: #eef2f5;
  border: 1px solid var(--line);
  border-radius: 15px;
}

.thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
  background: #e2e8ee;
}

.image-meta {
  display: none;
}

.image-item .icon-button {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 22px;
  min-height: 22px;
  width: 22px;
  height: 22px;
  padding: 0;
  color: #ffffff;
  background: rgba(23, 32, 38, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 999px;
  font-size: 0;
}

.image-item .icon-button::before {
  content: "x";
  font-size: 12px;
  line-height: 1;
}

.composer-state {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.submit-arrow-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  padding: 0;
  color: #ffffff;
  background: linear-gradient(135deg, #7868ff, #4f46e5);
  border: 0;
  border-radius: 999px;
  line-height: 1;
  box-shadow: 0 14px 28px rgba(79, 70, 229, 0.28);
}

.submit-arrow-button svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.submit-arrow-button:hover {
  background: linear-gradient(135deg, #6757f4, #4038c9);
  transform: translateY(-1px);
}

.submit-arrow-button:disabled {
  opacity: 0.58;
  box-shadow: none;
}

.table-tools {
  margin-bottom: 14px;
}

.task-stats-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.task-stat-pill {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 14px;
  color: var(--brand-dark);
  background: linear-gradient(135deg, #eefbf6, #f8fbff);
  border: 1px solid rgba(22, 122, 97, 0.18);
  border-radius: 999px;
  font-weight: 900;
}

.task-stat-pill.success {
  color: #075985;
  background: linear-gradient(135deg, #eef7ff, #ffffff);
  border-color: rgba(38, 98, 217, 0.18);
}

.task-stat-pill span {
  color: var(--muted);
  font-size: 12px;
}

.task-stat-pill strong {
  font-size: 18px;
}

.search-field {
  width: min(420px, 100%);
}

.task-table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
}

.pager {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  flex-wrap: wrap;
}

.pager-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pager .page-button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.pager .page-button:hover:not(:disabled) {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.pager .page-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.current-page-count {
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}

.current-page-count strong {
  color: var(--brand-dark);
}

.pager .icon-button {
  min-width: 36px;
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.pager span[id$="PageState"] {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pager #pageState {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 11px;
  line-height: 1.2;
  margin-left: 4px;
}

.pager span[id$="PageState"] strong {
  color: var(--brand-dark);
  font-size: 13px;
}

.pager select {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
}

.composer-controls > select,
.account-import-top select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
}

.table-bottom-pager {
  justify-content: flex-end;
  margin-top: 12px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.quota-panel .quota-table-wrap,
.accounts-panel .account-table-wrap {
  margin-top: 12px;
}

.accounts-panel .account-table-wrap {
  overflow-x: visible;
  border: 0;
}

.accounts-panel {
  padding: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(250, 251, 255, .98));
  border-color: rgba(109, 93, 252, .12);
  box-shadow: 0 20px 50px rgba(15, 23, 42, .06);
}

.accounts-panel > .panel-header {
  align-items: flex-start;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(216, 229, 234, .8);
}

.accounts-panel > .panel-header h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -.02em;
}

.account-panel-description {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.account-toolbar-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-left: auto;
}

.account-platform-filter {
  display: inline-grid;
  grid-template-columns: auto minmax(92px, auto) auto;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 4px 5px 4px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 5px 16px rgba(15, 23, 42, .04);
}

.account-filter-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
}

.account-platform-filter select {
  min-width: 92px;
  height: 30px;
  padding: 0 28px 0 8px;
  color: var(--ink);
  background-color: var(--surface-strong);
  border: 0;
  border-radius: 9px;
  font-weight: 900;
}

.account-platform-count {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid rgba(109, 93, 252, .14);
  border-radius: 9px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.account-status-counts {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 5px 16px rgba(15, 23, 42, .04);
}

.account-status-counts span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.account-status-counts strong {
  font-size: 16px;
}

.account-status-counts .normal {
  color: var(--ok);
  background: var(--ok-soft);
}

.account-status-counts .abnormal {
  color: var(--danger);
  background: var(--danger-soft);
}

.quota-reset-countdown {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 800;
}

.account-quota-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.account-quota-summary span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  background: linear-gradient(135deg, #f7fffb, #f8fbff);
  border: 1px solid rgba(22, 122, 97, 0.16);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.account-quota-summary strong {
  color: var(--brand-dark);
  font-size: 15px;
}

.account-task-search {
  width: 220px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
}

.account-import-form {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  align-items: stretch;
  gap: 14px;
  margin-top: 16px;
  padding: 16px;
  background: linear-gradient(135deg, #f8f9ff, #f7fbfc);
  border: 1px solid rgba(109, 93, 252, .12);
  border-radius: 16px;
}

.account-import-top {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.account-import-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  align-items: stretch;
  gap: 12px;
}

.account-name-field input,
.account-quota-field input {
  height: 44px;
}

.account-cookie-field textarea {
  min-height: 116px;
  max-height: 180px;
  resize: vertical;
}

.account-import-actions {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  align-items: end;
  justify-items: stretch;
  min-width: 0;
}

.account-detected-count {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
}

.account-detected-count.active {
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-color: rgba(34, 197, 94, 0.28);
}

.account-import-actions .muted {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 10px;
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}

.account-import-actions .primary-button {
  width: 100%;
  min-height: 44px;
}

.quota-entry-note {
  max-width: 620px;
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.client-entry-box {
  display: grid;
  grid-template-columns: auto minmax(260px, 420px) auto;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: var(--muted);
  font-weight: 800;
}

.client-entry-box input {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  color: #25313a;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.task-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  table-layout: fixed;
}

.quota-table,
.account-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.quota-table {
  min-width: 980px;
}

.account-table,
.account-table thead,
.account-table tbody,
.account-table tr {
  display: block;
}

.account-table thead {
  display: none;
}

.account-table tbody {
  display: grid;
  gap: 12px;
}

.account-table tr {
  display: grid;
  grid-template-columns: minmax(170px, 1.35fr) minmax(74px, 0.5fr) minmax(125px, 0.75fr) minmax(130px, 0.9fr) minmax(145px, 0.85fr) minmax(190px, 1.1fr);
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(203, 213, 225, .75);
  border-radius: 16px;
  background: linear-gradient(145deg, #fff, #fcfdff);
  box-shadow: 0 6px 18px rgba(15, 23, 42, .035);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.model-config-platform {
  min-width: 0;
  padding: 16px;
  background: linear-gradient(145deg, #fff, #f7f8ff);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
}

.model-config-platform:last-child {
  border-bottom: 1px solid var(--line);
}

.model-config-list { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 14px; min-height: 0; padding: 22px 26px; overflow: auto; }
.model-config-heading { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 8px; }
.model-config-heading strong { font-size: 16px; }
.model-config-heading span { padding: 4px 7px; color: var(--brand-dark); background: var(--brand-soft); border-radius: 999px; font-size: 11px; font-weight: 800; }
.model-config-heading .secondary-button { min-height: 30px; padding: 5px 9px; }
.model-config-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }

.model-config-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 126px auto;
  gap: 8px;
  align-items: center;
  margin: 0;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.model-config-row input[type="text"],
.model-config-row input[type="number"] {
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
}

.model-cost-field { position: relative; display: block; }
.model-cost-field input { padding-right: 52px !important; }
.model-cost-field em { position: absolute; top: 50%; right: 8px; color: var(--muted); font-size: 11px; font-style: normal; transform: translateY(-50%); pointer-events: none; }

.model-config-row .secondary-button { min-height: 32px; padding: 5px 8px; font-size: 12px; }
.model-modal-actions { padding: 16px 26px 22px; border-top: 1px solid var(--line); }
.model-modal-actions span { margin-right: auto; color: var(--muted); font-size: 12px; }
.list-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 16px; color: var(--muted); }
.security-modal { width: min(100%, 480px); padding: 24px; border-radius: 18px; }
.security-modal .modal-header > div { display: grid; gap: 4px; }
.security-modal .modal-header h2 { margin: 0; }
.modal-panel.package-modal { grid-template-rows: auto auto minmax(0, 1fr) auto; width: min(calc(100vw - 48px), 1320px); height: min(calc(100vh - 48px), 900px); max-height: calc(100vh - 48px); padding: 24px; overflow: hidden; border-radius: 20px; }
.package-modal .modal-header > div { display: grid; gap: 5px; }
.package-modal .modal-header h2, .package-modal .modal-header p { margin: 0; }
.package-modal .modal-header p { color: var(--muted); }
.package-create-form { display: grid; grid-template-columns: 1.4fr repeat(3, minmax(100px, .65fr)) auto; gap: 12px; align-items: end; padding: 16px; background: linear-gradient(135deg, var(--brand-soft), #f8fbff); border: 1px solid rgba(109, 93, 252, .16); border-radius: 15px; }
.package-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 12px; min-height: 0; padding-right: 4px; overflow: auto; }
.package-item { display: grid; gap: 14px; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow-soft); }
.package-item-heading, .package-item-heading > div, .package-item-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.package-item-heading > div { justify-content: flex-start; }
.package-item-heading > span { color: var(--brand-dark); font-size: 18px; font-weight: 900; }
.package-item-fields { display: grid; grid-template-columns: 1.3fr repeat(3, minmax(70px, .7fr)); gap: 8px; }
.package-item-actions { justify-content: flex-end; padding-top: 12px; border-top: 1px solid var(--line); }

.task-table .task-col {
  width: 21%;
}

.task-table .owner-col {
  width: 10%;
}

.task-table .status-col {
  width: 11%;
}

.task-table .result-col {
  width: 26%;
}

.task-table .video-col {
  width: 13%;
}

.task-table .action-col {
  width: 18%;
}

.quota-table .remark-col {
  width: 16%;
}

.quota-table .token-col {
  width: 28%;
}

.quota-table .quota-col,
.quota-table .concurrency-col,
.quota-table .remain-col {
  width: 10%;
}

.quota-table .time-col {
  width: 16%;
}

.quota-table .quota-action-col {
  width: 14%;
}

.account-table .account-name-col {
  width: 22%;
}

.account-table .account-status-col {
  width: 9%;
}

.account-table .account-quota-col {
  width: 15%;
}

.account-table .account-task-col {
  width: 16%;
}

.account-table .account-time-col {
  width: 20%;
}

.account-table .account-action-col {
  width: 24%;
}

.account-table colgroup {
  display: none;
}

.task-table th,
.task-table td,
.quota-table th,
.quota-table td,
.account-table th,
.account-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

.task-table th,
.task-table td {
  min-width: 0;
  overflow: hidden;
}

.account-table td {
  min-width: 0;
  padding: 0;
  border-bottom: 0;
}

.quota-table th,
.quota-table td,
.account-table th,
.account-table td {
  vertical-align: middle;
}

.task-table th,
.quota-table th,
.account-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #46535b;
  background: var(--surface-strong);
  font-size: 12px;
  text-transform: uppercase;
}

.task-table th:nth-child(2),
.task-table td:nth-child(2),
.task-table th:nth-child(4),
.task-table td:nth-child(4) {
  text-align: center;
}

.task-table th:nth-child(6),
.task-table td:nth-child(6) {
  text-align: right;
}

.quota-table th:nth-child(2),
.quota-table td:nth-child(2),
.quota-table th:nth-child(3),
.quota-table td:nth-child(3),
.quota-table th:nth-child(4),
.quota-table td:nth-child(4),
.quota-table th:nth-child(5),
.quota-table td:nth-child(5),
.quota-table th:nth-child(6),
.quota-table td:nth-child(6),
.account-table th:nth-child(2),
.account-table td:nth-child(2),
.account-table th:nth-child(4),
.account-table td:nth-child(4),
.account-table th:nth-child(5),
.account-table td:nth-child(5),
.account-table th:nth-child(6),
.account-table td:nth-child(6) {
  text-align: center;
}

.task-table tbody tr:hover,
.quota-table tbody tr:hover {
  background: #fbfcfd;
}

.account-table tbody tr:hover {
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: 0 14px 30px rgba(17, 24, 39, 0.08);
  transform: translateY(-2px);
}

.task-table tbody tr:last-child td,
.quota-table tbody tr:last-child td,
.account-table tbody tr:last-child td {
  border-bottom: 0;
}

.account-name-cell {
  display: grid;
  gap: 4px;
}

.video-library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.video-library-card {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.video-library-card { position: relative; overflow: hidden; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.video-library-card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(18, 54, 45, .1); }
.video-library-card.selected { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(22, 122, 97, 0.12); }
.video-card-select { position: absolute; z-index: 2; top: 20px; left: 20px; display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; color: #fff; background: rgba(15, 28, 25, .72); border: 1px solid rgba(255, 255, 255, .28); border-radius: 999px; backdrop-filter: blur(8px); font-size: 12px; font-weight: 800; cursor: pointer; }
.video-card-select input, .video-select-all input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.video-select-all { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; background: var(--brand-soft); border: 1px solid rgba(22, 122, 97, .18); border-radius: 10px; font-weight: 800; cursor: pointer; }

.video-library-card video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: #111;
}

.video-library-card span,
.video-library-card time {
  color: var(--muted);
  font-size: 12px;
}

.account-card-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.account-quota-cell {
  display: grid;
  gap: 4px;
}

.account-quota-cell strong {
  color: var(--brand-dark);
}

.account-quota-cell span,
.account-current-task {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.account-current-task {
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-current-task.active {
  color: var(--warning);
  font-weight: 800;
}

.account-name-cell code {
  overflow: hidden;
  color: #53616b;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-table .quota-row-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

@media (max-width: 1280px) {
  .account-table tr {
    grid-template-columns: minmax(160px, 1.3fr) minmax(80px, 0.55fr) minmax(130px, 0.85fr) minmax(140px, 0.95fr) minmax(150px, 1fr);
  }

  .account-table td:nth-child(6) {
    grid-column: 1 / -1;
  }

  .account-table .quota-row-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 980px) {
  .account-import-form {
    grid-template-columns: 1fr;
  }

  .account-import-top {
    grid-template-columns: minmax(0, 1fr) minmax(110px, 160px);
  }

  .account-table tr {
    grid-template-columns: 1fr 1fr;
  }

  .account-table td:nth-child(5),
  .account-table td:nth-child(6) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .account-import-form,
  .account-import-top,
  .account-import-main,
  .account-table tr {
    grid-template-columns: 1fr;
  }

  .account-table td:nth-child(5),
  .account-table td:nth-child(6) {
    grid-column: auto;
  }
}

.temp-token-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}

.temp-token-cell code {
  overflow: hidden;
  color: #53616b;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.temp-token-used {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.token-copy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 8px;
  color: var(--brand);
  background: #eaf2ff;
  border: 1px solid #c7dcff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.quota-limit-input {
  display: block;
  width: 86px;
  margin: 0 auto;
  padding: 7px 8px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.token-remark-input {
  display: block;
  width: 180px;
  max-width: 100%;
  margin: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.task-owner-chip {
  display: inline-flex;
  align-items: center;
  max-width: 120px;
  min-height: 30px;
  padding: 0 10px;
  overflow: hidden;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid rgba(22, 122, 97, 0.16);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quota-row-actions {
  align-items: center;
  justify-content: center;
}

.task-id {
  display: grid;
  gap: 4px;
}

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

.task-prompt {
  max-width: 100%;
  overflow: hidden;
  color: #1c2a30;
  font-weight: 800;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-copy-prompt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 7px;
  border: 1px solid #d7e1e7;
  border-radius: 999px;
  background: #f7fafb;
  color: #55707b;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.task-copy-prompt:hover {
  border-color: #b9cbd4;
  background: #edf5f7;
  color: #1f6d62;
}

.task-id code {
  overflow-wrap: anywhere;
  color: #79858d;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.task-time {
  color: var(--muted);
  font-size: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.chip.unknown {
  color: #52606a;
  background: #eef2f5;
}

.chip.success {
  color: var(--ok);
  background: var(--ok-soft);
}

.chip.failed {
  color: var(--danger);
  background: var(--danger-soft);
}

.chip.running {
  color: var(--warning);
  background: var(--warning-soft);
}

.task-status-stack {
  display: inline-grid;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  gap: 5px;
  justify-items: start;
}

.task-status-meta {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-text {
  max-width: 100%;
  color: #38454d;
  line-height: 1.45;
}

.result-text-button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  color: #38454d;
  background: var(--surface-strong);
  border: 1px solid transparent;
  border-radius: 10px;
  line-height: 1.45;
  text-align: left;
}

.result-text-button:disabled {
  cursor: default;
  opacity: 1;
}

.result-text-preview {
  display: -webkit-box;
  max-height: 2.9em;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.result-text-button.has-detail {
  cursor: pointer;
}

.result-text-button.has-detail:hover {
  color: var(--accent);
  border-color: rgba(38, 98, 217, 0.22);
  background: #f4f7ff;
}

.url-cell {
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: center;
}

.video-actions {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.url-cell a,
.video-link-button {
  min-width: 56px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  font-weight: 800;
  font-size: 11px;
  line-height: 1;
  text-decoration: none;
}

.video-link-button[data-action="open-video"] {
  color: #1766c2;
  background: #eaf3ff;
  border-color: #c8defa;
}

.video-link-button[data-action="copy-url"] {
  color: #1f7a5a;
  background: #e9f7f0;
  border-color: #c5e7d6;
}

.video-link-button[data-action="download-video"] {
  color: #9b5a10;
  background: #fff2dc;
  border-color: #f2d3a2;
}

.url-cell a:hover,
.video-link-button:hover {
  filter: saturate(1.08) brightness(0.98);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.task-table .row-actions .icon-button,
.task-table .row-actions .danger-button {
  min-height: 34px;
  padding: 0 10px;
}

.docs-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 14px;
}

.docs-panel {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
}

.docs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.docs-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid #cde7dc;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.api-list,
.command-list {
  display: grid;
  gap: 10px;
}

.api-item,
.command-item {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.api-item > div:not(.api-example) {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.api-item p {
  margin: 0;
  color: #46535b;
  line-height: 1.55;
}

.api-example {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.api-example span {
  color: #52606a;
  font-size: 12px;
  font-weight: 800;
}

.api-example code {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 10px;
  overflow-x: auto;
  color: #d9edf7;
  background: #14384b;
  border-radius: 6px;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
}

.method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 900;
}

.method.get {
  color: #174ea6;
  background: #e9f1ff;
}

.method.post {
  color: #0f6848;
  background: #e6f4ef;
}

.method.delete {
  color: #9f2222;
  background: var(--danger-soft);
}

.api-item > div:not(.api-example) code,
.api-item p code,
.command-item code {
  overflow-wrap: anywhere;
  color: #14251f;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

.api-example code {
  color: #ffffff;
}

.api-item p code {
  padding: 2px 5px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.command-item span {
  color: #38454d;
  font-size: 12px;
  font-weight: 800;
}

.command-item code {
  display: block;
  padding: 10px 12px;
  color: #dce8e2;
  background: #17211f;
  border-radius: 8px;
  line-height: 1.5;
}

.config-panel {
  display: grid;
  gap: 18px;
  max-width: 940px;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 10px;
  z-index: 50;
  width: min(380px, calc(100vw - 36px));
}

.toast {
  padding: 12px 14px;
  color: #172026;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 18, 22, 0.38);
}

.modal-panel {
  display: grid;
  gap: 18px;
  width: min(100%, 420px);
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.text-modal-panel {
  width: min(100%, 720px);
}

.video-modal-panel {
  width: min(100%, 620px);
}

.video-title-row {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.video-frame {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #0b1115;
  border: 1px solid #111b21;
  border-radius: 8px;
}

.video-loading {
  padding: 18px;
  color: #d7e0e5;
  font-weight: 800;
}

.video-player {
  width: 100%;
  height: 100%;
  background: #000000;
  object-fit: contain;
}

.decoder-help-link {
  color: #126fff;
  background: transparent;
  border: 0;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

.decoder-help-link:hover {
  color: #075bd8;
}

.full-text-content {
  max-height: min(58vh, 520px);
  margin: 0;
  padding: 14px;
  overflow: auto;
  color: #1f2c33;
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, "Microsoft YaHei", monospace;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #38454d;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
}

.modal-close:hover {
  background: #f7f9fa;
}

.modal-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.empty-state {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1120px) {
  .node-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .accounts-panel > .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .account-quota-summary,
  .account-toolbar-actions {
    margin-left: 0;
  }

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

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

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

  .settings-layout {
    grid-template-columns: 1fr;
  }

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

  .model-config-list {
    grid-template-columns: 1fr;
  }

  .package-create-form,
  .package-item-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .package-list {
    grid-template-columns: 1fr;
  }

  .settings-intro {
    position: static;
  }
}

@media (max-width: 820px) {
  .modal-backdrop {
    padding: 14px;
  }

  .modal-panel.settings-model-modal,
  .modal-panel.package-modal {
    width: calc(100vw - 28px);
    height: calc(100vh - 28px);
    max-height: calc(100vh - 28px);
  }

  .package-modal {
    padding: 18px;
  }

  .model-config-list {
    padding: 18px;
  }

  .model-config-rows {
    grid-template-columns: 1fr;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 14px;
    height: auto;
    overflow: visible;
  }

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

  .nav-item {
    justify-content: center;
    min-height: 38px;
    padding: 0 6px;
  }

  .nav-symbol,
  .brand-subtitle,
  .sidebar-status {
    display: none;
  }

  .sidebar-footer {
    margin-top: 0;
  }

  .sidebar-logout {
    justify-content: center;
  }

  .sidebar-logout span:last-child {
    display: none;
  }

  .main {
    height: auto;
    overflow: visible;
    padding: 16px;
  }

  .submit-layout {
    min-height: auto;
    padding: 12px 0 32px;
  }

  .submit-composer {
    min-height: 440px;
    border-radius: 22px;
  }

  .composer-heading,
  .composer-main {
    padding-left: 20px;
    padding-right: 20px;
  }

  .composer-footer {
    align-items: flex-end;
    padding: 14px 16px 14px 20px;
    border-radius: 0 0 22px 22px;
  }

  .page-header {
    margin-bottom: 16px;
  }

  .dashboard-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar,
  .table-tools,
  .submit-actions,
  .config-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .token-strip {
    grid-template-columns: 1fr auto auto;
    width: 100%;
  }

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

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

  .docs-layout {
    grid-template-columns: 1fr;
  }

  .docs-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .proxy-header-actions {
    justify-content: stretch;
  }

  .proxy-header-actions button {
    flex: 1 1 140px;
  }

  .task-table-actions {
    align-items: stretch;
    flex-direction: column;
    margin-left: 0;
  }

  .pager {
    justify-content: flex-end;
  }

  .toolbar-actions {
    justify-content: stretch;
  }

  .client-entry-box {
    grid-template-columns: 1fr;
    width: 100%;
    margin-left: 0;
  }

  .toolbar-actions button,
  .submit-actions button,
  .config-actions button {
    width: 100%;
  }
}

/* 1.2.4: stable data tables and client billing preference */
body[data-portal="admin"] .client-billing-panel {
  display: none !important;
}

.billing-priority-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: auto;
}

.billing-priority-control label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 66px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.billing-priority-control label:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.billing-priority-control input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--brand);
}

.billing-priority-control span {
  display: grid;
  gap: 3px;
}

.billing-priority-control strong {
  font-size: 14px;
}

.billing-priority-control small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

#tasksView .task-table,
.account-table {
  display: table !important;
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

#tasksView .task-table {
  min-width: 1040px;
}

#tasksView .task-table .task-col { width: 23%; }
#tasksView .task-table .owner-col { width: 12%; }
#tasksView .task-table .status-col { width: 11%; }
#tasksView .task-table .result-col { width: 26%; }
#tasksView .task-table .video-col { width: 10%; }
#tasksView .task-table .action-col { width: 18%; }

#tasksView .task-table th,
#tasksView .task-table td,
.account-table th,
.account-table td {
  box-sizing: border-box;
  vertical-align: middle;
}

#tasksView .task-table th,
#tasksView .task-table td {
  padding: 12px;
}

#tasksView .task-table th:nth-child(2),
#tasksView .task-table td:nth-child(2),
#tasksView .task-table th:nth-child(3),
#tasksView .task-table td:nth-child(3),
#tasksView .task-table th:nth-child(5),
#tasksView .task-table td:nth-child(5),
#tasksView .task-table th:nth-child(6),
#tasksView .task-table td:nth-child(6) {
  text-align: center;
}

#tasksView .task-table th:nth-child(1),
#tasksView .task-table td:nth-child(1),
#tasksView .task-table th:nth-child(4),
#tasksView .task-table td:nth-child(4) {
  text-align: left;
}

/* Final control polish for operational views. */

#feedbackModal .feedback-modal-panel {
  width: min(calc(100vw - 40px), 720px);
  padding: 28px 30px;
  gap: 18px;
  border-radius: 8px;
}

#feedbackModal .modal-header {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

#feedbackModal #feedbackContent {
  min-height: 220px;
  resize: vertical;
}

#feedbackModal .modal-actions {
  padding-top: 4px;
}

.announcement-level-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.announcement-level-picker button {
  display: grid;
  gap: 4px;
  min-height: 68px;
  padding: 10px 12px;
  color: var(--ink);
  background: #f7f9fa;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: left;
}

.announcement-level-picker button:hover {
  border-color: #9fc7c2;
  background: #f2f8f7;
}

.announcement-level-picker button.active {
  color: #075e57;
  background: #e8f5f3;
  border-color: #4d9b92;
  box-shadow: inset 0 0 0 1px #4d9b92;
}

.announcement-level-picker strong {
  font-size: 14px;
}

.announcement-level-picker small {
  color: var(--muted);
  font-size: 11px;
}

.node-selection-panel .node-controls {
  grid-template-columns: repeat(3, minmax(180px, 1fr)) auto;
  gap: 14px;
  padding: 18px;
  background: #f7f9fa;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: none;
}

.node-selection-panel .node-controls .field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.node-selection-panel .node-controls .field > span {
  color: #34434b;
  font-size: 12px;
  font-weight: 700;
}

.node-selection-panel .node-controls select {
  width: 100%;
  height: 40px;
  padding: 0 34px 0 11px;
  color: var(--ink);
  background-color: #fff;
  border: 1px solid #c7d3d9;
  border-radius: 6px;
}

.node-selection-panel #proxyNodesState {
  align-self: end;
  min-width: 132px;
  min-height: 40px;
  justify-content: center;
  white-space: normal;
  text-align: center;
}

@media (max-width: 900px) {
  .announcement-level-picker,
  .node-selection-panel .node-controls {
    grid-template-columns: 1fr;
  }

  .node-selection-panel #proxyNodesState {
    justify-self: stretch;
  }
}

/* Stable consumption ledger rows */
.ledger-table-wrap {
  overflow-x: auto;
}

.ledger-table {
  width: 100%;
  min-width: 880px;
  table-layout: fixed;
}

.ledger-table .ledger-time-col { width: 15%; }
.ledger-table .ledger-type-col { width: 11%; }
.ledger-table .ledger-detail-col { width: 33%; }
.ledger-table .ledger-points-col { width: 11%; }
.ledger-table .ledger-quota-col { width: 14%; }
.ledger-table .ledger-balance-col { width: 16%; }

.ledger-table th,
.ledger-table td {
  box-sizing: border-box;
  padding: 12px;
  vertical-align: middle;
}

.ledger-table tbody tr,
.ledger-table tbody td {
  height: 108px;
}

.ledger-description {
  display: grid;
  align-content: center;
  gap: 5px;
  width: 100%;
  min-width: 0;
  height: 76px;
  overflow: hidden;
}

.ledger-description > strong,
.ledger-description > small {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger-description > small {
  color: var(--muted);
}

.ledger-task-id {
  display: block;
  width: 100%;
  color: #344054;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}

.ledger-amount {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 28px;
  border-radius: 4px;
  background: #f4f6f8;
}

.ledger-amount.neutral {
  color: var(--muted);
}

.ledger-balance {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.ledger-balance span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ledger-balance strong {
  color: var(--ink);
  font-size: 13px;
}

.ledger-balance {
  width: fit-content;
  gap: 4px;
}

.ledger-balance span {
  display: grid;
  grid-template-columns: 48px max-content;
  justify-content: start;
  column-gap: 10px;
}

#tasksView .task-status-stack,
#tasksView .url-cell {
  align-items: center;
  justify-items: center;
}

#tasksView .row-actions {
  align-items: center;
}

.account-table {
  min-width: 880px;
}

.account-table thead { display: table-header-group !important; }
.account-table tbody { display: table-row-group !important; }
.account-table tr { display: table-row !important; }
.account-table colgroup { display: table-column-group !important; }
.account-table th,
.account-table td { display: table-cell !important; padding: 13px 12px; }

.account-table .account-name-col { width: 22%; }
.account-table .account-status-col { width: 10%; }
.account-table .account-quota-col { width: 14%; }
.account-table .account-task-col { width: 18%; }
.account-table .account-time-col { width: 16%; }
.account-table .account-action-col { width: 20%; }

.account-table th:nth-child(n + 2),
.account-table td:nth-child(n + 2) {
  text-align: center;
}

.account-table .account-card-label {
  display: none;
}

.account-table .account-quota-cell,
.account-table .account-name-cell {
  justify-items: center;
}

.account-table td:first-child .account-name-cell {
  justify-items: start;
}

.account-table .quota-row-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-content: stretch;
  gap: 6px;
}

.account-table .quota-row-actions button {
  width: 100%;
  min-width: 0;
}

@media (max-width: 640px) {
  .billing-priority-control {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .node-controls {
    grid-template-columns: 1fr;
  }

  .node-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }
  .accounts-panel {
    padding: 14px;
  }

  .account-toolbar-actions,
  .account-platform-filter,
  .account-status-counts,
  .account-task-search,
  .quota-reset-countdown,
  .account-toolbar-actions .secondary-button {
    width: 100%;
  }

  .account-platform-filter {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .account-platform-count {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .account-status-counts span {
    flex: 1;
    justify-content: center;
  }

  .modal-backdrop {
    padding: 8px;
  }

  .modal-panel.settings-model-modal,
  .modal-panel.package-modal {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    max-height: calc(100vh - 16px);
    border-radius: 16px;
  }

  .model-modal-header,
  .model-config-list,
  .model-modal-actions,
  .package-modal {
    padding-left: 14px;
    padding-right: 14px;
  }

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

  .login-panel {
    padding: 20px;
  }

  .login-actions {
    grid-template-columns: 1fr;
  }

  .settings-stack,
  .admin-password-form,
  .purchase-options {
    grid-template-columns: 1fr;
  }

  .package-create-form,
  .package-item-fields {
    grid-template-columns: 1fr;
  }

  .list-footer,
  .package-item-actions,
  .model-modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .model-modal-actions span {
    margin-right: 0;
  }

  .points-bonus-notice {
    align-items: flex-start;
    flex-direction: column;
  }

  .token-strip {
    grid-template-columns: 1fr;
  }

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

  .composer-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .composer-main {
    padding: 18px 16px;
  }

  .composer-main textarea {
    min-height: 220px;
  }

  .composer-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .composer-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .composer-select {
    grid-column: 1 / -1;
  }

  .composer-select select,
  .reference-button,
  .ratio-trigger {
    width: 100%;
  }

  .submit-arrow-button {
    align-self: flex-end;
  }

  .page-header-meta {
    display: none;
  }

  .settings-intro,
  .settings-stack .config-panel,
  .dashboard-hero {
    padding: 20px;
  }

  .primary-button,
  .secondary-button,
  .danger-button,
  .icon-button {
    width: 100%;
  }
}

/* Feedback uses a compact five-column layout instead of the wide user table contract. */
.users-table.message-table {
  width: 100%;
  min-width: 900px;
  table-layout: fixed;
}

.message-table th:nth-child(1) { width: 15%; }
.message-table th:nth-child(2) { width: 12%; }
.message-table th:nth-child(3) { width: 24%; }
.message-table th:nth-child(4) { width: 31%; }
.message-table th:nth-child(5) { width: 18%; }

/* Operational views added in 1.1: compact, neutral, and consistent. */
body {
  background: #f3f5f7;
}

body[data-portal="client"] #pointCardsNavItem,
body[data-portal="client"] #point-cardsView,
body[data-portal="client"] #membershipConfigPanel,
body[data-portal="admin"] #transactionsNavItem,
body[data-portal="admin"] #transactionsView {
  display: none !important;
}

.segmented-control {
  grid-template-columns: repeat(3, minmax(88px, 1fr));
}

.settings-stack {
  align-items: stretch;
}

.settings-stack .config-panel {
  display: flex;
  min-height: 210px;
  flex-direction: column;
  padding: 20px;
  border-radius: 8px;
  box-shadow: none;
}

.settings-stack .settings-featured {
  grid-column: auto;
}

.settings-card-value {
  margin-top: auto;
}

.settings-icon {
  border-radius: 6px;
}

.settings-state {
  border-radius: 6px;
}

.version-values {
  align-items: end;
}

.commerce-grid,
.card-code-layout,
.message-admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  gap: 16px;
  align-items: start;
}

.purchase-panel {
  max-width: none;
  margin: 0;
  padding: 24px;
}

.section-heading,
.membership-price,
.generated-codes > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-heading h2,
.redeem-panel h2 {
  margin: 5px 0 0;
}

.purchase-balance {
  margin: 0;
}

.purchase-balance strong {
  font-size: 38px;
}

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

.purchase-options button {
  min-height: 96px;
  border-radius: 8px;
  cursor: pointer;
}

.redeem-panel,
.card-generator,
.card-history,
.catalog-panel,
.ledger-panel {
  padding: 24px;
}

.redeem-panel,
.card-generator {
  display: grid;
  gap: 18px;
}

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

.membership-item {
  display: flex;
  min-height: 180px;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.membership-item h3,
.membership-item p {
  margin: 6px 0 0;
}

.membership-item p,
.membership-item span {
  color: var(--muted);
}

.membership-price strong {
  font-size: 24px;
}

.membership-benefits {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.membership-benefits span,
.card-type-chip {
  padding: 5px 8px;
  color: #08756b;
  background: #dcf8f2;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.ledger-amount.credit { color: var(--ok); }
.ledger-amount.debit { color: var(--danger); }

.card-code-layout {
  grid-template-columns: minmax(320px, .62fr) minmax(0, 1.38fr);
}

.point-card-workspace {
  padding: 0;
  overflow: hidden;
}

.point-card-toolbar,
.point-card-filters,
.point-card-actions,
.user-search-toolbar,
.announcement-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.point-card-toolbar {
  justify-content: space-between;
  padding: 18px;
  background: #eef8f8;
  border-bottom: 1px solid var(--line);
}

.point-card-filters {
  flex: 1;
}

.point-card-filters input {
  width: min(320px, 40vw);
}

.point-card-filters select {
  width: 150px;
}

.point-card-actions button {
  white-space: nowrap;
}

.point-card-table-wrap {
  max-height: calc(100vh - 260px);
  margin: 0 18px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.point-card-table {
  min-width: 1000px;
}

.point-card-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.point-card-workspace > .list-footer {
  padding: 14px 18px 18px;
}

.point-card-modal-panel {
  width: min(100%, 620px);
  padding: 24px;
  border-radius: 8px;
}

.point-card-modal-panel .modal-header > div {
  display: grid;
  gap: 4px;
}

.point-card-modal-panel .modal-header h2,
.point-card-modal-panel .modal-header p {
  margin: 0;
}

.point-card-modal-panel .modal-header p {
  color: var(--muted);
}

.user-search-toolbar {
  margin-bottom: 16px;
}

.user-search-toolbar input {
  width: min(420px, 55vw);
}

.small-announcement {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 4500;
  width: min(380px, calc(100vw - 32px));
  padding: 18px;
  color: #111827;
  background: #fff;
  border: 1px solid #b9d7d2;
  border-left: 5px solid #0f8f83;
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .2);
}

.small-announcement > div {
  display: grid;
  gap: 4px;
}

.small-announcement span {
  color: #08756b;
  font-size: 11px;
  font-weight: 800;
}

.small-announcement p {
  margin: 10px 0 0;
  line-height: 1.6;
  white-space: pre-wrap;
}

.emergency-announcement {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  padding: 32px;
  place-items: center;
  color: #fff;
  background: #15181d;
}

.emergency-announcement-inner {
  width: min(760px, 100%);
  text-align: center;
}

.emergency-label {
  display: inline-block;
  padding: 6px 10px;
  color: #fff;
  background: #c62828;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 900;
}

.emergency-announcement h1 {
  margin: 22px 0 16px;
  font-size: 36px;
}

.emergency-announcement-inner > div {
  color: #d9dee5;
  font-size: 16px;
  line-height: 1.9;
  white-space: pre-wrap;
}

.emergency-announcement button {
  width: auto;
  min-width: 180px;
  margin-top: 28px;
}

.emergency-lock-note {
  margin-top: 24px;
  color: #f6caca;
}

body.announcement-locked {
  overflow: hidden;
}

.announcement-lock-field {
  padding: 12px;
  background: var(--danger-soft);
  border: 1px solid #f4b8b8;
  border-radius: 8px;
}

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

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

.generated-codes {
  display: grid;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.generated-codes pre {
  max-height: 260px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  background: #f5f7f9;
  border: 1px solid var(--line);
  border-radius: 6px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.announcement-modal-panel {
  width: min(100%, 620px);
  padding: 24px;
  border-radius: 8px;
}

.announcement-modal-content {
  max-height: 50vh;
  overflow: auto;
  color: #26323d;
  font-size: 15px;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.membership-create-form {
  grid-template-columns: 1.4fr repeat(3, minmax(100px, .65fr)) auto;
}

.membership-item-fields {
  grid-template-columns: 1.3fr repeat(5, minmax(70px, .7fr));
}

@media (max-width: 1100px) {
  .commerce-grid,
  .card-code-layout,
  .message-admin-grid {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 700px) {
  .settings-stack,
  .membership-grid,
  .purchase-options,
  .compact-form-grid {
    grid-template-columns: 1fr;
  }

  .membership-create-form,
  .membership-item-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .package-item,
  .package-item-fields,
  .package-item-fields .field,
  .package-item-fields input {
    min-width: 0;
    width: 100%;
  }

  .settings-stack .config-panel {
    min-height: 0;
  }

  .field-wide {
    grid-column: auto;
  }

  .section-heading,
  .version-values {
    align-items: stretch;
    flex-direction: column;
  }

  .segmented-control {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .client-token-card {
    align-items: stretch;
    flex-direction: column;
  }

  .token-display {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .token-display input {
    grid-column: 1 / -1;
  }

  .point-card-filters,
  .point-card-actions,
  .user-search-toolbar,
  .announcement-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .point-card-filters input,
  .point-card-filters select,
  .user-search-toolbar input {
    width: 100%;
  }

  .small-announcement {
    right: 16px;
    bottom: 16px;
  }

  .emergency-announcement {
    padding: 22px;
  }

  .emergency-announcement h1 {
    font-size: 28px;
  }
}

/* Stable operational task table */
#tasksView .panel {
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: none;
}

#tasksView .table-tools {
  display: grid;
  grid-template-columns: auto minmax(260px, 420px);
  align-items: end;
  justify-content: space-between;
  gap: 12px 18px;
  padding: 16px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

#tasksView .task-stats-strip {
  flex-wrap: nowrap;
}

#tasksView .task-table-actions {
  grid-column: 1 / -1;
  width: 100%;
  margin-left: 0;
  justify-content: space-between;
}

#tasksView .task-stat-pill {
  min-height: 36px;
  padding: 6px 10px;
  background: #f7f9fa;
  border-color: var(--line);
  border-radius: 4px;
}

#tasksView .table-wrap {
  max-height: calc(100vh - 245px);
  margin: 0;
  overflow: auto;
  border: 0;
  border-radius: 0;
  scrollbar-gutter: stable both-edges;
}

#tasksView .task-table {
  min-width: 900px;
}

#tasksView .task-table .task-col { width: 21%; }
#tasksView .task-table .owner-col { width: 9%; }
#tasksView .task-table .status-col { width: 10%; }
#tasksView .task-table .result-col { width: 26%; }
#tasksView .task-table .video-col { width: 10%; }
#tasksView .task-table .action-col { width: 24%; }

#tasksView .task-table th {
  height: 42px;
  padding: 0 12px;
  background: #f6f8f9;
  text-transform: none;
  letter-spacing: 0;
}

#tasksView .task-table td {
  height: 104px;
  vertical-align: middle;
  background: #fff;
}

#tasksView .task-table th:nth-child(4),
#tasksView .task-table td:nth-child(4) {
  text-align: left;
}

#tasksView .chip {
  min-height: 26px;
  padding: 0 9px;
  border-radius: 4px;
  font-weight: 700;
}

#tasksView .result-text-button {
  min-height: 50px;
  padding: 8px 10px;
  background: #f7f9fa;
  border-radius: 4px;
}

#tasksView .row-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

#tasksView .task-table .row-actions .icon-button,
#tasksView .task-table .row-actions .danger-button {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  padding: 0 6px;
  border-radius: 4px;
  white-space: nowrap;
}

#tasksView #taskTableBody[aria-busy="true"] {
  opacity: .72;
}

@media (prefers-reduced-motion: no-preference) {
  #tasksView #taskTableBody {
    transition: opacity 120ms ease;
  }
}

@media (max-width: 700px) {
  #tasksView .table-tools {
    grid-template-columns: 1fr;
  }

  #tasksView .task-table-actions {
    grid-column: 1;
  }
}

/* Final cascade for the compact 1.2.1 application layout. */
.panel,
.metric-card,
.submit-composer,
.settings-stack .config-panel,
.node-controls,
.proxy-node-card,
.package-item,
.modal-panel.package-modal,
.modal-panel.settings-model-modal,
.security-modal {
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.045);
}

.primary-button,
.secondary-button,
.danger-button,
.text-button,
.icon-button,
input,
select,
textarea {
  border-radius: 6px;
}

.primary-button { box-shadow: none; }

.sidebar {
  gap: 18px;
  padding: 22px 16px;
  background: #171a1f;
  backdrop-filter: none;
}

.brand {
  min-height: auto;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 0 10px;
}

.brand-mark { box-shadow: none; }
.sidebar-client-identity {
  display: grid;
  min-width: 0;
  width: 100%;
  gap: 4px;
}

.sidebar-client-identity strong {
  overflow: hidden;
  color: #fff;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-client-identity span {
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  padding: 3px 7px;
  color: #b9dcd7;
  background: rgba(15, 118, 110, 0.18);
  border: 1px solid rgba(94, 184, 174, 0.24);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body[data-portal="admin"] .sidebar-client-identity { display: none; }

.nav {
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}

.nav::-webkit-scrollbar { width: 0; height: 0; }

.nav-item {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 6px;
}

.nav-item:hover { transform: none; }
.nav-item:hover,
.nav-item.active {
  color: #fff;
  background: #252a31;
  border-color: #343a43;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #4da59d;
  outline-offset: 2px;
}

.sidebar-version {
  display: flex;
  justify-content: space-between;
  padding: 0 12px;
  font-weight: 500;
}

.sidebar-version strong { color: #d7dbe1; font-weight: 700; }

.sidebar-status {
  padding: 10px 12px;
  border-radius: 6px;
  background: #1e2228;
}

.main { padding: 22px clamp(20px, 2.7vw, 40px) 36px; }
.page-header { min-height: 64px; margin-bottom: 20px; padding-bottom: 14px; }
.page-header h1 { font-size: 24px; letter-spacing: 0; }

.page-header-meta,
.settings-state,
.chip,
.balance-cost { border-radius: 6px; }
.balance-cost { max-width: min(56%, 420px); line-height: 1.4; overflow-wrap: anywhere; text-align: right; white-space: normal; }

.dashboard-hero,
.node-selection-panel,
.package-create-form,
.model-modal-header {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.dashboard-hero { border-radius: 8px; box-shadow: none; }
.dashboard-hero h2 { font-size: 20px; line-height: 1.3; }

.commerce-header,
.point-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.commerce-header {
  margin-bottom: 14px;
  padding: 2px 2px 14px;
  border-bottom: 1px solid var(--line);
}

body[data-portal="client"][data-view="points"] .commerce-header {
  padding-top: 0;
}

.commerce-header h2,
.commerce-header p,
.point-card-header h2,
.point-card-header p,
.section-heading h2,
.section-heading p { margin: 0; }

.commerce-header p,
.point-card-header p,
.section-heading p {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.5;
}
.commerce-grid { grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; }
.purchase-panel,
.redeem-panel { padding: 20px; }

.purchase-balance {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  text-align: right;
}

.purchase-balance strong { color: var(--ink); font-size: 30px; line-height: 1; }
.purchase-balance span { color: var(--muted); font-size: 12px; }
.commerce-actions { display: flex; align-items: center; justify-content: flex-end; gap: 16px; }
.purchase-options { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 18px 0 0; }

.purchase-options button.purchase-package {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: start;
  align-items: start;
  gap: 8px 14px;
  min-height: 126px;
  padding: 16px;
  color: var(--ink);
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 600;
}

.purchase-options button.purchase-package strong {
  grid-column: 1 / -1;
  color: var(--ink);
  font-size: 28px;
  letter-spacing: 0;
}

.purchase-options button.purchase-package:hover { background: #f8fafb; border-color: #96aaa8; }
.purchase-package-name { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.purchase-options button.purchase-package strong small { margin-left: 4px; color: var(--muted); font-size: 12px; font-weight: 600; }
.purchase-package-meta { color: var(--muted); font-size: 12px; }
.purchase-package-action { justify-self: end; color: var(--brand-dark); font-size: 12px; font-weight: 700; }

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

.membership-item-highest {
  border-color: #8ba7a3;
}

.membership-details-modal {
  width: min(100%, 680px);
}

.membership-details-list {
  display: grid;
  gap: 10px;
  max-height: 56vh;
  padding: 20px 24px;
  overflow-y: auto;
}

.membership-detail-row {
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.membership-detail-row > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.membership-detail-row dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 14px 0 0;
}

.membership-detail-row dl div { min-width: 0; }
.membership-detail-row dt { margin-bottom: 4px; color: var(--muted); font-size: 11px; }
.membership-detail-row dd { margin: 0; overflow-wrap: anywhere; font-size: 13px; }

.redeem-panel { align-content: start; }
.redeem-heading { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.section-index { color: var(--brand-dark); font-size: 11px; font-weight: 700; }

.redeem-modal-panel {
  width: min(100%, 760px);
  max-height: min(86vh, 720px);
  overflow: hidden;
}

.redeem-modal-content {
  display: grid;
  gap: 22px;
  min-height: 0;
}

.redeem-dialog-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.purchase-history-section {
  min-height: 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.purchase-history-header,
.purchase-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.purchase-history-header { margin-bottom: 10px; }
.purchase-history-header h3 { margin: 0; font-size: 15px; }
.purchase-history-list { display: grid; gap: 0; max-height: 330px; overflow-y: auto; }
.purchase-history-row { min-height: 64px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.purchase-history-row:last-child { border-bottom: 0; }
.purchase-history-row > div { display: grid; gap: 4px; min-width: 0; }
.purchase-history-row span { color: var(--muted); font-size: 12px; }
.purchase-history-amount { flex: 0 0 auto; text-align: right; }
.purchase-history-amount strong { color: var(--ok); font-size: 16px; }

.point-card-workspace { padding: 0; border-radius: 8px; }
.point-card-header { padding: 20px; border-bottom: 1px solid var(--line); }
.point-card-header-meta { display: flex; align-items: center; gap: 14px; }
.point-card-header-meta span { color: var(--muted); font-size: 12px; }
.point-card-toolbar { padding: 12px 20px; background: #f7f9fa; }
.point-card-table-wrap { max-height: calc(100vh - 290px); margin: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.point-card-table { min-width: 820px; table-layout: fixed; }
.point-card-table th:nth-child(1) { width: 120px; }
.point-card-table th:nth-child(2) { width: 92px; }
.point-card-table th:nth-child(3) { width: 90px; }
.point-card-table th:nth-child(4) { width: 92px; }
.point-card-table th:nth-child(5) { width: 130px; }
.point-card-table th:nth-child(6) { width: 132px; }
.point-card-table th:nth-child(7) { width: 96px; }
.point-card-table th:nth-child(8) { width: auto; }
.point-card-table td code { white-space: nowrap; }
.point-card-table th { background: #f7f9fa; }
.card-type-chip { display: inline-block; color: #285b57; background: #e7f4f2; border-radius: 4px; white-space: nowrap; }
.point-card-table .chip.failed { color: #9b1c1c; background: #feecec; border-color: #f5c2c2; box-shadow: none; }

.ledger-description { display: grid; gap: 4px; min-width: 220px; }
.ledger-description small { color: var(--muted); }
.ledger-task-id { width: 100%; max-width: 100%; overflow: visible; color: #344054; font-size: 12px; overflow-wrap: anywhere; text-overflow: clip; white-space: normal; }

.announcement-modal-panel { width: min(100%, 560px); padding: 0; overflow: hidden; border-radius: 8px; }
.announcement-modal-accent { height: 4px; background: var(--brand); }
.announcement-modal-panel .modal-header { padding: 22px 24px 18px; border-bottom: 1px solid var(--line); }
.announcement-modal-panel .modal-header h2 { margin-top: 6px; font-size: 22px; }
.announcement-modal-content { max-height: 52vh; min-height: 130px; padding: 22px 24px; font-size: 14px; line-height: 1.8; }
.announcement-modal-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; background: #f7f9fa; border-top: 1px solid var(--line); }
.announcement-modal-footer span { color: var(--muted); font-size: 12px; }
.small-announcement { padding: 0; overflow: hidden; border: 1px solid var(--line-strong); border-left: 4px solid var(--brand); border-radius: 6px; }
.small-announcement-head,
.small-announcement p { padding-left: 16px; padding-right: 16px; }
.small-announcement-head { padding-top: 15px; }
.small-announcement p { margin: 8px 0 14px; }
.small-announcement-progress { height: 3px; background: var(--brand); transform-origin: left; animation: announcement-countdown 8s linear forwards; }
.emergency-announcement { background: #16191d; }
.emergency-announcement-inner { position: relative; padding-top: 28px; }
.emergency-rule { position: absolute; top: 0; left: 50%; width: 48px; height: 3px; background: #d14343; transform: translateX(-50%); }
.emergency-label { border-radius: 4px; }

@keyframes announcement-countdown {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .small-announcement-progress { animation: none; }
}

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

@media (max-width: 700px) {
  .purchase-options { grid-template-columns: 1fr; }
  .commerce-header,
  .point-card-header,
  .point-card-header-meta { align-items: stretch; flex-direction: column; }
  .purchase-balance { justify-content: start; text-align: left; }
  .membership-current { align-items: flex-end; flex-direction: column; }
  .membership-detail-row dl { grid-template-columns: 1fr; gap: 10px; }
  .submit-balance { flex-wrap: wrap; }
  .balance-cost { width: 100%; max-width: none; margin-left: 0; text-align: left; }
}

/* 1.2.4 workspace refinements */
.home-account-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.home-points-card,
.home-account-row .client-token-card {
  min-height: 116px;
  margin: 0;
  padding: 20px 22px;
  border-radius: 8px;
  box-shadow: none;
}

.home-points-card {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
}

.home-points-card > div,
.home-account-row .client-token-card > div:first-child {
  display: grid;
  gap: 6px;
}

.home-points-card span,
.home-account-row .client-token-card > div:first-child span {
  color: var(--muted);
  font-size: 12px;
}

.home-points-card strong {
  color: var(--ink);
  font-size: 32px;
  line-height: 1;
}

.home-account-row .client-token-card > div:first-child strong { font-size: 16px; }
.home-account-row .token-display { width: min(440px, 70%); }
body[data-portal="admin"] .home-account-row { display: none; }

body[data-portal="client"] .metric-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

body[data-portal="client"] .metric-card {
  min-height: 116px;
  padding: 18px 20px;
  border-radius: 8px;
  box-shadow: none;
}

.sidebar-client-identity span {
  width: 100%;
  line-height: 1.45;
  white-space: normal;
}

.prompt-picker-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(720px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 40px));
  padding: 0;
  overflow: hidden;
  border-radius: 8px;
}

.prompt-picker-modal .modal-header { padding: 22px 24px 18px; border-bottom: 1px solid var(--line); }

.prompt-picker-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 260px;
  padding: 16px 20px;
  overflow-y: auto;
}

.prompt-picker-item {
  display: grid;
  gap: 5px;
  min-height: 64px;
  padding: 12px 14px;
  color: var(--ink);
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.prompt-picker-item:hover { background: #f6f8f8; border-color: #96aaa8; }
.prompt-picker-item strong { font-size: 13px; }
.prompt-picker-item span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-picker-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: #f7f9fa;
  border-top: 1px solid var(--line);
}

.prompt-picker-footer span {
  flex: 1 1 auto;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.message-workspace { margin-top: 18px; }

.message-toolbar {
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.message-refresh { display: flex; align-items: center; gap: 10px; }
.message-refresh span { min-width: 112px; color: var(--muted); font-size: 12px; text-align: right; }

.message-feedback-panel { padding: 0; overflow: hidden; }
.message-feedback-panel > .panel-header { padding: 20px 22px; border-bottom: 1px solid var(--line); }
.message-feedback-panel .table-wrap { margin: 0; border: 0; border-radius: 0; }
.message-feedback-panel .message-table { min-width: 1060px; table-layout: fixed; }
.message-feedback-panel .message-table th:nth-child(1) { width: 142px; }
.message-feedback-panel .message-table th:nth-child(2) { width: 96px; }
.message-feedback-panel .message-table th:nth-child(3) { width: 25%; }
.message-feedback-panel .message-table th:nth-child(4) { width: 30%; }
.message-feedback-panel .message-table th:nth-child(5) { width: 124px; }
.message-feedback-panel .message-table th:nth-child(6) { width: 78px; }
.message-feedback-panel .message-table th,
.message-feedback-panel .message-table td { padding: 14px 16px; vertical-align: top; }

.message-admin-grid {
  grid-template-columns: minmax(420px, 0.9fr) minmax(480px, 1.1fr);
  gap: 20px;
}

.notification-compose,
.notification-history { padding: 22px; }
.notification-compose { gap: 18px; }
.notification-compose .panel-header,
.notification-history .panel-header { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.recipient-list { gap: 10px; padding: 0; }
.recipient-option { padding: 12px; background: #fff; }

.notification-history .message-list {
  display: block;
  margin: 0 -22px -22px;
  max-height: 620px;
  border-top: 1px solid var(--line);
}

.admin-message-row {
  display: grid;
  gap: 9px;
  padding: 16px 22px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.admin-message-row:last-child { border-bottom: 0; }
.admin-message-row p { margin: 0; color: #3e4b53; line-height: 1.65; white-space: pre-wrap; }
.admin-message-row small { color: var(--muted); }
.message-row-actions,
.announcement-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

.point-card-table { min-width: 1040px; }
.point-card-table th:nth-child(1) { width: 278px; }
.point-card-table th:nth-child(8) { width: 150px; }
.point-card-table th,
.point-card-table td { padding: 14px 16px; }

.point-card-code {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.point-card-code code {
  flex: 1 1 auto;
  color: #25323a;
  font-size: 12px;
  letter-spacing: 0;
}

.point-card-code .card-copy-button {
  flex: 0 0 auto;
  min-width: 54px;
}

.point-card-summary { display: grid; gap: 4px; text-align: right; }

@media (max-width: 1100px) {
  .message-admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .home-account-row { grid-template-columns: 1fr; gap: 14px; }
  .home-points-card { align-items: stretch; }
  .home-points-card > div { grid-template-columns: auto 1fr; align-items: baseline; }
  .home-points-card span { white-space: nowrap; }
  .home-account-row .client-token-card { align-items: stretch; flex-direction: column; }
  .home-account-row .token-display { width: 100%; }
  .prompt-picker-footer { flex-wrap: wrap; }
  .prompt-picker-footer span { order: -1; flex-basis: 100%; }
  body[data-portal="client"] .metric-grid { grid-template-columns: 1fr 1fr; }
  .message-refresh span { display: none; }
}

@media (max-width: 480px) {
  body[data-portal="client"] .metric-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .sidebar {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px 12px;
    padding: 10px 12px 8px;
    overflow: hidden;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
    flex-direction: row;
    align-items: center;
    align-self: center;
    gap: 8px;
    padding: 0;
  }

  .brand-mark {
    flex: 0 0 auto;
  }

  .sidebar-client-identity {
    width: min(120px, 30vw);
  }

  .nav {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    min-width: 0;
    padding: 0 0 4px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
  }

  .nav-item {
    flex: 0 0 auto;
    min-width: 92px;
    width: auto;
    padding: 0 12px;
    scroll-snap-align: start;
    white-space: nowrap;
  }

  .sidebar-footer {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
    margin: 0;
  }

  .sidebar-version,
  .sidebar-status {
    min-height: 32px;
    padding: 6px 8px;
    font-size: 11px;
    white-space: nowrap;
  }

  .sidebar-status {
    display: flex;
  }

  .main {
    padding-top: 14px;
  }
}

/* Keep task columns identical in both portals after all responsive cascades. */
#tasksView .task-table {
  display: table !important;
  width: 100%;
  min-width: 1040px;
  table-layout: fixed;
}

#tasksView .task-table .task-col { width: 25%; }
#tasksView .task-table .owner-col { width: 10%; }
#tasksView .task-table .status-col { width: 10%; }
#tasksView .task-table .result-col { width: 24%; }
#tasksView .task-table .video-col { width: 10%; }
#tasksView .task-table .action-col { width: 21%; }

#tasksView .task-table th,
#tasksView .task-table td {
  box-sizing: border-box;
  height: 96px;
  padding: 12px 14px;
  vertical-align: middle;
}

#tasksView .task-table th {
  height: 44px;
}

#tasksView .table-wrap {
  scrollbar-gutter: stable;
}

#tasksView .task-id,
#tasksView .task-prompt-row,
#tasksView .result-text-button,
#tasksView .task-status-stack,
#tasksView .url-cell {
  width: 100%;
}

#tasksView .task-prompt-row {
  grid-template-columns: minmax(0, 1fr) 48px;
}

#tasksView .task-copy-prompt {
  width: 48px;
}

#tasksView .row-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(64px, 1fr));
  width: 100%;
  max-width: 260px;
  margin: 0 auto;
}

#tasksView .task-table th:nth-child(2),
#tasksView .task-table td:nth-child(2),
#tasksView .task-table th:nth-child(3),
#tasksView .task-table td:nth-child(3),
#tasksView .task-table th:nth-child(5),
#tasksView .task-table td:nth-child(5),
#tasksView .task-table th:nth-child(6),
#tasksView .task-table td:nth-child(6) {
  text-align: center;
}

#tasksView .task-table th:nth-child(1),
#tasksView .task-table td:nth-child(1),
#tasksView .task-table th:nth-child(4),
#tasksView .task-table td:nth-child(4) {
  text-align: left;
}

/* Keep ledger financial columns stable after the legacy layout rules. */
.ledger-table .ledger-time-col { width: 14%; }
.ledger-table .ledger-type-col { width: 10%; }
.ledger-table .ledger-detail-col { width: 28%; }
.ledger-table .ledger-points-col { width: 13%; }
.ledger-table .ledger-quota-col { width: 16%; }
.ledger-table .ledger-balance-col { width: 19%; }

/* 1.3.0: use the shared page title and keep panel controls in a compact action row. */
.panel-action-header {
  min-height: 38px;
  margin-bottom: 16px;
  align-items: center;
  justify-content: flex-end;
}

.panel-action-header .toolbar-actions {
  margin-left: auto;
}

.commerce-header h2 {
  font-size: 24px;
  line-height: 1.3;
}

.purchase-panel .purchase-options {
  margin-top: 0;
}

.prompt-manager-header {
  align-items: center;
}

@media (max-width: 700px) {
  .panel-action-header {
    min-height: 36px;
    align-items: stretch;
    flex-direction: row;
  }

  .panel-action-header > button,
  .panel-action-header .toolbar-actions {
    width: auto;
  }

  .commerce-header,
  .commerce-actions,
  .redeem-dialog-form {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .commerce-header,
  .commerce-actions { flex-direction: column; }
  .commerce-actions { width: 100%; }
  .commerce-actions > button { width: 100%; }
  .purchase-balance { align-self: flex-end; }
}

/* 1.3.4 navigation, card management and message workspace refinements. */
.icon-text-button,
.point-card-header-meta > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.icon-text-button svg,
.point-card-header-meta > button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.sidebar-collapse {
  display: grid;
  place-items: center;
  align-self: flex-end;
  width: 34px;
  height: 34px;
  margin: -8px 2px -6px 0;
  padding: 0;
  color: #aeb7c2;
  background: transparent;
  border: 1px solid #343a43;
  border-radius: 6px;
}

.sidebar-collapse:hover {
  color: #fff;
  background: #252a31;
}

.sidebar-collapse svg,
.nav-icon {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

.nav-icon { flex: 0 0 auto; color: #8f99a5; }
.nav-item:hover .nav-icon,
.nav-item.active .nav-icon { color: #69c2b7; }

.sidebar-version {
  align-self: stretch;
  gap: 8px;
  margin-top: -8px;
}

.app-shell,
.sidebar,
.nav-item { transition: grid-template-columns 180ms ease, width 180ms ease, padding 180ms ease; }

@media (min-width: 821px) {
  .app-shell.sidebar-collapsed { grid-template-columns: 76px minmax(0, 1fr); }
  .app-shell.sidebar-collapsed .sidebar { gap: 14px; padding: 22px 10px; }
  .app-shell.sidebar-collapsed .brand { align-items: center; padding: 0; }
  .app-shell.sidebar-collapsed .brand-mark { width: 42px; height: 42px; }
  .app-shell.sidebar-collapsed .sidebar-client-identity,
  .app-shell.sidebar-collapsed .sidebar-version,
  .app-shell.sidebar-collapsed .sidebar-footer { display: none; }
  .app-shell.sidebar-collapsed .sidebar-collapse { align-self: center; margin: 0; }
  .app-shell.sidebar-collapsed .nav { gap: 7px; }
  .app-shell.sidebar-collapsed .nav-item { justify-content: center; min-height: 42px; padding: 0; }
  .app-shell.sidebar-collapsed .nav-item > span { display: none; }
  .app-shell.sidebar-collapsed .nav-count { position: absolute; margin: -25px 0 0 25px; }
}

body[data-portal="client"][data-view="points"] .page-header { display: none; }
body[data-portal="client"][data-view="points"] .commerce-header {
  min-height: 64px;
  margin-bottom: 20px;
  padding: 0 0 14px;
  border: 0;
}
body[data-portal="client"][data-view="points"] .commerce-header h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.3;
}

.point-card-header {
  min-height: 82px;
  padding: 18px 20px;
}

.point-card-header h2 { font-size: 19px; }
.point-card-header p { margin-top: 5px; }
.point-card-summary { gap: 2px; }
.point-card-summary span:last-child { color: #64717a; }

.point-card-toolbar {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 13px 20px;
  background: #f7f9fa;
}

.point-card-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 132px 132px;
  gap: 10px;
}

.point-card-filters input,
.point-card-filters select,
.point-card-delete-controls select {
  min-height: 38px;
  width: 100%;
  color: #26343d;
  background: #fff;
  border: 1px solid #cbd5dc;
}

.point-card-actions,
.point-card-delete-controls,
.point-card-bulkbar,
.table-checkbox {
  display: flex;
  align-items: center;
}

.point-card-actions { gap: 8px; }
.point-card-bulkbar {
  justify-content: space-between;
  gap: 14px;
  min-height: 54px;
  padding: 8px 20px;
  background: #fff;
  border-top: 1px solid var(--line);
}
.point-card-delete-controls { gap: 8px; }
.point-card-delete-controls select { width: 172px; }
.table-checkbox { gap: 8px; color: #4b5963; font-size: 13px; font-weight: 700; cursor: pointer; }
.table-checkbox input,
[data-point-card-select] { width: 16px; height: 16px; accent-color: var(--brand-dark); }

.point-card-table-wrap { max-height: calc(100vh - 350px); }
.point-card-table { min-width: 1120px; }
.point-card-table th:nth-child(1) { width: 52px; }
.point-card-table th:nth-child(2) { width: 286px; }
.point-card-table th:nth-child(3) { width: 104px; }
.point-card-table th:nth-child(4) { width: 104px; }
.point-card-table th:nth-child(5) { width: 100px; }
.point-card-table th:nth-child(6) { width: 150px; }
.point-card-table th:nth-child(7) { width: 164px; }
.point-card-table th:nth-child(8) { width: auto; }
.point-card-check-col { text-align: center !important; }

.point-card-modal-panel .modal-header > div { display: block; }
.point-card-modal-panel .modal-header { padding-bottom: 16px; border-bottom: 1px solid var(--line); }

.message-admin-pane { display: block; }
.notification-compose-wide,
.announcement-compose { width: 100%; padding: 22px 24px; gap: 20px; }
.message-compose-header { align-items: center; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.message-compose-header p { margin-top: 4px; }

.notification-compose-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
  gap: 22px;
  align-items: stretch;
}

.notification-content-fields { display: grid; align-content: start; gap: 16px; }
.notification-content-fields textarea { min-height: 246px; }
.recipient-panel {
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.recipient-panel .recipient-header { min-height: 48px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.recipient-panel .recipient-list { max-height: 252px; padding: 10px; overflow-y: auto; }
.recipient-panel .recipient-option { min-height: 52px; border-radius: 6px; }
.compact-check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; cursor: pointer; }
.message-submit-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 16px; border-top: 1px solid var(--line); }

.announcement-level-picker { gap: 10px; }
.announcement-level-picker button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 76px;
  padding: 12px 14px;
  text-align: left;
  background: #f8fafb;
  border-color: #d6dee3;
  border-radius: 7px;
}
.announcement-level-picker button > svg {
  width: 20px;
  height: 20px;
  color: #65727b;
}
.announcement-level-picker button > span { display: grid; gap: 4px; }
.announcement-level-picker button.active { background: #eef8f6; border-color: #18877d; box-shadow: inset 0 0 0 1px #18877d; }
.announcement-level-picker button.active > svg { color: #13756d; }
.announcement-level-picker button small { color: #6d7880; }

.announcement-content-grid { display: grid; gap: 16px; }
.announcement-content-field textarea { min-height: 156px; }
.announcement-lock-control {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 68px;
  padding: 12px 14px;
  color: #4a3131;
  background: #fff8f7;
  border: 1px solid #eccac6;
  border-radius: 7px;
  cursor: pointer;
}
.announcement-lock-control > input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch-track { position: relative; width: 42px; height: 24px; flex: 0 0 auto; background: #aeb8be; border-radius: 999px; transition: background 160ms ease; }
.switch-track > span { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); transition: transform 160ms ease; }
.announcement-lock-control > input:checked + .switch-track { background: #b6403a; }
.announcement-lock-control > input:checked + .switch-track > span { transform: translateX(18px); }
.announcement-lock-control > input:focus-visible + .switch-track { outline: 2px solid #4da59d; outline-offset: 2px; }
.announcement-lock-copy { display: grid; gap: 3px; }
.announcement-lock-copy strong { color: #782c29; font-size: 13px; }
.announcement-lock-copy small { color: #7a6260; line-height: 1.4; }

.message-history-modal { width: min(100%, 860px); max-height: min(88vh, 760px); overflow: hidden; }
.message-history-list { min-height: 140px; max-height: 520px; margin: 0 -24px; overflow-y: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.message-history-list .admin-message-row { padding: 16px 24px; }
.message-history-list .empty-state { min-height: 180px; }
.message-history-modal > .modal-actions { padding-top: 0; }
.message-history-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.message-history-meta strong { color: #37454e; font-size: 12px; }
.worker-limit-note { margin: -4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

@media (max-width: 1040px) {
  .point-card-toolbar { grid-template-columns: 1fr; }
  .point-card-actions { justify-content: flex-end; }
  .notification-compose-layout { grid-template-columns: 1fr; }
  .recipient-panel .recipient-list { max-height: 220px; }
}

@media (max-width: 1400px) and (min-width: 821px) {
  body[data-portal="admin"] .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .sidebar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
  }
  .brand { grid-column: 1; grid-row: 1; }
  .sidebar-version { grid-column: 2; grid-row: 1; align-self: center; justify-self: end; width: auto; margin: 0; }
  .sidebar-footer { grid-column: 3; grid-row: 1; }
  .sidebar-collapse { display: none; }
  .nav { grid-column: 1 / -1; grid-row: 2; }
  .nav-item { gap: 7px; min-width: 112px; }
  .nav-icon { display: block; width: 16px; height: 16px; }
  .point-card-filters { grid-template-columns: 1fr 1fr; }
  .point-card-filters input { grid-column: 1 / -1; }
  .point-card-bulkbar { align-items: stretch; flex-direction: column; }
  .point-card-delete-controls { justify-content: space-between; }
  .point-card-delete-controls select { flex: 1 1 auto; width: auto; }
}

@media (max-width: 620px) {
  body[data-portal="client"][data-view="points"] .commerce-header {
    min-height: 56px;
    align-items: center;
    flex-direction: row;
    gap: 10px;
  }
  body[data-portal="client"][data-view="points"] .commerce-actions {
    width: auto;
    align-items: center;
    flex-direction: row;
    gap: 10px;
  }
  body[data-portal="client"][data-view="points"] .commerce-actions > button { width: auto; }
  body[data-portal="client"][data-view="points"] .purchase-balance { align-self: auto; }
  .point-card-header,
  .point-card-header-meta,
  .message-compose-header,
  .message-submit-row { align-items: stretch; flex-direction: column; }
  .point-card-header-meta { width: 100%; }
  .point-card-summary { text-align: left; }
  .point-card-actions > button { flex: 1 1 0; }
  .announcement-level-picker { grid-template-columns: 1fr; }
  .message-history-modal { padding: 18px; }
  .message-history-list { margin: 0 -18px; }
}

/* 1.3.5 membership hierarchy, bottom sidebar control and table scrolling. */
.sidebar-version {
  justify-content: flex-start;
  gap: 0;
}

.sidebar-version strong { margin-left: 0; }

.sidebar-client-identity {
  gap: 6px;
  padding: 10px;
  background: #1d2127;
  border: 1px solid #30363e;
  border-radius: 7px;
}

.sidebar-client-identity strong {
  font-size: 16px;
  line-height: 1.25;
}

.sidebar-client-identity span {
  min-height: 24px;
  align-items: center;
  padding: 4px 8px;
  border-radius: 5px;
  line-height: 1.35;
}

.sidebar-footer { gap: 8px; }
.sidebar-footer .sidebar-collapse {
  align-self: stretch;
  width: 100%;
  height: 36px;
  margin: 0;
}

@media (min-width: 821px) {
  .app-shell.sidebar-collapsed .sidebar-footer {
    display: grid;
    gap: 8px;
    margin-top: auto;
  }
  .app-shell.sidebar-collapsed .sidebar-footer .sidebar-collapse { align-self: stretch; }
  .app-shell.sidebar-collapsed .sidebar-status { justify-content: center; padding: 10px 0; }
  .app-shell.sidebar-collapsed #sidebarStatusText { display: none; }
}

body[data-portal="client"][data-view="points"] .commerce-header {
  border-bottom: 1px solid var(--line);
}

.membership-item {
  position: relative;
  border-top: 3px solid var(--membership-accent, #64748b);
  background: var(--membership-surface, #fff);
  box-shadow: 0 5px 16px rgba(15, 23, 42, .035);
}

.membership-item h3 { color: var(--membership-accent, var(--ink)); }
.membership-item .membership-benefits span {
  color: var(--membership-accent, #475569);
  background: var(--membership-soft, #f1f5f9);
}
.membership-item .primary-button {
  background: var(--membership-accent, var(--brand-dark));
  border-color: var(--membership-accent, var(--brand-dark));
}
.membership-tier-1 { --membership-accent: #64748b; --membership-soft: #f1f5f9; --membership-surface: #fff; }
.membership-tier-2 { --membership-accent: #2563a6; --membership-soft: #eaf2fb; --membership-surface: #fbfdff; }
.membership-tier-3 { --membership-accent: #0f766e; --membership-soft: #e5f5f2; --membership-surface: #fbfefd; }
.membership-tier-4 { --membership-accent: #6d4bb8; --membership-soft: #f1edfa; --membership-surface: #fdfcff; }
.membership-tier-5 { --membership-accent: #a16207; --membership-soft: #fff5d9; --membership-surface: #fffefa; }
.membership-tier-6 { --membership-accent: #8a6116; --membership-soft: #f7edcf; --membership-surface: #fffdf7; border-color: #b99a58; box-shadow: 0 8px 24px rgba(96, 65, 10, .1); }
.membership-tier-6 h3,
.membership-tier-6 .membership-price strong { color: #6f4b0d; }

.sidebar-client-identity .membership-tier-1 { color: #d9e2e9; background: #2e3942; border-color: #46545f; }
.sidebar-client-identity .membership-tier-2 { color: #d9ecff; background: #173a5d; border-color: #285f91; }
.sidebar-client-identity .membership-tier-3 { color: #d7fff8; background: #134f4a; border-color: #23776f; }
.sidebar-client-identity .membership-tier-4 { color: #eee6ff; background: #3d2c63; border-color: #6b51a4; }
.sidebar-client-identity .membership-tier-5 { color: #fff0bf; background: #594415; border-color: #937225; }
.sidebar-client-identity .membership-tier-6 { color: #fff1bc; background: #4a350c; border-color: #b18b35; box-shadow: inset 0 0 0 1px rgba(255, 221, 132, .08); }

.video-empty-state {
  display: grid;
  grid-column: 1 / -1;
  width: 100%;
  min-height: 220px;
  padding: 0;
  place-items: center;
}

.account-quota-summary {
  min-width: max-content;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.point-card-delete-controls { flex-wrap: wrap; justify-content: flex-end; }
.point-card-delete-controls .secondary-button { min-height: 38px; }

.table-wrap {
  scrollbar-width: thin;
  scrollbar-color: #c8cdd1 #f5f6f7;
}
.table-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
.table-wrap::-webkit-scrollbar-track { background: #f5f6f7; }
.table-wrap::-webkit-scrollbar-thumb {
  background: #c8cdd1;
  border: 2px solid #f5f6f7;
  border-radius: 8px;
}
.table-wrap::-webkit-scrollbar-thumb:hover { background: #adb4b9; }
.table-wrap::-webkit-scrollbar-corner { background: #f5f6f7; }

@media (min-width: 821px) {
  body[data-view="point-cards"] .main,
  body[data-view="tasks"] .main,
  body[data-view="quota"] .main,
  body[data-view="users"] .main,
  body[data-view="transactions"] .main { overflow: hidden; }

  body[data-view="point-cards"] #point-cardsView.active,
  body[data-view="tasks"] #tasksView.active,
  body[data-view="quota"] #quotaView.active,
  body[data-view="users"] #usersView.active,
  body[data-view="transactions"] #transactionsView.active {
    height: calc(100vh - 142px);
    min-height: 0;
  }

  #point-cardsView.active > .panel,
  #tasksView.active > .panel,
  #quotaView.active > .panel,
  #usersView.active > .panel,
  #transactionsView.active > .panel {
    display: flex;
    height: 100%;
    min-height: 0;
    flex-direction: column;
  }

  #point-cardsView.active .table-wrap,
  #tasksView.active .table-wrap,
  #quotaView.active .table-wrap,
  #usersView.active .table-wrap,
  #transactionsView.active .table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;
    overflow: auto;
    scrollbar-gutter: stable;
  }
}

@media (max-width: 760px) {
  .account-quota-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    min-width: 0;
  }
  .account-quota-summary span { justify-content: center; padding: 0 8px; }
  .point-card-delete-controls { width: 100%; justify-content: stretch; }
  .point-card-delete-controls button { flex: 1 1 130px; }
}

/* 1.4.1 shared ink interface with isolated client entry states. */
.client-entry-home,
.client-ink-canvas,
.client-ink-splatters,
.client-workspace-ink { display: none; }

body[data-portal="client"] .login-screen {
  display: block;
  min-height: 100vh;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: #fff;
}

body[data-portal="client"] .login-light-field { display: none; }

body[data-portal="client"] .client-ink-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

body[data-portal="client"] .client-entry-home {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: block;
  pointer-events: none;
}

body[data-portal="client"] .client-entry-header {
  display: flex;
  height: 82px;
  padding: 18px clamp(20px, 4vw, 64px);
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, .78);
  border: 0;
  backdrop-filter: blur(14px);
}

body[data-portal="client"] .client-entry-logo {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(20, 31, 29, .09);
}

body[data-portal="client"] .client-entry-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

body[data-portal="client"] #returnClientLanding {
  display: none;
  width: auto;
  min-width: 76px;
  min-height: 40px;
  color: #31443f;
  background: rgba(255, 255, 255, .76);
  border-color: rgba(49, 68, 63, .2);
}

body[data-portal="client"] #openClientLogin {
  min-width: 82px;
  min-height: 40px;
  pointer-events: auto;
  color: #fff;
  background: #171b1a;
  border-color: #171b1a;
}

body[data-portal="client"] #loginView:not([data-client-stage="landing"]) #openClientLogin {
  display: none;
}

body[data-portal="client"] #loginView:not([data-client-stage="landing"]) #returnClientLanding {
  display: inline-flex;
}

body[data-portal="client"] .client-entry-copy {
  position: absolute;
  top: 25%;
  left: clamp(56px, 8vw, 154px);
  display: grid;
  gap: 10px;
  max-width: 390px;
  opacity: 0;
  filter: blur(12px);
  transform: translateY(18px);
  animation: clientInkCopyReveal 2.1s cubic-bezier(.16, 1, .3, 1) .45s forwards;
}

body[data-portal="client"] .client-entry-copy span {
  color: transparent;
  background-image: linear-gradient(100deg, #111817 4%, #87908d 42%, #18201e 78%, #66706d 100%);
  background-size: 190% 100%;
  background-position: 100% 50%;
  background-clip: text;
  -webkit-background-clip: text;
  font-size: clamp(26px, 2.45vw, 46px);
  font-weight: 500;
  line-height: 1.25;
  text-shadow: 0 12px 35px rgba(27, 38, 35, .08);
  animation: clientInkTextFlow 7s ease-in-out infinite alternate;
}

body[data-portal="client"] .client-entry-copy span:last-child {
  margin-left: 1.3em;
  animation-delay: -2s;
}

body[data-portal="client"] #loginView:not([data-client-stage="landing"]) .client-entry-copy { display: none; }

@keyframes clientInkCopyReveal {
  to { opacity: 1; filter: none; transform: none; }
}

@keyframes clientInkTextFlow {
  to { background-position: 0 50%; }
}

body[data-portal="client"] .login-panel {
  z-index: 3;
  width: min(calc(100% - 32px), 430px);
  margin: clamp(190px, 30vh, 280px) auto 42px;
  padding: 28px 32px;
  gap: 16px;
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(52, 62, 58, .16);
  border-radius: 18px;
  box-shadow: 0 26px 80px rgba(23, 31, 29, .11);
  backdrop-filter: blur(18px) saturate(112%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(18px);
  transition: opacity 420ms ease, transform 620ms cubic-bezier(.16, 1, .3, 1), visibility 0s linear 620ms;
}

body[data-portal="client"] #loginView[data-client-stage="login"] .login-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  transition-delay: 80ms, 80ms, 0s;
}

body[data-portal="client"] .login-panel.register-mode {
  width: min(calc(100% - 32px), 470px);
  margin: 145px auto 32px;
  padding: 26px 32px;
}

body[data-portal="client"] .login-panel::before,
body[data-portal="client"] .login-brand { display: none; }

body[data-portal="client"] .login-heading { text-align: center; }
body[data-portal="client"] .login-heading h1 {
  margin: 0;
  font-size: 27px;
  font-weight: 650;
  letter-spacing: 0;
}

body[data-portal="client"] .login-panel .field { gap: 7px; }
body[data-portal="client"] .login-panel input,
body[data-portal="client"] .login-panel select {
  min-height: 42px;
  background: rgba(255, 255, 255, .82);
  border-color: rgba(60, 70, 66, .18);
}

body[data-portal="client"] .login-panel input:focus,
body[data-portal="client"] .login-panel select:focus {
  border-color: #5c837b;
  box-shadow: 0 0 0 3px rgba(92, 131, 123, .12);
}

body[data-portal="client"] .login-actions {
  display: block;
}

body[data-portal="client"] #loginButton {
  width: 100%;
  min-height: 42px;
  color: #fff;
  background: #12a594;
  border-color: #12a594;
  box-shadow: 0 9px 22px rgba(18, 165, 148, .18);
}

body[data-portal="client"] #loginState { display: none; }
body[data-portal="client"] #forgotPasswordButton { justify-self: end; padding: 0; color: #ef6575; }
body[data-portal="client"] .login-panel.register-mode .client-login-only { display: none !important; }

body[data-portal="client"] .client-auth-tabs {
  position: absolute;
  right: 0;
  bottom: -48px;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 0;
  background: transparent;
  border: 0;
}

body[data-portal="client"] .client-auth-tabs button {
  width: auto;
  min-height: 0;
  padding: 0;
  color: #ef6575;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-weight: 500;
}

body[data-portal="client"] .client-auth-tabs button:hover {
  color: #d54558;
  background: transparent;
}

body[data-portal="client"] .client-auth-tabs > span { color: #66726d; }

body[data-portal="client"] .login-panel:not(.register-mode) #clientLoginTab,
body[data-portal="client"] .login-panel:not(.register-mode) .client-login-prompt,
body[data-portal="client"] .login-panel.register-mode #clientRegisterTab,
body[data-portal="client"] .login-panel.register-mode .client-register-prompt { display: none; }

body[data-portal="client"] .login-panel:not(.register-mode) #clientRegisterTab,
body[data-portal="client"] .login-panel:not(.register-mode) .client-register-prompt,
body[data-portal="client"] .login-panel.register-mode #clientLoginTab,
body[data-portal="client"] .login-panel.register-mode .client-login-prompt { display: inline; }

body[data-portal="client"] .client-workspace-ink {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

body[data-portal="client"] .app-shell {
  position: relative;
  isolation: isolate;
  background-color: #f8f8f5;
  background-image: radial-gradient(circle at center, rgba(35, 48, 43, .08) 0 1px, transparent 1px);
  background-size: 12px 12px;
}

body[data-portal="client"] .app-shell > .sidebar,
body[data-portal="client"] .app-shell > .main {
  position: relative;
  z-index: 1;
}

body[data-portal="client"] .sidebar {
  color: #26312e;
  background: rgba(250, 250, 247, .88);
  border-right: 1px solid rgba(50, 63, 58, .18);
  backdrop-filter: blur(18px);
}

body[data-portal="client"] .sidebar .brand-mark {
  background: #fff;
  border: 1px solid rgba(53, 65, 61, .16);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(26, 42, 37, .08);
}

body[data-portal="client"] .sidebar-client-identity {
  background: rgba(255, 255, 255, .62);
  border-color: rgba(57, 74, 68, .16);
}

body[data-portal="client"] .sidebar-client-identity strong { color: #1e2926; }
body[data-portal="client"] .sidebar-client-identity span { box-shadow: none; }
body[data-portal="client"] .sidebar-version,
body[data-portal="client"] .sidebar-version strong { color: #6a756f; }

body[data-portal="client"] .nav-item { color: #68736e; border-color: transparent; }
body[data-portal="client"] .nav-item:hover {
  color: #1c2d28;
  background: rgba(55, 89, 79, .07);
  border-color: rgba(55, 89, 79, .08);
}
body[data-portal="client"] .nav-item.active {
  color: #132722;
  background: rgba(55, 89, 79, .1);
  border-color: rgba(55, 89, 79, .13);
  box-shadow: inset 2px 0 #497d73;
}

body[data-portal="client"] .sidebar-status {
  color: #52615b;
  background: rgba(255, 255, 255, .62);
  border: 1px solid rgba(57, 74, 68, .12);
}
body[data-portal="client"] .sidebar-collapse { color: #4f5f59; background: rgba(255, 255, 255, .58); border-color: rgba(57, 74, 68, .16); }
body[data-portal="client"] .sidebar-collapse:hover { color: #173c35; background: rgba(67, 112, 101, .1); }

body[data-portal="client"] .main {
  background: rgba(250, 250, 247, .68);
  backdrop-filter: blur(8px);
}

body[data-portal="client"] .page-header {
  border-bottom-color: rgba(55, 67, 63, .2);
}

body[data-portal="client"] .panel,
body[data-portal="client"] .metric-card,
body[data-portal="client"] .submit-composer,
body[data-portal="client"] .settings-stack .config-panel,
body[data-portal="client"] .package-item {
  background: rgba(255, 255, 255, .76);
  border-color: rgba(54, 68, 63, .17);
  box-shadow: 0 5px 20px rgba(27, 43, 38, .045);
  backdrop-filter: blur(10px);
}

body[data-portal="client"] .metric-card:nth-child(3n + 1) { border-top-color: rgba(59, 118, 105, .58); }
body[data-portal="client"] .metric-card:nth-child(3n + 2) { border-top-color: rgba(166, 126, 45, .52); }
body[data-portal="client"] .metric-card:nth-child(3n) { border-top-color: rgba(151, 70, 58, .42); }

body[data-portal="client"] .primary-button {
  color: #fff;
  background: #18211f;
  border-color: #18211f;
}
body[data-portal="client"] .primary-button:hover { background: #29443e; border-color: #29443e; }
body[data-portal="client"] .secondary-button,
body[data-portal="client"] .icon-button {
  color: #34443f;
  background: rgba(255, 255, 255, .72);
  border-color: rgba(54, 68, 63, .2);
}
body[data-portal="client"] .secondary-button:hover,
body[data-portal="client"] .icon-button:hover { color: #173c35; background: rgba(66, 113, 102, .08); }

.client-ink-splash {
  position: fixed;
  z-index: 10000;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  pointer-events: none;
  background: #17201e;
  filter: blur(1px);
  opacity: .65;
  transform: translate(-50%, -50%) scale(.2);
  animation: clientInkSplash 680ms cubic-bezier(.16, 1, .3, 1) forwards;
}

.client-ink-splash::before,
.client-ink-splash::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: inherit;
}
.client-ink-splash::before { width: 6px; height: 6px; left: -10px; top: 7px; }
.client-ink-splash::after { width: 4px; height: 4px; right: -12px; top: -3px; }

@keyframes clientInkSplash {
  55% { opacity: .4; transform: translate(-50%, -50%) scale(2.8); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(4.7); }
}

.ink-canvas-fallback {
  background: radial-gradient(circle at 50% 50%, rgba(28, 38, 35, .72), rgba(98, 108, 103, .28) 38%, transparent 39%);
}

@media (prefers-reduced-motion: reduce) {
  body[data-portal="client"] .login-panel,
  .client-ink-splash { animation: none; transition: none; }
}

@media (max-width: 700px) {
  body[data-portal="client"] .client-entry-header {
    height: 68px;
    padding: 12px 16px;
  }
  body[data-portal="client"] .client-entry-logo { width: 42px; height: 42px; }
  body[data-portal="client"] #openClientLogin { min-width: 72px; min-height: 38px; }
  body[data-portal="client"] #openClientLogin { width: auto; }
  body[data-portal="client"] #returnClientLanding { min-width: 68px; min-height: 38px; }
  body[data-portal="client"] .client-entry-copy {
    top: 17%;
    right: 18px;
    left: 18px;
    justify-items: center;
    gap: 6px;
  }
  body[data-portal="client"] .client-entry-copy span { font-size: clamp(22px, 7vw, 30px); }
  body[data-portal="client"] .client-entry-copy span:last-child { margin-left: 2.1em; }
  body[data-portal="client"] .login-panel {
    margin-top: 210px;
    padding: 24px 26px;
  }
  body[data-portal="client"] .login-panel.register-mode {
    margin-top: 112px;
    padding: 22px 24px;
  }
  body[data-portal="client"] .email-address-row,
  body[data-portal="client"] .registration-code-row { grid-template-columns: 1fr; }
  body[data-portal="client"] .email-address-row select,
  body[data-portal="client"] .registration-code-row button { width: 100%; }
  body[data-portal="client"] .app-shell { background-size: 10px 10px; }
}

/* Shared paper-and-ink styling for the client and administrator workspaces. */
body[data-portal="admin"] .login-screen {
  display: block;
  min-height: 100vh;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: #fff;
}

body[data-portal="admin"] .login-light-field { display: none; }
body[data-portal="admin"] .client-ink-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

body[data-portal="admin"] .client-entry-home {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: block;
  pointer-events: none;
}

body[data-portal="admin"] .client-entry-header {
  display: flex;
  height: 82px;
  padding: 18px clamp(20px, 4vw, 64px);
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, .78);
  border: 0;
  backdrop-filter: blur(14px);
}

body[data-portal="admin"] .client-entry-logo {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(20, 31, 29, .09);
}

body[data-portal="admin"] .client-entry-actions,
body[data-portal="admin"] .client-entry-copy { display: none; }

body[data-portal="admin"] .login-panel {
  z-index: 3;
  width: min(calc(100% - 32px), 430px);
  margin: clamp(190px, 30vh, 280px) auto 42px;
  padding: 30px 32px;
  gap: 16px;
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(52, 62, 58, .16);
  border-radius: 18px;
  box-shadow: 0 26px 80px rgba(23, 31, 29, .11);
  backdrop-filter: blur(18px) saturate(112%);
}

body[data-portal="admin"] .login-panel::before,
body[data-portal="admin"] .login-brand { display: none; }
body[data-portal="admin"] .login-heading { text-align: center; }
body[data-portal="admin"] .login-heading h1 { margin: 2px 0 0; font-size: 27px; letter-spacing: 0; }
body[data-portal="admin"] .login-panel .field { gap: 7px; }
body[data-portal="admin"] .login-panel input { min-height: 42px; background: rgba(255, 255, 255, .84); border-color: rgba(60, 70, 66, .18); }
body[data-portal="admin"] .login-actions { grid-template-columns: 1fr; text-align: center; }
body[data-portal="admin"] #loginButton { width: 100%; min-height: 42px; }

body[data-portal] .client-workspace-ink {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

body[data-portal] .app-shell {
  position: relative;
  isolation: isolate;
  background-color: #fff;
  background-image: radial-gradient(circle at center, rgba(35, 48, 43, .055) 0 1px, transparent 1px);
  background-size: 12px 12px;
}

body[data-portal] .app-shell > .sidebar,
body[data-portal] .app-shell > .main { position: relative; z-index: 1; }

body[data-portal] .sidebar {
  color: #26312e;
  background: rgba(255, 255, 255, .91);
  border-right: 1px solid rgba(50, 63, 58, .18);
  backdrop-filter: blur(18px);
}

body[data-portal] .sidebar .brand-mark {
  background: #fff;
  border: 1px solid rgba(53, 65, 61, .16);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(26, 42, 37, .08);
}

body[data-portal] .sidebar-version,
body[data-portal] .sidebar-version strong { color: #68736e; }
body[data-portal] .nav-item { color: #68736e; border-color: transparent; }
body[data-portal] .nav-item:hover {
  color: #1c2d28;
  background: rgba(55, 89, 79, .065);
  border-color: rgba(55, 89, 79, .08);
}
body[data-portal] .nav-item.active {
  color: #132722;
  background: rgba(55, 89, 79, .095);
  border-color: rgba(55, 89, 79, .13);
  box-shadow: inset 2px 0 #497d73;
}

body[data-portal] .sidebar-status {
  color: #52615b;
  background: rgba(255, 255, 255, .68);
  border: 1px solid rgba(57, 74, 68, .12);
}
body[data-portal] .sidebar-collapse { color: #4f5f59; background: rgba(255, 255, 255, .66); border-color: rgba(57, 74, 68, .16); }
body[data-portal] .sidebar-collapse:hover { color: #173c35; background: rgba(67, 112, 101, .1); }

body[data-portal] .main {
  background: rgba(255, 255, 255, .76);
  backdrop-filter: blur(8px);
}

body[data-portal] .page-header { border-bottom-color: rgba(55, 67, 63, .2); }
body[data-portal] .panel,
body[data-portal] .metric-card,
body[data-portal] .submit-composer,
body[data-portal] .settings-stack .config-panel,
body[data-portal] .package-item,
body[data-portal] .node-controls,
body[data-portal] .proxy-node-card {
  background: rgba(255, 255, 255, .84);
  border-color: rgba(54, 68, 63, .17);
  box-shadow: 0 5px 20px rgba(27, 43, 38, .045);
  backdrop-filter: blur(10px);
}

body[data-portal] .primary-button {
  color: #fff;
  background: #18211f;
  border-color: #18211f;
}
body[data-portal] .primary-button:hover { color: #fff; background: #29443e; border-color: #29443e; }
body[data-portal] .secondary-button,
body[data-portal] .icon-button {
  color: #34443f;
  background: rgba(255, 255, 255, .78);
  border-color: rgba(54, 68, 63, .2);
}
body[data-portal] .secondary-button:hover,
body[data-portal] .icon-button:hover { color: #173c35; background: rgba(66, 113, 102, .08); }

body[data-portal="client"] #loginButton,
body[data-portal="client"] #loginButton:hover {
  color: #fff;
  background: #12a594;
  border-color: #12a594;
}

body[data-portal="client"] .sidebar-client-identity {
  background: rgba(255, 255, 255, .72);
  border-color: rgba(57, 74, 68, .16);
}

body[data-portal="client"] .sidebar-client-identity strong { color: #1e2926; }
body[data-portal="client"] .sidebar-client-identity span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: none;
}
body[data-portal="client"] .sidebar-client-identity span::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}

body[data-portal="client"] .sidebar-client-identity .membership-tier-1 { color: #52616a; background: #eef2f3; border-color: #d6dde0; }
body[data-portal="client"] .sidebar-client-identity .membership-tier-2 { color: #25618c; background: #eaf3fa; border-color: #bfd7e8; }
body[data-portal="client"] .sidebar-client-identity .membership-tier-3 { color: #177568; background: #e7f5f2; border-color: #b9ddd6; }
body[data-portal="client"] .sidebar-client-identity .membership-tier-4 { color: #7050a3; background: #f2edf8; border-color: #d8caeb; }
body[data-portal="client"] .sidebar-client-identity .membership-tier-5 { color: #9b690f; background: #fff6df; border-color: #ead7a7; }
body[data-portal="client"] .sidebar-client-identity .membership-tier-6 { color: #77500b; background: #fff3ce; border-color: #d8b85f; box-shadow: inset 0 0 0 1px rgba(142, 103, 18, .08), 0 4px 14px rgba(112, 79, 10, .08); }

@media (max-width: 700px) {
  body[data-portal="admin"] .client-entry-header { height: 68px; padding: 12px 16px; }
  body[data-portal="admin"] .client-entry-logo { width: 42px; height: 42px; }
  body[data-portal="admin"] .login-panel { margin-top: 210px; padding: 24px 26px; }
  body[data-portal] .app-shell { background-size: 10px 10px; }
}

/* 1.4.4 layered ink sphere and paper splash background. */
body[data-portal="client"] .client-entry-header { position: relative; z-index: 2; }

body[data-portal="client"] .client-ink-splatters {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 360ms ease;
}

body[data-portal="client"] .client-ink-canvas { z-index: 1; }

body[data-portal="client"] .client-ink-splatters.is-entering { animation: clientInkPaperReveal 900ms cubic-bezier(.16, 1, .3, 1); }
body[data-portal="client"] #loginView[data-client-stage="converging"] .client-ink-splatters { opacity: .92; animation: none !important; }
body[data-portal="client"] #loginView[data-client-stage="login"] .client-ink-splatters { opacity: .86; animation: none !important; }

/* 1.4.9 rain-night entry scene and interactive water sphere. */
body[data-portal="client"] .login-screen {
  transition: background-color 620ms cubic-bezier(.16, 1, .3, 1);
}

body[data-portal="client"] #loginView[data-client-stage="landing"] {
  color: #eef3f2;
  background-color: #07090a;
}

body[data-portal="client"] #loginView[data-client-stage="converging"] {
  color: #eef3f2;
  background-color: #07090a;
}

body[data-portal="client"] #loginView[data-client-stage="converging"] .client-entry-header {
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

body[data-portal="client"] #loginView[data-client-stage="converging"] .client-entry-logo {
  background: rgba(249, 250, 249, .94);
  box-shadow: 0 12px 38px rgba(0, 0, 0, .3), 0 0 0 1px rgba(255, 255, 255, .12);
}

body[data-portal="client"] #loginView[data-client-stage="converging"] #returnClientLanding {
  color: #eef3f2;
  background: rgba(19, 24, 25, .76);
  border-color: rgba(230, 238, 236, .18);
}

body[data-portal="client"] #loginView[data-client-stage="landing"] .client-entry-header {
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

body[data-portal="client"] #loginView[data-client-stage="landing"] .client-entry-logo {
  background: rgba(249, 250, 249, .94);
  box-shadow: 0 12px 38px rgba(0, 0, 0, .3), 0 0 0 1px rgba(255, 255, 255, .12);
}

body[data-portal="client"] #loginView[data-client-stage="landing"] #openClientLogin {
  color: #101516;
  background: rgba(239, 244, 243, .94);
  border-color: rgba(255, 255, 255, .22);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
}

body[data-portal="client"] #loginView[data-client-stage="landing"] #openClientLogin:hover {
  color: #070a0b;
  background: #fff;
  border-color: rgba(255, 255, 255, .5);
}

body[data-portal="client"] #loginView[data-client-stage="landing"] .client-ink-splatters {
  opacity: .98;
}

body[data-portal="client"] #loginView[data-client-stage="converging"] .client-ink-canvas,
body[data-portal="client"] #loginView[data-client-stage="login"] .client-ink-canvas {
  filter: drop-shadow(0 10px 22px rgba(42, 79, 80, .2)) drop-shadow(0 0 16px rgba(125, 184, 184, .24));
}

body[data-portal="client"] #loginView[data-client-stage="landing"] .client-ink-canvas {
  filter: drop-shadow(0 24px 44px rgba(0, 0, 0, .42)) drop-shadow(0 0 30px rgba(164, 190, 188, .08));
  transition: filter 260ms ease;
}

body[data-portal="client"] #loginView[data-client-stage="landing"].sphere-hover {
  cursor: pointer;
}

body[data-portal="client"] #loginView[data-client-stage="landing"].sphere-hover .client-ink-canvas {
  filter: drop-shadow(0 28px 50px rgba(0, 0, 0, .48)) drop-shadow(0 0 40px rgba(179, 207, 205, .14));
}

body[data-portal="client"] #loginView[data-client-stage="landing"] ~ .client-ink-splash,
body[data-portal="client"] #loginView[data-client-stage="landing"] .client-ink-splash {
  background: #b7c6c4;
}

@keyframes clientInkPaperReveal {
  0% { opacity: 0; transform: scale(.985); }
  48% { opacity: .82; }
  100% { opacity: 1; transform: scale(1); }
}

body[data-portal] input:focus,
body[data-portal] textarea:focus,
body[data-portal] select:focus,
body[data-portal] input:focus-visible,
body[data-portal] textarea:focus-visible,
body[data-portal] select:focus-visible,
body[data-portal="client"] .login-panel input:focus,
body[data-portal="client"] .login-panel select:focus {
  outline: none;
  border-color: #202423;
  box-shadow: 0 0 0 3px rgba(20, 24, 23, .11);
}

.email-address-row select,
body[data-portal="client"] .login-panel .email-address-row select {
  min-width: 126px;
  min-height: 40px;
  padding: 0 38px 0 13px;
  appearance: none;
  color: #202423;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, transparent 50%, #353a38 50%),
    linear-gradient(135deg, #353a38 50%, transparent 50%),
    linear-gradient(to right, #e3e7e5, #e3e7e5);
  background-position:
    calc(100% - 17px) 50%,
    calc(100% - 12px) 50%,
    calc(100% - 34px) 50%;
  background-size: 5px 5px, 5px 5px, 1px 20px;
  background-repeat: no-repeat;
  border: 1px solid #cfd5d2;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(20, 24, 23, .03);
}

body[data-portal="client"] #loginButton,
body[data-portal="client"] #loginButton:hover,
.submit-arrow-button,
.submit-arrow-button:hover {
  color: #fff;
  background: #171a19;
  border-color: #171a19;
  box-shadow: 0 10px 24px rgba(17, 20, 19, .18);
}

.composer-main textarea:focus {
  background: #fff;
  border-color: #202423;
  box-shadow: 0 0 0 3px rgba(20, 24, 23, .1), 0 12px 30px rgba(15, 23, 42, .045);
}

.reference-button:hover,
.ratio-trigger:hover,
.ratio-picker.open .ratio-trigger {
  color: #171a19;
  background: #f0f2f1;
  border-color: #aeb6b2;
}

.prompt-save-button { color: #171a19; background: #f1f3f2; border-color: #c9cfcc; }

.prompt-card:hover { border-color: #939c98; box-shadow: 0 14px 34px rgba(20, 24, 23, .09); }
.prompt-card-index { color: #171a19; background: #edf0ef; border: 1px solid #d9dddb; border-radius: 9px; }
.prompt-card-actions button { color: #202423; }
.prompt-card-actions button:hover { color: #0d0f0f; background: #eef0ef; }

.prompt-pager {
  justify-content: flex-end;
  gap: 10px;
  margin-top: 34px;
  padding-top: 12px;
  border-top: 1px solid #e1e5e3;
}

.prompt-pager .page-button,
.prompt-picker-footer .page-button {
  min-height: 36px;
  padding: 0 14px;
  color: #242826;
  background: #fff;
  border: 1px solid #cfd5d2;
  border-radius: 8px;
  font-weight: 750;
}

.prompt-pager .page-button:hover:not(:disabled),
.prompt-picker-footer .page-button:hover:not(:disabled) { color: #fff; background: #1a1d1c; border-color: #1a1d1c; }
.prompt-pager .page-button:disabled,
.prompt-picker-footer .page-button:disabled { opacity: .42; cursor: not-allowed; }
.prompt-empty { min-height: 0; padding: 26px 8px 8px; text-align: left; }

#feedbackModal .feedback-modal-panel {
  width: min(calc(100vw - 40px), 760px);
  padding: 28px 30px 26px;
  gap: 17px;
  border-color: #d5dad7;
  border-radius: 12px;
  box-shadow: 0 28px 80px rgba(13, 16, 15, .17);
}

#feedbackModal .modal-header { padding-bottom: 15px; }
#feedbackModal .modal-header h2 { margin: 0; font-size: 23px; }
#feedbackModal #feedbackCategory { min-height: 42px; padding: 0 12px; background: #fff; border: 1px solid #cfd5d2; border-radius: 9px; }
#feedbackModal #feedbackContent { min-height: 210px; }
#feedbackModal .modal-actions { justify-content: flex-end; padding-top: 8px; }

.sidebar-logout {
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  color: #fff;
  background: #171a19;
  border-color: #171a19;
  border-radius: 7px;
}

.sidebar-logout:hover { color: #fff; background: #292d2b; border-color: #292d2b; }
.sidebar-logout svg { width: 17px; height: 17px; flex: 0 0 auto; }

.logout-confirm-panel {
  justify-items: center;
  width: min(100%, 360px);
  padding: 28px;
  text-align: center;
  border-radius: 12px;
}

.logout-confirm-panel h2 { margin: 0; font-size: 22px; }
.logout-confirm-panel p { margin: 8px 0 0; color: var(--muted); }
.logout-confirm-panel .modal-actions { width: 100%; justify-content: center; }
.logout-confirm-panel .modal-actions button { flex: 1 1 0; }
.logout-confirm-mark { display: grid; place-items: center; width: 42px; height: 42px; color: #fff; background: #171a19; border-radius: 50%; }
.logout-confirm-mark svg { width: 19px; height: 19px; }

.metric-card::before { content: none; }
.metric-card::after {
  content: "";
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 15px;
  height: 15px;
  border-right: 1px solid rgba(28, 33, 31, .2);
  border-bottom: 1px solid rgba(28, 33, 31, .2);
}

body[data-portal] .app-shell { background-color: #fff; }
body[data-portal] .main { background: rgba(255, 255, 255, .9); }
body[data-portal] .nav-item.active { color: #151817; box-shadow: inset 2px 0 #1b1e1d; }
body[data-portal] .nav-item.active { background: rgba(24, 29, 27, .075); border-color: rgba(24, 29, 27, .14); }
body[data-portal] .nav-item:hover .nav-icon,
body[data-portal] .nav-item.active .nav-icon { color: #171a19; }
body[data-portal] .settings-icon { color: #171a19; background: #eef0ef; }
body[data-portal] .ratio-options button:hover,
body[data-portal] .ratio-options button.active {
  color: #171a19;
  background: #ecefed;
}
body[data-portal] .billing-priority-control label:has(input:checked) {
  border-color: #202423;
  background: #eef0ef;
  box-shadow: inset 0 0 0 1px #202423;
}
body[data-portal] .billing-priority-control input { accent-color: #171a19; }
body[data-portal] button:focus-visible,
body[data-portal] a:focus-visible { outline: 2px solid #202423; outline-offset: 2px; }
body[data-portal] .announcement-lock-control > input:focus-visible + .switch-track { outline-color: #202423; }
body[data-portal="client"] .sidebar-client-identity span:not([class*="membership-tier-"]) { color: #444b48; background: #f0f2f1; border-color: #d7dcda; }
body[data-portal="client"] .metric-card:nth-child(3n + 1),
body[data-portal="client"] .metric-card:nth-child(3n + 2),
body[data-portal="client"] .metric-card:nth-child(3n) { border-top-color: rgba(54, 68, 63, .17); }
.submit-balance { border-color: rgba(28, 34, 32, .2); box-shadow: 0 8px 22px rgba(20, 24, 23, .045); }
.balance-item.free strong,
.balance-cost { color: #1d211f; }
.balance-divider { background: rgba(28, 34, 32, .16); }
.balance-cost { background: #eef0ef; }
.metric-edit-button { color: #202423; }

.runtime-config-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.runtime-config-form .field { max-width: 260px; }
.runtime-config-form button { min-width: 116px; }
.settings-icon svg { width: 18px; height: 18px; }

#emailModal .modal-panel {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(calc(100vw - 40px), 760px);
  max-height: min(90vh, 820px);
  padding: 28px 30px;
  overflow-y: auto;
  border-radius: 12px;
}

#emailModal .modal-panel > .modal-header,
#emailModal .modal-panel > .field:nth-child(2),
#emailModal .modal-panel > .field:nth-child(3),
#emailModal .modal-panel > .modal-actions { grid-column: 1 / -1; }
#emailModal .email-domain-editor { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#emailModal .email-domain-add { min-width: 140px; }

.client-ink-splash {
  width: 7px;
  height: 7px;
  background: #111413;
  filter: blur(.3px);
  transform: translate(-50%, -50%) scale(.35);
  animation-name: clientInkSplashCompact;
  animation-timing-function: cubic-bezier(.16, 1, .3, 1);
  animation-fill-mode: forwards;
}

.client-ink-splash::before,
.client-ink-splash::after { display: none; }

@keyframes clientInkSplashCompact {
  55% { opacity: .34; transform: translate(-50%, -50%) scale(1.85); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(2.45); }
}

.sidebar-client-identity { contain: paint; isolation: isolate; backface-visibility: hidden; }

.submit-secondary-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.batch-task-modal {
  width: min(calc(100vw - 40px), 980px);
  max-height: min(90vh, 860px);
  padding: 26px;
  overflow: hidden;
}

.batch-import-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: #f6f7f6;
  border: 1px solid #dfe3e1;
  border-radius: 8px;
}

.batch-file-button { margin: 0; cursor: pointer; }
.batch-file-copy { min-width: 0; }
.batch-file-copy strong {
  display: block;
  overflow: hidden;
  color: #1c211f;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-format-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.batch-format-list span {
  padding: 2px 6px;
  color: #69716e;
  background: #fff;
  border: 1px solid #d9dddb;
  border-radius: 4px;
  font-size: 10px;
  line-height: 1.4;
}

.batch-task-options {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) auto auto;
  align-items: end;
  gap: 14px;
}

.batch-task-options .field { margin: 0; }
.batch-select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 13px;
  color: #252a28;
  background: #fff;
  border: 1px solid #d1d6d3;
  border-radius: 7px;
  cursor: pointer;
}

.batch-select-all input { width: 16px; height: 16px; accent-color: #171a19; }
.batch-selection-state { align-self: center; min-width: 88px; color: #4f5754; font-size: 13px; text-align: right; }

.batch-prompt-list {
  min-height: 180px;
  max-height: min(43vh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-block: 1px solid #e1e5e3;
  scrollbar-color: #c5cbc8 transparent;
  scrollbar-width: thin;
}

.batch-prompt-row {
  display: grid;
  grid-template-columns: 22px 72px minmax(0, 1fr) 132px;
  align-items: center;
  gap: 12px;
  min-height: 86px;
  padding: 12px 4px;
  border-bottom: 1px solid #edf0ee;
}

.batch-prompt-row:last-child { border-bottom: 0; }
.batch-prompt-row > input { width: 16px; height: 16px; accent-color: #171a19; }
.batch-prompt-row textarea {
  min-height: 58px;
  max-height: 116px;
  padding: 10px 11px;
  resize: vertical;
  background: #fff;
  border: 1px solid #d7dcda;
  border-radius: 6px;
}

.batch-prompt-index,
.batch-prompt-status { color: #69716e; font-size: 12px; }
.batch-prompt-status { text-align: right; overflow-wrap: anywhere; }
.batch-prompt-row.is-success .batch-prompt-status { color: #1f6250; }
.batch-prompt-row.is-failed .batch-prompt-status { color: #a23a35; }
.batch-task-actions { align-items: center; }
.batch-task-actions .muted { margin-right: auto; }

.prompt-manager-panel.is-empty {
  display: flex;
  min-height: calc(100vh - 150px);
  flex-direction: column;
}

.prompt-manager-panel.is-empty .prompt-grid {
  display: grid;
  flex: 1;
  place-items: center;
}

.prompt-manager-panel.is-empty .prompt-empty { padding: 24px; text-align: center; }
.prompt-manager-panel.is-empty .prompt-pager { margin-top: auto; justify-content: flex-end; }

body[data-portal] .proxy-node-card.selected,
body[data-portal] .proxy-node-card[aria-pressed="true"] {
  color: #14201d;
  background: #e8efec;
  border-color: #263d37;
  box-shadow: inset 3px 0 0 #17201e, 0 7px 22px rgba(26, 45, 39, .1);
}

@media (min-width: 821px) {
  .app-shell.sidebar-content-hidden .sidebar-client-identity,
  .app-shell.sidebar-transitioning.sidebar-content-hidden .sidebar-client-identity {
    display: none !important;
    visibility: hidden !important;
  }
  .app-shell.sidebar-collapsed .sidebar-client-identity { display: none !important; visibility: hidden; }
  .app-shell.sidebar-collapsed .sidebar-logout { justify-content: center; padding: 0; }
  .app-shell.sidebar-collapsed .sidebar-logout span { display: none; }
}

@media (max-width: 700px) {
  .prompt-pager { justify-content: center; margin-top: 26px; }
  .prompt-manager-panel.is-empty .prompt-pager { justify-content: flex-end; }
  .batch-task-modal { width: min(calc(100vw - 20px), 980px); max-height: 94vh; padding: 20px 16px; }
  .batch-import-toolbar { grid-template-columns: 1fr auto; padding: 13px; }
  .batch-file-copy { grid-column: 1 / -1; grid-row: 2; }
  .batch-task-options { grid-template-columns: 1fr 1fr; }
  .batch-select-all { justify-content: center; }
  .batch-selection-state { text-align: right; }
  .batch-prompt-row { grid-template-columns: 20px minmax(0, 1fr); gap: 8px 10px; padding: 12px 2px; }
  .batch-prompt-index { grid-column: 2; grid-row: 1; }
  .batch-prompt-row textarea { grid-column: 1 / -1; min-height: 76px; }
  .batch-prompt-status { grid-column: 1 / -1; text-align: left; }
  .batch-task-actions { flex-wrap: wrap; }
  .batch-task-actions .muted { width: 100%; margin: 0 0 4px; }
  #feedbackModal .feedback-modal-panel { padding: 22px 20px; }
  #feedbackModal #feedbackContent { min-height: 170px; }
  .runtime-config-form { grid-template-columns: 1fr; }
  .runtime-config-form .field { max-width: none; }
  #emailModal .modal-panel { grid-template-columns: 1fr; padding: 22px 20px; }
  #emailModal .modal-panel > .field { grid-column: 1; }
  #emailModal .email-domain-editor { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  body[data-portal="client"] .client-ink-splatters.is-entering { animation: none; }
}
