/* ==========================================================================
   千川自动化投放工作台 - 现代化企业级视觉设计系统 (v2.0.19)
   ========================================================================== */

:root {
  --control-height: 38px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  /* 背景层级 */
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-subtle-hover: #e2e8f0;

  /* 文字颜色 */
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;

  /* 边框线条 */
  --border-subtle: #f1f5f9;
  --border-default: #e2e8f0;
  --border-hover: #cbd5e1;
  --border-focus: #3b82f6;

  /* 品牌与侧边栏 */
  --brand-navy-900: #0f172a;
  --nav-bg-start: #0f172a;
  --nav-bg-end: #1e293b;
  --nav-text: #94a3b8;
  --nav-text-hover: #f8fafc;
  --nav-active-bg: rgba(37, 99, 235, 0.16);
  --nav-active-text: #ffffff;
  --nav-active-border: #38bdf8;

  /* 主色调：现代科技蓝 */
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;

  /* 状态颜色 */
  --green-50: #ecfdf5;
  --green-500: #10b981;
  --green-600: #059669;
  --green-700: #047857;

  --amber-50: #fffbeb;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-700: #b45309;

  --red-50: #fef2f2;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --red-700: #b91c1c;

  /* 阴影 */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.07), 0 1px 2px -1px rgba(0, 0, 0, 0.07);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.12);

  /* 圆角规范 */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
}

/* 基础重置 */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* 布局骨架 */
.shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
}

/* ==========================================================================
   侧边导航栏 (Sidebar)
   ========================================================================== */
.sidebar {
  background: linear-gradient(180deg, var(--nav-bg-start) 0%, var(--nav-bg-end) 100%);
  color: var(--nav-text);
  padding: 20px 14px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
  z-index: 10;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #ffffff;
  text-decoration: none;
  padding: 0 8px 24px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 18px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.brand span {
  display: flex;
  flex-direction: column;
}

.brand strong {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #38bdf8;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 2px;
}

nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  margin-bottom: 12px;
}

nav a {
  color: var(--nav-text);
  text-decoration: none;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.15s ease;
  position: relative;
  flex-shrink: 0;
}

nav a .icon {
  font-size: 15px;
  width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.9;
}

nav a span:last-child {
  flex: 1;
  text-align: left;
  white-space: nowrap;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
}

nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--nav-text-hover);
}

nav a.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
  font-weight: 600;
}

nav a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--nav-active-border);
  border-radius: 0 3px 3px 0;
}

.sidebar-foot {
  margin-top: auto;
  padding: 16px 10px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #64748b;
  font-size: 12px;
}

.sidebar-foot #connection {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #94a3b8;
  font-weight: 500;
}

.sidebar-foot #connection::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-500);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.sidebar-foot small {
  display: block;
  margin-top: 6px;
  color: #475569;
  font-size: 11px;
}

/* ==========================================================================
   工作区与顶部栏 (Workspace & Topbar)
   ========================================================================== */
.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 64px;
  border-bottom: 1px solid var(--border-default);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 9;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid transparent;
}

.mode-badge.observe {
  background: var(--amber-50);
  color: var(--amber-700);
  border-color: var(--amber-500);
}

.mode-badge.live {
  background: var(--green-50);
  color: var(--green-700);
  border-color: var(--green-500);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber-600);
}

.status-dot.live {
  background: var(--green-500);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
  animation: pulse-dot 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.15); }
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================================================
   主内容区域 (Main Content)
   ========================================================================== */
main {
  padding: 20px 24px;
  max-width: 100%;
  width: 100%;
  margin: 0;
  box-sizing: border-box;
  flex: 1;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}

.page-head h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: 0 0 6px;
}

.page-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13.5px;
}

/* ==========================================================================
   卡片与面板 (Panels & Cards)
   ========================================================================== */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.panel:hover {
  border-color: var(--border-hover);
}

.panel-title {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #fafbfc;
}

.panel-title h2 {
  font-size: 15.5px;
  font-weight: 650;
  color: var(--text-primary);
  margin: 0;
}

.panel-title a {
  color: var(--blue-600);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

.panel-title a:hover {
  text-decoration: underline;
}

.panel-body {
  padding: 24px;
}

/* ==========================================================================
   指标看板 (Metrics Grid)
   ========================================================================== */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-xs);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.metric:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.metric span {
  display: block;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  margin-bottom: 8px;
}

.metric strong {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.metric small {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 4px;
}

/* ==========================================================================
   按钮系统 (Buttons)
   ========================================================================== */
button, .btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 7px 14px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-xs);
  text-decoration: none;
  white-space: nowrap;
}

button:hover, .btn:hover {
  border-color: var(--border-hover);
  background: var(--bg-subtle);
  color: var(--text-primary);
}

button:active, .btn:active {
  transform: translateY(1px);
}

button:disabled, .btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

button.primary, .btn.primary {
  background: var(--blue-600);
  border-color: var(--blue-600);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.25);
}

button.primary:hover, .btn.primary:hover {
  background: var(--blue-700);
  border-color: var(--blue-700);
  color: #ffffff;
}

button.quiet, .btn.quiet {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

button.quiet:hover, .btn.quiet:hover {
  background: var(--bg-subtle);
  border-color: var(--border-subtle);
}

button.danger, button.bad, .btn.danger {
  color: var(--red-600);
}

button.danger:hover, button.bad:hover, .btn.danger:hover {
  background: var(--red-50);
  border-color: var(--red-500);
  color: var(--red-700);
}

/* ==========================================================================
   分段标签页 (Tabs)
   ========================================================================== */
.tabs {
  display: inline-flex;
  background: #f1f5f9;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 4px;
  gap: 4px;
  margin-bottom: 20px;
}

.tabs button {
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: var(--radius-md);
  padding: 6px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  min-height: 32px;
}

.tabs button:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.5);
}

.tabs button.active {
  background: #ffffff;
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-default);
  padding-bottom: 8px;
  margin-bottom: 18px;
}

.tabs-nav .tab-btn {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-md);
}

.tabs-nav .tab-btn.active {
  background: var(--blue-50);
  color: var(--blue-600);
  font-weight: 600;
}

/* ==========================================================================
   工具栏与表单控件 (Toolbar & Form Controls)
   ========================================================================== */
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 18px;
}

.toolbar input[type="search"] {
  max-width: 320px;
  flex: 1;
  min-width: 180px;
}

.toolbar select {
  width: auto;
  min-width: 150px;
}

.toolbar .grow {
  flex: 1;
}

input[type="text"],
input[type="search"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="password"],
select,
textarea {
  font-family: inherit;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  padding: 7px 12px;
  min-height: 34px;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-xs);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

label.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 550;
  color: var(--text-secondary);
}

label.field input,
label.field select,
label.field textarea {
  font-weight: normal;
}

.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px 20px;
  margin-bottom: 20px;
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.check-inline input[type="checkbox"],
.check-inline input[type="radio"] {
  margin: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--blue-600);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 24px;
  padding-top: 18px;
}

.form-error {
  background: var(--red-50);
  border: 1px solid var(--red-500);
  color: var(--red-700);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.6;
}

.form-error:empty {
  display: none;
}

.help, p.help {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 6px 0 0;
}

/* ==========================================================================
   表格系统 (Tables)
   ========================================================================== */
.table-wrap {
  overflow-x: auto;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

dialog:has(.history-snapshot) {width:min(1280px,calc(100vw - 48px));max-width:calc(100vw - 48px);}
dialog:has(.history-snapshot) #dialog-body {padding:20px 24px;max-height:calc(90vh - 100px);}
.history-snapshot {min-width:0;}
.history-snapshot .tablewrap {overflow:auto;border:1px solid var(--border-default);border-radius:10px;}
.history-snapshot table {width:100%;min-width:760px;font-variant-numeric:tabular-nums;}
.history-snapshot th,.history-snapshot td {padding:10px 14px;}
.history-snapshot th:not(:first-child),.history-snapshot td:not(:first-child){text-align:right;}
.history-snapshot th:first-child {min-width:215px;}
.history-snapshot td:first-child strong {font-size:13px;}
.history-snapshot td:first-child small {font-size:11px;color:var(--text-muted);}
.history-snapshot .history-detail-account-row:hover td {background:#eff6ff;}
.history-snapshot .history-detail-account-row:focus-within td {background:#eff6ff;}
.history-snapshot-filters {background:#f8fafc;border:1px solid var(--border-default);border-radius:10px;padding:14px;margin:18px 0;}
.history-snapshot-filters input,.history-snapshot-filters select {min-width:0;max-width:100%;height:36px;}
.history-detail-button {color:#1d4ed8;background:#eff6ff;border:1px solid #bfdbfe;border-radius:7px;padding:7px 12px;white-space:nowrap;}
.history-detail-button:hover {background:#dbeafe;border-color:#60a5fa;}
@media(max-width:800px){dialog:has(.history-snapshot){width:calc(100vw - 20px);max-width:calc(100vw - 20px);}dialog:has(.history-snapshot) #dialog-body{padding:14px;}.history-snapshot-filters>div>div{min-width:0!important;flex-basis:100%!important;}.history-snapshot h3{font-size:14px;}}

/* Material workspace: keep all actions reachable at laptop widths. */
.material-filters {display:flex;flex-wrap:wrap;gap:12px;align-items:center;margin-bottom:20px;}
.material-filters label {min-width:0;}
.material-filters select {max-width:240px;}
.material-filters #material-search {flex:1 1 200px;min-width:160px;max-width:300px;}
.material-date-filters {display:flex;flex-wrap:wrap;align-items:center;gap:8px;}
.material-date-filters .backfill-date-buttons {display:flex;flex-wrap:wrap;gap:6px;}
.material-results .table-wrap {max-height:calc(100vh - 300px);min-height:200px;overflow:auto;scrollbar-gutter:stable;}
.material-results table {table-layout:fixed;min-width:1180px;width:100%;}
.material-results th,.material-results td {padding:12px 10px;white-space:normal;overflow-wrap:anywhere;line-height:1.5;}
.material-results th {position:sticky;top:0;z-index:2;}
.material-results th .quiet {padding:4px 0;font-size:12px;text-align:left;white-space:normal;}
.material-results td.name {min-width:0;max-width:none;}
.material-results td strong {display:block;}
.material-results td br {display:none;}
.material-results td code {display:block;margin-top:5px;font-variant-numeric:tabular-nums;letter-spacing:-.4px;}
.material-results th:nth-child(1) {width:12%;}
.material-results th:nth-child(2) {width:14%;}
.material-results th:nth-child(3) {width:18%;}
.material-results th:nth-child(4) {width:7%;}
.material-results th:nth-child(5) {width:9%;}
.material-results th:nth-child(6) {width:7%;}
.material-results th:nth-child(7) {width:10%;}
.material-results th:nth-child(8),.material-results th:nth-child(9) {width:8%;}
.material-results th:nth-child(10) {width:7%;}
.material-results td:nth-child(10),.material-results th:nth-child(10) {position:sticky;right:0;background:#fff;box-shadow:-3px 0 8px #1325440a;}
.material-results th:nth-child(10) {z-index:3;background:#f8fafc;}
.material-results td:nth-child(10) button {padding:5px 0;white-space:nowrap;}
@media(max-width:1450px){.material-date-filters{flex-basis:100%;justify-content:flex-end;}.material-filters #material-search{margin-left:auto;}.material-results .table-wrap{max-height:calc(100vh - 340px);}}
@media(max-width:800px){.material-filters>label{flex:1 1 100%;}.material-filters select{flex:1;max-width:100%;min-width:0!important;}.material-filters #material-search{max-width:none;flex-basis:100%;}.material-date-filters{justify-content:flex-start;}.material-results .table-wrap{max-height:65vh;}}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  white-space: nowrap;
}

th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: #f8fafc;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-default);
  letter-spacing: 0.02em;
}

td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-secondary);
  transition: background 0.1s ease;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #f8fafc;
}

td.name {
  white-space: normal;
  min-width: 200px;
  max-width: 340px;
}

td.name strong {
  display: block;
  color: var(--text-primary);
  font-weight: 600;
}

td .secondary {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 3px;
  font-family: var(--font-mono);
}

td.wrap {
  white-space: normal;
  min-width: 220px;
  max-width: 460px;
  line-height: 1.6;
}

/* ==========================================================================
   徽章与标签 (Pills / Badges)
   ========================================================================== */
.pill {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 550;
  border-radius: var(--radius-full);
  padding: 3px 9px;
  background: #edf2f8;
  color: #475569;
  border: 1px solid #e2e8f0;
  line-height: 1.3;
  white-space: nowrap;
}

.pill.good {
  background: var(--green-50);
  color: var(--green-700);
  border-color: var(--green-500);
}

.pill.bad {
  background: var(--red-50);
  color: var(--red-700);
  border-color: var(--red-500);
}

.pill.wait {
  background: var(--amber-50);
  color: var(--amber-700);
  border-color: var(--amber-500);
}

.pill.info {
  background: var(--blue-50);
  color: var(--blue-700);
  border-color: var(--blue-100);
}

/* ==========================================================================
   空状态美化 (Rich Empty States)
   ========================================================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 56px 24px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: #f1f5f9;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.04);
}

.empty-state-title {
  font-size: 16px;
  font-weight: 650;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-state-desc {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 420px;
  line-height: 1.6;
  margin-bottom: 18px;
}

.empty-state-action {
  margin-top: 4px;
}

.loading {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 24px;
  font-size: 13.5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.loading::before {
  content: "";
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-default);
  border-top-color: var(--blue-600);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 通知框 */
.notice {
  border-left: 3px solid var(--amber-500);
  background: var(--amber-50);
  color: var(--amber-700);
  padding: 12px 18px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  line-height: 1.7;
  margin-bottom: 20px;
  font-size: 13px;
}

.notice.info {
  border-color: var(--blue-500);
  background: var(--blue-50);
  color: var(--blue-700);
}

/* ==========================================================================
   账户列表卡片 (Account Cards)
   ========================================================================== */
.account-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.account-item {
  padding: 22px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
}

.account-item:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.account-item h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 650;
  color: var(--text-primary);
}

.account-item .muted {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.account-item .subtle {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-top: 4px;
}

.account-item .toolbar {
  margin-top: 18px;
  margin-bottom: 0;
}

/* ==========================================================================
   弹窗组件 (Dialog / Modals)
   ========================================================================== */
dialog {
  border: 0;
  border-radius: var(--radius-xl);
  padding: 0;
  width: min(840px, 94vw);
  max-height: 90vh;
  box-shadow: var(--shadow-xl);
  color: inherit;
  background: var(--bg-surface);
  overflow: hidden;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
}

dialog > header {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-default);
  padding: 20px 26px;
}

dialog > header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

dialog > header p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 4px 0 0;
}

dialog button.icon {
  font-size: 20px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-muted);
}

dialog button.icon:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

#dialog-body {
  padding: 24px 26px;
  max-height: calc(90vh - 80px);
  overflow-y: auto;
}

/* 预设卡片选择器 */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.preset-card {
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  cursor: pointer;
  background: var(--bg-surface);
  transition: all 0.15s ease;
  text-align: left;
}

.preset-card:hover {
  border-color: var(--blue-500);
  background: var(--blue-50);
}

.preset-card.active {
  border-color: var(--blue-600);
  background: var(--blue-50);
  box-shadow: 0 0 0 1px var(--blue-600);
}

.preset-card strong {
  display: block;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.preset-card p {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* 提示浮层 */
#toast {
  position: fixed;
  right: 28px;
  bottom: 28px;
  background: var(--brand-navy-900, #0f172a);
  color: #ffffff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  max-width: 520px;
  width: auto;
  z-index: 100000;
  display: none;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  animation: slide-up 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#toast.visible {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

#toast .toast-icon {
  flex-shrink: 0;
  font-size: 15px;
  margin-top: 1px;
}

#toast .toast-content {
  flex: 1;
  word-break: break-word;
  white-space: pre-wrap;
}

#toast .toast-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  padding: 2px 4px;
  font-size: 16px;
  line-height: 1;
  border-radius: 3px;
  flex-shrink: 0;
}

#toast .toast-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.2);
}

@keyframes slide-up {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* 辅助与代码 */
.mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.muted {
  color: var(--text-muted);
}

details {
  margin-top: 16px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  background: #fafbfc;
}

summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--blue-600);
  user-select: none;
}

footer {
  font-size: 11.5px;
  color: var(--text-subtle);
  padding: 12px 32px 24px;
  text-align: center;
}

/* ==========================================================================
   响应式断点适配 (Responsive Media Queries)
   ========================================================================== */
@media (max-width: 1140px) {
  .shell {
    grid-template-columns: 200px minmax(0, 1fr);
  }
  main {
    padding: 24px;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .shell {
    display: block;
  }
  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }
  .topbar {
    height: auto;
    padding: 14px 16px;
    flex-wrap: wrap;
  }
  main {
    padding: 16px;
  }
  .metrics {
    grid-template-columns: 1fr;
  }
}


/* ==========================================================================
   图2风格：经营数据首页、侧边栏性能监控与核心指标看板 (Dashboard v2.0.16)
   ========================================================================== */

/* PRO 标志与品牌副标题 */
.brand-block {
  margin-bottom: 12px;
}
.brand-text {
  display: flex;
  flex-direction: column;
}
.brand-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}
.badge-pro {
  display: inline-block;
  background: rgba(6, 182, 212, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.2;
}
.brand-sub {
  font-size: 11px;
  color: #64748b;
  font-weight: 400;
  margin-top: 3px;
}

.sidebar-spacer {
  flex: 1;
}

/* 侧边栏底部性能卡片 */
.sidebar-perf-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.perf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.perf-title {
  font-size: 11.5px;
  font-weight: 600;
  color: #94a3b8;
}
.perf-time {
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: #64748b;
}
.perf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}
.perf-item {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  padding: 6px 8px;
}
.perf-lbl {
  font-size: 10px;
  color: #94a3b8;
  display: block;
  white-space: nowrap;
}
.perf-val {
  font-size: 12px;
  font-weight: 600;
  color: #f1f5f9;
  font-family: var(--font-mono);
  display: block;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.perf-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.perf-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 500;
  color: #10b981;
}
.perf-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.7);
  flex-shrink: 0;
}
.perf-meta {
  font-size: 10px;
  color: #64748b;
}

/* 顶部栏标题与状态 */
.top-title-area {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#top-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
}
#top-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}
.conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 9999px;
  padding: 4px 12px;
  font-size: 12px;
  color: #059669;
  font-family: var(--font-mono);
  font-weight: 500;
}
.conn-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
  flex-shrink: 0;
}

/* 经营数据过滤条 */
.overview-filter-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
}
.filter-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.quick-tabs {
  display: inline-flex;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
  border: 1px solid var(--border-default);
}
.quick-tab-btn {
  border: none;
  background: transparent;
  padding: 5px 14px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}
.quick-tab-btn.active {
  background: var(--bg-surface);
  color: var(--blue-600);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}
.filter-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}
.filter-field input[type="date"],
.filter-field select {
  padding: 5px 10px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-mono);
  background: var(--bg-surface);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s ease;
}
.filter-field input[type="date"]:focus,
.filter-field select:focus {
  border-color: var(--blue-500);
}
.btn-compare-apply {
  background: var(--blue-600);
  color: #ffffff;
  border: none;
  padding: 6px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-compare-apply:hover {
  background: var(--blue-700);
}
.btn-compare-update {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-compare-update:hover {
  background: var(--bg-subtle-hover);
  border-color: var(--border-hover);
}
.overview-subtext {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.overview-subtext strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* 6核心指标卡片 */
.metrics-grid-6 {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.kpi-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}
.kpi-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.kpi-value {
  font-size: 21px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.kpi-compare-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  padding-top: 6px;
}
.cmp-label {
  color: var(--text-subtle);
}
.cmp-val {
  font-family: var(--font-mono);
  color: var(--text-secondary);
}
.delta-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
}
.delta-pos {
  color: #059669;
  background: rgba(16, 185, 129, 0.1);
}
.delta-neg {
  color: #dc2626;
  background: rgba(239, 68, 68, 0.1);
}
.delta-neutral {
  color: #64748b;
  background: rgba(100, 116, 139, 0.08);
}

/* 3趋势图表网格 */
.charts-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.chart-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.legend-dot.current {
  background: #0284c7;
}
.legend-dot.compare {
  background: #94a3b8;
}
.chart-svg-container {
  position: relative;
  width: 100%;
  height: 165px;
}
.chart-svg-container svg {
  width: 100%;
  height: 100%;
  display: block;
}
.chart-tooltip {
  position: absolute;
  z-index: 30;
  background: rgba(15, 23, 42, 0.94);
  color: #ffffff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  line-height: 1.4;
  white-space: nowrap;
}
.chart-tooltip b {
  display: block;
  font-size: 11px;
  color: #38bdf8;
  margin-bottom: 2px;
}

/* 账户今日明细表卡片 */
.overview-table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  margin-bottom: 16px;
}
.overview-table-card .panel-title {
  margin-bottom: 14px;
}
.account-perf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.account-perf-table th {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}
.account-perf-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}
.account-perf-table tr:hover td {
  background: #fafbfc;
}
.btn-collect-profit {
  padding: 3px 10px;
  font-size: 11.5px;
  background: var(--blue-50);
  color: var(--blue-600);
  border: 1px solid var(--blue-200);
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-collect-profit:hover {
  background: var(--blue-100);
  border-color: var(--blue-500);
}

@media (max-width: 1380px) {
  .metrics-grid-6 {
    grid-template-columns: repeat(3, 1fr);
  }
  .charts-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   旧版复刻与全量重构增强样式 (9 大核心项)
   ========================================================================== */

/* 1. 执行监控 4 核心指标卡 & 节点状态条 (图 2) */
.job-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.job-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
}
.job-stat-card .job-stat-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.job-stat-card .job-stat-num {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  font-feature-settings: "tnum";
  line-height: 1.2;
}
.job-stat-card .job-stat-sub {
  font-size: 11.5px;
  color: var(--text-subtle);
  margin-top: 6px;
}

.node-timeline-strip {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.node-timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.node-timeline-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.node-timeline-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.node-chips-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.node-chip {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: default;
  white-space: nowrap;
}
.node-chip.active {
  background: var(--blue-50);
  border-color: var(--blue-500);
  color: var(--blue-700);
  font-weight: 600;
}
.node-chip .badge {
  background: rgba(0,0,0,0.06);
  padding: 1px 5px;
  border-radius: 10px;
  font-size: 10.5px;
}
.node-chip.active .badge {
  background: var(--blue-200);
  color: var(--blue-800);
}

/* 2. 历史每日数据与月度汇总卡片 (图 6) */
.history-monthly-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 14px 0 16px;
}
.history-kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-xs);
}
.history-kpi-card .lbl {
  font-size: 12.5px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}
.history-kpi-card .val {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  font-feature-settings: "tnum";
}

/* 3. 系统设置 9 大分类 (图 7) */
.settings-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.settings-category-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 2px solid var(--border-subtle);
  overflow-x: auto;
  padding-bottom: 2px;
  margin-bottom: 16px;
}
.settings-category-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.settings-category-btn:hover {
  color: var(--text-primary);
  background: var(--bg-subtle);
}
.settings-category-btn.active {
  color: var(--blue-600);
  border-bottom-color: var(--blue-600);
  font-weight: 600;
  background: transparent;
}
.settings-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-xs);
}
.settings-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px 24px;
}

/* 4. 历史补采工作台 (Item 9) */
.backfill-wizard-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-xs);
}
.backfill-step-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.backfill-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--blue-600);
  color: #fff;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.backfill-plans-grid {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  background: var(--bg-subtle);
  margin-bottom: 16px;
}
.backfill-date-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.backfill-date-btn {
  padding: 6px 14px;
  font-size: 12.5px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.backfill-date-btn.active {
  background: var(--blue-50);
  border-color: var(--blue-600);
  color: var(--blue-600);
  font-weight: 600;
}
.backfill-preview-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 16px 0;
  font-size: 13px;
}

/* 5. 素材分时记录弹窗 (图 4) */
.interval-stat-summary {
  display: flex;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
}
.interval-stat-item {
  display: flex;
  flex-direction: column;
}
.interval-stat-item .val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ==========================================================================
   2.0.16 现场九项需求增强样式 (N01 - N09)
   ========================================================================== */

/* 顶部正在运行任务胶囊 (N03) */
.active-tasks-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  transition: all 0.15s ease;
}
.active-tasks-pill:hover {
  background: #dcfce7;
  border-color: #86efac;
}
.active-tasks-pill.running {
  background: #eff6ff;
  color: #1e40af;
  border-color: #bfdbfe;
}
.active-tasks-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2563eb;
  animation: pulse-dot 1.4s infinite ease-in-out;
}
@keyframes pulse-dot {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

/* 经营数据趋势图 Hover Tooltip (N02) */
.chart-svg-container {
  position: relative;
}
.chart-tooltip {
  position: absolute;
  top: 10px;
  right: 12px;
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  line-height: 1.4;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  z-index: 20;
  min-width: 140px;
}
.chart-tooltip-time {
  font-weight: 700;
  color: #93c5fd;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 2px;
}
.chart-tooltip-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0;
}
.chart-tooltip-item .lbl {
  color: #cbd5e1;
}
.chart-tooltip-item .val {
  font-weight: 600;
  font-family: var(--font-mono);
}

/* 24 小时整点数据采集看板 (N06) */
.hourly-kanban-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-top: 18px;
  box-shadow: var(--shadow-xs);
}
.hourly-kanban-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.hourly-kanban-title {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.hourly-kanban-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 8px;
}
@media (max-width: 1200px) {
  .hourly-kanban-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}
@media (max-width: 768px) {
  .hourly-kanban-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.hourly-slot-card {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 8px;
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  transition: all 0.15s ease;
}
.hourly-slot-card:hover {
  background: var(--bg-surface);
  border-color: var(--blue-500);
  box-shadow: var(--shadow-xs);
}
.hourly-slot-card.status-success {
  border-color: #bbf7d0;
  background: #f0fdf4;
}
.hourly-slot-card.status-partial {
  border-color: #fef08a;
  background: #fefce8;
}
.hourly-slot-card.status-failed {
  border-color: #fecaca;
  background: #fef2f2;
}
.hourly-slot-card.status-running {
  border-color: #bfdbfe;
  background: #eff6ff;
}
.hourly-slot-time {
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
}
.hourly-slot-status {
  font-weight: 500;
  font-size: 11px;
}
.hourly-slot-cov {
  color: var(--text-muted);
  font-size: 10.5px;
}
.hourly-slot-btn {
  margin-top: 2px;
  padding: 2px 6px;
  font-size: 10.5px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  cursor: pointer;
  text-align: center;
}
.hourly-slot-btn:hover {
  background: var(--blue-50);
  border-color: var(--blue-500);
  color: var(--blue-600);
}

/* 素材卡片徽章 (N07) */
.material-meta-badges {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.meta-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}
.meta-badge.account {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}
.meta-badge.plan {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

/* 执行明细全量查询与导出 (N09) */
.execution-logs-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
}
.execution-logs-tabs {
  display: flex;
  gap: 4px;
}
.execution-tab-btn {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: var(--bg-subtle);
  font-size: 12.5px;
  cursor: pointer;
  color: var(--text-secondary);
}
.execution-tab-btn.active {
  background: var(--blue-600);
  color: #ffffff;
  border-color: var(--blue-600);
  font-weight: 600;
}
.execution-logs-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

/* 进度条与未定进度 (R216-03) */
.progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: var(--bg-subtle, #f1f5f9);
  border-radius: 4px;
  overflow: hidden;
  margin: 12px 0;
}
.progress-bar {
  height: 100%;
  background: var(--blue-600, #2563eb);
  border-radius: 4px;
  transition: width 0.3s ease;
}
.progress-bar.indeterminate {
  background: linear-gradient(90deg, #3b82f6 25%, #60a5fa 50%, #3b82f6 75%);
  background-size: 200% 100%;
  animation: progress-indeterminate 1.8s infinite linear;
}
@keyframes progress-indeterminate {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}




/* 2.0.37: modal feedback, compact actions, bounded chart tooltips */
.dialog-toast {display:none;padding:12px 18px;margin:0 18px;background:#fff1f2;color:#9f1239;border:1px solid #fecdd3;border-radius:6px;overflow-wrap:anywhere;}
.dialog-toast.visible {display:flex;gap:10px;align-items:flex-start;}
.dialog-toast .toast-content {flex:1;min-width:0;}
.row-actions {display:inline-flex;flex-wrap:nowrap;gap:8px;align-items:center;white-space:nowrap;}
td.actions .row-actions button {display:inline-flex;margin:0;font-family:inherit;align-items:center;min-height:30px;white-space:nowrap;}
.chart-card,.chart-svg-container {min-width:0;max-width:100%;}
.chart-svg-container .chart-tooltip {right:auto;top:auto;min-width:0;box-sizing:border-box;white-space:normal;pointer-events:none;}
.chart-tooltip-item {gap:8px;}
main,#main,.main-content,.table-wrap,.tablewrap {min-width:0;max-width:100%;}
.tablewrap {overflow-x:auto;}

#job-message {white-space:pre-wrap;overflow-wrap:anywhere;max-height:280px;overflow:auto;}

#plans-subtab-container .panel {overflow-x:auto;max-width:100%;}

.dialog-toast[data-kind="success"] {background:#ecfdf5;color:#065f46;border-color:#a7f3d0;}
.dialog-toast[data-kind="info"] {background:#eff6ff;color:#1e40af;border-color:#bfdbfe;}

/* Account plan controls fit within the management dialog. */
.account-plans-table { width:100%; table-layout:fixed; min-width:0; }
.account-plans-table th,.account-plans-table td { padding:12px 10px; min-width:0; white-space:normal; overflow-wrap:anywhere; }
.account-plans-table td.actions { width:auto; min-width:0; }
.account-plans-table .row-actions { display:flex; justify-content:flex-start; gap:0; }
.account-plans-table .btn-drawer-edit { margin-top:6px; font-size:12px; padding:3px 8px; }
.account-plans-table td code { font-size:10px !important; }

.material-filters { display:flex; align-items:center; flex-wrap:nowrap; gap:10px; }
.material-filters label { flex-shrink:0; }
.template-plan-filter { display:flex;align-items:center;gap:8px;flex-wrap:wrap; }
.template-plan-search { display:flex;align-items:center;gap:9px;width:310px;max-width:100%;height:38px;padding:0 12px;background:#fff;border:1px solid #cbd5e1;border-radius:8px;color:#64748b;box-shadow:0 1px 2px #0f172a08; }
.template-plan-search:focus-within { border-color:#2563eb;box-shadow:0 0 0 3px #2563eb15; }
.template-plan-search input { width:100%;min-width:0;padding:0;border:0;background:transparent;outline:none;box-shadow:none;font:inherit;font-size:13px; }
.template-plan-filter button { height:38px;padding:0 16px;white-space:nowrap; }
@media(max-width:700px) { .template-plan-search { width:100%; } .template-plan-filter { width:100%; } }
.material-filters #material-plan { min-width:160px !important; max-width:220px; }
.material-filters #material-search { min-width:160px; max-width:260px; flex:1; }
.material-date-filters { display:flex; flex-direction:column; align-items:flex-end; gap:4px; flex-shrink:0; }
.material-date-filters #material-preset-group { display:flex; flex-wrap:nowrap; gap:6px; }
.material-date-filters .backfill-date-btn { white-space:nowrap; padding:6px 10px; }
@media(max-width:1400px) { .material-filters { flex-wrap:wrap; } .material-date-filters { margin-left:auto; } }

.charts-grid-4 {grid-template-columns:repeat(4,minmax(0,1fr));}
.charts-grid-4 .chart-header {flex-wrap:wrap;gap:6px;}
@media(max-width:1200px){.charts-grid-4{grid-template-columns:repeat(2,minmax(0,1fr));}}
@media(max-width:700px){.charts-grid-4{grid-template-columns:1fr;}}

/* UI UX Pro Max review: consistent desktop data-workspace controls. */
:where(button,a,input,select,textarea):focus-visible {outline:3px solid #93c5fd;outline-offset:3px;}
button {cursor:pointer;}
button:disabled {cursor:not-allowed;}
#main .toolbar {gap:10px;row-gap:12px;align-items:center;}
#main input:not([type=checkbox]):not([type=radio]),#main select {min-height:var(--control-height);border-color:#cbd5e1;}
#main input::placeholder {color:#64748b;}
#main .panel {border-color:#dce4ef;box-shadow:0 1px 3px #0f172a05;}
#main th {color:#475569;letter-spacing:0;}
#main td {font-variant-numeric:tabular-nums;}
#main .subtle {color:#64748b;}
.chart-card {padding:18px;border-color:#dce4ef;}
.chart-header {align-items:flex-start;gap:12px;}
.chart-title {font-size:14px;line-height:1.5;}
.chart-legend {gap:10px;flex-wrap:wrap;font-size:12px;}
.history-snapshot .history-detail-account-row {transition:background-color .15s;}
.history-snapshot-filters {position:relative;}
.history-snapshot td {line-height:1.6;}
dialog > header {border-bottom:1px solid #e2e8f0;}
dialog button.icon {min-width:36px;min-height:36px;}
.material-results td {vertical-align:middle;}
.material-results tbody tr:nth-child(even) td {background-color:#fafcff;}
.material-results tbody tr:hover td {background-color:#eff6ff;}
.material-results td:nth-child(10) {border-left:1px solid #e2e8f0;}
@media(max-width:900px){#main .toolbar{flex-wrap:wrap;}.chart-card{padding:14px;}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;transition-duration:.01ms!important;}}

/* 节点详情：身份固定、结果优先、阶段按需展开。 */
.execution-detail { max-height: 65vh; overflow-y: auto; overflow-x: hidden; padding-right: 6px; overflow-wrap: anywhere; }
.execution-result { background: var(--bg-subtle); border: 1px solid var(--border-default); border-radius: 12px; padding: 18px; }
.execution-result-heading, .execution-identity, .execution-step-heading, .execution-stage-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.execution-result-heading h3 { margin: 0 0 6px; font-size: 18px; }
.execution-result-heading code, .execution-identity, .execution-timeline time { font-size: 12px; color: var(--text-muted); }
.execution-identity { justify-content: flex-start; margin-top: 12px; }
.execution-result-reason { margin: 14px 0; line-height: 1.7; }
.execution-result-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; border-top: 1px solid var(--border-default); padding-top: 14px; }
.execution-result-metrics span { font-size: 12px; color: var(--text-muted); }
.execution-result-metrics strong { display: block; margin-top: 5px; color: var(--text-primary); font-size: 14px; }
.execution-stage-heading { margin: 20px 0 12px; }
.execution-stage-heading h4 { margin: 0; }
.execution-stage-heading span { font-size: 12px; color: var(--text-muted); }
.execution-stage { border: 1px solid var(--border-default); border-radius: 10px; margin: 10px 0; background: var(--bg-surface); }
.execution-stage summary { padding: 14px; cursor: pointer; }
.execution-stage summary span { margin-left: 14px; font-size: 12px; color: var(--text-muted); }
.execution-stage summary:focus-visible, .execution-raw summary:focus-visible { outline: 2px solid var(--blue-500, #3b82f6); outline-offset: 2px; }
.execution-timeline { list-style: none; padding: 0 16px 0 28px; margin: 0 0 16px; }
.execution-timeline li { position: relative; padding: 4px 0 18px 18px; border-left: 2px solid var(--border-default); font-size: 13px; line-height: 1.7; }
.execution-timeline li::before { content: ''; position: absolute; left: -5px; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.execution-step-heading { justify-content: flex-start; gap: 8px; }
.execution-timeline time { display: block; margin: 4px 0; }
.execution-timeline p { margin: 6px 0; white-space: pre-wrap; }
.execution-step-name { color: var(--text-muted); }
.execution-detail-tools { display: flex; justify-content: flex-end; padding: 12px 0; }
.execution-raw { border-top: 1px solid var(--border-default); padding-top: 12px; }
.execution-raw summary { cursor: pointer; font-size: 12px; color: var(--text-muted); }
.execution-raw pre { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 700px) { .execution-result-metrics { grid-template-columns: 1fr; } .execution-stage summary span { display: block; margin: 6px 0 0 18px; } }

/* Isolated shop order dashboard */
.shop-orders { color:var(--text-primary); }
.shop-orders {display:flex;flex-direction:column;gap:20px;}
.shop-orders .orders-toolbar { order:0;display:flex;justify-content:space-between;align-items:center;gap:20px;flex-wrap:wrap;margin:0; }
.shop-orders .orders-config {order:2;background:var(--bg-surface);border:1px solid var(--border-default);border-radius:12px;padding:0 20px;}
.shop-orders .orders-config summary {display:flex;align-items:center;gap:18px;min-height:58px;cursor:pointer;font-size:13px;color:var(--text-secondary);}
.shop-orders .orders-config summary strong {color:var(--text-primary);font-size:14px;}
.shop-orders .orders-config summary span:last-child {margin-left:auto;color:#2563eb;white-space:nowrap;}
.shop-orders #orders-settings {display:flex;align-items:center;gap:24px;flex-wrap:wrap;border-top:1px solid var(--border-default);padding:20px 0;}
.shop-orders .orders-toggle {display:flex;align-items:center;gap:8px;font-size:13px;cursor:pointer;}
.shop-orders .orders-toggle input {width:16px;height:16px;accent-color:#2563eb;}
.shop-orders .orders-times {display:grid;gap:6px;flex:1;min-width:240px;font-size:13px;}
.shop-orders .orders-times input {width:100%;min-height:40px;border:1px solid #cbd5e1;border-radius:8px;padding:9px 12px;background:#fff;color:#0f172a;font:inherit;box-shadow:0 1px 2px #0f172a08;}
.shop-orders .orders-times input:focus {outline:2px solid #93c5fd;outline-offset:1px;border-color:#2563eb;}
.shop-orders .orders-error {margin-top:8px;font-size:12px;color:#b91c1c;}
.shop-orders .orders-error summary {cursor:pointer;line-height:1.6;overflow-wrap:anywhere;}
.shop-orders .orders-error pre {white-space:pre-wrap;overflow-wrap:anywhere;max-height:180px;overflow:auto;padding:10px;border-radius:6px;background:#fff1f2;}
.shop-orders h2 { margin:0 0 5px;font-size:22px; }
.shop-orders p { margin:0;color:var(--text-muted);font-size:13px; }
.shop-orders .orders-actions,.shop-orders .orders-row-actions { display:flex;gap:8px;align-items:center;flex-wrap:wrap; }
.shop-orders button { min-height:38px;cursor:pointer; }
.shop-orders button:focus-visible { outline:2px solid #2563eb;outline-offset:3px; }
.shop-orders .orders-metrics { order:1;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px; }
.shop-orders .orders-metrics article { background:var(--bg-surface);border:1px solid var(--border-default);border-radius:12px;padding:20px 24px;display:grid;gap:8px; }
.shop-orders .orders-metrics span { font-size:14px;color:var(--text-secondary); }
.shop-orders .orders-metrics strong { font-size:30px;font-variant-numeric:tabular-nums; }
.shop-orders .orders-metrics article:nth-child(2) strong {color:#b45309;}
.shop-orders .orders-metrics article:nth-child(3) strong {color:#b91c1c;}
.shop-orders small { display:block;font-size:12px;color:var(--text-muted);line-height:1.6;margin-top:4px;overflow-wrap:anywhere; }
.shop-orders .orders-table-wrap {order:3;border:1px solid var(--border-default);border-radius:12px;overflow:auto;background:var(--bg-surface); }
.shop-orders table { width:100%;min-width:980px;table-layout:fixed;border-collapse:collapse; }
.shop-orders th,.shop-orders td { padding:16px 14px;vertical-align:top;white-space:normal;overflow-wrap:anywhere; }
.shop-orders th { font-size:12px;background:var(--bg-subtle);color:var(--text-secondary); }
.shop-orders th:first-child { width:15%; }.shop-orders th:nth-child(5) {width:18%;}.shop-orders th:nth-child(6){width:23%;}.shop-orders th:last-child{width:11%;}
.shop-orders .orders-number { font-size:17px;font-weight:600;font-variant-numeric:tabular-nums; }
.shop-orders .orders-alert { color:#b91c1c; }
.shop-orders .orders-status { display:inline-block;border-radius:6px;padding:3px 8px;background:var(--bg-subtle);font-size:12px; }
.shop-orders .orders-complete {color:#047857;background:#ecfdf5;}.shop-orders .orders-failed {color:#b91c1c;background:#fef2f2;}.shop-orders .orders-running {color:#1d4ed8;background:#eff6ff;}
.shop-orders .orders-waiting_login {color:#92400e;background:#fffbeb;}
.shop-orders .orders-queued {color:#475569;background:#f1f5f9;}
.shop-orders .orders-deadline {font-size:15px;font-weight:600;font-variant-numeric:tabular-nums;}
.shop-orders .orders-deadline small {font-weight:400;}
.shop-orders .orders-deadline-badge {display:inline-block;padding:7px 10px;border-radius:7px;line-height:1.5;}
.shop-orders .orders-deadline-badge.is-ok {color:#047857;background:#ecfdf5;}
.shop-orders .orders-deadline-badge.is-alert {color:#b91c1c;background:#fef2f2;}
.shop-orders .orders-config {order:0;padding:20px 24px;}
.shop-orders .orders-toolbar {order:-1;}
.shop-orders .orders-config-heading {display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:18px;}
.shop-orders .orders-config-heading h3 {margin:0 0 5px;font-size:16px;}
.shop-orders .orders-config-heading p {font-size:12px;}
.shop-orders #orders-settings {display:grid;grid-template-columns:1fr 1fr minmax(260px,1.4fr) auto;gap:20px;padding:18px 0 0;}
.shop-orders .orders-toggle {padding:12px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;min-height:72px;}
.shop-orders .orders-toggle strong {font-size:13px;font-weight:600;}
.shop-orders .orders-toggle small {margin-top:3px;}
.shop-orders #orders-settings button {align-self:center;}
.shop-orders th:nth-child(4) {width:19%;}
.shop-orders th:nth-child(5) {width:12%;}
@media(max-width:1200px){.shop-orders #orders-settings{grid-template-columns:1fr 1fr;}.shop-orders .orders-times{min-width:0;}}
@media(max-width:600px){.shop-orders #orders-settings{grid-template-columns:1fr;}.shop-orders .orders-config{padding:16px;}}
.shop-orders .orders-row-actions {flex-direction:column;align-items:stretch;}
.shop-orders .orders-row-actions button {white-space:nowrap;}
.shop-orders .orders-config summary:focus-visible {outline:2px solid #2563eb;outline-offset:3px;}
.shop-orders .orders-note {order:4;}
.shop-orders .orders-note { margin-top:14px;line-height:1.7; }.shop-orders .orders-empty {text-align:center;padding:48px;}
@media(max-width:800px){.shop-orders .orders-metrics{grid-template-columns:1fr;gap:10px;}.shop-orders .orders-metrics article{padding:16px;}.shop-orders .orders-actions{width:100%;}}

/* Compact independent order collection controls. */
.shop-orders .orders-config{padding:14px 18px;}
.shop-orders .orders-config-heading{margin-bottom:10px;flex-wrap:wrap;gap:10px;}
.shop-orders .orders-config-heading h3{margin:0;}
.shop-orders .orders-config-heading .orders-actions{margin-left:auto;}
.shop-orders #orders-settings{padding-top:12px;gap:14px;grid-template-columns:auto auto minmax(220px,1fr) auto;}
.shop-orders .orders-toggle{min-height:46px;padding:8px 10px;}
.shop-orders .orders-toggle small,.shop-orders .orders-times small{display:none;}
.shop-orders .orders-metrics article{padding:14px 20px;}
.shop-orders{gap:14px;}
@media(max-width:1200px){.shop-orders #orders-settings{grid-template-columns:1fr 1fr;}}
@media(max-width:600px){.shop-orders #orders-settings{grid-template-columns:1fr;}}

.account-sort-controls{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-left:auto;}
.account-sort-controls label{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--text-secondary);}
.account-sort-controls select,.order-account-label select{min-height:36px;border:1px solid var(--border-default);border-radius:7px;background:var(--bg-surface);color:var(--text-primary);padding:5px 9px;}
.overview-table-card .panel-title{flex-wrap:wrap;gap:12px;}
.order-editor{display:grid;grid-template-columns:1fr 1fr;gap:20px;}
.order-editor section{min-width:0;}.order-editor h3{font-size:15px;margin:0 0 12px;}
.order-editor ol{list-style:none;margin:12px 0 0;padding:0;max-height:430px;overflow:auto;border:1px solid var(--border-default);border-radius:8px;}
.order-editor li{display:flex;align-items:center;gap:10px;padding:12px;border-bottom:1px solid var(--border-default);}.order-editor li:last-child{border-bottom:0;}
.order-position{font-variant-numeric:tabular-nums;color:var(--text-muted);width:20px;flex-shrink:0;}
.order-editor li strong{font-size:13px;overflow-wrap:anywhere;}.order-editor li small{display:block;color:var(--text-muted);font-size:11px;margin-top:4px;}
.order-moves{margin-left:auto;display:flex;gap:6px;flex-shrink:0;}.order-moves button{padding:5px 8px;min-height:34px;font-size:12px;}
.order-editor-footer{display:flex;justify-content:flex-end;align-items:center;gap:10px;margin-top:18px;border-top:1px solid var(--border-default);padding-top:14px;flex-wrap:wrap;}.order-editor-footer span{margin-right:auto;font-size:12px;}
.order-account-label{display:flex;align-items:center;gap:8px;font-size:13px;}
@media(max-width:760px){.order-editor{grid-template-columns:1fr;}.account-sort-controls{margin-left:0;}}
#performance-table .performance-sequence{width:65px;white-space:nowrap;}
#performance-table [data-performance-number]{color:var(--text-secondary);font-variant-numeric:tabular-nums;}
.performance-account-label{display:flex;align-items:center;gap:8px;}
.performance-account-label select{max-width:150px;min-height:32px;border:1px solid var(--border-default);border-radius:6px;background:var(--bg-surface);color:var(--text-primary);padding:4px 7px;}
.performance-sort-button,#performance-default{border:0;background:transparent;color:inherit;font:inherit;cursor:pointer;padding:5px 2px;white-space:nowrap;}
.performance-sort-button:hover,.performance-sort-button.active,#performance-default:hover{color:#2563eb;}
.performance-sort-button:focus-visible,#performance-default:focus-visible{outline:2px solid #2563eb;outline-offset:3px;border-radius:3px;}
#performance-default{margin-left:6px;font-size:16px;}
.shop-orders{gap:10px;}
.shop-orders .orders-config{padding:10px 16px;}
.shop-orders .orders-config-heading{margin-bottom:6px;}
.shop-orders #orders-settings{padding:8px 0 0;gap:10px;}
.shop-orders .orders-toggle{min-height:36px;padding:5px 8px;}
.shop-orders .orders-times input{min-height:36px;padding:6px 10px;}
.shop-orders .orders-metrics{gap:10px;}
.shop-orders .orders-metric-filter{display:grid;grid-template-columns:1fr auto;align-items:center;gap:4px 12px;text-align:left;padding:12px 18px;border:1px solid var(--border-default);border-radius:10px;background:var(--bg-surface);color:var(--text-primary);}
.shop-orders .orders-metric-filter strong{font-size:26px;grid-column:2;grid-row:1 / 3;}
.shop-orders .orders-metric-filter small{margin:0;font-size:11px;}
.shop-orders .orders-metric-filter:nth-child(2) strong{color:#b45309;}
.shop-orders .orders-metric-filter:nth-child(3) strong{color:#b91c1c;}
.shop-orders .orders-metric-filter:hover{border-color:#93b4fa;background:#f8fbff;}
.shop-orders .orders-metric-filter.is-active{border-color:#2563eb;background:#eff6ff;box-shadow:inset 0 0 0 1px #2563eb;}
.shop-orders .orders-filter-summary{order:2;display:flex;align-items:center;gap:12px;font-size:12px;color:var(--text-secondary);}
.shop-orders .orders-filter-summary button{min-height:28px;padding:3px 9px;color:#2563eb;}
.shop-orders th,.shop-orders td{padding:10px 12px;}
.shop-orders .orders-row-actions{flex-direction:row;flex-wrap:nowrap;}
.shop-orders .orders-row-actions button{min-height:32px;padding:5px 9px;}
.shop-orders th:last-child{width:170px;}
.shop-orders .orders-number{font-size:15px;}
.shop-orders small{margin-top:2px;line-height:1.45;}
.shop-orders .orders-deadline-badge{padding:6px 8px;}
.shop-orders .orders-note{margin-top:0;}
.account-management-table .account-sequence{width:52px;text-align:center;color:var(--text-secondary);font-variant-numeric:tabular-nums;}
.account-management-table .row-actions{display:flex;gap:6px;align-items:center;flex-wrap:wrap;}
.account-management-table .row-actions button{min-height:32px;padding:5px 9px!important;font-size:12px!important;font-weight:500!important;white-space:nowrap;border:1px solid var(--border-default);border-radius:7px;background:var(--bg-surface);box-shadow:0 1px 2px #0f172a08;}
.account-management-table .row-actions button:hover{background:#f1f5f9;border-color:#94a3b8;}
.account-management-table .row-actions .btn-delete-account{color:#dc2626;border-color:#fecaca;background:#fff;}
.account-management-table .row-actions .btn-delete-account:hover{background:#fef2f2;border-color:#f87171;}

/* Compact rule selection table in the plan editor. */
dialog:has(.plan-editor) {width:min(1120px,96vw);max-width:96vw;}
dialog:has(.plan-editor) #dialog-body {padding-bottom:0;}
.plan-editor>.fields {gap:12px 20px;}
.plan-section-heading {display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:10px;}
.plan-section-heading h3 {margin:0;font-size:15px;}
.plan-section-heading p {margin:3px 0 0;font-size:12px;}
.plan-section-heading>strong {white-space:nowrap;color:var(--blue-600);font-size:12px;}
.plan-rules {border-top:1px solid var(--border-default);padding-top:14px;min-width:0;}
.plan-rule-filters {display:grid;grid-template-columns:minmax(180px,1fr) 140px 140px;gap:10px;margin-bottom:10px;}
.plan-rule-filters label {display:grid;gap:4px;font-size:12px;color:var(--text-muted);}
.plan-rule-filters input,.plan-rule-filters select {width:100%;min-height:34px;}
.plan-rule-table-wrap {max-height:360px;overflow:auto;border:1px solid var(--border-default);border-radius:8px;}
.plan-rule-table {width:100%;border-collapse:collapse;table-layout:fixed;font-size:13px;margin:0;}
.plan-rule-table th {position:sticky;top:0;z-index:1;background:var(--bg-subtle);color:var(--text-secondary);font-size:12px;white-space:nowrap;}
.plan-rule-table th,.plan-rule-table td {padding:9px 12px;text-align:left;border-bottom:1px solid var(--border-default);vertical-align:middle;}
.plan-rule-table th:first-child {width:34%;}
.plan-rule-table th:nth-child(2) {width:21%;}
.plan-rule-table th:nth-child(3) {width:18%;}
.plan-rule-table th:nth-child(4) {width:17%;}
.plan-rule-table th:last-child {width:10%;}
.plan-rule-table tr:last-child td {border-bottom:0;}
.plan-rule-row[hidden] {display:none;}
.plan-rule-row.is-selected {background:var(--blue-50);}
.plan-rule-select {display:flex;gap:8px;align-items:center;font-size:13px;font-weight:500;cursor:pointer;min-height:30px;}
.plan-rule-select span {overflow-wrap:anywhere;}
.plan-rule-select input {flex-shrink:0;}
.plan-rule-table small {display:block;font-size:11px;margin-left:23px;}
.plan-rule-table button {min-height:30px;padding:4px 8px;font-size:12px;color:var(--blue-600);}
.plan-rule-cell-line {line-height:1.8;white-space:nowrap;}
.plan-rule-help {font-size:12px;line-height:1.5;margin:8px 0 0;}
.plan-rule-empty {padding:20px!important;text-align:center!important;color:var(--text-muted);}
.plan-editor>.form-actions {position:sticky;bottom:0;background:var(--bg-surface);border-top:1px solid var(--border-default);padding:12px 0;margin-bottom:0;z-index:2;gap:12px;}
.plan-identifiers .fields {margin-top:8px;}
.template-impact-notice {padding:12px 14px;background:var(--blue-50);border:1px solid var(--border-default);border-radius:8px;margin-bottom:16px;font-size:13px;line-height:1.7;overflow-wrap:anywhere;}
@media(max-width:700px) {
  dialog:has(.plan-editor) #dialog-body {padding:16px 14px 0;}
  .plan-editor>.fields {grid-template-columns:1fr;}
  .plan-rule-filters {grid-template-columns:1fr 1fr;}
  .plan-rule-filters label:first-child {grid-column:1/-1;}
  .plan-rule-table {min-width:720px;}
}

/* Keep the plan management columns compact and bounded. */
#plans-table table {table-layout:fixed;width:100%;min-width:1090px;}
#plans-table th,#plans-table td {padding:12px 14px;white-space:normal;overflow-wrap:anywhere;}
#plans-table th:nth-child(1) {width:20%;}
#plans-table th:nth-child(2) {width:14%;}
#plans-table th:nth-child(3) {width:8%;}
#plans-table th:nth-child(4) {width:13%;}
#plans-table th:nth-child(5) {width:15%;}
#plans-table th:nth-child(6) {width:13%;}
#plans-table th:nth-child(7) {width:17%;}
#plans-table td.name {min-width:0;max-width:none;}
#plans-table td.actions {min-width:0;width:auto;}
#plans-table .row-actions {display:flex;flex-wrap:wrap;white-space:normal;gap:6px;}
#plans-table .row-actions button {padding:4px 8px;font-size:12px;}
#plans-table .plan-stop-template {font-size:12px;line-height:1.6;}
