/*
 * Sky Atelier UI — shared visual layer for the cloud console and desktop clients.
 * The rules intentionally sit after the compiled application stylesheet so the
 * business bundle remains untouched and future rollback is a single link removal.
 */

:root {
  color-scheme: light;
  --bg: #f2f9ff;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-soft: #f6fbff;
  --surface-strong: #ffffff;
  --sidebar: rgba(247, 252, 255, 0.94);
  --sidebar-soft: #eaf6ff;
  --line: #d9ecfa;
  --line-strong: #bcdcf2;
  --text: #102a43;
  --muted: #627d98;
  --slate: #486581;
  --primary: #269cf0;
  --primary-dark: #0878c9;
  --blue: #148fe2;
  --green: #0eaa7a;
  --orange: #ee9b25;
  --red: #e35d6a;
  --sky-25: #f8fcff;
  --sky-50: #eef9ff;
  --sky-100: #dff2ff;
  --sky-200: #bae5ff;
  --sky-300: #78ccff;
  --sky-400: #35adf5;
  --sky-500: #148fe2;
  --sky-600: #0878c9;
  --navy-900: #102a43;
  --shadow-sm: 0 1px 2px rgba(31, 100, 145, 0.06), 0 4px 14px rgba(31, 100, 145, 0.05);
  --shadow-md: 0 12px 32px rgba(31, 100, 145, 0.10), 0 2px 8px rgba(31, 100, 145, 0.06);
  --shadow-lg: 0 28px 80px rgba(22, 89, 136, 0.18), 0 8px 24px rgba(22, 89, 136, 0.10);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  font-family: Inter, "SF Pro Display", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

html {
  background: #f2f9ff;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  background:
    radial-gradient(circle at 12% -10%, rgba(116, 207, 255, .28), transparent 34rem),
    radial-gradient(circle at 94% 8%, rgba(186, 229, 255, .34), transparent 30rem),
    linear-gradient(145deg, #f9fdff 0%, #f0f8ff 46%, #f7fbff 100%);
  color: var(--text);
  letter-spacing: .005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  position: fixed;
  z-index: -1;
  top: -16rem;
  right: -12rem;
  width: 38rem;
  height: 38rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(81, 183, 244, .16), rgba(81, 183, 244, 0) 68%);
  content: "";
  pointer-events: none;
  animation: sky-drift 18s ease-in-out infinite alternate;
}

::selection {
  background: rgba(53, 173, 245, .24);
  color: #073b63;
}

button, input, select, textarea, a {
  transition:
    color .22s ease,
    background-color .22s ease,
    border-color .22s ease,
    box-shadow .22s ease,
    opacity .22s ease,
    transform .22s var(--ease-out);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(38, 156, 240, .25);
  outline-offset: 2px;
}

.app-shell {
  grid-template-columns: 264px minmax(0, 1fr);
  isolation: isolate;
}

.sidebar {
  border-right: 1px solid rgba(148, 205, 240, .42);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(239, 249, 255, .93)),
    var(--sidebar);
  color: var(--text);
  box-shadow: 14px 0 44px rgba(53, 139, 194, .07);
  backdrop-filter: blur(22px) saturate(140%);
}

.brand {
  min-height: 92px;
  padding: 22px 18px 20px;
  border-bottom: 1px solid var(--line);
}

.brand-mark,
.auth-heading > span {
  position: relative;
  width: 46px;
  height: 46px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 15px;
  background: linear-gradient(145deg, #57c4ff 0%, #148fe2 56%, #0878c9 100%);
  color: #fff;
  box-shadow: 0 12px 25px rgba(20, 143, 226, .26), inset 0 1px 0 rgba(255, 255, 255, .44);
}

.brand-mark::after,
.auth-heading > span::after {
  position: absolute;
  top: -55%;
  left: -80%;
  width: 60%;
  height: 220%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .5), transparent);
  content: "";
  transform: rotate(24deg);
  animation: mark-shine 7s ease-in-out infinite;
}

.brand h1 {
  color: #123b59;
  font-size: 18px;
  font-weight: 760;
  letter-spacing: -.02em;
}

.brand p {
  color: #7896aa;
  letter-spacing: .04em;
}

.nav-list {
  padding: 18px 12px;
}

.nav-item {
  position: relative;
  min-height: 46px;
  margin-bottom: 6px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 13px;
  color: #58758c;
  font-weight: 620;
}

.nav-item svg {
  color: #79a2bd;
  transition: color .22s ease, transform .22s var(--ease-out);
}

.nav-item:hover {
  border-color: rgba(148, 205, 240, .45);
  background: rgba(226, 245, 255, .72);
  color: #126caa;
  transform: translateX(2px);
}

.nav-item:hover svg {
  color: var(--sky-500);
  transform: scale(1.08);
}

.nav-item.active {
  border-color: #bae5ff;
  background: linear-gradient(120deg, #dff2ff, #f7fcff 72%);
  color: #0878c9;
  box-shadow: 0 8px 20px rgba(50, 151, 213, .12), inset 0 1px 0 #fff;
}

.nav-item.active::before {
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: -13px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, #56c5ff, #148fe2);
  content: "";
  box-shadow: 0 0 12px rgba(20, 143, 226, .52);
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--line);
  background: rgba(247, 252, 255, .72);
}

.sidebar-store-select span,
.account-badge span {
  color: #7896aa;
}

.sidebar-store-select select,
.account-badge,
.footer-settings-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .88);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.sidebar-store-select select {
  height: 38px;
  border-radius: 11px;
}

.account-badge,
.footer-settings-button {
  border-radius: 13px;
}

.account-badge:hover,
.footer-settings-button:hover {
  border-color: var(--sky-200);
  background: #fff;
  color: var(--primary-dark);
  box-shadow: 0 10px 24px rgba(31, 119, 177, .12);
  transform: translateY(-1px);
}

.account-badge.ready {
  border-color: rgba(14, 170, 122, .28);
  background: linear-gradient(135deg, #f1fff9, #fff);
}

.account-badge.running {
  border-color: rgba(238, 155, 37, .32);
  background: linear-gradient(135deg, #fff9ea, #fff);
}

.footer-settings-button.active {
  border-color: var(--sky-200);
  background: var(--sky-100);
  color: var(--primary-dark);
}

.sidebar-update-link {
  color: #6f91a9;
}

.sidebar-update-link:hover {
  background: var(--sky-100);
  color: var(--primary-dark);
}

.main-area {
  position: relative;
  padding: 26px clamp(20px, 2.5vw, 38px) 36px;
}

.main-area > * {
  position: relative;
  z-index: 1;
}

.topbar {
  min-height: 72px;
  margin-bottom: 20px;
}

.topbar h2 {
  color: #0c3554;
  font-size: clamp(23px, 2vw, 30px);
  font-weight: 780;
  letter-spacing: -.035em;
}

.topbar p {
  margin-top: 7px;
  color: #7892a6;
}

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

.status-pill {
  min-height: 38px;
  padding: 0 13px;
  border-color: var(--line);
  background: rgba(255, 255, 255, .82);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
}

.status-pill span {
  box-shadow: 0 0 0 4px currentColor;
  opacity: .75;
  transform: scale(.55);
}

.status-pill.ready span {
  animation: status-breathe 2.4s ease-in-out infinite;
}

.topbar-user {
  border-left-color: var(--line);
}

.primary-button,
.icon-button,
.ghost-button,
.row-action,
.quick-actions button,
.tabs button,
.pager button,
.app-update-button,
.soft-danger-button,
.status-toggle {
  min-height: 38px;
  border-radius: 11px;
  font-weight: 650;
}

.primary-button {
  border: 1px solid rgba(7, 105, 176, .14);
  background: linear-gradient(135deg, #35adf5 0%, #148fe2 58%, #0878c9 100%);
  box-shadow: 0 9px 20px rgba(20, 143, 226, .22), inset 0 1px 0 rgba(255, 255, 255, .34);
}

.primary-button:hover {
  background: linear-gradient(135deg, #51baff 0%, #148fe2 54%, #066bb4 100%);
  box-shadow: 0 13px 28px rgba(20, 143, 226, .29), inset 0 1px 0 rgba(255, 255, 255, .42);
  transform: translateY(-1px);
}

.primary-button:active,
.ghost-button:active,
.icon-button:active,
.row-action:active {
  transform: translateY(0) scale(.98);
}

.icon-button,
.ghost-button,
.quick-actions button,
.pager button {
  border-color: var(--line);
  background: rgba(255, 255, 255, .86);
  color: #486b84;
  box-shadow: var(--shadow-sm);
}

.icon-button:hover,
.ghost-button:hover,
.quick-actions button:hover,
.pager button:hover:not(:disabled) {
  border-color: var(--sky-200);
  background: #f2faff;
  color: var(--primary-dark);
  box-shadow: 0 8px 20px rgba(31, 119, 177, .10);
  transform: translateY(-1px);
}

.app-update-button {
  border-color: #b9e3fb;
  background: linear-gradient(135deg, #eef9ff, #fff);
  color: #0878c9;
}

.app-update-button:hover {
  border-color: #78ccff;
  background: #e3f5ff;
  color: #066bb4;
}

.view-stack {
  gap: 18px;
  animation: content-enter .5s var(--ease-out) both;
}

.metric-grid {
  gap: 16px;
}

.metric-card,
.panel,
.toolbar {
  border-color: rgba(180, 219, 242, .68);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px) saturate(130%);
}

.metric-card {
  position: relative;
  min-height: 148px;
  overflow: hidden;
  padding: 19px;
}

.metric-card::after {
  position: absolute;
  top: -52px;
  right: -42px;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(71, 181, 246, .15), transparent 70%);
  content: "";
  transition: transform .45s var(--ease-out);
}

.metric-card:hover {
  border-color: #b3ddf5;
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.metric-card:hover::after {
  transform: scale(1.25) translate(-5px, 6px);
}

.metric-icon,
.readiness-icon,
.dispatch-target-icon {
  border: 1px solid rgba(125, 202, 246, .24);
  border-radius: 12px;
  background: linear-gradient(145deg, #e9f7ff, #f8fcff);
  color: var(--sky-600);
  box-shadow: inset 0 1px 0 #fff;
}

.metric-card strong {
  margin-top: 8px;
  color: #0b3554;
  font-size: 30px;
  font-weight: 780;
  letter-spacing: -.04em;
}

.panel {
  padding: 18px;
}

.panel:hover {
  border-color: rgba(150, 207, 240, .86);
}

.panel-heading {
  margin-bottom: 16px;
}

.panel-heading h3 {
  color: #153e5a;
  font-size: 16px;
  font-weight: 730;
  letter-spacing: -.015em;
}

.toolbar {
  padding: 15px;
}

.notice {
  margin-bottom: 16px;
  padding: 13px 15px;
  border-radius: 13px;
  box-shadow: 0 7px 18px rgba(31, 100, 145, .05);
}

.notice.success {
  border-color: #b9eadb;
  background: linear-gradient(135deg, #eefff9, #fbfffd);
}

.notice.warning {
  border-color: #f6d8a7;
  background: linear-gradient(135deg, #fff8e9, #fffdf8);
}

.notice.error {
  border-color: #f1c4ca;
  background: linear-gradient(135deg, #fff2f4, #fffafb);
}

.readiness-summary,
.readiness-card,
.rule-block,
.model-mode-card,
.script-patch-card,
.empty-card,
.script-version-card,
.dispatch-target {
  border-color: var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .88);
}

.readiness-card:hover,
.dispatch-target:hover,
.script-version-card:hover {
  border-color: var(--sky-200);
  background: #f7fcff;
  box-shadow: 0 10px 24px rgba(31, 119, 177, .10);
  transform: translateY(-2px);
}

.tabs {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(234, 246, 255, .74);
}

.tabs button {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.tabs button.active {
  background: #fff;
  color: var(--primary-dark);
  box-shadow: 0 5px 14px rgba(31, 100, 145, .12);
}

input,
select,
textarea,
.config-input,
.account-password-form input,
.account-create-row input,
.account-create-row select,
.account-table input,
.account-table select,
.browser-visibility-settings select {
  border-color: var(--line-strong);
  border-radius: 11px;
  background: rgba(255, 255, 255, .92);
  color: var(--text);
  box-shadow: inset 0 1px 2px rgba(31, 100, 145, .035);
}

input:hover,
select:hover,
textarea:hover,
.config-input:hover {
  border-color: #91cff2;
}

input:focus,
select:focus,
textarea:focus,
.config-input:focus {
  border-color: var(--sky-400);
  outline: 0;
  box-shadow: 0 0 0 4px rgba(53, 173, 245, .13), 0 8px 22px rgba(31, 119, 177, .08);
}

.search-box {
  border-color: var(--line-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, .9);
}

.search-box:focus-within {
  border-color: var(--sky-400);
  box-shadow: 0 0 0 4px rgba(53, 173, 245, .12);
}

.table-wrap,
.account-table-wrap,
.script-bundle-table {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .76);
  scrollbar-gutter: stable;
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

thead th,
.account-table th {
  height: 44px;
  border-bottom-color: var(--line);
  background: rgba(239, 249, 255, .94);
  color: #58758c;
  font-size: 12px;
  font-weight: 720;
  letter-spacing: .03em;
  backdrop-filter: blur(12px);
}

tbody td,
.account-table td {
  border-bottom-color: #e8f3fa;
  color: #405f76;
}

tbody tr {
  transition: background-color .18s ease, transform .18s ease;
}

tbody tr:hover {
  background: rgba(226, 245, 255, .48);
}

.row-action {
  border: 1px solid #bfe3f7;
  background: #eff9ff;
  color: var(--primary-dark);
}

.row-action:hover:not(:disabled) {
  border-color: var(--sky-300);
  background: #dff2ff;
  box-shadow: 0 7px 16px rgba(31, 119, 177, .12);
  transform: translateY(-1px);
}

.column-settings-button,
.field-chip {
  border-color: var(--line);
  border-radius: 10px;
}

.column-settings-button:hover,
.field-chip:hover {
  border-color: var(--sky-200);
  background: var(--sky-50);
  color: var(--primary-dark);
}

.field-chip.selected {
  border-color: var(--sky-300);
  background: var(--sky-100);
  color: #075f9e;
}

.field-chip.selected span {
  background: var(--primary);
}

.column-modal-backdrop,
.dispatch-modal-backdrop,
.share-config-backdrop,
.script-library-modal-backdrop {
  background: rgba(15, 54, 80, .34);
  backdrop-filter: blur(9px) saturate(120%);
}

.column-modal,
.dispatch-modal,
.share-config-modal,
.script-library-modal {
  overflow: hidden;
  border-color: rgba(182, 221, 243, .86);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--shadow-lg);
  animation: modal-enter .28s var(--ease-out) both;
}

.column-modal-head,
.dispatch-modal-head,
.share-config-head,
.rules-panel .panel-heading,
.table-template-panel .panel-heading,
.config-panel .panel-heading,
.models-panel .panel-heading,
.account-section-heading {
  border-bottom-color: var(--line);
  background: linear-gradient(180deg, #fbfeff, #f3faff);
}

.settings-nav {
  border-color: var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, .82);
  box-shadow: var(--shadow-sm);
}

.settings-nav button.active {
  background: linear-gradient(135deg, var(--sky-100), #f8fcff);
  color: var(--primary-dark);
}

.config-help {
  border-color: var(--sky-200);
  border-radius: 13px;
  background: linear-gradient(135deg, #eaf7ff, #f8fcff);
  color: #145c8c;
}

.config-panel dl > .config-row:hover {
  background: #f5fbff;
}

.config-save.changed {
  border-color: var(--sky-300);
  background: var(--sky-100);
  color: var(--primary-dark);
}

.task-output,
.log-output,
pre {
  border: 1px solid #23445d;
  border-radius: 14px;
  background: linear-gradient(155deg, #102a43, #173c56);
  color: #d9f2ff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 12px 30px rgba(15, 42, 67, .12);
}

.auth-screen {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(101, 205, 255, .40), transparent 28rem),
    radial-gradient(circle at 88% 72%, rgba(189, 230, 255, .56), transparent 32rem),
    linear-gradient(145deg, #f9fdff, #e9f6ff 58%, #f8fcff);
}

.auth-screen::before,
.auth-screen::after {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, .68);
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  box-shadow: inset 0 0 60px rgba(255, 255, 255, .38);
  content: "";
  pointer-events: none;
}

.auth-screen::before {
  top: -12vw;
  right: -8vw;
  width: 38vw;
  height: 38vw;
  animation: sky-drift 13s ease-in-out infinite alternate;
}

.auth-screen::after {
  bottom: -18vw;
  left: -10vw;
  width: 44vw;
  height: 44vw;
  animation: sky-drift 17s ease-in-out -4s infinite alternate-reverse;
}

.auth-panel {
  position: relative;
  z-index: 1;
  width: min(430px, calc(100vw - 32px));
  gap: 18px;
  padding: 34px;
  border-color: rgba(255, 255, 255, .9);
  border-radius: 24px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 30px 90px rgba(31, 100, 145, .18), inset 0 1px 0 #fff;
  backdrop-filter: blur(26px) saturate(135%);
  animation: auth-enter .65s var(--ease-out) both;
}

.auth-heading {
  margin-bottom: 6px;
}

.auth-panel h1 {
  color: #103d5d;
  font-size: 25px;
  font-weight: 780;
  letter-spacing: -.03em;
}

.auth-panel label > span {
  color: #57758c;
  font-weight: 650;
}

.auth-panel input {
  height: 46px;
  padding: 0 14px;
}

.auth-panel .primary-button {
  min-height: 46px;
  margin-top: 2px;
}

.auth-error {
  padding: 10px 12px;
  border: 1px solid #f0c2c9;
  border-radius: 11px;
  background: #fff3f5;
}

.cloud-drawer-shell .sidebar::after {
  border-right-color: rgba(122, 197, 241, .42);
  background: linear-gradient(180deg, #dff2ff, #f7fcff) !important;
}

.cloud-drawer-shell .sidebar:hover,
.cloud-drawer-shell .sidebar:focus-within {
  box-shadow: 22px 0 58px rgba(31, 100, 145, .18) !important;
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: #edf7fd;
}

::-webkit-scrollbar-thumb {
  border: 2px solid #edf7fd;
  border-radius: 999px;
  background: #9ccfea;
}

::-webkit-scrollbar-thumb:hover {
  background: #63b7e4;
}

@keyframes content-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modal-enter {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes auth-enter {
  from { opacity: 0; transform: translateY(20px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes status-breathe {
  0%, 100% { opacity: .72; box-shadow: 0 0 0 4px currentColor; }
  50% { opacity: 1; box-shadow: 0 0 0 7px transparent; }
}

@keyframes sky-drift {
  from { transform: translate3d(0, 0, 0) rotate(0); }
  to { transform: translate3d(-22px, 18px, 0) rotate(7deg); }
}

@keyframes mark-shine {
  0%, 72% { transform: translateX(-20%) rotate(24deg); opacity: 0; }
  82% { opacity: .85; }
  100% { transform: translateX(420%) rotate(24deg); opacity: 0; }
}

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 224px minmax(0, 1fr); }
  .main-area { padding-inline: 22px; }
  .metric-card { min-height: 138px; }
}

@media (max-width: 760px) {
  body {
    background: linear-gradient(160deg, #f8fcff, #eef8ff);
  }

  .app-shell { display: block; }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 10px 30px rgba(31, 100, 145, .08);
  }

  .brand {
    min-height: 76px;
    padding: 14px 16px;
  }

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

  .nav-list {
    border-top-color: var(--line);
    background: rgba(250, 253, 255, .96);
    box-shadow: 0 -10px 30px rgba(31, 100, 145, .10);
    backdrop-filter: blur(18px) saturate(140%);
  }

  .nav-item {
    border-radius: 12px;
    color: #5c7a91;
  }

  .nav-item span {
    max-width: none;
    overflow: visible;
    font-size: 11px;
    text-overflow: clip;
    white-space: nowrap;
  }

  .nav-item.active {
    border-color: transparent;
    background: var(--sky-100);
  }

  .nav-item.active::before { display: none; }

  .main-area {
    padding: 18px 14px calc(92px + env(safe-area-inset-bottom));
  }

  .topbar {
    min-height: auto;
    gap: 13px;
    margin-bottom: 18px;
  }

  .topbar h2 { font-size: 24px; }

  .topbar-actions {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 3px;
  }

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

  .metric-card {
    min-height: 126px;
    padding: 15px;
    border-radius: 15px;
  }

  .metric-card strong { font-size: 25px; }

  .panel,
  .toolbar { border-radius: 15px; }

  .panel { padding: 14px; }

  .panel-heading {
    align-items: flex-start;
    gap: 8px;
  }

  .panel-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
  }

  .panel-actions > span {
    white-space: nowrap;
  }

  .panel-actions .primary-button {
    padding-inline: 10px;
    font-size: 12px;
  }

  .auth-panel {
    padding: 26px 22px;
    border-radius: 20px;
  }

  .column-modal-backdrop,
  .dispatch-modal-backdrop,
  .share-config-backdrop,
  .script-library-modal-backdrop {
    padding: 10px;
  }

  .column-modal,
  .dispatch-modal,
  .share-config-modal,
  .script-library-modal {
    width: 100%;
    max-height: calc(100vh - 20px);
    border-radius: 18px;
  }
}

/* Dedicated UP/bab portals expose only their own locked store. */
html[data-dedicated-store] select[data-dedicated-store-locked="true"] {
  appearance: none;
  -webkit-appearance: none;
  cursor: default;
  opacity: 1;
  color: var(--text-strong, #10233f);
  background-image: none;
  padding-right: 12px;
}

@media (max-width: 460px) {
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 116px; }
  .topbar-actions > * { flex: 0 0 auto; }
  .auth-panel { width: calc(100vw - 22px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Task workspace: keep operational details on the right and give logs a full-width reading lane. */
.task-board {
  grid-template-areas:
    "task-list task-detail"
    "task-log task-detail";
}

.task-list-panel { grid-area: task-list; }
.task-detail-panel { grid-area: task-detail; }

.task-log-panel {
  grid-area: task-log;
  min-width: 0;
  margin-top: 0;
  padding: 16px;
  align-self: start;
}

.task-log-panel .task-log-header {
  margin-bottom: 10px;
}

.task-log-panel .task-output {
  min-height: 220px;
  max-height: min(44vh, 520px);
}

@media (max-width: 1100px) {
  .task-board {
    grid-template-areas:
      "task-list"
      "task-detail"
      "task-log";
  }
}

/*
 * Flat UI refresh — a quieter, current product interface.
 * Solid surfaces, restrained depth and compact geometry replace glass effects.
 */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-strong: #ffffff;
  --sidebar: #ffffff;
  --sidebar-soft: #f1f7fb;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --text: #0f172a;
  --muted: #64748b;
  --slate: #475569;
  --primary: #0ea5e9;
  --primary-dark: #0369a1;
  --blue: #0284c7;
  --green: #059669;
  --orange: #d97706;
  --red: #dc2626;
  --sky-25: #f8fcff;
  --sky-50: #f0f9ff;
  --sky-100: #e0f2fe;
  --sky-200: #bae6fd;
  --sky-300: #7dd3fc;
  --sky-400: #38bdf8;
  --sky-500: #0ea5e9;
  --sky-600: #0284c7;
  --navy-900: #0f172a;
  --shadow-sm: none;
  --shadow-md: 0 8px 24px rgba(15, 23, 42, .08);
  --shadow-lg: 0 18px 50px rgba(15, 23, 42, .14);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
}

html,
body {
  background: var(--bg);
}

body {
  color: var(--text);
  letter-spacing: 0;
}

body::before,
.brand-mark::after,
.auth-heading > span::after,
.metric-card::after,
.auth-screen::before,
.auth-screen::after {
  display: none;
}

button,
input,
select,
textarea,
a {
  transition: color .16s ease, background-color .16s ease, border-color .16s ease, box-shadow .16s ease, opacity .16s ease;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(14, 165, 233, .34);
  outline-offset: 2px;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #fff;
  box-shadow: none;
  backdrop-filter: none;
}

.brand {
  min-height: 82px;
  padding: 18px 16px;
  border-bottom-color: var(--line);
}

.brand-mark,
.auth-heading > span {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  box-shadow: none;
}

.brand h1 {
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.015em;
}

.brand p,
.sidebar-store-select span,
.account-badge span {
  color: var(--muted);
}

.nav-list {
  padding: 14px 10px;
}

.nav-item {
  min-height: 42px;
  margin-bottom: 4px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: #475569;
  font-weight: 600;
}

.nav-item svg {
  color: #94a3b8;
  transition: color .16s ease;
}

.nav-item:hover {
  border-color: transparent;
  background: #f1f5f9;
  color: #0f172a;
  transform: none;
}

.nav-item:hover svg {
  color: #0284c7;
  transform: none;
}

.nav-item.active {
  border: 0;
  background: #eaf7fe;
  color: #0369a1;
  box-shadow: none;
}

.nav-item.active::before {
  top: 9px;
  bottom: 9px;
  left: -10px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--primary);
  box-shadow: none;
}

.sidebar-footer {
  border-top-color: var(--line);
  background: #fff;
}

.sidebar-store-select select,
.account-badge,
.footer-settings-button {
  border-color: var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
}

.account-badge:hover,
.footer-settings-button:hover {
  border-color: #bae6fd;
  background: #f0f9ff;
  color: var(--primary-dark);
  box-shadow: none;
  transform: none;
}

.account-badge.ready {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.account-badge.running {
  border-color: #fed7aa;
  background: #fff7ed;
}

.main-area {
  padding: 24px clamp(18px, 2.2vw, 32px) 32px;
}

.topbar {
  min-height: 64px;
  margin-bottom: 18px;
}

.topbar h2 {
  color: var(--text);
  font-size: clamp(22px, 1.7vw, 28px);
  font-weight: 700;
  letter-spacing: -.025em;
}

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

.status-pill {
  min-height: 36px;
  border-color: var(--line);
  border-radius: 999px;
  background: #fff;
  box-shadow: none;
  backdrop-filter: none;
}

.status-pill span,
.status-pill.ready span {
  box-shadow: none;
  opacity: 1;
  transform: none;
  animation: none;
}

.primary-button,
.icon-button,
.ghost-button,
.row-action,
.quick-actions button,
.tabs button,
.pager button,
.app-update-button,
.soft-danger-button,
.status-toggle {
  min-height: 36px;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: none;
}

.primary-button {
  border: 1px solid #0284c7;
  background: #0284c7;
  color: #fff;
  box-shadow: none;
}

.primary-button:hover {
  border-color: #0369a1;
  background: #0369a1;
  box-shadow: none;
  transform: none;
}

.primary-button:active,
.ghost-button:active,
.icon-button:active,
.row-action:active {
  transform: none;
}

.icon-button,
.ghost-button,
.quick-actions button,
.pager button {
  border-color: var(--line-strong);
  background: #fff;
  color: #475569;
  box-shadow: none;
}

.icon-button:hover,
.ghost-button:hover,
.quick-actions button:hover,
.pager button:hover:not(:disabled) {
  border-color: #7dd3fc;
  background: #f0f9ff;
  color: #0369a1;
  box-shadow: none;
  transform: none;
}

.app-update-button {
  border-color: #bae6fd;
  background: #f0f9ff;
  color: #0369a1;
}

.view-stack {
  gap: 16px;
  animation: none;
}

.metric-grid {
  gap: 12px;
}

.metric-card,
.panel,
.toolbar {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
  backdrop-filter: none;
}

.metric-card {
  min-height: 132px;
  padding: 17px;
}

.metric-card:hover,
.panel:hover {
  border-color: #cbd5e1;
  box-shadow: none;
  transform: none;
}

.metric-icon,
.readiness-icon,
.dispatch-target-icon {
  border: 0;
  border-radius: 8px;
  background: #eaf7fe;
  color: #0284c7;
  box-shadow: none;
}

.metric-card strong {
  margin-top: 6px;
  color: var(--text);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.03em;
}

.panel {
  padding: 16px;
}

.panel-heading {
  margin-bottom: 14px;
}

.panel-heading h3 {
  color: #1e293b;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
}

.toolbar {
  padding: 13px;
}

.notice {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: none;
}

.notice.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.notice.warning {
  border-color: #fed7aa;
  background: #fff7ed;
}

.notice.error {
  border-color: #fecaca;
  background: #fef2f2;
}

.readiness-summary,
.readiness-card,
.rule-block,
.model-mode-card,
.script-patch-card,
.empty-card,
.script-version-card,
.dispatch-target {
  border-color: var(--line);
  border-radius: 8px;
  background: #fff;
}

.readiness-card:hover,
.dispatch-target:hover,
.script-version-card:hover {
  border-color: #bae6fd;
  background: #f8fcff;
  box-shadow: none;
  transform: none;
}

.tabs {
  padding: 3px;
  border: 0;
  border-radius: 9px;
  background: #f1f5f9;
}

.tabs button {
  min-height: 32px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  box-shadow: none;
}

.tabs button.active {
  background: #fff;
  color: #0369a1;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .10);
}

input,
select,
textarea,
.config-input,
.account-password-form input,
.account-create-row input,
.account-create-row select,
.account-table input,
.account-table select,
.browser-visibility-settings select,
.search-box {
  border-color: var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  box-shadow: none;
}

input:hover,
select:hover,
textarea:hover,
.config-input:hover,
.search-box:hover {
  border-color: #94a3b8;
}

input:focus,
select:focus,
textarea:focus,
.config-input:focus,
.search-box:focus-within {
  border-color: #38bdf8;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, .14);
}

.table-wrap,
.account-table-wrap,
.script-bundle-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

thead th,
.account-table th {
  height: 42px;
  border-bottom-color: var(--line);
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .015em;
  backdrop-filter: none;
}

tbody td,
.account-table td {
  border-bottom-color: #eef2f6;
  color: #334155;
}

tbody tr {
  transition: background-color .14s ease;
}

tbody tr:hover {
  background: #f8fafc;
}

.selected-row,
tbody tr.selected-row:hover {
  background: #f0f9ff;
}

.row-action {
  border-color: #bae6fd;
  border-radius: 7px;
  background: #f0f9ff;
  color: #0369a1;
}

.row-action:hover:not(:disabled) {
  border-color: #7dd3fc;
  background: #e0f2fe;
  box-shadow: none;
  transform: none;
}

.column-settings-button,
.field-chip {
  border-color: var(--line);
  border-radius: 7px;
}

.column-modal-backdrop,
.dispatch-modal-backdrop,
.share-config-backdrop,
.script-library-modal-backdrop,
.task-feedback-backdrop {
  background: rgba(15, 23, 42, .42);
  backdrop-filter: none;
}

.column-modal,
.dispatch-modal,
.share-config-modal,
.script-library-modal,
.task-feedback-modal {
  border-color: var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  animation: none;
}

.column-modal-head,
.dispatch-modal-head,
.share-config-head,
.rules-panel .panel-heading,
.table-template-panel .panel-heading,
.config-panel .panel-heading,
.models-panel .panel-heading,
.account-section-heading {
  border-bottom-color: var(--line);
  background: #f8fafc;
}

.settings-nav {
  border-color: var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
}

.settings-nav button.active {
  background: #eaf7fe;
  color: #0369a1;
}

.config-help {
  border-color: #bae6fd;
  border-radius: 8px;
  background: #f0f9ff;
  color: #075985;
}

.config-panel dl > .config-row:hover {
  background: #f8fafc;
}

.config-save.changed {
  border-color: #7dd3fc;
  background: #e0f2fe;
  color: #0369a1;
}

.task-output,
.log-output,
pre {
  border: 1px solid #1e293b;
  border-radius: 8px;
  background: #0f172a;
  color: #dbeafe;
  box-shadow: none;
}

.auth-screen {
  background: #f5f7fa;
}

.auth-panel {
  gap: 16px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 36px rgba(15, 23, 42, .10);
  backdrop-filter: none;
  animation: none;
}

.auth-panel h1 {
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.02em;
}

.auth-panel label > span {
  color: #475569;
  font-weight: 600;
}

.auth-error {
  border-color: #fecaca;
  border-radius: 8px;
  background: #fef2f2;
}

.cloud-drawer-shell .sidebar::after {
  border-right-color: #bae6fd;
  background: #eaf7fe !important;
}

.cloud-drawer-shell .sidebar:hover,
.cloud-drawer-shell .sidebar:focus-within {
  box-shadow: 8px 0 24px rgba(15, 23, 42, .10) !important;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  border-color: #f1f5f9;
  background: #cbd5e1;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

@media (max-width: 760px) {
  body { background: var(--bg); }

  .sidebar {
    border-bottom-color: var(--line);
    background: #fff;
    box-shadow: none;
  }

  .nav-list {
    border-top-color: var(--line);
    background: #fff;
    box-shadow: 0 -1px 0 var(--line);
    backdrop-filter: none;
  }

  .main-area {
    padding: 16px 12px calc(88px + env(safe-area-inset-bottom));
  }

  .panel,
  .toolbar {
    border-radius: 9px;
  }

  .panel { padding: 13px; }
}

/*
 * Product UI 2.0 — complete typography and card-system pass.
 * The scale follows contemporary product sites: 14px labels/copy, compact
 * 12–13px supporting text, display-weight page titles and tabular numerals.
 */
:root {
  --font-ui: "Segoe UI Variable Text", "Inter Variable", Inter, "SF Pro Text", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  --font-display: "Segoe UI Variable Display", "Inter Variable", Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei UI", system-ui, sans-serif;
  --font-mono: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --canvas: #f3f7fb;
  --card: #ffffff;
  --card-subtle: #f8fbfe;
  --card-muted: #f5f8fb;
  --border-card: #dce6f0;
  --border-soft: #e8eef5;
  --ink: #122033;
  --ink-secondary: #536579;
  --ink-tertiary: #7c8da0;
  --brand: #0b8fd8;
  --brand-hover: #0878bc;
  --brand-soft: #e9f6fd;
  --radius-control: 11px;
  --radius-card: 16px;
  --radius-card-lg: 20px;
  --shadow-card: 0 1px 2px rgba(23, 51, 79, .04), 0 8px 24px rgba(23, 51, 79, .06);
  --shadow-card-hover: 0 2px 4px rgba(23, 51, 79, .05), 0 12px 30px rgba(23, 51, 79, .08);
  --shadow-modal: 0 24px 70px rgba(15, 35, 55, .20);
}

html,
body,
button,
input,
select,
textarea {
  font-family: var(--font-ui);
}

body {
  background: var(--canvas);
  color: var(--ink);
  font-size: 14px;
  font-kerning: normal;
  font-optical-sizing: auto;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

h1,
h2,
h3,
.brand h1,
.topbar h2,
.metric-card strong,
.auth-panel h1 {
  font-family: var(--font-display);
}

small,
.topbar p,
.brand p,
.panel-heading > span,
.task-log-header span,
.metric-card small {
  color: var(--ink-tertiary);
  font-size: 12px;
  line-height: 1.5;
}

button,
.nav-item,
.tabs button,
thead th {
  font-size: 14px;
  letter-spacing: -.005em;
}

.app-shell {
  grid-template-columns: 248px minmax(0, 1fr);
  background: var(--canvas);
}

.sidebar {
  border-right: 1px solid var(--border-card);
  background: rgba(255, 255, 255, .98);
}

.brand {
  min-height: 88px;
  padding: 20px 18px;
  border-bottom-color: var(--border-soft);
}

.brand-mark,
.auth-heading > span {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: var(--brand);
  box-shadow: 0 7px 18px rgba(11, 143, 216, .22);
}

.brand h1 {
  color: var(--ink);
  font-size: 17px;
  font-weight: 720;
  line-height: 1.25;
}

.brand p {
  margin-top: 3px;
  font-size: 12px;
}

.nav-list {
  padding: 16px 12px;
}

.nav-item {
  min-height: 44px;
  margin-bottom: 5px;
  padding: 0 13px;
  border-radius: 12px;
  color: var(--ink-secondary);
  font-weight: 620;
}

.nav-item:hover {
  background: var(--card-muted);
  color: var(--ink);
}

.nav-item.active {
  background: var(--brand-soft);
  color: #066aa5;
  box-shadow: inset 0 0 0 1px rgba(11, 143, 216, .08);
}

.nav-item.active::before {
  display: none;
}

.sidebar-footer {
  padding: 14px 12px;
  border-top-color: var(--border-soft);
}

.sidebar-store-select select,
.account-badge,
.footer-settings-button {
  border-color: var(--border-card);
  border-radius: 12px;
  background: var(--card);
}

.account-badge {
  box-shadow: 0 1px 2px rgba(23, 51, 79, .04);
}

.main-area {
  padding: 28px clamp(22px, 2.5vw, 38px) 40px;
}

.topbar {
  min-height: 66px;
  margin-bottom: 22px;
}

.topbar h2 {
  color: var(--ink);
  font-size: clamp(25px, 2vw, 31px);
  font-weight: 740;
  line-height: 1.16;
  letter-spacing: -.035em;
}

.topbar p {
  margin-top: 6px;
  font-size: 13px;
}

.topbar-actions {
  gap: 8px;
}

.status-pill {
  min-height: 38px;
  padding-inline: 14px;
  border-color: var(--border-card);
  background: var(--card);
  box-shadow: 0 1px 2px rgba(23, 51, 79, .04);
  font-size: 13px;
  font-weight: 600;
}

.view-stack {
  gap: 20px;
}

.panel,
.toolbar,
.metric-card,
.settings-nav,
.account-management-panel,
.diagnostics-panel,
.browser-section,
.local-setup-panel,
.share-status-card,
.submit-mode-card {
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.panel,
.toolbar {
  padding: 18px;
}

.panel:hover,
.toolbar:hover {
  border-color: #d0deeb;
}

.metric-grid {
  gap: 14px;
}

.metric-card {
  min-height: 144px;
  padding: 19px;
  overflow: hidden;
}

.metric-card:hover {
  border-color: #c8daea;
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}

.metric-icon,
.readiness-icon,
.dispatch-target-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand);
}

.metric-card > span {
  margin-top: 13px;
  color: var(--ink-secondary);
  font-size: 13px;
  font-weight: 560;
}

.metric-card strong {
  margin-top: 5px;
  color: var(--ink);
  font-size: 30px;
  font-weight: 730;
  line-height: 1.12;
}

.metric-card small {
  margin-top: 6px;
}

.panel-heading {
  min-height: 28px;
  margin-bottom: 16px;
}

.panel-heading h3,
.account-section-heading h3,
.script-section-title,
.local-setup-step-title {
  color: var(--ink);
  font-size: 16px;
  font-weight: 680;
  line-height: 1.35;
  letter-spacing: -.015em;
}

.primary-button,
.icon-button,
.ghost-button,
.row-action,
.quick-actions button,
.pager button,
.app-update-button,
.soft-danger-button,
.status-toggle,
.mini-action {
  min-height: 38px;
  border-radius: var(--radius-control);
  font-size: 14px;
  font-weight: 620;
}

.primary-button {
  border-color: var(--brand);
  background: var(--brand);
  box-shadow: 0 4px 12px rgba(11, 143, 216, .20);
}

.primary-button:hover {
  border-color: var(--brand-hover);
  background: var(--brand-hover);
  box-shadow: 0 6px 16px rgba(8, 120, 188, .24);
  transform: translateY(-1px);
}

.ghost-button,
.icon-button,
.quick-actions button,
.pager button {
  border-color: var(--border-card);
  background: var(--card);
  color: var(--ink-secondary);
}

.ghost-button:hover,
.icon-button:hover,
.quick-actions button:hover,
.pager button:hover:not(:disabled) {
  border-color: #bcd2e5;
  background: var(--card-subtle);
  color: #075f97;
}

.ghost-button.danger,
.mini-action.danger,
.soft-danger-button {
  border-color: #fecaca;
  background: #fffafa;
  color: #c24141;
}

.toolbar,
.task-toolbar {
  gap: 12px;
  border-radius: var(--radius-card);
}

.tabs {
  gap: 2px;
  padding: 4px;
  border-radius: 12px;
  background: #eef3f8;
}

.tabs button {
  min-height: 34px;
  padding-inline: 15px;
  border-radius: 9px;
  color: #5c6d80;
  font-weight: 620;
}

.tabs button.active {
  background: #fff;
  color: #05689f;
  box-shadow: 0 1px 3px rgba(23, 51, 79, .12), inset 0 0 0 1px rgba(23, 51, 79, .04);
}

input,
select,
textarea,
.config-input,
.search-box,
.account-password-form input,
.account-create-row input,
.account-create-row select,
.account-table input,
.account-table select,
.browser-visibility-settings select {
  min-height: 40px;
  border-color: #cddae7;
  border-radius: var(--radius-control);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

textarea {
  padding: 11px 13px;
}

input::placeholder,
textarea::placeholder {
  color: #9aa9b8;
}

input:hover,
select:hover,
textarea:hover,
.search-box:hover,
.config-input:hover {
  border-color: #aebfd0;
}

input:focus,
select:focus,
textarea:focus,
.config-input:focus,
.search-box:focus-within {
  border-color: #38aee8;
  box-shadow: 0 0 0 3px rgba(11, 143, 216, .13);
}

.search-box {
  padding-inline: 12px;
}

.table-wrap,
.account-table-wrap,
.script-bundle-table,
.warning-table-wrap {
  overflow: hidden;
  border: 1px solid var(--border-card);
  border-radius: 13px;
  background: var(--card);
}

thead th,
.account-table th {
  height: 44px;
  padding-inline: 12px;
  border-bottom-color: var(--border-card);
  background: #f6f9fc;
  color: #56697d;
  font-size: 12px;
  font-weight: 670;
  letter-spacing: .018em;
}

tbody td,
.account-table td {
  padding-inline: 12px;
  border-bottom-color: var(--border-soft);
  color: #33475b;
  font-size: 13px;
  line-height: 1.45;
}

tbody tr:hover {
  background: #f7fbfe;
}

.selected-row,
tbody tr.selected-row:hover {
  background: #edf8fe;
  box-shadow: inset 3px 0 0 var(--brand);
}

.task-status,
.script-library-module-pill,
.script-module-pill,
.field-chip,
.status-toggle {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
}

.notice,
.task-error,
.account-notice,
.warning-message {
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
}

.readiness-summary,
.readiness-card,
.rule-block,
.model-mode-card,
.script-patch-card,
.empty-card,
.script-version-card,
.dispatch-target,
.diagnostic-card,
.browser-binding-option,
.local-setup-step,
.config-help,
.share-status-card,
.submit-mode-card {
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--card-subtle);
  box-shadow: none;
}

.readiness-card,
.dispatch-target,
.script-version-card,
.diagnostic-card,
.browser-binding-option,
.local-setup-step {
  padding: 15px;
}

.readiness-card:hover,
.dispatch-target:hover,
.script-version-card:hover,
.browser-binding-option:hover {
  border-color: #c6dced;
  background: #fff;
  box-shadow: 0 5px 16px rgba(23, 51, 79, .06);
  transform: none;
}

.settings-layout {
  gap: 18px;
}

.settings-nav {
  padding: 8px;
  border-radius: 16px;
}

.settings-nav button,
.settings-nav-item {
  min-height: 42px;
  border-radius: 11px;
  color: var(--ink-secondary);
  font-weight: 610;
}

.settings-nav button.active,
.settings-nav-item.active {
  background: var(--brand-soft);
  color: #066aa5;
}

.config-panel dl > .config-row,
.rule-row,
.account-current-strip,
.script-library-row {
  border-color: var(--border-soft);
  border-radius: 12px;
}

.config-panel dl > .config-row:hover,
.rule-row:hover,
.script-library-row:hover {
  background: var(--card-subtle);
}

.task-detail-grid {
  row-gap: 11px;
}

.task-detail-grid > span {
  color: var(--ink-tertiary);
  font-size: 12px;
}

.task-detail-grid > strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.task-log-panel {
  padding: 18px;
}

.task-log-header strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 680;
}

.task-output,
.log-output,
pre {
  border-color: #203247;
  border-radius: 12px;
  background: #101c2c;
  color: #dcecff;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
}

.column-modal-backdrop,
.dispatch-modal-backdrop,
.share-config-backdrop,
.script-library-modal-backdrop,
.task-feedback-backdrop {
  background: rgba(16, 31, 48, .48);
}

.column-modal,
.dispatch-modal,
.share-config-modal,
.script-library-modal,
.task-feedback-modal {
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: var(--radius-card-lg);
  background: #fff;
  box-shadow: var(--shadow-modal);
}

.column-modal-head,
.dispatch-modal-head,
.share-config-head,
.script-library-modal-head,
.task-feedback-head {
  border-bottom-color: var(--border-soft);
  background: #fff;
}

.auth-screen {
  background: #eff5fa;
}

.auth-panel {
  width: min(440px, calc(100vw - 28px));
  padding: 34px;
  border: 1px solid var(--border-card);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 2px 4px rgba(23, 51, 79, .05), 0 22px 60px rgba(23, 51, 79, .12);
}

.auth-panel h1 {
  font-size: 26px;
  font-weight: 740;
  line-height: 1.2;
}

.auth-panel label > span {
  color: var(--ink-secondary);
  font-size: 13px;
  font-weight: 620;
}

.auth-panel input,
.auth-panel .primary-button {
  min-height: 46px;
  border-radius: 12px;
}

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .main-area { padding-inline: 22px; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }

  .brand {
    min-height: 74px;
    padding: 14px 16px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 11px;
  }

  .main-area {
    padding: 18px 12px calc(92px + env(safe-area-inset-bottom));
  }

  .topbar {
    gap: 14px;
    margin-bottom: 18px;
  }

  .topbar h2 { font-size: 25px; }

  .metric-grid { gap: 10px; }

  .metric-card {
    min-height: 138px;
    padding: 16px;
    border-radius: 15px;
  }

  .metric-card strong { font-size: 27px; }

  .panel,
  .toolbar,
  .settings-nav {
    border-radius: 15px;
  }

  .panel,
  .toolbar { padding: 14px; }

  .nav-list {
    padding: 8px max(8px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom));
  }

  .nav-item {
    min-height: 48px;
    border-radius: 12px;
  }

  .auth-panel {
    padding: 28px 22px;
    border-radius: 18px;
  }
}

/*
 * Task list workspace — full-width queue followed by a balanced detail row.
 * The log and task detail share one grid row so both cards stretch to the
 * same height; the log viewport uses the available card height.
 */
.task-board {
  grid-template-columns: minmax(0, 1.62fr) minmax(360px, .62fr);
  grid-template-areas:
    "task-list task-list"
    "task-log task-detail";
  align-items: stretch;
}

.task-list-panel {
  grid-area: task-list;
  width: 100%;
}

.task-detail-panel {
  grid-area: task-detail;
  height: clamp(620px, 76vh, 840px);
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  align-self: stretch;
}

.task-log-panel {
  grid-area: task-log;
  display: flex;
  min-width: 0;
  height: clamp(620px, 76vh, 840px);
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
  align-self: stretch;
}

.task-log-panel .task-output,
.task-log-panel .task-log-empty {
  flex: 1 1 auto;
}

.task-log-panel .task-output {
  min-height: 0;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
}

@media (max-width: 1100px) {
  .task-board {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "task-list"
      "task-detail"
      "task-log";
    align-items: start;
  }

  .task-log-panel {
    height: min(68vh, 620px);
    min-height: 380px;
  }

  .task-detail-panel {
    height: auto;
    overflow: visible;
  }

  .task-log-panel .task-output {
    min-height: 0;
    max-height: none;
  }
}
