:root {
  --bg: #f4f7fb;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: #ffffff;
  --text: #132238;
  --muted: #67788f;
  --line: #d8e2ef;
  --brand: #1f63c4;
  --brand-soft: #ddebff;
  --accent: #f59f0b;
  --accent-soft: #fff3d7;
  --danger: #d9485f;
  --danger-soft: #fde8ec;
  --success: #2b8a6e;
  --success-soft: #def7ec;
  --shadow: 0 18px 40px rgba(19, 34, 56, 0.08);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-ui: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  color: var(--text);
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(31, 99, 196, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(245, 159, 11, 0.15), transparent 18%),
    linear-gradient(180deg, #f9fbff 0%, var(--bg) 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 20px auto 40px;
}

.detail-shell-page {
  margin-top: 0;
}

.toast-banner {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 40;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(216, 226, 239, 0.94);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 28px rgba(19, 34, 56, 0.14);
  font-size: 14px;
  font-weight: 600;
}

.toast-success {
  color: var(--success);
}

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

.sticky-chrome {
  position: sticky;
  top: 0;
  z-index: 28;
  padding-top: 10px;
  background: linear-gradient(180deg, rgba(244, 247, 251, 0.99), rgba(244, 247, 251, 0.95), rgba(244, 247, 251, 0.78), transparent);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0 4px;
}

.title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}

.title-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--muted);
  font-size: 12px;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 700;
  min-width: 0;
  word-break: break-word;
}

.brand-title {
  display: flex;
  flex-direction: column;
  line-height: 1.18;
  font-size: clamp(16px, 2.2vw, 22px);
  font-weight: 700;
}

.role-switcher {
  display: grid;
  grid-template-columns: auto minmax(120px, 168px);
  align-items: center;
  gap: 6px 10px;
  min-width: 0;
}

.role-switcher label {
  color: var(--muted);
  white-space: nowrap;
}

.role-switcher .inline-note,
.role-switcher .readonly-field {
  grid-column: 1 / -1;
}

input,
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #ccd8e7;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

.role-switcher select {
  width: 100%;
  border-radius: 999px;
}

.compact-readonly {
  min-height: auto;
  padding: 8px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.view-stack {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.panel,
.content-card,
.status-tile,
.timeline-item,
.comment-item,
.history-item,
.order-item,
.dialog-card {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(216, 226, 239, 0.94);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.panel,
.content-card {
  padding: 22px;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.hero-panel p {
  margin: 0;
}

.hero-note {
  color: var(--muted);
  line-height: 1.65;
  margin-top: 10px !important;
}

.panel-kicker {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.inline-note {
  color: var(--muted);
  font-size: 13px;
}

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

.status-bar-shell {
  padding: 8px 0 10px;
}

.status-tile {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.status-tile:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 99, 196, 0.28);
}

.status-tile.active {
  border-color: rgba(31, 99, 196, 0.3);
  background: linear-gradient(180deg, #ffffff, #eef5ff);
  box-shadow: 0 12px 24px rgba(31, 99, 196, 0.08);
}

.status-tile.active .status-label,
.status-tile.active .status-value {
  color: var(--brand);
}

.status-label {
  color: var(--muted);
  font-size: 14px;
  white-space: normal;
  line-height: 1.2;
}

.feature-panel-success {
  border-color: rgba(43, 138, 110, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(242, 252, 247, 0.96)),
    var(--panel);
}

.status-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}

.dual-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: 18px;
}

.panel-head,
.card-head,
.section-head,
.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.panel-head p,
.card-head p,
.detail-head p {
  margin: 0;
}

.card-tip,
.status-pill,
.tag,
.placeholder-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.card-tip,
.tag {
  background: #eef4fb;
  color: var(--muted);
}

.status-pill {
  background: var(--brand-soft);
  color: var(--brand);
}

.status-pill.closed {
  background: #f0f3f8;
  color: #58677d;
}

.status-pill.completed {
  background: var(--success-soft);
  color: var(--success);
}

.quick-list,
.history-list,
.list-body,
.record-grid,
.timeline-list,
.comment-list,
.placeholder-list,
.overview-grid {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.compact-list {
  gap: 10px;
}

.order-item,
.history-item {
  padding: 16px 18px;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.order-item:hover,
.history-item:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 99, 196, 0.28);
}

.order-item h3,
.history-item h3 {
  font-size: 18px;
  line-height: 1.38;
  word-break: break-word;
  margin-top: 6px;
}

.compact-order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 16px 18px;
  text-align: left;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  border: 1px solid rgba(216, 226, 239, 0.94);
  border-radius: 22px;
  box-shadow: var(--shadow);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.compact-order-item-inline {
  width: 100%;
  padding-right: 118px;
}

.compact-order-item:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 99, 196, 0.28);
}

.compact-order-main {
  min-width: 0;
  flex: 1;
}

.compact-order-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.compact-order-code {
  color: var(--brand);
  font-size: 13px;
  letter-spacing: 0.12em;
}

.compact-order-title {
  margin: 10px 0 8px;
  font-size: 18px;
  line-height: 1.35;
  word-break: break-word;
}

.compact-order-line {
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.compact-order-muted {
  margin-top: 6px;
  color: var(--muted);
}

.tech-deadline-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #eef4fb;
  color: #334155;
  font-size: 13px;
  line-height: 1.35;
}

.tech-deadline-line strong {
  flex-shrink: 0;
}

.tech-deadline-line.due-soon {
  background: #fff7e6;
  color: #8a4b00;
}

.tech-deadline-line.overdue {
  background: #fff0f0;
  color: #b42318;
}

.field-deadline-tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  margin-top: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef4fb;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  vertical-align: middle;
  white-space: normal;
}

.field-deadline-tag.due-soon {
  background: #fff7e6;
  color: #8a4b00;
}

.field-deadline-tag.overdue {
  background: #fff0f0;
  color: #b42318;
}

.sheet-inline-field small .field-deadline-tag {
  margin-top: 0;
  margin-left: 6px;
}

.compact-order-arrow {
  color: #9ba9bc;
  font-size: 26px;
  line-height: 1;
  flex-shrink: 0;
}

.close-management-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.close-management-panel .panel-head {
  display: none;
}

.closable-order-row {
  position: relative;
}

.order-topline,
.history-topline,
.order-meta,
.order-tags,
.summary-grid,
.insight-list,
.detail-meta,
.tab-nav,
.detail-actions,
.comment-headline,
.summary-row,
.back-row,
.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.order-topline,
.history-topline,
.toggle-row,
.back-row {
  align-items: center;
  justify-content: space-between;
}

.order-meta,
.order-tags {
  margin-top: 12px;
}

.summary-grid {
  margin-top: 16px;
  gap: 14px;
}

.summary-item,
.insight-item,
.placeholder-item,
.review-row,
.comment-item,
.timeline-item,
.readonly-field,
.finance-only-note {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfdff;
}

.summary-item,
.insight-item,
.placeholder-item,
.review-row,
.timeline-item {
  padding: 14px 16px;
}

.summary-item {
  flex: 1 1 220px;
}

.summary-item strong,
.insight-item strong,
.review-row strong,
.timeline-item strong,
.placeholder-item strong {
  display: block;
  margin-bottom: 6px;
}

.insight-list {
  margin-top: 16px;
}

.finance-only-note {
  padding: 18px;
  margin-top: 16px;
  color: var(--muted);
  line-height: 1.65;
}

.history-panel {
  padding: 14px 18px;
}

.history-toggle-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.history-toggle-label {
  font-size: 20px;
  font-weight: 700;
}

.history-toggle-arrow {
  color: var(--muted);
  font-size: 20px;
}

.collapse-btn,
.ghost-inline-btn,
.back-btn {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.detail-shell {
  display: grid;
  gap: 16px;
  padding-bottom: 112px;
}

.detail-page {
  display: grid;
}

.detail-view-stack {
  margin-top: 0;
}

.detail-sticky-head {
  position: sticky;
  top: 0;
  z-index: 26;
  display: grid;
  gap: 10px;
  padding: 12px 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(255, 255, 255, 0.96));
  border-bottom: 1px solid rgba(216, 226, 239, 0.86);
}

.detail-title {
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.25;
  word-break: break-word;
}

.detail-save-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.detail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.detail-meta {
  align-items: center;
  justify-content: flex-end;
  margin-top: 0;
  margin-left: auto;
}

.detail-meta .status-pill,
.detail-meta .tag {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
}

.detail-meta .tech-deadline-tag {
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef4fb;
  color: #334155;
}

.detail-meta .tech-deadline-tag.due-soon {
  background: #fff7e6;
  color: #8a4b00;
}

.detail-meta .tech-deadline-tag.overdue {
  background: #fff0f0;
  color: #b42318;
}

.detail-actions {
  position: fixed;
  right: 24px;
  bottom: 16px;
  z-index: 32;
  margin-top: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  justify-content: flex-end;
}

.device-select-dialog {
  width: min(720px, calc(100vw - 24px));
}

.device-select-card {
  width: 100%;
  display: grid;
  gap: 14px;
}

.device-select-search input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid #d9e2ef;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font-size: 15px;
}

.device-select-list {
  display: grid;
  gap: 10px;
  max-height: min(62vh, 560px);
  overflow: auto;
  padding-right: 2px;
}

.device-select-option {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  border: 1px solid rgba(31, 99, 196, 0.18);
  border-radius: 12px;
  background: #f8fbff;
  color: #183153;
  text-align: left;
}

.device-select-option strong {
  color: var(--brand);
  font-size: 16px;
}

.device-select-option span {
  color: var(--muted);
  font-size: 13px;
}

.finance-detail-grid {
  grid-template-columns: 1fr;
}

.finance-detail-card {
  max-width: 760px;
}

.finance-summary-grid .summary-item {
  flex-basis: 200px;
}

.finance-receipt-btn {
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid rgba(31, 99, 196, 0.38);
  background: #fff;
  color: var(--brand);
  font-weight: 700;
}

.finance-receipt-btn.active {
  border-color: transparent;
  background: linear-gradient(135deg, #1f63c4, #3483ec);
  color: #fff;
}

.tab-nav {
  margin-top: 0;
}

.tab-btn {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.tab-btn.active {
  border-color: rgba(31, 99, 196, 0.26);
  background: var(--brand-soft);
  color: var(--brand);
}

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

.content-card {
  min-width: 0;
}

.full-width-card {
  grid-column: 1 / -1;
}

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

.form-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.full-span {
  grid-column: 1 / -1;
}

.readonly-field {
  min-height: 48px;
  padding: 12px 14px;
  color: var(--text);
  line-height: 1.55;
}

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

.comment-item {
  padding: 14px 16px;
}

.comment-headline {
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.comment-meta,
.timeline-meta,
.inline-muted {
  color: var(--muted);
  font-size: 13px;
}

.comment-composer {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfdff;
  display: grid;
  gap: 10px;
}

.review-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

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

.placeholder-pill.reserved {
  background: #f0f3f8;
  color: #607086;
}

.placeholder-pill.completed {
  background: var(--success-soft);
  color: var(--success);
}

.empty-state {
  padding: 28px;
  border: 1px dashed rgba(31, 99, 196, 0.3);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(31, 99, 196, 0.06), rgba(255, 255, 255, 0.9));
  color: var(--muted);
}

.empty-state h3 {
  margin-bottom: 10px;
  color: var(--text);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn {
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
}

.primary-btn {
  background: linear-gradient(135deg, #1f63c4, #3483ec);
  color: #fff;
}

.primary-btn-compact {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
}

.secondary-btn {
  background: #fff;
  color: var(--brand);
  border-color: rgba(31, 99, 196, 0.24);
}

.ghost-btn {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.ghost-btn-compact {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
}

.title-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.title-actions .primary-btn-compact {
  min-width: 72px;
  text-align: center;
  justify-content: center;
}

.swipe-card {
  position: relative;
  margin-bottom: 8px;
  border-radius: 22px;
  overflow: hidden;
}

.swipe-card-body {
  width: 100%;
  transition: transform 0.2s ease;
  will-change: transform;
}

.swipe-card.open .swipe-card-body {
  transform: translateX(-72px);
}

.swipe-close-pill {
  position: absolute;
  display: none;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  z-index: 3;
}

.swipe-card.open .swipe-close-pill {
  display: inline-flex;
}

@media (hover: hover) {
  .swipe-card[data-swipeable="1"]:hover .swipe-card-body {
    transform: translateX(-72px);
  }
  .swipe-card[data-swipeable="1"]:hover .swipe-close-pill {
    display: inline-flex;
  }
}

@media (max-width: 720px) {
  .swipe-card {
    border-radius: 18px;
  }
}

.recycle-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
  width: 100%;
}

.recycle-card {
  background: var(--panel-strong, #fff);
  border: 1px solid var(--line, #e7e6e0);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.recycle-card-topline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.recycle-card-topline .compact-order-code {
  margin: 0;
}

.recycle-card-topline .status-pill {
  flex-shrink: 0;
}

.recycle-actions-inline {
  margin-left: auto;
  display: inline-flex;
  gap: 6px;
  flex-shrink: 0;
}

.pill-btn {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--line, #e7e6e0);
  color: var(--muted, #6b7480);
  cursor: pointer;
  line-height: 1.6;
  font-weight: 500;
  white-space: nowrap;
}

.pill-btn-restart {
  border-color: rgba(31, 99, 196, 0.32);
  color: var(--brand, #1f63c4);
}

.pill-btn-restart:hover {
  background: rgba(31, 99, 196, 0.08);
}

.pill-btn-delete {
  border-color: rgba(217, 72, 95, 0.4);
  color: var(--danger, #d9485f);
}

.pill-btn-delete:hover {
  background: rgba(217, 72, 95, 0.08);
}

.recycle-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
}

.recycle-card-body .compact-order-title {
  margin: 4px 0 4px;
}

.recycle-card-body .compact-order-line {
  margin: 0;
}

.recycle-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding-bottom: 8px;
}

.recycle-dialog-head .panel-kicker {
  margin: 0;
}

.recycle-dialog-body {
  display: block !important;
  margin-top: 0 !important;
}

.recycle-dialog-body .recycle-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.danger-btn {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(217, 72, 95, 0.16);
}

.danger-btn-compact {
  padding: 12px 14px;
  min-width: 64px;
  position: absolute;
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
  z-index: 2;
}

.secondary-btn-compact {
  padding: 12px 14px;
  min-width: 64px;
  position: absolute;
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
  z-index: 2;
}

dialog {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: calc(100vw - 16px);
  overflow: hidden;
}

dialog::backdrop {
  background: rgba(19, 34, 56, 0.45);
  backdrop-filter: blur(4px);
}

.order-fullscreen-dialog {
  width: min(1240px, calc(100vw - 40px));
  max-width: calc(100vw - 40px);
}

.dialog-card {
  width: min(900px, calc(100vw - 24px));
  padding: 22px;
  background: var(--panel-strong);
  max-height: min(88vh, 920px);
  overflow: auto;
  overflow-x: hidden;
}

.order-dialog-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  overflow: hidden;
}

.dialog-head,
.dialog-actions {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.dialog-head {
  position: sticky;
  top: 0;
  z-index: 2;
  padding-bottom: 12px;
  background: var(--panel-strong);
}

#orderForm .dialog-head {
  position: static;
  top: auto;
  padding-bottom: 0;
}

.dialog-body {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

#orderForm .dialog-body {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  padding-bottom: 96px;
}

.dialog-section {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fbfdff;
}

.dialog-grid {
  margin-top: 14px;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

#orderForm .dialog-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: 0;
  padding: 14px 0 4px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.96) 24%, var(--panel-strong) 100%);
}

.dialog-close-btn {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.dialog-close-btn:hover {
  color: var(--text);
}

.detail-close-btn {
  align-self: flex-start;
  margin-left: auto;
  font-size: 28px;
  padding: 0 4px;
}

#closeOrderForm {
  width: min(680px, calc(100vw - 24px));
  max-width: 100%;
}

#closeOrderForm .dialog-head,
#closeOrderForm .dialog-actions {
  align-items: center;
}

#closeOrderDialog {
  width: min(680px, calc(100vw - 16px));
  max-width: calc(100vw - 16px);
}

#approveForm {
  width: min(680px, calc(100vw - 24px));
  max-width: 100%;
}

#approveDialog {
  width: min(680px, calc(100vw - 16px));
  max-width: calc(100vw - 16px);
}

#closeOrderForm .dialog-section {
  padding: 0;
  border: 0;
  background: transparent;
}

#closeOrderForm .dialog-body {
  margin-top: 8px;
}

.close-order-title-block {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.close-order-title-label {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

.close-order-title {
  min-width: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  word-break: break-word;
}

.close-order-reason-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

#closeOrderForm #closeOrderReason {
  border: 1px solid #ccd8e7;
  border-radius: 12px;
  background: #fff;
  padding: 12px 14px;
  min-height: 120px;
  box-shadow: none;
  resize: none;
}

#closeOrderForm #closeOrderReason:focus {
  outline: none;
  border-color: rgba(31, 99, 196, 0.42);
}

@media (max-width: 1080px) {
  .status-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dual-grid,
  .close-management-grid,
  .overview-grid,
  .record-grid,
  .placeholder-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .shell {
    width: calc(100vw - 16px);
    margin: 12px auto 24px;
  }

  .topbar {
    gap: 10px;
    padding: 4px 0 2px;
  }

  .title-wrap {
    gap: 8px;
    min-width: 0;
    flex-wrap: nowrap;
  }

  .title-badge {
    display: none;
  }

  h1 {
    font-size: 15px;
    line-height: 1.2;
  }

  .primary-btn-compact {
    padding: 6px 10px;
    font-size: 11px;
  }

  .role-switcher {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 6px;
    margin-left: 0;
  }

  .role-switcher .role-switcher-label {
    display: none;
  }

  .role-switcher select {
    padding: 6px 8px;
    font-size: 11px;
  }

  .compact-readonly,
  .role-switcher .inline-note {
    grid-column: 1 / -1;
    font-size: 11px;
  }

  .brand-title {
    font-size: 14px;
    line-height: 1.15;
  }

  .title-actions .primary-btn-compact {
    min-width: 56px;
    padding: 6px 10px;
    font-size: 11px;
  }

  .hero-panel,
  .panel,
  .content-card {
    padding: 16px;
  }

  .hero-panel {
    grid-template-columns: 1fr;
  }

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

  .status-tile {
    padding: 8px 6px;
    min-height: 48px;
    gap: 4px;
    border-radius: 14px;
  }

  .status-label {
    font-size: 9px;
    line-height: 1.15;
  }

  .status-value {
    font-size: 12px;
  }

  .toast-banner {
    top: 10px;
    right: 10px;
    left: 10px;
    padding: 10px 12px;
    text-align: center;
  }

  .order-item,
  .history-item {
    padding: 14px;
  }

  .order-item h3,
  .history-item h3 {
    font-size: 16px;
  }

  .compact-order-item {
    padding: 14px;
    border-radius: 18px;
  }

  .compact-order-code {
    font-size: 12px;
    letter-spacing: 0.08em;
  }

  .compact-order-title {
    margin: 8px 0 6px;
    font-size: 16px;
  }

  .compact-order-line {
    font-size: 13px;
  }

  .compact-order-arrow {
    font-size: 22px;
  }

  .closable-order-row {
    display: block;
  }

  .compact-order-item-inline {
    padding-right: 98px;
  }

  .danger-btn-compact {
    right: 14px;
    min-width: 60px;
    padding: 10px 12px;
  }

  .secondary-btn-compact {
    right: 14px;
    min-width: 60px;
    padding: 10px 12px;
  }

  .history-panel {
    padding: 12px 14px;
  }

  .history-toggle-label {
    font-size: 16px;
  }

  .detail-title {
    font-size: 17px;
    line-height: 1.25;
  }

  .detail-shell {
    gap: 10px;
    padding-bottom: 108px;
  }

  .detail-shell .back-row {
    justify-content: flex-end;
  }

  .detail-head {
    gap: 8px;
  }

  .detail-toolbar {
    gap: 8px;
    align-items: flex-start;
  }

  .detail-meta {
    gap: 6px;
    margin-top: 0;
  }

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

  .tab-nav {
    gap: 6px;
    margin-top: 0;
  }

  .tab-btn {
    padding: 8px 12px;
    font-size: 13px;
  }

  .detail-actions {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 32;
    margin-top: 0;
    padding: 0;
    justify-content: stretch;
  }

  .detail-actions .primary-btn,
  .detail-actions .secondary-btn,
  .detail-actions .ghost-btn,
  .detail-actions .finance-receipt-btn {
    flex: 1 1 0;
  }

  .device-card-head-actions {
    align-items: flex-end;
    gap: 6px;
  }

  .device-change-hint {
    display: none;
  }

  .device-template-choice-grid {
    grid-template-columns: 1fr;
  }

  .sheet-line-mobile-fields {
    display: grid;
  }

  .sheet-line-table {
    display: none;
  }

  .comment-composer {
    padding: 14px;
  }

  .dialog-card {
    width: calc(100vw - 16px);
    padding: 16px;
  }

  #closeOrderDialog {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
  }

  #closeOrderForm {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
  }

  .dialog-section {
    padding: 14px;
  }

  .dialog-close-btn {
    font-size: 34px;
  }

  .close-order-title,
  .close-order-title-label,
  .close-order-reason-field {
    font-size: 13px;
  }

  #closeOrderForm #closeOrderReason {
    min-height: 104px;
  }

  #orderDialog {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    margin: 0;
    inset: 0;
  }

  .order-dialog-card {
    width: 100vw;
    max-width: 100vw;
    min-height: 100vh;
    max-height: 100vh;
    padding: 0;
    border-radius: 0;
    overflow: hidden;
  }

  .order-dialog-head {
    position: sticky;
    top: 0;
    z-index: 5;
    margin: 0;
    padding: 10px 12px 8px;
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid rgba(207, 219, 235, 0.85);
  }

  #orderForm .dialog-body {
    margin-top: 0;
    gap: 8px;
    padding: 0 0 calc(90px + env(safe-area-inset-bottom));
    overflow: auto;
  }

  #orderForm .dialog-actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.94) 22%, #fff 100%);
  }

  #orderForm .dialog-actions .primary-btn {
    width: 100%;
    min-height: 48px;
    border-radius: 16px;
  }

  .order-dialog-body {
    padding-top: 0;
  }

  .draft-order-shell {
    gap: 0;
  }

  .draft-order-group {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .draft-order-intro h3 {
    display: none;
  }

  .draft-order-group {
    margin: 0;
    width: 100%;
  }

  .draft-order-intro {
    display: none;
  }

  .draft-order-groups {
    gap: 8px;
  }

  .draft-order-group-head {
    min-height: 42px;
    padding: 0 16px;
  }

  .draft-order-row {
    grid-template-columns: 78px minmax(0, 1fr);
    min-height: 54px;
    padding: 0 16px;
    gap: 10px;
  }

  .draft-order-row.is-textarea {
    padding-top: 10px;
    padding-bottom: 12px;
  }

  .draft-order-label {
    font-size: 12px;
  }

  .draft-order-control .sheet-inline-input,
  .draft-order-control .sheet-line-value {
    min-height: 38px;
    font-size: 14px;
  }

  .draft-order-control .sheet-textarea {
    min-height: 92px;
  }

  .choice-chip-row {
    gap: 6px;
  }

  .choice-chip {
    min-height: 34px;
    padding: 0 10px;
    font-size: 12px;
  }

  .model-inline-row {
    gap: 6px;
  }

  .model-inline-row .choice-chip {
    padding: 0 6px;
  }

  .bag-size-grid {
    gap: 4px;
  }

  .bag-size-line,
  .bag-size-input-line {
    flex-wrap: nowrap;
    gap: 4px;
    font-size: 12px;
  }

  .bag-size-line strong,
  .bag-size-input-line strong {
    min-width: 34px;
  }

  .bag-size-line .inline-underline-input,
  .bag-size-input-line .inline-underline-input {
    flex: 1 1 0;
    min-width: 58px;
  }

  .bag-size-line .inline-underline-input.qty,
  .bag-size-input-line .inline-underline-input.qty,
  .bag-size-input-line .inline-underline.qty {
    flex: 0 0 24px;
    min-width: 24px;
  }

  .bag-size-line .inline-sep,
  .bag-size-input-line .inline-sep {
    white-space: nowrap;
    font-size: 11px;
  }

  .bag-size-input-line .inline-underline {
    min-width: 58px;
  }

  .dimension-pair-line {
    gap: 4px;
    font-size: 12px;
  }

  .dimension-pair-line .inline-underline-input,
  .dimension-pair-line .inline-underline {
    flex: 0 0 48px;
    min-width: 48px;
    max-width: 48px;
  }

  .inline-image-preview img {
    max-width: 110px;
    max-height: 46px;
  }

  .template-media-grid,
  .sheet-inline-grid {
    grid-template-columns: 1fr;
  }

  .config-figure-thumb {
    width: 70px;
  }

  .config-figure-thumb img {
    height: 38px;
  }
}

.order-dialog-body {
  padding-top: 4px;
}

.order-dialog-card {
  width: 100%;
}

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

.draft-order-intro {
  display: grid;
  gap: 0;
}

.draft-order-intro h3 {
  margin: 0;
  font-size: 17px;
  color: #183153;
}

.draft-order-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.draft-order-groups {
  display: grid;
  gap: 10px;
}

.draft-order-group {
  border-radius: 12px;
  border: 1px solid rgba(220, 229, 240, 0.95);
  background: #fff;
  padding: 0;
  box-shadow: none;
  overflow: hidden;
}

.draft-order-group.preview {
  box-shadow: none;
}

.draft-order-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(229, 236, 245, 0.95);
}

.draft-order-group-head::before {
  content: "";
  width: 3px;
  height: 16px;
  border-radius: 999px;
  background: #2e6de5;
}

.draft-order-group-head h4 {
  margin: 0;
  font-size: 15px;
  color: #183153;
}

.draft-order-list {
  display: grid;
}

.device-add-group {
  border-style: dashed;
}

.device-add-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  min-height: 56px;
  padding: 10px 14px;
}

.draft-order-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(229, 236, 245, 0.95);
}

.draft-order-row:last-child {
  border-bottom: 0;
}

.draft-order-row.is-textarea {
  align-items: start;
  padding-top: 10px;
  padding-bottom: 10px;
}

.draft-order-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  color: #26394d;
  font-size: 13px;
  font-weight: 600;
}

.draft-order-control {
  min-width: 0;
}

.money-with-unit {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.money-with-unit .money-input,
.money-with-unit .money-value {
  flex: 1 1 auto;
  min-width: 0;
}

.money-with-unit.readonly .money-value {
  padding: 0;
  border: 0;
}

.money-unit {
  flex: 0 0 auto;
  color: #5e6b7b;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.prepayment-status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  color: #1b2d42;
}

.prepayment-ratio-value {
  min-width: 46px;
  font-weight: 700;
}

.prepayment-status-value {
  color: #5e6b7b;
  font-size: 13px;
  font-weight: 600;
}

.ship-crate-control {
  display: grid;
  grid-template-columns: minmax(96px, 0.7fr) minmax(132px, 1fr);
  gap: 10px;
  align-items: center;
}

.ship-crate-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.ship-crate-field small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.quantity-with-unit {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.quantity-with-unit .sheet-inline-input {
  flex: 1 1 auto;
  min-width: 0;
}

.quantity-unit {
  flex: 0 0 auto;
  color: #5e6b7b;
  font-size: 13px;
  font-weight: 600;
}

.sheet-inline-input::placeholder,
.sheet-textarea::placeholder,
.finance-amount-input::placeholder {
  color: #8a94a6;
  opacity: 1;
}

.date-placeholder-shell {
  position: relative;
  display: block;
  min-width: 0;
  width: 100%;
}

.date-placeholder-text {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  color: #8a94a6;
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
}

.date-placeholder-shell.has-value .date-placeholder-text,
.date-placeholder-shell:focus-within .date-placeholder-text {
  display: none;
}

.date-placeholder-shell:not(.has-value) .date-placeholder-input {
  color: transparent;
}

.required-star {
  margin-left: 4px;
  color: #d34d43;
  font-style: normal;
}

.draft-order-control .sheet-inline-input,
.draft-order-control .sheet-textarea,
.draft-inline-select {
  width: 100%;
  min-height: 40px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #1b2d42;
  box-sizing: border-box;
  box-shadow: none;
  text-align: left;
}

.draft-order-control .sheet-textarea {
  min-height: 86px;
  resize: none;
  padding: 10px 12px;
  border: 1px solid #d9e2ef;
  border-radius: 10px;
  background: #fff;
}

.empty-device-group .draft-order-group-head {
  justify-content: space-between;
}

.device-empty-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.device-empty-body h3 {
  margin: 0;
  color: #183153;
  font-size: 17px;
}

.device-empty-body p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.device-template-selector {
  display: grid;
  gap: 10px;
}

.device-template-row {
  min-height: 50px;
}

.device-template-input {
  color: var(--brand);
  font-weight: 700;
}

.device-template-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 14px 12px;
}

.device-empty-body .device-template-choice-grid {
  padding: 0;
}

.device-template-choice {
  display: grid;
  gap: 4px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid rgba(31, 99, 196, 0.18);
  border-radius: 12px;
  background: #f8fbff;
  color: #183153;
  text-align: left;
}

.device-template-choice strong {
  color: var(--brand);
  font-size: 14px;
}

.device-template-choice span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.device-card-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.device-card-head-actions .secondary-btn,
.device-card-head-actions .ghost-btn {
  white-space: nowrap;
}

.device-change-hint {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.device-collapse-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 13px;
  border-bottom: 1px solid rgba(229, 236, 245, 0.95);
  flex-wrap: wrap;
}

.device-collapse-summary strong {
  color: #183153;
}

.order-device-group.collapsed .device-collapse-summary {
  border-bottom: 0;
}

.device-list-empty {
  margin-top: 0;
}

.sheet-line-mobile-fields {
  display: none;
}

@media (max-width: 760px) {
  .detail-shell-page {
    width: 100%;
    margin: 0;
  }

  .detail-view-stack {
    gap: 0;
  }

  .detail-shell-page .detail-shell {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .detail-sticky-head {
    padding: 10px 12px;
  }

  .device-card-head-actions {
    align-items: flex-end;
    gap: 6px;
  }

  .device-change-hint {
    display: none;
  }

  .device-template-choice-grid {
    grid-template-columns: 1fr;
  }

  .sheet-line-mobile-fields {
    display: grid;
  }

  .sheet-line-table {
    display: none;
  }

  .device-select-dialog {
    width: 100vw;
    max-width: 100vw;
  }

  .device-select-card {
    width: 100vw;
    max-height: 86vh;
    border-radius: 18px 18px 0 0;
  }
}

.finance-amount-group {
  display: grid;
  gap: 8px;
}

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

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

.finance-inline-pair {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.finance-inline-pair.readonly {
  align-items: stretch;
}

.finance-inline-label {
  flex: 0 0 auto;
  font-size: 12px;
  line-height: 1.2;
  color: #6a7486;
  white-space: nowrap;
}

.finance-inline-pair .sheet-inline-input,
.finance-inline-pair .sheet-line-value {
  flex: 1 1 auto;
  min-width: 0;
}

.finance-inline-pair.readonly .sheet-line-value {
  display: flex;
  align-items: center;
}

.finance-amount-cell {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.finance-inline-pair .finance-amount-input {
  min-width: 0;
  border-width: 0 0 1px;
  border-style: solid;
  border-color: rgba(31, 99, 196, 0.34);
  border-radius: 0;
  background: transparent;
  padding: 0 2px 4px;
  min-height: 30px;
}

.finance-inline-pair .finance-amount-input:focus {
  border-color: rgba(31, 99, 196, 0.72);
  box-shadow: none;
}

.finance-amount-readonly {
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid #d9e2ef;
  border-radius: 10px;
  background: #f8fafc;
  color: #1b2d42;
}

.draft-order-control .sheet-inline-input:focus,
.draft-order-control .sheet-textarea:focus,
.draft-inline-select:focus {
  outline: none;
  border-color: rgba(31, 99, 196, 0.45);
  box-shadow: none;
}

.choice-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.choice-chip-row.choice-grid-2x2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
}

.choice-chip-row.choice-grid-2x2 .choice-chip {
  width: 100%;
  min-width: 0;
}

.choice-chip-row.choice-grid-2x2 .choice-chip span {
  display: block;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
}

.choice-chip-row.choice-inline-row {
  flex-wrap: nowrap;
}

.choice-chip-row.choice-inline-row .choice-chip {
  flex: 1 1 0;
  min-width: 0;
  padding: 0 6px;
}

.choice-chip-row.choice-inline-row .choice-chip span {
  display: block;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
}

.dimension-pair-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
}

.dimension-pair-line .inline-underline-input,
.dimension-pair-line .inline-underline {
  flex: 0 0 57px;
  min-width: 57px;
  max-width: 57px;
}

.dimension-pair-line .inline-sep {
  white-space: nowrap;
}

.inline-image-preview {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.inline-image-preview img {
  display: block;
  max-width: 132px;
  max-height: 52px;
  border-radius: 8px;
  border: 1px solid #d9e2ef;
  background: #fff;
  object-fit: contain;
}

.model-inline-row {
  flex-wrap: nowrap;
}

.model-inline-row .choice-chip {
  flex: 1 1 0;
  min-width: 0;
  padding: 0 8px;
}

.choice-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #cfdbeb;
  background: #fff;
  color: #36506f;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.choice-chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.choice-chip.selected {
  border-color: rgba(31, 99, 196, 0.35);
  background: rgba(31, 99, 196, 0.08);
  color: #1f63c4;
  font-weight: 700;
}

.choice-chip.is-display {
  cursor: default;
}

.choice-chip .chip-inline-input {
  margin-left: 6px;
}

.choice-chip .chip-inline-input.hidden {
  display: none;
}

.option-note-stack {
  display: grid;
  gap: 8px;
}

.option-note-list {
  display: grid;
  gap: 6px;
}

.option-note-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #667a90;
  font-size: 12px;
}

.option-note-row:not(.active) {
  display: none;
}

.inline-underline-input {
  min-width: 56px;
  height: 28px;
  padding: 0 4px;
  border: 0;
  border-bottom: 1px solid #9cb0c8;
  border-radius: 0;
  background: transparent;
  text-align: center;
  color: #1b2d42;
}

.inline-underline-input.qty {
  min-width: 44px;
}

.inline-underline-input.wide {
  flex: 1 1 auto;
  min-width: 90px;
  text-align: left;
}

.inline-underline {
  display: inline-flex;
  min-width: 48px;
  min-height: 22px;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(156, 176, 200, 0.95);
  color: #1b2d42;
}

.inline-underline.inline-display {
  flex: 1 1 auto;
  min-width: 90px;
  justify-content: flex-start;
  padding: 0 4px;
}

.inline-sep {
  color: #667a90;
  font-size: 12px;
}

.bag-size-grid {
  display: grid;
  gap: 6px;
}

.bag-size-section {
  display: grid;
  gap: 8px;
}

.bag-size-title {
  color: #3a5776;
  font-size: 12px;
  font-weight: 600;
}

.bag-size-line,
.bag-size-input-line {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  color: #1b2d42;
  font-size: 13px;
}

.bag-size-line strong,
.bag-size-input-line strong {
  min-width: 42px;
  font-weight: 600;
}

.bag-size-input-line .inline-underline-input {
  flex: 1 1 0;
  min-width: 92px;
}

.bag-size-input-line .inline-underline-input.qty,
.bag-size-input-line .inline-underline.qty {
  flex: 0 0 32px;
  min-width: 32px;
}

.bag-size-input-line .inline-underline {
  flex: 1 1 0;
  min-width: 92px;
}

.bag-size-input-line .inline-sep:last-child {
  flex: 0 0 auto;
  min-width: 18px;
  text-align: right;
}

.draft-order-row.bag-size-split-row {
  align-items: start;
}

.draft-order-group-head.with-figure,
.sheet-compact-head {
  align-items: flex-start;
}

.sheet-compact-head-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.config-figure-thumb {
  flex-shrink: 0;
  display: grid;
  gap: 6px;
  width: 88px;
  padding: 6px;
  border: 1px solid rgba(74, 55, 31, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  color: #4d3922;
  text-align: center;
}

.config-figure-thumb img {
  width: 100%;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
  background: #fff;
}

.config-figure-thumb span {
  color: #51687f;
  font-size: 11px;
  line-height: 1.2;
}

.config-figure-thumb.draft {
  width: 76px;
  padding: 4px;
}

.config-figure-thumb.draft img {
  height: 42px;
}

.draft-order-control .sheet-line-value {
  min-height: 40px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #51687f;
}

.template-rule-table {
  overflow-x: auto;
}

.template-rule-table table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

.template-rule-table th,
.template-rule-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.template-rule-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.template-rule-table td input[type="text"],
.template-rule-table td select,
.template-rule-table td textarea,
.template-rule-table td input:not([type="checkbox"]) {
  width: 100%;
}

.rule-check-cell {
  text-align: center !important;
}

.rule-check-cell input {
  width: 18px;
  height: 18px;
}

.rule-category-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(31, 99, 196, 0.08);
  color: #1f63c4;
  font-size: 12px;
  font-weight: 600;
}

.draft-preview-shell {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, #fbfdff, #f6faff);
  border: 1px solid rgba(207, 219, 235, 0.9);
}

.sheet-order-shell {
  display: grid;
  gap: 14px;
}

.sheet-order-shell.detail {
  gap: 0;
}

.sheet-order-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.sheet-order-toolbar-note {
  color: var(--muted);
  font-size: 13px;
}

.sheet-order-product-picker {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.sheet-order-product-picker select {
  min-width: 260px;
}

.sheet-paper-card {
  border-radius: 22px;
  border: 1px solid rgba(74, 55, 31, 0.14);
  background: linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(252, 248, 242, 0.98));
  padding: 16px;
  color: #221c14;
  box-shadow: 0 16px 34px rgba(74, 55, 31, 0.08);
}

.sheet-paper-card.detail {
  padding: 18px;
}

.sheet-paper-card.preview {
  padding: 14px;
}

.sheet-paper-head {
  display: grid;
  gap: 10px;
  text-align: center;
  padding-bottom: 10px;
  border-bottom: 2px solid rgba(74, 55, 31, 0.22);
}

.sheet-paper-head h2 {
  margin: 0;
  font-size: clamp(20px, 2.4vw, 30px);
  color: #21170d;
}

.sheet-paper-code {
  justify-self: end;
  color: #4d3922;
  font-size: 13px;
}

.sheet-line-list {
  margin-top: 10px;
  border-top: 1px solid rgba(74, 55, 31, 0.14);
}

.sheet-line-item {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 44px;
  border-bottom: 1px solid rgba(74, 55, 31, 0.14);
}

.sheet-line-label {
  color: #221c14;
  font-weight: 700;
}

.sheet-line-value {
  min-height: 22px;
  display: flex;
  align-items: center;
  color: #b54c1d;
}

.sheet-inline-input,
.sheet-textarea {
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #221c14;
}

.sheet-inline-input:focus,
.sheet-textarea:focus {
  outline: none;
}

.sheet-textarea {
  min-height: 68px;
  resize: vertical;
  padding-top: 4px;
}

.sheet-table-head,
.sheet-compact-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sheet-table-head {
  margin-top: 14px;
  margin-bottom: 8px;
}

.sheet-table-head h3,
.sheet-compact-head h4 {
  margin: 0;
  color: #221c14;
}

.sheet-table-head span,
.sheet-compact-head span {
  color: var(--muted);
  font-size: 12px;
}

.sheet-line-table table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.sheet-line-table th,
.sheet-line-table td {
  border: 1px solid rgba(74, 55, 31, 0.26);
  padding: 8px 6px;
  text-align: center;
  vertical-align: middle;
  background: rgba(255, 253, 249, 0.94);
}

.sheet-line-table th {
  background: rgba(246, 239, 229, 0.92);
  color: #221c14;
}

.sheet-line-table td .sheet-inline-input,
.sheet-line-table td select {
  text-align: center;
}

.accent-cell {
  color: #b54c1d;
  font-weight: 700;
}

.sheet-compact-block {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed rgba(74, 55, 31, 0.16);
}

.sheet-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.sheet-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 9px;
  border-radius: 999px;
  border: 1px solid rgba(74, 55, 31, 0.14);
  background: rgba(255, 255, 255, 0.78);
  color: #4d3922;
  font-size: 12px;
}

.sheet-chip.active {
  color: #b54c1d;
  border-color: rgba(181, 76, 29, 0.24);
  background: rgba(181, 76, 29, 0.08);
  font-weight: 700;
}

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

.sheet-inline-field {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(74, 55, 31, 0.14);
}

.sheet-inline-field.full {
  grid-column: 1 / -1;
  align-items: start;
}

.sheet-inline-field small {
  color: var(--muted);
  line-height: 1.35;
}

.sheet-inline-notice {
  margin-top: 10px;
  padding: 9px 10px;
  border-left: 3px solid rgba(31, 99, 196, 0.28);
  background: rgba(31, 99, 196, 0.08);
  color: #365b89;
  font-size: 12px;
  line-height: 1.5;
}

.sheet-reference-block {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed rgba(74, 55, 31, 0.16);
  display: grid;
  gap: 8px;
}

.sheet-reference-title {
  font-size: 13px;
  font-weight: 700;
  color: #4d3922;
}

.sheet-reference-row {
  font-size: 12px;
  color: var(--muted);
}

.detail-mobile-shell {
  display: grid;
  gap: 8px;
}

.desktop-word-shell {
  max-width: 1160px;
  margin: 0 auto;
}

.desktop-word-card {
  border-radius: 8px;
  border-color: rgba(34, 28, 20, 0.3);
  background: #fff;
  padding: 24px 28px 30px;
  box-shadow: 0 10px 28px rgba(34, 28, 20, 0.08);
  font-family: "SimSun", "Songti SC", serif;
}

.desktop-word-card .sheet-paper-head {
  position: relative;
  gap: 8px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(34, 28, 20, 0.6);
}

.desktop-word-card .sheet-paper-head h2 {
  font-size: clamp(28px, 2.6vw, 40px);
  font-weight: 700;
  letter-spacing: 1px;
}

.desktop-word-card .sheet-paper-code {
  position: absolute;
  right: 0;
  bottom: 0;
  color: #bf2f1c;
  font-size: 16px;
}

.desktop-word-card .sheet-line-list {
  margin-top: 16px;
  border-top: 0;
}

.desktop-word-card .sheet-line-item {
  grid-template-columns: 124px minmax(0, 1fr);
  gap: 16px;
  align-items: end;
  min-height: 50px;
  border-bottom: 1px solid rgba(34, 28, 20, 0.22);
}

.desktop-word-card .sheet-line-label {
  font-size: 16px;
}

.desktop-word-card .sheet-line-value {
  min-height: 28px;
  color: #bf2f1c;
}

.desktop-word-card .sheet-inline-input,
.desktop-word-card .sheet-textarea {
  border-bottom: 1px solid rgba(34, 28, 20, 0.2);
}

.desktop-word-card .sheet-textarea {
  min-height: 92px;
}

.desktop-word-card .sheet-table-head {
  margin-top: 22px;
  margin-bottom: 10px;
}

.desktop-word-card .sheet-table-head h3,
.desktop-word-card .sheet-compact-head h4 {
  font-size: 18px;
}

.desktop-word-card .sheet-table-head span,
.desktop-word-card .sheet-compact-head span {
  font-size: 13px;
}

.desktop-word-card .sheet-line-table th,
.desktop-word-card .sheet-line-table td {
  padding: 10px 8px;
  border-color: rgba(34, 28, 20, 0.34);
  background: #fff;
  font-size: 15px;
}

.desktop-word-card .sheet-line-table th {
  background: #f6f1ea;
}

.desktop-word-card .sheet-compact-block {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid rgba(34, 28, 20, 0.24);
}

.desktop-word-card .sheet-chip {
  border-radius: 999px;
  border-color: rgba(34, 28, 20, 0.18);
  background: #fff;
}

.desktop-word-card .sheet-chip.active {
  color: #bf2f1c;
  border-color: rgba(191, 47, 28, 0.3);
  background: rgba(191, 47, 28, 0.05);
}

.desktop-word-card .word-inline-grid {
  grid-template-columns: 1fr;
  gap: 12px;
}

.desktop-word-card .word-field {
  grid-template-columns: 116px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding-bottom: 10px;
}

.desktop-word-card .word-field small {
  color: #221c14;
  font-size: 15px;
  font-weight: 700;
}

.desktop-word-card .word-field .sheet-line-value {
  border-bottom: 1px solid rgba(34, 28, 20, 0.18);
  padding-bottom: 5px;
}

.desktop-word-card .finance-amount-readonly {
  border-color: rgba(34, 28, 20, 0.18);
  background: transparent;
  color: #bf2f1c;
}

.desktop-word-card .word-field .sheet-inline-input,
.desktop-word-card .word-field .sheet-textarea {
  padding-bottom: 5px;
}

.desktop-word-card .option-note-row {
  font-size: 13px;
}

.template-center-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.template-product-list {
  display: grid;
  gap: 10px;
  align-content: start;
}

.template-product-item {
  display: grid;
  gap: 4px;
  padding: 14px;
  text-align: left;
  border-radius: 18px;
  border: 1px solid rgba(216, 226, 239, 0.94);
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  color: var(--text);
}

.template-product-item.active {
  border-color: rgba(31, 99, 196, 0.26);
  background: linear-gradient(180deg, #ffffff, #eef5ff);
}

.template-product-item span {
  color: var(--muted);
  font-size: 13px;
}

.template-editor-shell {
  display: grid;
  gap: 16px;
}

.template-editor-meta,
.template-default-grid,
.template-header-grid {
  display: grid;
  gap: 12px;
}

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

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

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

.template-edit-section {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(216, 226, 239, 0.94);
  background: rgba(255, 255, 255, 0.72);
}

.template-edit-section label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

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

.sales-region-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(244, 247, 251, 0.82);
}

.sales-region-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sales-region-meta span {
  color: var(--muted);
  font-size: 12px;
}

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

.template-media-stack {
  display: grid;
  gap: 16px;
}

.template-media-preview-card {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 14px;
  border-radius: 18px;
  border: 1px dashed rgba(31, 99, 196, 0.26);
  background: linear-gradient(180deg, #fbfdff, #f7fbff);
  color: var(--muted);
  text-align: center;
}

.template-media-preview-card.has-image {
  border-style: solid;
  color: var(--text);
}

.template-media-preview-card:disabled {
  cursor: default;
  opacity: 1;
}

.template-media-preview-image {
  width: 100%;
  max-width: 200px;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border-radius: 14px;
  background: #fff;
}

.template-media-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 200px;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  background: rgba(31, 99, 196, 0.06);
  color: var(--muted);
  font-size: 13px;
}

.template-upload-cta {
  display: inline-grid !important;
  justify-items: start;
  gap: 8px;
  color: var(--text) !important;
  font-weight: 600;
}

.template-media-side {
  display: grid;
  gap: 8px;
  align-content: center;
}

.template-upload-cta input[type="file"] {
  width: 100%;
}

.template-header-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(244, 247, 251, 0.78);
}

.template-preview-shell {
  margin-top: 14px;
}

.image-preview-card {
  width: min(980px, calc(100vw - 24px));
}

.image-preview-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  padding-top: 12px;
}

.image-preview-body img {
  width: 100%;
  max-height: min(72vh, 760px);
  object-fit: contain;
  border-radius: 18px;
  background: #fff;
}

@media (max-width: 920px) {
  .template-center-layout {
    grid-template-columns: 1fr;
  }

  .template-editor-meta,
  .template-default-grid,
  .template-header-grid,
  .sales-region-grid,
  .sheet-inline-grid {
    grid-template-columns: 1fr;
  }

  .sheet-line-item {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 8px 0;
  }

  .sheet-order-product-picker select {
    min-width: 0;
  }
}

@media (max-width: 760px) {
  .finance-amount-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .finance-inline-label {
    font-size: 11px;
  }

  .finance-inline-pair {
    gap: 6px;
  }

  .finance-amount-input,
  .finance-amount-readonly {
    min-height: 38px;
    padding-left: 8px;
    padding-right: 8px;
    font-size: 13px;
  }

  .draft-order-row.bag-size-split-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .draft-order-row.bag-size-split-row .draft-order-control {
    overflow: hidden;
  }

  .sheet-inline-field.bag-size-field {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 6px;
  }

  .draft-order-row.bag-size-split-row .bag-size-section {
    gap: 6px;
  }

  .draft-order-row.bag-size-split-row .bag-size-input-line {
    display: grid;
    grid-template-columns: 44px 12px minmax(46px, 1fr) 10px 14px minmax(46px, 1fr) 22px;
    align-items: center;
    column-gap: 4px;
    row-gap: 0;
    width: 100%;
  }

  .draft-order-row.bag-size-split-row .bag-size-input-line.outer-line {
    grid-template-columns: 44px 26px 10px 12px minmax(42px, 1fr) 10px 14px minmax(42px, 1fr) 22px;
  }

  .draft-order-row.bag-size-split-row .bag-size-input-line strong,
  .draft-order-row.bag-size-split-row .bag-size-input-line .inline-sep,
  .draft-order-row.bag-size-split-row .bag-size-input-line .inline-underline,
  .draft-order-row.bag-size-split-row .bag-size-input-line .inline-underline-input {
    min-width: 0;
  }

  .draft-order-row.bag-size-split-row .bag-size-input-line strong {
    font-size: 11px;
    white-space: nowrap;
  }

  .draft-order-row.bag-size-split-row .bag-size-input-line .inline-sep {
    font-size: 10px;
    text-align: center;
  }

  .draft-order-row.bag-size-split-row .bag-size-input-line .inline-sep:last-child {
    min-width: 22px;
    text-align: left;
  }

  .draft-order-row.bag-size-split-row .bag-size-input-line .inline-underline,
  .draft-order-row.bag-size-split-row .bag-size-input-line .inline-underline-input {
    width: 100%;
    min-width: 0;
  }

  .draft-order-row.bag-size-split-row .bag-size-input-line .inline-underline-input.qty,
  .draft-order-row.bag-size-split-row .bag-size-input-line .inline-underline.qty {
    width: 100%;
    min-width: 0;
  }
}
