:root {
  --bg: #f0e6d8;
  --card-bg: #faf5ee;
  --card-border: #e5d5c5;
  --text-primary: #2d1b0e;
  --text-body: #7a5c4a;
  --accent: #c49a6c;
  --tag-bg: #e8d5c0;
  --tag-text: #5c3d2e;
  --muted: #9a7a63;
  --danger: #ad5147;
  --ok: #5e7f59;
  --line-head: #c49a6c;
  --line-row-a: #fffaf5;
  --line-row-b: #f7eee4;
  --line-panel: #faf5ee;
  --workbar-height: 260px;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text-primary);
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

body[data-line="1f"] {
  --line-head: #d9892b;
  --line-row-a: #fff4ec;
  --line-row-b: #f8dfd1;
  --line-panel: #fff2e8;
}

body[data-line="2f"] {
  --line-head: #1e9a8a;
  --line-row-a: #edf9f5;
  --line-row-b: #d7eee9;
  --line-panel: #e8f5f1;
}

body[data-line="cnc"] {
  --line-head: #8b6cb5;
  --line-row-a: #f4effa;
  --line-row-b: #e5d9f1;
  --line-panel: #f0e8f7;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  transition: grid-template-columns 0.18s ease;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 22px 16px;
  border-right: 1px solid var(--card-border);
  background: #ead9c7;
  transition: padding 0.18s ease;
}

.sidebar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

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

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 17px;
}

.brand span {
  margin-top: 3px;
  color: var(--text-body);
  font-size: 12px;
}

.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text-body);
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus-visible {
  border-color: var(--line-head);
  color: var(--text-primary);
  outline: none;
}

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

.nav-item {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0 14px;
  background: transparent;
  color: var(--text-body);
  text-align: left;
  font-weight: 700;
}

.nav-item.active,
.nav-item:hover {
  border-color: var(--card-border);
  background: var(--card-bg);
  color: var(--text-primary);
}

.sidebar-note {
  margin-top: auto;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 14px;
  background: var(--card-bg);
}

.sidebar-note span,
.sidebar-note strong {
  display: block;
}

.sidebar-note span {
  color: var(--text-body);
  font-size: 13px;
}

.sidebar-note strong {
  margin-top: 5px;
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 72px minmax(0, 1fr);
}

body.sidebar-collapsed .sidebar {
  align-items: center;
  gap: 18px;
  padding: 18px 10px;
}

body.sidebar-collapsed .sidebar-header {
  flex-direction: column;
  align-items: center;
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .sidebar-note {
  display: none;
}

body.sidebar-collapsed .nav-list {
  width: 100%;
}

body.sidebar-collapsed .nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0;
  font-size: 0;
}

body.sidebar-collapsed .nav-item::before {
  content: attr(data-short);
  color: inherit;
  font-size: 14px;
  font-weight: 900;
}

.workspace {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 0 24px 24px;
}

.topbar,
.line-tabs,
.tool-grid,
.top-metrics,
.line-summary,
.content-layout,
.panel-header,
.pager {
  display: flex;
}

.sticky-workbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 24px 0 14px;
  background: var(--bg);
}

.topbar {
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 14px;
}

.title-area {
  flex: 0 0 auto;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--text-body);
  font-size: 12px;
  font-weight: 800;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--text-primary);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  font-weight: 700;
}

.summary-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 172px;
  min-height: 58px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0 18px;
  background: var(--card-bg);
}

.summary-badge span {
  display: block;
  color: var(--text-body);
  font-size: 13px;
}

.summary-badge strong {
  display: block;
  color: var(--accent);
  font-size: 24px;
  line-height: 1;
}

.top-metrics {
  align-items: stretch;
  gap: 10px;
  justify-content: flex-end;
  flex: 1 1 760px;
  min-width: 0;
  margin-bottom: 0;
  padding-top: 23px;
  overflow: visible;
}

.line-tabs {
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 0;
  overflow: visible;
}

.line-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 146px;
  min-height: 58px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0 18px;
  background: var(--card-bg);
  color: var(--text-body);
  text-align: left;
}

.line-tab.line-1f {
  background: #f8dfd1;
  border-color: #d9892b;
  color: #5f3517;
  box-shadow: inset 0 0 0 1px rgba(217, 137, 43, 0.16);
}

.line-tab.line-2f {
  background: #e8f5f1;
  border-color: #84c8bd;
}

.line-tab.line-cnc {
  background: #f0e8f7;
  border-color: #bba4d5;
}

.line-tab span,
.line-tab strong {
  display: block;
}

.line-tab strong {
  color: var(--accent);
  font-size: 24px;
}

.line-tab.line-1f strong {
  color: #d9892b;
}

.line-tab.line-2f strong {
  color: #1e9a8a;
}

.line-tab.line-cnc strong {
  color: #8b6cb5;
}

.line-tab.active {
  border-color: var(--text-primary);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 2px rgba(45, 27, 14, 0.18);
}

.line-tab.line-1f.active {
  border-color: #b86617;
  box-shadow: inset 0 0 0 2px rgba(217, 137, 43, 0.32);
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(240px, 420px) 110px 110px 120px 120px minmax(0, 1fr);
  gap: 8px;
  align-items: end;
  margin-bottom: 0;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 14px;
  background: var(--card-bg);
}

.group-info {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--text-body);
  font-size: 13px;
  font-weight: 800;
}

.compact-input input {
  text-align: center;
  font-weight: 900;
}

.dispatch-limit-button {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 0 12px;
  background: #fffaf5;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 900;
  text-align: center;
}

.dispatch-limit-button:hover,
.dispatch-limit-button:focus-visible {
  border-color: var(--line-head);
  background: #fff8ed;
  outline: none;
}

.input-box {
  display: grid;
  gap: 6px;
}

.input-box span {
  color: var(--text-body);
  font-size: 12px;
  font-weight: 800;
}

.input-box input,
.input-box textarea {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 0 12px;
  background: #fffaf5;
  color: var(--text-primary);
}

.input-box textarea {
  min-height: 96px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.5;
}

.primary-button,
.secondary-button,
.mini-button,
.tiny-button {
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: #fffaf5;
  color: var(--tag-text);
  font-weight: 800;
}

.primary-button {
  min-height: 40px;
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.secondary-button {
  min-height: 40px;
}

.line-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 0;
}

.line-summary article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 150px;
  min-height: 58px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0 16px;
  background: var(--card-bg);
}

.line-summary article.metric-clickable {
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.line-summary article.metric-clickable:hover,
.line-summary article.metric-clickable:focus-visible {
  border-color: var(--line-head);
  background: #fff8ed;
  transform: translateY(-1px);
}

.line-summary span {
  display: block;
  color: var(--text-body);
  font-size: 13px;
}

.line-summary strong {
  display: block;
  color: var(--accent);
  font-size: 22px;
}

.content-layout {
  align-items: flex-start;
  gap: 16px;
  flex: 1 1 auto;
  height: auto;
  min-height: 420px;
  overflow: hidden;
}

.queue-panel,
.side-panel > section {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: var(--card-bg);
}

.queue-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  max-height: 100%;
  min-width: 0;
  padding: 12px;
  background: var(--line-panel);
}

.line-1f-surface {
  border-color: #e2a676;
}

.line-2f-surface {
  border-color: #84c8bd;
}

.line-cnc-surface {
  border-color: #bba4d5;
}

.side-panel {
  display: grid;
  flex: 0 0 360px;
  gap: 16px;
  max-height: 100%;
  overflow: auto;
}

.side-panel > section {
  padding: 16px;
}

.panel-header {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.queue-panel-header {
  justify-content: flex-end;
}

.panel-header.compact {
  margin-bottom: 8px;
}

.pager {
  align-items: center;
  gap: 8px;
  color: var(--text-body);
  font-size: 13px;
  font-weight: 800;
}

.mini-button {
  min-height: 30px;
  padding: 0 10px;
}

.table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: #fffaf5;
}

table {
  width: 100%;
  min-width: 1740px;
  border-collapse: collapse;
  table-layout: fixed;
}

.col-select { width: 44px; }
.col-status { width: 72px; }
.col-sequence { width: 76px; }
.col-line { width: 68px; }
.col-schedule { width: 178px; }
.col-origin { width: 170px; }
.col-customer { width: 78px; }
.col-product { width: 230px; }
.col-spec { width: 230px; }
.col-process { width: 96px; }
.col-qty { width: 64px; }
.col-hours { width: 56px; }
.col-people { width: 54px; }
.col-ready { width: 54px; }
.col-note { width: 270px; }
.col-action { width: 100px; }

th,
td {
  border-bottom: 1px solid var(--card-border);
  padding: 5px 8px;
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--line-head);
  color: #ffffff;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

tbody tr {
  background: var(--line-row-a);
}

tbody tr:nth-child(even) {
  background: var(--line-row-b);
}

tbody tr.selected {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

tbody tr.batch-selected {
  background: #ead9c7;
}

tbody tr.issue {
  background: #f5e3dd;
}

tbody tr.candidate-row {
  background: #f7efe4;
  color: #685848;
}

tbody tr.process-batch-row {
  background: #fff2dc;
  box-shadow: inset 4px 0 0 #9f6b38;
}

tbody tr.process-batch-row.issue {
  background: #f2e4d2;
}

tbody tr.process-batch-row.candidate-row {
  background: #efe4d6;
  box-shadow: inset 4px 0 0 #8d7a66;
}

tbody tr.schedule-section-row td {
  border-bottom: 1px solid #d9c0a4;
  padding: 4px 10px;
  background: #ead9c7;
  color: var(--text-primary);
}

tbody tr.schedule-section-row.candidate td {
  background: #e8ded2;
}

tbody tr.schedule-section-row.published td {
  background: #dceee8;
}

tbody tr.schedule-section-row.scheduled td {
  background: #f2e3c9;
}

tbody tr.schedule-section-row strong,
tbody tr.schedule-section-row span {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
}

tbody tr.schedule-section-row strong {
  margin-right: 10px;
  font-size: 12px;
}

tbody tr.schedule-section-row span {
  color: var(--text-body);
  font-size: 11px;
  font-weight: 800;
}

tbody tr.batch-detail-row {
  background: #fffaf5;
}

tbody tr.batch-detail-row td {
  padding: 0;
}

tbody tr.drop-target {
  box-shadow: inset 0 3px 0 var(--accent);
}

td small {
  display: block;
  max-width: 100%;
  margin-top: 2px;
  color: var(--text-body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
}

.rank-cell {
  color: var(--accent);
  font-size: 18px;
  font-weight: 900;
}

.row-check {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.cell-input {
  width: 46px;
  min-height: 26px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 6px;
  background: transparent;
  color: var(--text-primary);
  font-weight: 800;
  text-align: center;
}

.cell-input:hover {
  border-color: var(--card-border);
  background: #fffaf5;
}

.cell-input:focus {
  outline: 2px solid var(--line-head);
  outline-offset: 1px;
  border-color: transparent;
  background: #fffaf5;
}

.note-edit-button {
  display: block;
  width: 100%;
  min-height: 26px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 3px 8px;
  background: transparent;
  color: var(--text-body);
  text-align: left;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.note-edit-button:hover,
.note-edit-button:focus-visible {
  border-color: var(--card-border);
  background: #fffaf5;
  color: var(--text-primary);
}

.note-edit-button span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-note-editor {
  display: grid;
  gap: 6px;
}

.detail-note-editor span {
  color: var(--text-body);
  font-size: 12px;
  font-weight: 800;
}

.detail-note-button {
  width: 100%;
  min-height: 44px;
}

.note-modal-input {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  line-height: 1.6;
  font-family: inherit;
}

.metric-flip-card {
  display: grid;
  gap: 10px;
  animation: metricFlipIn 0.22s ease-out;
  transform-origin: center top;
}

.metric-detail-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  border: 1px solid #e3cdb2;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff8ed;
}

.metric-detail-item span {
  color: var(--text-body);
  font-size: 13px;
  font-weight: 800;
}

.metric-detail-item strong {
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 900;
}

@keyframes metricFlipIn {
  from {
    opacity: 0;
    transform: rotateX(-12deg) translateY(-4px);
  }
  to {
    opacity: 1;
    transform: rotateX(0) translateY(0);
  }
}

.batch-title-button {
  font-size: 15px;
}

.batch-value {
  display: inline-grid;
  min-width: 36px;
  min-height: 26px;
  place-items: center;
  border-radius: 8px;
  background: rgba(159, 107, 56, 0.12);
  color: var(--text-primary);
  font-weight: 900;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 22px;
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 900;
}

.status-pill.published {
  background: #dceee8;
  color: #196b5f;
}

.status-pill.scheduled {
  background: #f2e3c9;
  color: #8b5e23;
}

.status-pill.candidate {
  background: #e8ded2;
  color: #6f5a46;
}

.pending-sequence {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  border-radius: 8px;
  padding: 2px 8px;
  background: #e8ded2;
  color: #6f5a46;
  font-size: 12px;
  font-weight: 900;
}

.sequence-note {
  max-width: 90px;
  margin-top: 2px;
  color: #856d57;
  white-space: normal;
}

.batch-detail {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #fff8ed;
}

.batch-detail span {
  color: var(--text-body);
  font-size: 12px;
  font-weight: 800;
}

.batch-detail strong {
  display: block;
  margin-top: 3px;
  color: var(--text-primary);
}

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

.batch-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  border: 1px solid #d7b894;
  border-radius: 8px;
  padding: 5px 8px;
  background: #fffaf5;
  color: var(--text-body);
  font-size: 12px;
  font-weight: 800;
}

.child-order-list {
  display: grid;
  min-width: 720px;
  overflow: hidden;
  border: 1px solid #e3cdb2;
  border-radius: 8px;
  background: #fffaf5;
}

.side-batch-detail .child-order-list {
  min-width: 0;
  overflow-x: auto;
}

.child-order-head,
.child-order-row {
  display: grid;
  grid-template-columns: 1.2fr 1.35fr 0.9fr 0.5fr 0.5fr 0.5fr 0.55fr;
  gap: 8px;
  align-items: center;
  min-width: 700px;
  padding: 7px 9px;
}

.child-order-head {
  background: #ead9c7;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 900;
}

.child-order-row {
  border-top: 1px solid #efe0cf;
  color: var(--text-body);
  font-size: 12px;
  font-weight: 800;
}

.child-order-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-batch-detail {
  border: 1px solid var(--card-border);
  border-radius: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 20px;
  padding: 4px 12px;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 12px;
  font-weight: 800;
}

.link-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text-primary);
  font-weight: 800;
  text-align: left;
  white-space: nowrap;
}

.tiny-button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 13px;
  white-space: nowrap;
}

.tiny-button:disabled {
  cursor: not-allowed;
  border-color: #d6c4b1;
  background: #ece2d7;
  color: #8a7764;
}

.tiny-button.ghost {
  background: transparent;
}

.detail-panel {
  display: grid;
  gap: 12px;
}

.detail-title h2 {
  margin: 10px 0 4px;
  font-size: 20px;
  line-height: 1.3;
}

.detail-title p,
.note-text {
  color: var(--text-body);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin: 0;
}

.detail-grid div {
  min-height: 62px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 9px;
  background: #fffaf5;
}

dt {
  color: var(--text-body);
  font-size: 12px;
  font-weight: 800;
}

dd {
  margin: 6px 0 0;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 900;
}

.note-text {
  margin-bottom: 0;
  line-height: 1.55;
}

.exception-list {
  display: grid;
  gap: 8px;
}

.exception-item {
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 10px;
  background: #fffaf5;
  color: var(--text-primary);
  text-align: left;
}

.exception-item strong,
.exception-item span {
  display: block;
}

.exception-item span {
  margin-top: 4px;
  color: var(--text-body);
  font-size: 13px;
}

.empty-cell,
.empty-panel {
  padding: 30px;
  color: var(--text-body);
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(45, 27, 14, 0.36);
}

.modal-card {
  width: min(560px, 100%);
  max-height: min(90vh, 760px);
  overflow: auto;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 18px;
  background: var(--card-bg);
}

.detail-modal-card {
  width: min(920px, 100%);
}

.modal-info {
  margin-bottom: 14px;
  color: var(--text-body);
  line-height: 1.5;
}

.rule-help {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  border: 1px solid #e3cdb2;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff8ed;
  color: var(--text-body);
  font-size: 13px;
  line-height: 1.5;
}

.rule-help strong {
  color: var(--text-primary);
  font-size: 14px;
}

.rule-manager {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  border-top: 1px solid var(--card-border);
  padding-top: 14px;
}

.rule-manager-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.rule-manager-title strong {
  color: var(--text-primary);
}

.rule-manager-title span,
.rule-item span,
.rule-empty {
  color: var(--text-body);
  font-size: 13px;
}

.rule-list {
  display: grid;
  gap: 8px;
}

.rule-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid #e3cdb2;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fffaf5;
}

.rule-item strong,
.rule-item span {
  display: block;
}

.rule-item-actions {
  display: flex;
  gap: 8px;
}

.rule-empty {
  border: 1px dashed #d7b990;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff8ed;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.hidden {
  display: none;
}

@media (max-width: 1280px) and (min-width: 1181px) {
  .workspace {
    padding: 0 16px 14px;
  }

  .sticky-workbar {
    padding: 14px 0 8px;
  }

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

  .eyebrow {
    margin-bottom: 4px;
  }

  h1 {
    font-size: 34px;
  }

  .top-metrics {
    gap: 8px;
    padding-top: 12px;
  }

  .line-tabs,
  .line-summary {
    gap: 8px;
  }

  .line-tab,
  .summary-badge,
  .line-summary article {
    min-height: 50px;
    border-radius: 10px;
    padding: 0 14px;
  }

  .line-tab {
    min-width: 146px;
  }

  .summary-badge {
    min-width: 170px;
  }

  .line-tab strong,
  .summary-badge strong {
    font-size: 22px;
  }

  .line-summary strong {
    font-size: 20px;
  }

  .tool-grid {
    padding: 10px 12px;
  }

  .input-box {
    gap: 4px;
  }

  .input-box input,
  .dispatch-limit-button,
  .primary-button,
  .secondary-button {
    min-height: 36px;
  }

  .content-layout {
    gap: 12px;
    height: calc(100vh - var(--workbar-height) - 10px);
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--card-border);
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    overflow-x: auto;
  }

  .sidebar-note {
    display: none;
  }

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

  .content-layout {
    flex-direction: column;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .queue-panel,
  .side-panel {
    max-height: none;
  }

  .table-wrap {
    max-height: 620px;
  }

  .side-panel {
    width: 100%;
    flex-basis: auto;
    grid-template-columns: 1fr 1fr;
    overflow: visible;
  }
}

@media (max-width: 760px) {
  .workspace {
    padding: 0 16px 16px;
  }

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

  .summary-badge {
    text-align: left;
  }

  .sticky-workbar {
    padding-top: 16px;
  }

  .top-metrics,
  .line-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .top-metrics {
    flex: 0 1 auto;
    padding-top: 0;
  }

  .tool-grid,
  .side-panel {
    grid-template-columns: 1fr;
  }

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