:root {
  --shell-font: "IBM Plex Sans", "Noto Sans TC", sans-serif;
  --shell-sidebar-width: 236px;
  --shell-sidebar-collapsed-width: 76px;
  --shell-gap: 14px;
  --shell-radius: 16px;
  --shell-radius-sm: 10px;

  --shell-bg: #f3f4fa;
  --shell-bg-glow-1: rgba(167, 160, 255, 0.22);
  --shell-bg-glow-2: rgba(160, 196, 255, 0.20);
  --shell-surface: #ffffff;
  --shell-surface-2: #f6f7fc;
  --shell-text: #1c2033;
  --shell-muted: #6b7189;
  --shell-border: #e7e9f3;
  --shell-card-border: rgba(226, 229, 242, 0.7);
  --shell-accent: #4f5ee8;
  --shell-accent-soft: #eef0fe;
  --shell-hover: rgba(79, 94, 232, 0.07);
  --shell-active-bar: var(--shell-accent);
  --shell-focus: rgba(79, 94, 232, 0.28);
  --shell-btn-primary-bg: #14161f;
  --shell-btn-primary-fg: #ffffff;
  --shell-danger: #d14343;
  --shell-danger-soft: rgba(209, 67, 67, 0.10);
  --shell-success: #1d8656;
  --shell-success-soft: #e2f5ea;
  --shell-shadow: 0 1px 2px rgba(22, 26, 52, 0.04), 0 8px 28px rgba(22, 26, 52, 0.06);
  --shell-shadow-pop: 0 12px 32px rgba(22, 26, 52, 0.14);
  --shell-scrim: rgba(16, 18, 30, 0.35);

  --chip-0-bg: #e7eeff; --chip-0-fg: #2f56cf;
  --chip-1-bg: #fde7ef; --chip-1-fg: #bf3867;
  --chip-2-bg: #e2f5ea; --chip-2-fg: #1d8656;
  --chip-3-bg: #fdf0da; --chip-3-fg: #a26405;
  --chip-4-bg: #efe7fd; --chip-4-fg: #6b42c7;
  --chip-5-bg: #ddf3f4; --chip-5-fg: #157d87;
}

html[data-theme="dark"] {
  --shell-bg: #10121a;
  --shell-bg-glow-1: rgba(99, 102, 241, 0.12);
  --shell-bg-glow-2: rgba(56, 120, 220, 0.08);
  --shell-surface: #1a1d29;
  --shell-surface-2: #222636;
  --shell-text: #e7e9f3;
  --shell-muted: #9097b1;
  --shell-border: #2b3044;
  --shell-card-border: #262a3b;
  --shell-accent: #8b96ff;
  --shell-accent-soft: rgba(139, 150, 255, 0.14);
  --shell-hover: rgba(139, 150, 255, 0.09);
  --shell-focus: rgba(139, 150, 255, 0.35);
  --shell-btn-primary-bg: #e7e9f3;
  --shell-btn-primary-fg: #12141c;
  --shell-danger: #f07474;
  --shell-danger-soft: rgba(240, 116, 116, 0.12);
  --shell-success: #6fd3a0;
  --shell-success-soft: rgba(52, 190, 120, 0.15);
  --shell-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.28);
  --shell-shadow-pop: 0 14px 36px rgba(0, 0, 0, 0.5);
  --shell-scrim: rgba(0, 0, 0, 0.55);

  --chip-0-bg: rgba(96, 135, 255, 0.16); --chip-0-fg: #a3b8ff;
  --chip-1-bg: rgba(240, 98, 146, 0.16); --chip-1-fg: #f59ab9;
  --chip-2-bg: rgba(52, 190, 120, 0.16); --chip-2-fg: #7fd8a9;
  --chip-3-bg: rgba(240, 170, 50, 0.16); --chip-3-fg: #f3c26b;
  --chip-4-bg: rgba(150, 110, 255, 0.18); --chip-4-fg: #c0a6ff;
  --chip-5-bg: rgba(40, 180, 190, 0.16); --chip-5-fg: #7fd3d9;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; margin: 0; }
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
body {
  font-family: var(--shell-font);
  color: var(--shell-text);
  background:
    radial-gradient(1100px 620px at 100% -10%, var(--shell-bg-glow-1), transparent 60%),
    radial-gradient(900px 560px at -10% 110%, var(--shell-bg-glow-2), transparent 60%),
    var(--shell-bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.shell-icon { display: inline-flex; width: 18px; height: 18px; flex-shrink: 0; }
.shell-icon svg, .ui-btn svg, .ui-searchbox svg, .ui-page-btn svg { width: 100%; height: 100%; display: block; }

/* —— Layout —— */
.shell { min-height: 100vh; display: flex; align-items: flex-start; }

.shell-sidebar {
  position: sticky;
  top: var(--shell-gap);
  width: var(--shell-sidebar-width);
  height: calc(100vh - var(--shell-gap) * 2);
  margin: var(--shell-gap) 0 var(--shell-gap) var(--shell-gap);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--shell-surface);
  border: 1px solid var(--shell-card-border);
  border-radius: 20px;
  box-shadow: var(--shell-shadow);
  transition: width .2s ease;
  z-index: 30;
}

.shell-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 16px;
  min-height: 78px;
  overflow: hidden;
}
.shell-sidebar__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #5b6cff, #3f8cff);
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  box-shadow: 0 6px 16px rgba(79, 94, 232, 0.35);
}
.shell-sidebar__brand-text { display: flex; flex-direction: column; line-height: 1.2; white-space: nowrap; }
.shell-sidebar__brand-text strong { font-size: 1.05rem; font-weight: 700; letter-spacing: 0.02em; }
.shell-sidebar__brand-text small { font-size: 0.72rem; color: var(--shell-muted); }

.shell-sidebar__nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 12px; }

.shell-sidebar__foot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--shell-border);
}
.shell-sidebar__collapse {
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 5px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--shell-muted);
  cursor: pointer;
  transition: transform .2s ease, background .15s ease;
}
.shell-sidebar__collapse:hover { background: var(--shell-hover); color: var(--shell-text); }

.shell-nav-group { margin-bottom: 4px; }
.shell-nav-group__head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--shell-radius-sm);
  background: transparent;
  color: var(--shell-text);
  font-family: var(--shell-font);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.shell-nav-group__head:hover { background: var(--shell-hover); }
.shell-nav-group.is-current > .shell-nav-group__head {
  background: var(--shell-accent-soft);
  color: var(--shell-accent);
  font-weight: 600;
}
.shell-nav-group__label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.shell-nav-group__chevron {
  display: inline-flex;
  width: 16px;
  height: 16px;
  color: var(--shell-muted);
  transition: transform .2s ease;
}
.shell-nav-group__chevron svg { width: 100%; height: 100%; }
.shell-nav-group.is-open .shell-nav-group__chevron { transform: rotate(180deg); }
.shell-nav-group__items { display: none; padding: 4px 0 6px 30px; }
.shell-nav-group.is-open .shell-nav-group__items { display: flex; flex-direction: column; gap: 2px; }

.shell-side-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--shell-muted);
  font-family: var(--shell-font);
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shell-side-item:hover { background: var(--shell-hover); color: var(--shell-text); }
.shell-side-item.is-active {
  background: var(--shell-accent-soft);
  color: var(--shell-text);
  font-weight: 600;
}
.shell-side-item.is-soon { cursor: default; opacity: 0.6; }
.shell-side-item.is-soon:hover { background: transparent; color: var(--shell-muted); }
.shell-soon {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--shell-surface-2);
  border: 1px solid var(--shell-border);
  font-size: 0.65rem;
  font-weight: 500;
}

/* Collapsed (icon-only) sidebar — desktop only */
@media (min-width: 861px) {
  .shell.is-collapsed .shell-sidebar { width: var(--shell-sidebar-collapsed-width); }
  .shell.is-collapsed .shell-sidebar__brand { padding-left: 18px; padding-right: 18px; }
  .shell.is-collapsed .shell-sidebar__brand-text,
  .shell.is-collapsed .shell-nav-group__label,
  .shell.is-collapsed .shell-nav-group__chevron,
  .shell.is-collapsed .shell-nav-group__items { display: none; }
  .shell.is-collapsed .shell-nav-group__head { justify-content: center; padding: 11px 0; }
  .shell.is-collapsed .shell-sidebar__collapse { transform: rotate(180deg); }
}

.shell-scrim {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: var(--shell-scrim);
}

.shell-content { flex: 1; min-width: 0; position: relative; }

.shell-topbar {
  position: absolute;
  top: 24px;
  right: 28px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
}
.shell-topbar__spacer { flex: 1; }
.shell-topbar__menu {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 10px;
  border: 1px solid var(--shell-card-border);
  border-radius: var(--shell-radius-sm);
  background: var(--shell-surface);
  color: var(--shell-text);
  cursor: pointer;
}
.shell-topbar__menu svg { width: 100%; height: 100%; }

.shell-user-wrap { position: relative; }
.shell-user {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 4px 12px 4px 4px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--shell-text);
  font-family: var(--shell-font);
  cursor: pointer;
}
.shell-user:hover, .shell-user[aria-expanded="true"] { background: var(--shell-surface); box-shadow: var(--shell-shadow); }
.shell-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--shell-accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
}
html[data-theme="dark"] .shell-avatar { color: #12141c; }
.shell-user__name {
  max-width: 150px;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shell-user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  padding: 8px;
  background: var(--shell-surface);
  border: 1px solid var(--shell-card-border);
  border-radius: 14px;
  box-shadow: var(--shell-shadow-pop);
}
.shell-user-menu__region {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 8px 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--shell-border);
}
.shell-user-menu__region label { font-size: 0.72rem; font-weight: 600; color: var(--shell-muted); }
.shell-user-menu__region select {
  font-family: var(--shell-font);
  font-size: 0.875rem;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--shell-border);
  border-radius: 8px;
  background: var(--shell-surface-2);
  color: var(--shell-text);
}
.shell-user-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--shell-text);
  font-family: var(--shell-font);
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
}
.shell-user-menu__item:hover { background: var(--shell-hover); }

.shell-main { padding: 24px 28px 48px; outline: none; }
.shell-main > .ui-toolbar { padding-right: calc(var(--shell-topbar-w, 200px) + 16px); min-height: 40px; }

@media (max-width: 860px) {
  .shell-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: calc(100vh - var(--shell-gap) * 2);
    transform: translateX(calc(-100% - var(--shell-gap) * 2));
    transition: transform .2s ease;
  }
  .shell-sidebar.is-open { transform: translateX(0); }
  .shell-sidebar__collapse { display: none; }
  .shell-topbar { position: static; padding: 16px 16px 0; height: auto; }
  .shell-topbar__menu { display: inline-flex; }
  .shell-main { padding: 16px 16px 40px; }
  .shell-main > .ui-toolbar { padding-right: 0; }
}

.shell-muted { color: var(--shell-muted); }
.shell-card {
  background: var(--shell-surface);
  border: 1px solid var(--shell-card-border);
  border-radius: var(--shell-radius);
  box-shadow: var(--shell-shadow);
  padding: 22px 24px;
  max-width: 720px;
}
.shell-card h1 { margin: 0 0 8px; font-size: 1.25rem; font-weight: 600; }
.shell-card p { margin: 0; color: var(--shell-muted); line-height: 1.5; }

/* —— Widgets —— */
.ui-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.ui-title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  flex: 1;
  min-width: 140px;
}
.ui-toolbar__actions { display: flex; flex-wrap: wrap; gap: 8px; }

.ui-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--shell-font);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--shell-border);
  background: var(--shell-surface);
  color: var(--shell-text);
  border-radius: 999px;
  height: 38px;
  padding: 0 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, filter .15s ease;
}
.ui-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.ui-btn:hover { background: var(--shell-surface-2); }
.ui-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ui-btn--primary {
  background: var(--shell-btn-primary-bg);
  border-color: var(--shell-btn-primary-bg);
  color: var(--shell-btn-primary-fg);
  font-weight: 600;
}
.ui-btn--primary:hover { background: var(--shell-btn-primary-bg); filter: brightness(1.18); }
html[data-theme="dark"] .ui-btn--primary:hover { filter: brightness(0.92); }
.ui-btn--danger { border-color: var(--shell-danger); color: var(--shell-danger); }
.ui-btn--danger:hover { background: var(--shell-danger-soft); }
.ui-btn--small, .ui-btn--sm { height: 30px; padding: 0 12px; font-size: 0.8125rem; }

.ui-link {
  font: inherit;
  color: var(--shell-accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

.ui-filters, .ui-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 16px;
}
.ui-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--shell-muted);
}
.ui-field input,
.ui-field textarea,
.ui-field select,
.ui-inline-form input,
.ui-inline-form select,
.ui-form input,
.ui-form textarea,
.ui-form select,
.ui-info-grid dd input,
.ui-info-grid dd textarea,
.ui-info-grid dd select,
.ui-quote .ui-table select {
  font-family: var(--shell-font);
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--shell-text);
  background: var(--shell-surface);
  border: 1px solid var(--shell-border);
  border-radius: var(--shell-radius-sm);
  height: 38px;
  padding: 0 12px;
  min-width: 140px;
}
.ui-field textarea,
.ui-form textarea,
.ui-info-grid dd textarea {
  height: auto;
  padding: 9px 12px;
  resize: vertical;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--shell-accent);
  box-shadow: 0 0 0 3px var(--shell-focus);
}
button:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--shell-accent);
  outline-offset: 2px;
}

.ui-panel {
  background: var(--shell-surface);
  border: 1px solid var(--shell-card-border);
  border-radius: var(--shell-radius);
  box-shadow: var(--shell-shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
  max-width: 960px;
}
.ui-section { margin: 0 0 12px; font-size: 0.95rem; font-weight: 600; }
.ui-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.ui-section-head .ui-section { margin: 0; }

.ui-table-wrap { overflow: auto; max-width: 960px; }
.ui-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.ui-table th,
.ui-table td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--shell-border);
  vertical-align: top;
}
.ui-table th {
  font-weight: 600;
  color: var(--shell-muted);
  font-size: 0.78rem;
  white-space: nowrap;
}
.ui-table tbody tr:last-child td { border-bottom: 0; }

.ui-form { display: flex; flex-direction: column; gap: 12px; }
.ui-form--grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.ui-form__actions { display: flex; gap: 8px; margin-top: 8px; }

.ui-dialog {
  border: 1px solid var(--shell-card-border);
  border-radius: 18px;
  padding: 22px;
  background: var(--shell-surface);
  color: var(--shell-text);
  box-shadow: var(--shell-shadow-pop);
  max-width: 420px;
  width: calc(100% - 32px);
}
.ui-dialog--lg { max-width: 520px; }
.ui-dialog--xl { max-width: 640px; }
.ui-dialog::backdrop { background: var(--shell-scrim); }
.ui-dialog h2 { margin: 0 0 12px; font-size: 1.1rem; }
.ui-dialog #assignee-pick-q,
.ui-dialog .ui-search {
  width: 100%;
  margin-bottom: 12px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--shell-border);
  border-radius: var(--shell-radius-sm);
  background: var(--shell-surface-2);
  color: var(--shell-text);
  font-family: var(--shell-font);
  font-size: 0.875rem;
}

.ui-banner { padding: 10px 14px; border-radius: var(--shell-radius-sm); margin-bottom: 12px; font-size: 0.875rem; }
.ui-banner--error {
  background: var(--shell-danger-soft);
  color: var(--shell-danger);
  border: 1px solid var(--shell-danger);
}

.ui-toast-host {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ui-toast {
  background: var(--shell-surface);
  border: 1px solid var(--shell-card-border);
  color: var(--shell-text);
  padding: 11px 16px;
  border-radius: 12px;
  box-shadow: var(--shell-shadow-pop);
  font-size: 0.875rem;
}
.ui-toast--error { border-color: var(--shell-danger); color: var(--shell-danger); }

.ui-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.75rem; }
.ui-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.75rem;
  background: var(--shell-surface-2);
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--shell-border);
}
.ui-dl { display: grid; grid-template-columns: 7rem 1fr; gap: 8px 12px; margin: 0; font-size: 0.875rem; }
.ui-dl dt { color: var(--shell-muted); font-weight: 600; }
.ui-dl dd { margin: 0; }

.ui-filters--bar {
  gap: 10px 12px;
  padding: 16px 18px;
  background: var(--shell-surface);
  border: 1px solid var(--shell-card-border);
  border-radius: var(--shell-radius);
  box-shadow: var(--shell-shadow);
}
.ui-filters--bar .ui-field { margin: 0; min-width: 120px; }
.ui-filters__actions { display: flex; gap: 8px; margin-left: auto; }

.ui-pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--shell-border);
  background: var(--shell-surface-2);
  color: var(--shell-text);
}
.ui-pill--accent { background: var(--shell-accent-soft); border-color: transparent; color: var(--shell-accent); }
.ui-pill--muted { color: var(--shell-muted); }
.ui-pill--success { background: var(--shell-success-soft); border-color: transparent; color: var(--shell-success); }
.ui-pill svg { width: 12px; height: 12px; margin-left: 4px; }
.ui-pill--clickable { cursor: pointer; font-family: inherit; }
.ui-pill--clickable:hover { border-color: var(--shell-accent); }

.ui-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--shell-border);
  border-radius: 8px;
  background: var(--shell-surface-2);
  color: var(--shell-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.ui-icon-btn:hover { color: var(--shell-accent); border-color: var(--shell-accent); background: var(--shell-hover); }
.ui-icon-btn svg { width: 14px; height: 14px; display: block; }
.ui-icon-btn--danger:hover { color: var(--shell-danger); border-color: var(--shell-danger); background: var(--shell-danger-soft); }
.ui-icon-btn--lg { width: 36px; height: 36px; border-radius: var(--shell-radius-sm); background: var(--shell-surface); }
.ui-icon-btn--lg svg { width: 18px; height: 18px; }

.ui-channel-manage-list { max-height: 280px; overflow: auto; margin-bottom: 12px; }
.ui-site-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.ui-site-toolbar input[type="search"] {
  flex: 1;
  min-width: 160px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--shell-border);
  border-radius: var(--shell-radius-sm);
  background: var(--shell-surface-2);
  color: var(--shell-text);
  font-family: var(--shell-font);
  font-size: 0.875rem;
}

.ui-customer-pick { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.ui-customer-pick__selected {
  padding: 8px 10px;
  border: 1px solid var(--shell-border);
  border-radius: var(--shell-radius-sm);
  background: var(--shell-surface-2);
  font-size: 0.875rem;
  line-height: 1.4;
}
.ui-customer-pick__results { max-height: 180px; margin-bottom: 0; }
.ui-customer-pick__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--shell-border);
  border-radius: var(--shell-radius-sm);
  background: transparent;
  color: var(--shell-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.ui-customer-pick__item:hover { border-color: var(--shell-accent); background: var(--shell-hover); }
.ui-customer-pick__name { font-weight: 600; font-size: 0.875rem; }

.ui-checklist { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; max-height: 420px; overflow: auto; }
.ui-check { display: flex; gap: 8px; align-items: center; font-size: 0.875rem; }
.ui-check input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--shell-accent);
}

.ui-radio-group { grid-column: 1 / -1; min-width: 0; margin: 0; padding: 0; border: 0; }
.ui-radio-group legend { padding: 0; margin-bottom: 10px; }
.ui-radio-group__options { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.ui-radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--shell-text);
  cursor: pointer;
}
.ui-field .ui-radio input[type="radio"] {
  appearance: none;
  display: grid;
  place-content: center;
  width: 20px;
  min-width: 0;
  height: 20px;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  border: 1.5px solid var(--shell-muted);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.ui-field .ui-radio input[type="radio"]::before {
  content: '';
  width: 12px;
  height: 12px;
  background: var(--shell-surface);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
  transform: scale(0);
  transition: transform 0.12s ease;
}
.ui-field .ui-radio input[type="radio"]:checked { border-color: var(--shell-text); background: var(--shell-text); }
.ui-field .ui-radio input[type="radio"]:checked::before { transform: scale(1); }

/* —— List pages (customers / sites) —— */
.ui-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 26px;
}
.ui-stat {
  padding: 18px 22px 20px;
  background: var(--shell-surface);
  border: 1px solid var(--shell-card-border);
  border-radius: var(--shell-radius);
  box-shadow: var(--shell-shadow);
}
.ui-stat__label { font-size: 0.8rem; color: var(--shell-muted); }
.ui-stat__value {
  margin-top: 8px;
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ui-listbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.ui-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--shell-accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
}
html[data-theme="dark"] .ui-count { color: #12141c; }
.ui-searchbox { position: relative; margin-left: auto; }
.ui-searchbox--start { margin-left: 0; }
.ui-searchbox svg {
  position: absolute;
  left: 13px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--shell-muted);
  pointer-events: none;
}
.ui-searchbox input {
  width: min(280px, 70vw);
  height: 38px;
  padding: 0 14px 0 38px;
  border: 1px solid var(--shell-border);
  border-radius: 999px;
  background: var(--shell-surface);
  color: var(--shell-text);
  font-family: var(--shell-font);
  font-size: 0.875rem;
}

.ui-data-card {
  background: var(--shell-surface);
  border: 1px solid var(--shell-card-border);
  border-radius: var(--shell-radius);
  box-shadow: var(--shell-shadow);
  padding: 6px 8px 0;
  margin-bottom: 18px;
}
.ui-data-card .ui-table-wrap { max-width: none; }
.ui-data-card .ui-table th { padding: 16px 16px 12px; }
.ui-data-card .ui-table td { padding: 15px 16px; vertical-align: middle; }
.ui-data-card__msg { margin: 0; padding: 22px 16px; color: var(--shell-muted); }
.ui-table__empty { color: var(--shell-muted); text-align: center !important; padding: 36px 16px !important; }
.ui-row-link { cursor: pointer; transition: background .12s ease; }
.ui-row-link:hover td { background: var(--shell-hover); }
.ui-cell-title { font-weight: 600; }
.ui-cell-sub { margin-top: 2px; font-size: 0.78rem; color: var(--shell-muted); }
.ui-cell-num { font-variant-numeric: tabular-nums; }

.ui-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ui-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--chip-fg);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.ui-chip--0 { --chip-bg: var(--chip-0-bg); --chip-fg: var(--chip-0-fg); }
.ui-chip--1 { --chip-bg: var(--chip-1-bg); --chip-fg: var(--chip-1-fg); }
.ui-chip--2 { --chip-bg: var(--chip-2-bg); --chip-fg: var(--chip-2-fg); }
.ui-chip--3 { --chip-bg: var(--chip-3-bg); --chip-fg: var(--chip-3-fg); }
.ui-chip--4 { --chip-bg: var(--chip-4-bg); --chip-fg: var(--chip-4-fg); }
.ui-chip--5 { --chip-bg: var(--chip-5-bg); --chip-fg: var(--chip-5-fg); }

.ui-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 10px 16px;
  border-top: 1px solid var(--shell-border);
  font-size: 0.8125rem;
  color: var(--shell-muted);
}
.ui-pager__pages { display: flex; align-items: center; gap: 6px; }
.ui-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--shell-border);
  border-radius: 8px;
  background: var(--shell-surface);
  color: var(--shell-text);
  font-family: var(--shell-font);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.ui-page-btn svg { width: 14px; height: 14px; }
.ui-page-btn:hover:not(:disabled) { border-color: var(--shell-accent); }
.ui-page-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.ui-page-btn.is-current {
  background: var(--shell-accent-soft);
  border-color: var(--shell-accent);
  color: var(--shell-accent);
  font-weight: 700;
}
.ui-page-gap { padding: 0 2px; }

.ui-selected-customer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  margin-bottom: 18px;
  background: var(--shell-surface);
  border: 1px solid var(--shell-card-border);
  border-radius: var(--shell-radius);
  box-shadow: var(--shell-shadow);
}
.ui-selected-customer__actions { display: flex; gap: 8px; }
.ui-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

/* —— Customer detail —— */
.ui-page-head { flex: 1; min-width: 0; }
.ui-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 0.8rem;
  color: var(--shell-muted);
}
.ui-breadcrumb a { color: inherit; text-decoration: none; }
.ui-breadcrumb a:hover { color: var(--shell-accent); }
.ui-breadcrumb svg { width: 12px; height: 12px; }
.ui-breadcrumb [aria-current] { color: var(--shell-text); font-weight: 600; }
.ui-subtitle { margin: 4px 0 0; font-size: 0.875rem; color: var(--shell-muted); }

.ui-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px 24px;
  margin-bottom: 18px;
  background: var(--shell-surface);
  border: 1px solid var(--shell-card-border);
  border-radius: var(--shell-radius);
  box-shadow: var(--shell-shadow);
}
.ui-hero__avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--shell-accent-soft);
  color: var(--shell-accent);
  box-shadow: 0 0 0 5px var(--shell-surface), 0 0 0 6px var(--shell-border);
}
.ui-hero__avatar > svg { width: 32px; height: 32px; }
.ui-hero__dot {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--shell-muted);
  border: 3px solid var(--shell-surface);
}
.ui-hero__dot.is-on { background: var(--shell-success); }
.ui-hero__body { flex: 1; min-width: 0; }
.ui-hero__name { margin: 0; font-size: 1.4rem; font-weight: 700; word-break: break-word; }
.ui-hero__sub { margin: 2px 0 0; color: var(--shell-muted); font-size: 0.9rem; }
.ui-hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 10px;
  font-size: 0.85rem;
}
.ui-meta { display: inline-flex; align-items: center; gap: 5px; }
.ui-meta svg { width: 15px; height: 15px; color: var(--shell-muted); }

.ui-menu-wrap { position: relative; align-self: flex-start; }
.ui-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 15;
  min-width: 170px;
  padding: 6px;
  background: var(--shell-surface);
  border: 1px solid var(--shell-card-border);
  border-radius: 12px;
  box-shadow: var(--shell-shadow-pop);
}
.ui-menu button {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--shell-text);
  font-family: var(--shell-font);
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
}
.ui-menu button:hover { background: var(--shell-hover); }
.ui-menu button.is-danger { color: var(--shell-danger); }
.ui-menu button.is-danger:hover { background: var(--shell-danger-soft); }

.ui-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 18px;
  align-items: start;
}
.ui-detail-main, .ui-detail-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
@media (max-width: 1080px) {
  .ui-detail-grid { grid-template-columns: minmax(0, 1fr); }
}

.ui-card {
  padding: 20px 22px;
  background: var(--shell-surface);
  border: 1px solid var(--shell-card-border);
  border-radius: var(--shell-radius);
  box-shadow: var(--shell-shadow);
}
.ui-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.ui-card__title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--shell-accent);
}
.ui-card__title svg { width: 16px; height: 16px; }
.ui-card__subtitle {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--shell-muted);
}
.ui-card__divider { height: 1px; margin: 18px 0; background: var(--shell-border); }
.ui-card__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--shell-accent);
  text-decoration: none;
}
.ui-card__link svg { width: 13px; height: 13px; }
.ui-card__link:hover { text-decoration: underline; }

.ui-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px 28px;
  margin: 0;
}
.ui-info-grid dt {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--shell-muted);
}
.ui-info-grid dt svg { width: 14px; height: 14px; }
.ui-info-grid dd { margin: 0; font-size: 0.9rem; font-weight: 500; word-break: break-word; }
.ui-info-grid a, .ui-channel__value a { color: var(--shell-accent); text-decoration: none; }
.ui-info-grid a:hover, .ui-channel__value a:hover { text-decoration: underline; }

.ui-channel-grid { display: flex; flex-direction: column; gap: 10px; }
.ui-channel {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--shell-border);
  border-radius: 12px;
  background: var(--shell-surface-2);
}
.ui-channel__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--shell-surface);
  color: var(--shell-text);
}
.ui-channel__icon svg { width: 16px; height: 16px; }
.ui-channel__body { min-width: 0; }
.ui-channel__name { font-size: 0.85rem; font-weight: 600; }
.ui-channel__value { font-size: 0.8rem; word-break: break-all; }

.ui-card--tabs { padding: 0; overflow: hidden; }
.ui-tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--shell-border); overflow-x: auto; }
.ui-tab {
  position: relative;
  padding: 14px 10px 12px;
  border: 0;
  background: transparent;
  color: var(--shell-muted);
  font-family: var(--shell-font);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.ui-tab:hover { color: var(--shell-text); }
.ui-tab.is-active { color: var(--shell-accent); font-weight: 600; }
.ui-tab.is-active::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--shell-accent);
}
.ui-tabs__body { padding: 16px 20px 20px; }
.ui-tabs__tools { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.ui-tabs__search {
  flex: 1;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--shell-border);
  border-radius: var(--shell-radius-sm);
  background: var(--shell-surface-2);
  color: var(--shell-text);
  font-family: var(--shell-font);
  font-size: 0.875rem;
}
.ui-tabs__note { margin: 10px 0 0; font-size: 0.78rem; }
.ui-tab-panel .ui-table-wrap { max-width: none; }

.ui-round-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--shell-btn-primary-bg);
  color: var(--shell-btn-primary-fg);
  cursor: pointer;
}
.ui-round-btn svg { width: 15px; height: 15px; }
.ui-round-btn:hover { filter: brightness(1.18); }

.ui-side-empty { margin: 4px 0; padding: 10px 0; text-align: center; font-size: 0.8rem; color: var(--shell-muted); }
.ui-side-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--shell-border);
  border-radius: 12px;
  background: var(--shell-surface-2);
}
.ui-side-item:last-child { margin-bottom: 0; }
.ui-side-item--compact { align-items: center; justify-content: space-between; }
.ui-side-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ui-side-item__title { font-size: 0.875rem; font-weight: 600; word-break: break-word; }
.ui-side-item__muted { font-weight: 400; color: var(--shell-muted); font-size: 0.78rem; }
.ui-side-item__sub { font-size: 0.78rem; color: var(--shell-muted); word-break: break-word; }
.ui-side-item__actions { display: flex; gap: 6px; flex-shrink: 0; }
.ui-tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--shell-accent-soft);
  color: var(--shell-accent);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.ui-assign-group + .ui-assign-group { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--shell-border); }
.ui-assign-group__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--shell-muted);
}

.ui-memo { margin: 0; font-size: 0.875rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }

/* —— Quotation detail —— */
.ui-quote { display: flex; flex-direction: column; gap: 18px; }
.ui-quote > .ui-hero { margin-bottom: 0; }
.ui-quote .ui-table-wrap { max-width: none; }
.ui-quote .ui-table select { height: 32px; min-width: 96px; }
.ui-quote .ui-info-grid dd input,
.ui-quote .ui-info-grid dd textarea,
.ui-quote .ui-info-grid dd select { width: 100%; }

.ui-hero__title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ui-hero__name a { color: inherit; text-decoration: none; }
.ui-hero__name a:hover { color: var(--shell-accent); }
.ui-hero__facts { display: grid; grid-template-columns: repeat(4, auto); margin: 0; align-self: stretch; }
.ui-hero__facts > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 4px 22px;
  border-left: 1px solid var(--shell-border);
}
.ui-hero__facts dt { font-size: 0.75rem; font-weight: 600; color: var(--shell-muted); }
.ui-hero__facts dd { margin: 0; font-size: 0.875rem; font-weight: 500; white-space: nowrap; }
@media (max-width: 1080px) {
  .ui-hero { flex-wrap: wrap; }
  .ui-hero__facts { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 12px 0; }
  .ui-hero__facts > div:nth-child(odd) { padding-left: 0; border-left: 0; }
}

.ui-quote-process {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr) auto;
  gap: 16px 28px;
  align-items: start;
}
.ui-quote-process__total { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.ui-quote-process__amount { font-size: 2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ui-quote-process__main { min-width: 0; padding-left: 28px; border-left: 1px solid var(--shell-border); }
.ui-quote-process__title { margin: 0; font-size: 0.95rem; font-weight: 600; }
.ui-quote-process__main .ui-subtitle { margin: 4px 0 14px; }
.ui-quote-process__side { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.ui-quote-process__notice { grid-column: 2 / -1; margin: 0 0 0 28px; }
@media (max-width: 1080px) {
  .ui-quote-process { grid-template-columns: minmax(0, 1fr); }
  .ui-quote-process__main { padding-left: 0; border-left: 0; }
  .ui-quote-process__notice { grid-column: auto; margin-left: 0; }
}

.ui-banner--info {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--shell-accent-soft);
  color: var(--shell-text);
  font-size: 0.8125rem;
  line-height: 1.6;
}
.ui-banner--info svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; color: var(--shell-accent); }
.ui-banner--info p { margin: 0; }

.ui-info-grid__wide { grid-column: 1 / -1; }

.ui-quote-sum {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  margin: 4px 0 0;
  padding: 14px 12px 0;
  border-top: 1px solid var(--shell-border);
  font-size: 0.875rem;
}
.ui-quote-sum > div { display: flex; justify-content: space-between; gap: 24px; min-width: 280px; }
.ui-quote-sum dt { color: var(--shell-muted); }
.ui-quote-sum dd { margin: 0; font-variant-numeric: tabular-nums; }
.ui-quote-sum .is-total dt,
.ui-quote-sum .is-total dd { color: var(--shell-text); font-size: 1rem; font-weight: 700; }
