:root {
  --ink: #111111;
  --ink-inverse: #ffffff;
  --ink-soft: #707072;
  --ink-faint: #9e9ea0;
  --paper: #f5f5f5;
  --surface: #ffffff;
  --surface-subtle: #fafafa;
  --surface-hover: #eeeeee;
  --line: #cacacb;
  --line-soft: #e5e5e5;
  --red: #e63217;
  --red-dark: #bd2812;
  --red-soft: #fff0ec;
  --green: #007d48;
  --green-soft: #e8f6ef;
  --amber: #8c5a00;
  --amber-soft: #fff5d6;
  --blue: #245b78;
  --blue-soft: #edf5f9;
  --focus: #275dc5;
  --sidebar-width: 240px;
  --topbar-height: 104px;
  --radius-sm: 4px;
  --radius: 8px;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  color-scheme: light;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Helvetica Neue", Helvetica, Arial, "Noto Sans TC", "PingFang TC", sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button { cursor: pointer; }
[hidden] { display: none !important; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-family: "Arial Narrow", "Helvetica Neue", sans-serif;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.eyebrow--red { color: var(--red); }

.brand-lockup {
  min-width: 0;
  display: flex;
  align-items: center;
}

.brand-lockup img {
  display: block;
  width: auto;
  height: auto;
  flex: 0 0 auto;
  object-fit: contain;
}

.brand-lockup--login {
  position: relative;
  width: 300px;
  max-width: min(62vw, 100%);
  aspect-ratio: 3079 / 2164;
  padding: 0;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
  isolation: isolate;
}

.brand-lockup--login img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 240ms ease;
}

#login-logo-particles {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  touch-action: none;
  transition: opacity 240ms ease;
}

.brand-lockup--login.is-particle-ready img { opacity: 0; }
.brand-lockup--login.is-particle-ready #login-logo-particles { opacity: 1; }

.brand-lockup--topbar img { width: 140px; }

.login-view {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(440px, 1.1fr) minmax(420px, 0.9fr);
  background: var(--surface);
}

.login-brand {
  position: relative;
  min-height: 640px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px 64px;
  overflow: hidden;
  color: var(--ink-inverse);
  background: var(--ink);
}

.login-brand::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 10px;
  height: 100%;
  background: var(--red);
}

.login-brand > * {
  position: relative;
  z-index: 1;
}

.login-brand__statement {
  max-width: 680px;
  margin: 80px 0 64px;
}

.login-brand__statement .eyebrow { color: #b7b7b9; }

.login-brand__statement h1 {
  max-width: 700px;
  margin: 0;
  font-family: "Arial Narrow", "Helvetica Neue", sans-serif;
  font-size: 64px;
  font-weight: 700;
  line-height: 0.96;
}

.login-brand__statement > p:last-child {
  max-width: 430px;
  margin: 24px 0 0;
  color: #d6d6d7;
  font-size: 17px;
  line-height: 1.7;
}

.login-brand__footer {
  display: flex;
  gap: 24px;
  color: #9e9ea0;
  font-size: 10px;
  font-weight: 700;
}

.login-panel {
  min-height: 640px;
  display: grid;
  place-items: center;
  padding: 64px;
  background: var(--surface);
}

.login-form {
  width: min(100%, 420px);
  padding: 40px;
  border: 1px solid var(--line-soft);
  border-top: 5px solid var(--red);
  border-radius: var(--radius);
  background: var(--surface);
}

.login-form__heading { margin-bottom: 32px; }

.login-form__heading h2 {
  margin: 0;
  font-family: "Arial Narrow", "Helvetica Neue", sans-serif;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.1;
}

.login-form__heading > p:last-child {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
}

.login-form__support {
  margin: 22px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 20px;
}

.field > span {
  color: #333333;
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea,
.search-field input {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  background: var(--paper);
  transition: border-color 160ms ease, background-color 160ms ease;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.field input:hover,
.field select:hover,
.field textarea:hover,
.search-field input:hover { border-color: var(--ink-soft); }

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-field input:focus {
  border-color: var(--ink);
  background: var(--surface);
}

.field small {
  min-height: 15px;
  color: var(--red-dark);
  font-size: 11px;
}

.field.has-error input,
.field.has-error select { border-color: var(--red); }

.field.has-error .image-picker__select { border-color: var(--red); }

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.button__icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  flex: 0 0 18px;
  place-items: center;
  font-size: 18px;
  line-height: 1;
}

.button:disabled {
  cursor: not-allowed;
  color: var(--ink-faint);
  background: var(--surface-hover);
  border-color: var(--surface-hover);
}

.button--primary {
  color: var(--ink-inverse);
  background: var(--red);
}

.button--primary:hover:not(:disabled) { background: var(--red-dark); }

.button--danger {
  color: var(--ink-inverse);
  border-color: var(--red-dark);
  background: var(--red-dark);
}

.button--danger:hover:not(:disabled) {
  border-color: #8f1c0c;
  background: #8f1c0c;
}

.button--secondary {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface);
}

.button--secondary:hover:not(:disabled) {
  border-color: var(--ink);
  background: var(--paper);
}

.button--quiet {
  min-height: 38px;
  padding: 8px 14px;
  color: var(--ink-soft);
  border-color: var(--line-soft);
  background: var(--surface);
}

.icon-command {
  width: 46px;
  height: 46px;
  display: inline-grid;
  flex: 0 0 46px;
  place-items: center;
  padding: 0;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  font-size: 24px;
  line-height: 1;
}

.icon-command:hover:not(:disabled) {
  color: var(--ink-inverse);
  border-color: var(--ink);
  background: var(--ink);
}

.icon-command:disabled { opacity: 0.65; }
.icon-command.is-spinning { animation: board-spin 720ms linear infinite; }

.button--quiet:hover {
  color: var(--ink);
  border-color: var(--line);
  background: var(--paper);
}

.button--full {
  width: 100%;
  justify-content: space-between;
}

.form-alert {
  margin: 0 0 18px;
  padding: 12px 14px;
  color: #8a1e0c;
  border-left: 3px solid var(--red);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--red-soft);
  font-size: 13px;
  line-height: 1.5;
}

.app-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: var(--topbar-height) minmax(calc(100vh - var(--topbar-height)), auto);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  grid-column: 1 / -1;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
}

.topbar__account {
  display: flex;
  align-items: center;
  gap: 14px;
}

.agent-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-badge__initials {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--ink-inverse);
  border-radius: 50%;
  background: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.agent-badge__copy {
  display: grid;
  gap: 2px;
}

.agent-badge__copy strong { font-size: 13px; }
.agent-badge__copy small { color: var(--ink-soft); font-size: 10px; }

.sidebar {
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  display: flex;
  flex-direction: column;
  padding: 28px 16px 20px;
  color: var(--ink-inverse);
  background: var(--ink);
}

.sidebar__region {
  display: grid;
  gap: 3px;
  margin: 0 10px 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid #39393b;
}

.sidebar__region span,
.sidebar__region small {
  color: #9e9ea0;
  font-size: 10px;
}

.sidebar__region strong {
  margin-top: 2px;
  font-family: "Arial Narrow", "Helvetica Neue", sans-serif;
  font-size: 24px;
  line-height: 1.15;
}

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

.nav-item {
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  padding: 8px 12px;
  color: #cacacb;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
}

.nav-item:hover {
  color: var(--ink-inverse);
  background: #28282a;
}

.nav-item.is-active {
  color: var(--ink-inverse);
  border-left-color: var(--red);
  background: #28282a;
}

.nav-item__index {
  color: #707072;
  font-size: 10px;
  font-weight: 700;
}

.sidebar__security {
  margin: auto 10px 0;
  color: #9e9ea0;
  font-size: 11px;
  line-height: 1.5;
}

.sidebar__security::before {
  content: "";
  width: 7px;
  height: 7px;
  display: inline-block;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--green);
}

.workspace {
  min-width: 0;
  padding: 48px;
  background: var(--paper);
}

.workspace-section {
  width: min(100%, 1320px);
  margin: 0 auto;
}

.page-header,
.detail-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 28px;
}

.page-header h1,
.detail-header h1 {
  margin: 0;
  font-family: "Arial Narrow", "Helvetica Neue", sans-serif;
  font-size: 42px;
  font-weight: 700;
  line-height: 0.98;
}

.page-header > div > p:last-child,
.detail-header > div > p:last-child {
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
}

.page-header__actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.sync-state {
  min-width: 146px;
  display: grid;
  justify-items: end;
  gap: 3px;
  line-height: 1.25;
}

.sync-state span {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.sync-state span[data-state="syncing"] { color: #8c6200; }
.sync-state span[data-state="failed"] { color: #9f2411; }

.sync-state small {
  color: var(--ink-soft);
  font-size: 11px;
  white-space: nowrap;
}

.metrics-band {
  min-height: 116px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 24px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
}

.metric {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  padding: 22px 26px;
  border-right: 1px solid var(--line-soft);
}

.metric:last-child { border-right: 0; }
.metric span { color: var(--ink-soft); font-size: 12px; }

.metric strong {
  overflow: hidden;
  font-family: "Arial Narrow", "Helvetica Neue", sans-serif;
  font-size: 32px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric--accent {
  color: var(--ink-inverse);
  background: var(--ink);
}

.metric--accent span { color: #cacacb; }

.list-tools {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
}

.board-tools {
  min-height: 52px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.board-tools .search-field { width: 100%; max-width: 460px; }

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(4, minmax(68px, auto));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.segmented-control button {
  min-height: 42px;
  padding: 8px 12px;
  color: var(--ink-soft);
  border: 0;
  border-right: 1px solid var(--line-soft);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.segmented-control button:last-child { border-right: 0; }

.segmented-control button:hover,
.segmented-control button.is-active {
  color: var(--ink-inverse);
  background: var(--ink);
}

.order-board {
  display: grid;
  grid-auto-columns: minmax(280px, 310px);
  grid-auto-flow: column;
  gap: 12px;
  padding-bottom: 12px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: inline proximity;
}

.order-board-lane {
  --lane-color: var(--ink);
  min-width: 0;
  align-self: start;
  padding: 0 10px 12px;
  border-top: 4px solid var(--lane-color);
  border-radius: var(--radius-sm);
  background: #ededed;
  scroll-snap-align: start;
}

.order-board-lane--planning { --lane-color: var(--red); }
.order-board-lane--production { --lane-color: var(--blue); }
.order-board-lane--delivery { --lane-color: var(--green); }
.order-board-lane--closing { --lane-color: var(--amber); }
.order-board-lane--completed { --lane-color: var(--ink); }
.order-board-lane--cancelled { --lane-color: #8a3030; }
.order-board-lane--other { --lane-color: var(--ink-soft); }

.order-board-lane__header {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 2px 10px;
}

.order-board-lane__header span {
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 700;
}

.order-board-lane__header h2 {
  margin: 3px 0 0;
  font-family: "Arial Narrow", "Helvetica Neue", sans-serif;
  font-size: 20px;
  line-height: 1;
}

.order-board-lane__header > strong {
  min-width: 30px;
  min-height: 30px;
  display: inline-grid;
  place-items: center;
  padding: 4px 7px;
  color: var(--ink-inverse);
  border-radius: 50%;
  background: var(--lane-color);
  font-size: 11px;
}

.order-board-lane__orders { display: grid; gap: 9px; }

.order-board-lane__empty {
  min-height: 92px;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--ink-faint);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  font-size: 11px;
}

.order-board-card {
  min-height: 252px;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 11px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.order-board-card__header,
.order-board-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.order-board-card__header > strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-status {
  flex: 0 0 auto;
  max-width: 132px;
  overflow: hidden;
  padding: 4px 7px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-subtle);
  font-size: 9px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-status--planning { color: var(--red-dark); border-color: #e9afa5; background: var(--red-soft); }
.board-status--production { color: var(--blue); border-color: #a9c8d8; background: var(--blue-soft); }
.board-status--delivery { color: var(--green); border-color: #9cc9b5; background: var(--green-soft); }
.board-status--closing { color: var(--amber); border-color: #dbc582; background: var(--amber-soft); }
.board-status--cancelled { color: #7f1d1d; border-color: #dfaaaa; background: #fff1f1; }

.order-board-card h3 {
  min-height: 40px;
  margin: 0;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.35;
}

.order-board-card__items {
  min-height: 30px;
  margin: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.45;
}

.order-board-card__facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin: 0;
}

.order-board-card__facts div { min-width: 0; }
.order-board-card__facts dt { color: var(--ink-soft); font-size: 9px; }

.order-board-card__facts dd {
  margin: 3px 0 0;
  overflow: hidden;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-board-card__footer {
  padding-top: 11px;
  border-top: 1px solid var(--line-soft);
}

.board-customer-action {
  padding: 5px 0;
  color: var(--ink);
  border: 0;
  background: transparent;
  font-size: 10px;
  font-weight: 700;
}

.board-customer-action:hover { color: var(--red); }

@keyframes board-spin { to { transform: rotate(360deg); } }

.search-field {
  position: relative;
  flex: 1;
  max-width: 560px;
}

.search-field__icon {
  position: absolute;
  top: 50%;
  left: 14px;
  z-index: 1;
  color: var(--ink-soft);
  font-size: 22px;
  line-height: 1;
  transform: translateY(-52%);
  pointer-events: none;
}

.search-field input {
  min-height: 48px;
  padding-left: 44px;
  background: var(--surface);
}

.result-count {
  margin-left: auto;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.table-wrap {
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
}

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

.data-table th {
  height: 46px;
  padding: 0 16px;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
  background: var(--surface-subtle);
  font-size: 10px;
  font-weight: 700;
  text-align: left;
  text-transform: uppercase;
}

.data-table td {
  min-height: 66px;
  padding: 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background-color 140ms ease; }
.data-table tbody tr:hover { background: var(--surface-subtle); }
.data-table th:nth-child(1) { width: 27%; }
.data-table th:nth-child(2) { width: 16%; }
.data-table th:nth-child(3) { width: 17%; }
.data-table th:nth-child(4) { width: 14%; }
.data-table th:nth-child(5) { width: 17%; }
.data-table th:nth-child(6) { width: 9%; }

.customer-name {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.customer-name strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-name small { color: var(--ink-soft); font-size: 10px; }

.row-action {
  min-width: 72px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font-size: 11px;
  font-weight: 700;
}

.row-action:hover {
  color: var(--ink-inverse);
  border-color: var(--ink);
  background: var(--ink);
}

.tag {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  color: #4b4b4d;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font-size: 10px;
  font-weight: 700;
}

.tag--active {
  color: var(--green);
  border-color: #9cc9b5;
  background: var(--green-soft);
}

.tag--warning {
  color: var(--amber);
  border-color: #dbc582;
  background: var(--amber-soft);
}

.agent-table th:nth-child(1) { width: 31%; }
.agent-table th:nth-child(2) { width: 20%; }
.agent-table th:nth-child(3) { width: 13%; }
.agent-table th:nth-child(4) { width: 18%; }
.agent-table th:nth-child(5) { width: 18%; }

.agent-code-value {
  font-family: "Arial Narrow", "Helvetica Neue", sans-serif;
  font-size: 14px;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.table-action {
  min-height: 34px;
  padding: 6px 10px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 11px;
  font-weight: 700;
}

.table-action:hover {
  border-color: var(--ink);
  background: var(--paper);
}

.table-action--danger { color: var(--red-dark); }

.table-action--danger:hover {
  color: var(--ink-inverse);
  border-color: var(--red-dark);
  background: var(--red-dark);
}

.loading-state {
  min-height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
}

.loading-state span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
  animation: pulse 900ms ease-in-out infinite;
}

.loading-state span:nth-child(2) { animation-delay: 140ms; }
.loading-state span:nth-child(3) { animation-delay: 280ms; }

@keyframes pulse {
  0%, 100% { transform: translateY(0); opacity: 0.25; }
  50% { transform: translateY(-5px); opacity: 1; }
}

.empty-state {
  min-height: 300px;
  display: grid;
  place-items: center;
  align-content: center;
  padding: 36px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
  text-align: center;
}

.empty-state h2,
.empty-state h3 {
  margin: 0;
  font-family: "Arial Narrow", "Helvetica Neue", sans-serif;
  font-size: 28px;
}

.empty-state p:not(.eyebrow) {
  max-width: 520px;
  margin: 10px 0 20px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}

.empty-state--compact { min-height: 180px; }
.empty-state--compact h3 { font-size: 22px; }

.text-action {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  padding: 0;
  color: var(--ink-soft);
  border: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.text-action:hover { color: var(--red); }
.detail-header { align-items: center; margin-bottom: 24px; }

.ownership-stamp {
  min-width: 132px;
  padding: 14px 16px;
  color: var(--ink-inverse);
  border-left: 4px solid var(--red);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--ink);
}

.ownership-stamp span {
  display: block;
  color: #9e9ea0;
  font-size: 9px;
}

.ownership-stamp strong {
  display: block;
  margin-top: 4px;
  font-family: "Arial Narrow", "Helvetica Neue", sans-serif;
  font-size: 17px;
}

.customer-facts {
  margin-bottom: 40px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
}

.customer-facts dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}

.customer-facts dl > div {
  min-height: 94px;
  padding: 20px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.customer-facts dl > div:nth-child(3n) { border-right: 0; }
.customer-facts dl > div:nth-last-child(-n+3) { border-bottom: 0; }

.customer-facts dt {
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.customer-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.customer-images-section {
  margin: 0 0 36px;
}

.section-heading--compact {
  align-items: flex-end;
}

.customer-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.customer-image {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.customer-image a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.customer-image img {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: cover;
  background: var(--surface-subtle);
}

.customer-image figcaption {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 10px 12px;
}

.customer-image strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-image small {
  color: var(--ink-soft);
  font-size: 9px;
}

.orders-section { margin-top: 8px; }

.section-heading {
  display: flex;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 14px;
}

.section-heading h2 {
  margin: 0;
  font-family: "Arial Narrow", "Helvetica Neue", sans-serif;
  font-size: 28px;
}

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

.order-row {
  min-height: 84px;
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) minmax(110px, 0.7fr) minmax(110px, 0.7fr) minmax(130px, 0.8fr) 110px;
  gap: 18px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid var(--line-soft);
  border-left: 4px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.order-row.is-complete { border-left-color: var(--green); }

.order-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.order-main strong {
  overflow: hidden;
  font-family: "Arial Narrow", "Helvetica Neue", sans-serif;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-main small,
.order-cell span { color: var(--ink-soft); font-size: 10px; }
.order-cell { display: grid; gap: 4px; }
.order-cell strong { overflow-wrap: anywhere; font-size: 12px; }

.status-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  color: var(--blue);
  border: 1px solid #aac1d1;
  border-radius: 999px;
  background: var(--blue-soft);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.status-pill.is-paid {
  color: var(--green);
  border-color: #9cc9b5;
  background: var(--green-soft);
}

.order-items {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-top: 11px;
  border-top: 1px solid var(--line-soft);
}

.order-item-chip {
  padding: 6px 9px;
  color: #4b4b4d;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--paper);
  font-size: 10px;
}

.customer-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  max-height: calc(100svh - 32px);
  padding: 0;
  overflow: hidden;
  border: 1px solid #39393b;
  border-radius: var(--radius);
  background: var(--surface);
}

.customer-dialog::backdrop { background: rgba(17, 17, 17, 0.72); }

.confirm-dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  overflow: hidden;
  border: 1px solid #39393b;
  border-radius: var(--radius);
  background: var(--surface);
}

.confirm-dialog::backdrop { background: rgba(17, 17, 17, 0.72); }

.confirm-dialog__body { padding: 28px 28px 0; }

.confirm-dialog__body h2 {
  margin: 7px 0 12px;
  font-family: "Arial Narrow", "Helvetica Neue", sans-serif;
  font-size: 28px;
}

.confirm-dialog__body > p:not(.eyebrow) {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.7;
}

.confirm-dialog__warning {
  margin-top: 20px;
  padding: 12px 14px;
  color: var(--red-dark);
  border-left: 4px solid var(--red);
  background: var(--red-soft);
  font-size: 12px;
  font-weight: 700;
}

.confirm-dialog .dialog-actions { margin: 24px -28px 0; }

.customer-form {
  max-height: calc(100vh - 34px);
  max-height: calc(100svh - 34px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  padding: 0;
}

.dialog-header {
  min-height: 98px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  color: var(--ink-inverse);
  border-bottom: 5px solid var(--red);
  background: var(--ink);
}

.dialog-header h2 {
  margin: 0;
  font-family: "Arial Narrow", "Helvetica Neue", sans-serif;
  font-size: 28px;
}

.dialog-header .eyebrow { color: #ff8b77; }

.dialog-close {
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--ink-inverse);
  border: 1px solid #707072;
  border-radius: 50%;
  background: transparent;
  font-size: 26px;
  line-height: 1;
}

.dialog-close:hover { border-color: var(--ink-inverse); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
  padding: 28px 28px 8px;
  overflow-y: auto;
}

.field--wide { grid-column: 1 / -1; }
.customer-form .form-alert { margin: 0 28px 18px; }

.image-picker {
  display: grid;
  gap: 10px;
}

.image-picker__select {
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  cursor: pointer;
}

.image-picker__select:hover { border-color: var(--ink); }

.image-picker__select:focus-within {
  border-color: var(--ink);
  outline: 2px solid rgba(17, 17, 17, 0.12);
  outline-offset: 2px;
}

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

.image-picker__icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  color: var(--ink-inverse);
  border-radius: var(--radius-sm);
  background: var(--ink);
  font-size: 20px;
}

.image-picker__select > span:last-of-type,
.image-picker__preview > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.image-picker__select strong,
.image-picker__preview strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-picker__select small,
.image-picker__preview small {
  min-height: 0;
  color: var(--ink-soft);
  font-size: 10px;
}

.image-picker__preview {
  min-height: 72px;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.image-picker__preview[hidden] { display: none; }

.image-picker__preview img {
  width: 72px;
  height: 72px;
  display: block;
  object-fit: cover;
  background: var(--surface-subtle);
}

.image-picker__remove {
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--red-dark);
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  background: var(--surface);
  font-size: 20px;
  line-height: 1;
}

.image-picker__remove:hover {
  color: var(--ink-inverse);
  border-color: var(--red-dark);
  background: var(--red-dark);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 28px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface-subtle);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  max-width: min(390px, calc(100vw - 44px));
  padding: 14px 16px;
  color: var(--ink-inverse);
  border: 1px solid #39393b;
  border-left: 4px solid var(--red);
  border-radius: var(--radius-sm);
  background: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 1100px) {
  :root { --sidebar-width: 212px; }
  .workspace { padding: 40px 32px; }
  .page-header h1,
  .detail-header h1 { font-size: 38px; }
}

@media (max-width: 900px) {
  .login-view { grid-template-columns: 1fr; }
  .login-brand { min-height: 360px; padding: 32px 40px; }
  .login-brand::before { width: 8px; }
  .login-brand__statement { margin: 48px 0 28px; }
  .login-brand__statement h1 { font-size: 50px; }
  .login-brand__statement > p:last-child { margin-top: 16px; font-size: 15px; }
  .brand-lockup--login { width: 240px; }
  .login-panel { min-height: auto; padding: 48px 24px; }
  .login-form { padding: 34px; }

  .app-view {
    grid-template-columns: 1fr;
    grid-template-rows: var(--topbar-height) 52px minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: var(--topbar-height);
    z-index: 19;
    grid-row: 2;
    height: 52px;
    flex-direction: row;
    align-items: center;
    padding: 0 20px;
    overflow-x: auto;
    background: #202020;
  }

  .sidebar__region,
  .sidebar__security { display: none; }
  .nav-list { display: flex; gap: 2px; }

  .nav-item {
    width: auto;
    min-height: 44px;
    grid-template-columns: 1fr;
    padding: 8px 15px;
    border-left: 0;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
  }

  .nav-item.is-active {
    border-left: 0;
    border-bottom-color: var(--red);
  }

  .nav-item__index { display: none; }
  .workspace { grid-row: 3; }
  .customer-facts dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customer-facts dl > div:nth-child(3n) { border-right: 1px solid var(--line-soft); }
  .customer-facts dl > div:nth-child(2n) { border-right: 0; }
  .customer-facts dl > div:nth-last-child(-n+3) { border-bottom: 1px solid var(--line-soft); }
  .customer-facts dl > div:nth-last-child(-n+2) { border-bottom: 0; }
  .order-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-items { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  :root { --topbar-height: 84px; }
  .topbar { padding: 0 16px; }
  .brand-lockup--topbar img { width: 100px; }
  .brand-lockup--login { width: 220px; }
  .agent-badge__copy { display: none; }
  .agent-badge__initials { width: 36px; height: 36px; }
  .topbar__account { gap: 8px; }
  .topbar .button--quiet { min-width: 54px; min-height: 38px; padding: 7px 10px; }
  .sidebar { padding: 0 10px; }
  .workspace { padding: 28px 16px 40px; }

  .page-header,
  .detail-header {
    align-items: flex-start;
    gap: 18px;
  }

  .page-header h1,
  .detail-header h1 { font-size: 38px; }
  .page-header > .button { min-height: 42px; padding: 9px 12px; white-space: nowrap; }
  .page-header__actions .button { min-height: 42px; padding: 9px 12px; white-space: nowrap; }
  .metrics-band { min-height: 92px; margin-bottom: 20px; }
  .metric { gap: 5px; padding: 14px 12px; }
  .metric span { min-height: 30px; font-size: 10px; line-height: 1.4; }
  .metric strong { font-size: 23px; }
  .list-tools { align-items: stretch; flex-direction: column; gap: 8px; }
  .search-field { max-width: none; }
  .result-count { margin-left: 0; }
  .board-tools { grid-template-columns: 1fr; align-items: stretch; gap: 9px; }
  .board-tools .search-field { max-width: none; }
  .segmented-control { width: 100%; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .segmented-control button { min-width: 0; padding-inline: 6px; }
  .order-board { grid-auto-flow: row; grid-template-columns: minmax(0, 1fr); overflow: visible; }
  .order-board-lane { width: 100%; }
  .icon-command { width: 42px; height: 42px; flex-basis: 42px; }

  .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .data-table,
  .data-table tbody { display: block; }
  .data-table thead { display: none; }

  .data-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 11px 14px;
    margin-bottom: 10px;
    padding: 16px;
    border: 1px solid var(--line-soft);
    border-left: 4px solid var(--ink);
    border-radius: var(--radius-sm);
    background: var(--surface);
  }

  .data-table td {
    min-height: 0;
    display: block;
    padding: 0;
    border: 0;
  }

  .data-table td:nth-child(1) { grid-column: 1 / -1; }
  .data-table td:nth-child(2)::before { content: "聯絡人  "; color: var(--ink-soft); font-size: 9px; }
  .data-table td:nth-child(3) { grid-column: 1 / -1; color: var(--ink-soft); }
  .data-table td:nth-child(4),
  .data-table td:nth-child(5) { display: none; }
  .data-table td:nth-child(6) { grid-column: 2; grid-row: 2; }
  .agent-table td:nth-child(1) { grid-column: 1 / -1; }
  .agent-table td:nth-child(2) { grid-column: 1; color: var(--ink); }
  .agent-table td:nth-child(2)::before { content: "代理  "; color: var(--ink-soft); font-size: 9px; }
  .agent-table td:nth-child(3) { grid-column: 2; grid-row: 2; }
  .agent-table td:nth-child(4) { display: block; grid-column: 1 / -1; color: var(--ink-soft); font-size: 11px; }
  .agent-table td:nth-child(4)::before { content: "建立日期  "; font-size: 9px; }
  .agent-table td:nth-child(5) { display: block; grid-column: 1 / -1; }
  .agent-table .table-actions { justify-content: flex-end; }
  .customer-name strong { font-size: 15px; }
  .detail-header { gap: 12px; }
  .ownership-stamp { min-width: 98px; padding: 11px 12px; }

  .customer-facts dl { grid-template-columns: 1fr; }
  .customer-facts dl > div,
  .customer-facts dl > div:nth-child(2n),
  .customer-facts dl > div:nth-child(3n),
  .customer-facts dl > div:nth-last-child(-n+2) {
    min-height: 76px;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .customer-facts dl > div:last-child { border-bottom: 0; }
  .customer-images { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-row { grid-template-columns: 1fr 1fr; gap: 13px; padding: 15px; }
  .order-main { grid-column: 1 / -1; }
  .order-items { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: 1fr; padding: 22px 20px 4px; }
  .field--wide { grid-column: auto; }
  .dialog-header { min-height: 88px; padding: 20px; }
  .customer-form .form-alert { margin: 0 20px 16px; }
  .dialog-actions { padding: 16px 20px; }
}

@media (max-width: 460px) {
  .login-brand { min-height: 320px; padding: 26px 24px; }
  .login-brand__statement { margin: 38px 0 20px; }
  .login-brand__statement h1 { font-size: 42px; }
  .login-brand__statement > p:last-child { max-width: 300px; font-size: 14px; }
  .login-panel { padding: 28px 16px; }
  .login-form { padding: 26px 22px; }
  .login-form__heading h2 { font-size: 30px; }
  .page-header { flex-direction: column; }
  .page-header > .button { align-self: flex-start; }
  .page-header__actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .sync-state {
    min-width: 0;
    margin-right: auto;
    justify-items: start;
  }
  .page-header h1,
  .detail-header h1 { font-size: 36px; }
  .metric { padding: 12px 9px; }
  .metric strong { font-size: 21px; }
  .detail-header { flex-direction: column; }
  .ownership-stamp { align-self: flex-start; }
  .customer-dialog { width: calc(100vw - 16px); max-height: calc(100svh - 16px); }
  .customer-form { max-height: calc(100svh - 18px); }
  .dialog-actions .button { flex: 1; padding-inline: 10px; }
  .customer-images { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .brand-lockup--login img,
  #login-logo-particles { transition: none; }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
