:root {
  color-scheme: light;
  --bg: #f5fbfa;
  --panel: #ffffff;
  --panel-soft: #edf6f5;
  --ink: #0b3347;
  --muted: #607783;
  --line: #d8e7e5;
  --primary: #0b3d52;
  --primary-strong: #082f40;
  --accent: #38cbb4;
  --accent-strong: #16a38b;
  --accent-soft: #def8f1;
  --brand-navy: #0b3d52;
  --brand-teal: #38cbb4;
  --danger: #dc2626;
  --success: #16a34a;
  --shadow: 0 16px 40px rgba(11, 61, 82, 0.08);
  --soft-shadow: 0 8px 22px rgba(11, 61, 82, 0.06);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(56, 203, 180, 0.08), transparent 260px),
    var(--bg);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC",
    "Microsoft JhengHei", sans-serif;
  line-height: 1.5;
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  letter-spacing: 0;
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 17px;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: var(--primary);
  color: white;
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
}

button:hover {
  background: var(--primary-strong);
}

button.ghost {
  background: white;
  color: var(--primary);
}

button.ghost:hover {
  border-color: rgba(56, 203, 180, 0.55);
  background: var(--accent-soft);
}

button:disabled {
  border-color: var(--line);
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

button:disabled:hover {
  background: #f1f5f9;
}

button.small {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

button.danger-action {
  border-color: var(--danger);
  color: var(--danger);
}

button.danger-action:disabled {
  border-color: var(--line);
  color: #94a3b8;
}

label,
.field-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input:not([type="checkbox"]):not([type="radio"]),
textarea,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 9px 11px;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:not([type="checkbox"]):not([type="radio"]):hover,
textarea:hover,
select:hover {
  border-color: #bdd5d1;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(56, 203, 180, 0.18);
}

textarea {
  min-height: 112px;
  resize: vertical;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M3 4.5L6 7.5L9 4.5' stroke='%23607783' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 34px;
  cursor: pointer;
}

select:disabled {
  background-color: #f8fafa;
  color: var(--muted);
  cursor: not-allowed;
}

input[type="checkbox"],
input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1.5px solid #bdd5d1;
  background: white;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  vertical-align: middle;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

input[type="checkbox"] {
  border-radius: 4px;
}

input[type="radio"] {
  border-radius: 50%;
}

input[type="checkbox"]:hover,
input[type="radio"]:hover {
  border-color: var(--accent-strong);
}

input[type="checkbox"]:checked {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 6px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

input[type="checkbox"]:indeterminate {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

input[type="checkbox"]:indeterminate::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 7px;
  width: 10px;
  height: 2px;
  background: white;
  border-radius: 1px;
}

input[type="radio"]:checked {
  border-color: var(--accent-strong);
  border-width: 5px;
}

input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
  outline: 3px solid rgba(56, 203, 180, 0.24);
  outline-offset: 1px;
}

input[type="checkbox"]:disabled,
input[type="radio"]:disabled {
  background: #f3f4f6;
  border-color: #e5e7eb;
  cursor: not-allowed;
}

/* === SOFONE 品牌色 ===
   深墨青 #0e364b · 薄荷青 #39cfab · 中階 #16a38b */

.login-screen {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(135deg, #f1fbf8 0%, #e0f5ed 50%, #c8ecdf 100%);
}

.login-screen-crm {
  background: linear-gradient(135deg, #effaf6 0%, #d4f1e8 40%, #a5dcc9 100%);
}

.login-screen-admin {
  background: linear-gradient(135deg, #0e364b 0%, #0b2c3d 55%, #062331 100%);
}

.login-shapes {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.login-shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  animation: loginFloat 18s ease-in-out infinite;
}

.login-screen-crm .login-shape-1 { width: 520px; height: 520px; background: #39cfab; top: -120px; left: -120px; }
.login-screen-crm .login-shape-2 { width: 480px; height: 480px; background: #0e364b; bottom: -140px; right: -120px; animation-delay: -6s; opacity: 0.28; }
.login-screen-crm .login-shape-3 { width: 320px; height: 320px; background: #16a38b; top: 55%; left: 50%; animation-delay: -12s; opacity: 0.42; }

.login-screen-admin .login-shape-1 { width: 540px; height: 540px; background: #39cfab; top: -160px; left: -120px; opacity: 0.4; }
.login-screen-admin .login-shape-2 { width: 460px; height: 460px; background: #16a38b; bottom: -140px; right: -120px; animation-delay: -6s; opacity: 0.32; }
.login-screen-admin .login-shape-3 { width: 320px; height: 320px; background: #39cfab; top: 60%; left: 55%; animation-delay: -12s; opacity: 0.22; }

@keyframes loginFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(60px, -80px) scale(1.1); }
  66% { transform: translate(-80px, 50px) scale(0.9); }
}

.login-card {
  position: relative;
  width: min(440px, 100%);
  padding: 36px 34px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 30px 80px rgba(14, 54, 75, 0.2), 0 1px 0 rgba(255, 255, 255, 0.6) inset;
  animation: loginCardEnter 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-screen-admin .login-card {
  border-color: rgba(57, 207, 171, 0.28);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.6) inset;
}

@keyframes loginCardEnter {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.brand-logo {
  display: block;
  height: auto;
  object-fit: contain;
}

.login-logo {
  width: min(200px, 64%);
  margin: 0 auto 22px;
  animation: loginLogoFloat 5s ease-in-out infinite;
}

@keyframes loginLogoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.login-card .eyebrow {
  text-align: center;
  letter-spacing: 1.5px;
  margin-bottom: 6px;
  font-size: 11px;
  color: #16a38b;
  font-weight: 700;
}

.login-card h1 {
  text-align: center;
  margin-bottom: 12px;
  font-size: 22px;
  letter-spacing: 0.5px;
  color: #0e364b;
}

.login-copy {
  margin-bottom: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.login-card button {
  width: 100%;
  margin-top: 10px;
  height: 46px;
  border-radius: 12px;
  font-size: 15px;
  letter-spacing: 0.5px;
  border: 0;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.login-card button[type="submit"] {
  background: linear-gradient(135deg, #0e364b 0%, #16a38b 100%);
  color: #fff;
  box-shadow: 0 10px 26px rgba(14, 54, 75, 0.3);
}

.login-card button[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 36px rgba(14, 54, 75, 0.35);
  background: linear-gradient(135deg, #0e364b 0%, #39cfab 100%);
}

.login-card button.ghost {
  background: transparent;
  color: #0e364b;
  border: 1px solid rgba(14, 54, 75, 0.15);
}

.login-card button.ghost:hover {
  background: rgba(57, 207, 171, 0.08);
  border-color: rgba(14, 54, 75, 0.3);
}

.login-card .field-grid input {
  border-radius: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(14, 54, 75, 0.12);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.login-card .field-grid input:focus {
  outline: none;
  border-color: #39cfab;
  box-shadow: 0 0 0 4px rgba(57, 207, 171, 0.18);
  background: #fff;
}

.login-card .field-grid label {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.4px;
  margin-bottom: 6px;
  display: inline-block;
}

.login-tagline {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 11px;
  letter-spacing: 2px;
  color: rgba(14, 54, 75, 0.5);
  text-align: center;
  text-transform: uppercase;
}

.login-screen-admin .login-tagline {
  color: rgba(244, 252, 249, 0.45);
}

@media (max-width: 520px) {
  .login-card { padding: 30px 24px; }
  .login-card h1 { font-size: 20px; }
  .login-tagline { font-size: 10px; letter-spacing: 1.4px; padding: 0 18px; }
  .login-shape { filter: blur(50px); }
  .login-screen-crm .login-shape-1,
  .login-screen-admin .login-shape-1 { width: 60vw; height: 60vw; top: -20vw; left: -20vw; }
  .login-screen-crm .login-shape-2,
  .login-screen-admin .login-shape-2 { width: 56vw; height: 56vw; bottom: -20vw; right: -20vw; }
  .login-screen-crm .login-shape-3,
  .login-screen-admin .login-shape-3 { width: 40vw; height: 40vw; }
}

@media (prefers-reduced-motion: reduce) {
  .login-shape,
  .login-card,
  .login-logo {
    animation: none !important;
  }
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 32px;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(11, 61, 82, 0.05);
  backdrop-filter: blur(16px);
}

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

.header-logo {
  width: 176px;
  max-width: 28vw;
}

.header-actions,
.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.user-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(56, 203, 180, 0.28);
  background: var(--accent-soft);
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

button.user-pill {
  cursor: pointer;
}

button.user-pill:hover {
  border-color: rgba(56, 203, 180, 0.55);
  background: #f7fdfb;
}

.app-shell {
  min-height: 100vh;
}

.admin-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 24px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 28px 64px;
}

.admin-sidebar {
  position: sticky;
  top: 102px;
  align-self: start;
  display: grid;
  gap: 8px;
}

.nav-button {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
  width: 100%;
  min-height: 40px;
  padding: 0 14px;
  border-color: transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  text-decoration: none;
  text-align: left;
}

.nav-button:hover,
.nav-button.active {
  border-color: rgba(56, 203, 180, 0.35);
  background: white;
  color: var(--primary);
  box-shadow: var(--soft-shadow);
}

.line-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  color: currentColor;
}

.workspace {
  min-width: 0;
}

.view {
  display: none;
}

.active-view {
  display: grid;
  gap: 18px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.toolbar.compact {
  box-shadow: none;
}

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

.metric-card,
.panel,
.form-section,
.review-panel,
.summary-band,
.progress-panel,
.filter-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--soft-shadow);
}

.metric-card {
  padding: 16px;
}

.metric-button {
  width: 100%;
  min-height: 0;
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  white-space: normal;
  box-shadow: var(--soft-shadow);
}

.metric-button:hover {
  border-color: rgba(56, 203, 180, 0.55);
  background: #f7fdfb;
  color: var(--ink);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin: 6px 0 2px;
  font-size: 28px;
  line-height: 1;
  color: var(--primary);
}

.metric-card small {
  color: var(--muted);
}

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

.dashboard-chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.chart-panel {
  min-width: 0;
}

.dashboard-bars {
  gap: 8px;
}

.chart-bar-row {
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 400;
  text-align: left;
  white-space: normal;
}

button.chart-bar-row {
  cursor: pointer;
}

button.chart-bar-row:hover span,
button.chart-bar-row:hover strong {
  color: var(--primary);
}

.chart-stat-grid,
.profile-grid,
.profile-stat-grid {
  display: grid;
  gap: 12px;
}

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

.chart-stat-grid div,
.profile-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbfa;
}

.chart-stat-grid span,
.profile-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.chart-stat-grid strong,
.profile-grid strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
}

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

.profile-stat-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.followup-board {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 14px;
}

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

.followup-board.single-board {
  grid-template-columns: 1fr;
}

.admin-tabs {
  display: grid;
  gap: 14px;
}

.admin-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

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

.split-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.split-list span {
  color: var(--muted);
}

.org-levels {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.org-levels div {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.org-levels strong {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--primary);
  color: white;
  grid-row: span 2;
}

.org-levels small,
.field-help {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.org-warning {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #fbbf24;
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.panel {
  padding: 18px;
}

.panel h3 {
  margin-bottom: 14px;
}

.panel h4 {
  margin: 0 0 10px;
}

.panel-copy {
  margin-bottom: 14px;
  color: var(--muted);
}

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

.bar-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.bar-row div {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dcebe8;
}

.bar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-navy), var(--brand-teal));
}

.bar-row strong {
  color: var(--ink);
  text-align: right;
}

.mini-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.mini-table-row {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.mini-table-row:last-child {
  border-bottom: 0;
}

.mini-table-head {
  background: #f4faf9;
  color: var(--ink);
  font-weight: 800;
}

.sales-stat-row span {
  align-items: center;
  display: flex;
}

.table-drill,
.mini-stat {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  text-align: left;
  white-space: normal;
}

.table-drill:hover,
.mini-stat:hover {
  background: transparent;
  color: var(--primary);
}

.mini-stat {
  color: var(--primary);
}

.sales-overview-table .mini-table-row {
  grid-template-columns: minmax(150px, 1.6fr) repeat(10, minmax(0, 1fr));
  align-items: center;
  font-variant-numeric: tabular-nums;
}

.sales-overview-table .mini-table-row > span:not(:first-child) {
  justify-content: center;
  text-align: center;
}

.sales-overview-table .mini-table-row > span:nth-child(10) {
  justify-content: flex-end;
  text-align: right;
}

.sales-overview-table .mini-table-head > span:not(:first-child) {
  text-align: center;
}

.sales-overview-table .mini-table-head > span:nth-child(10) {
  text-align: right;
}

.sales-overview-table .table-drill {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.35;
  gap: 2px;
  white-space: nowrap;
}

.sales-overview-table .table-drill small {
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
}

@media (max-width: 1100px) {
  .sales-overview-table .mini-table-row {
    grid-template-columns: minmax(120px, 1.4fr) repeat(10, minmax(0, 1fr));
    font-size: 13px;
  }
}

/* === KPI 卡片均高、行事曆細節對齊 === */
.metric-grid {
  align-items: stretch;
}

.metric-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 92px;
}

.metric-card strong {
  margin-top: auto;
}

.calendar-cell {
  min-height: 68px;
}

.calendar-cell strong {
  margin-top: 2px;
}

.case-queue {
  display: grid;
  gap: 10px;
}

.case-queue-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 10px;
  min-height: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  text-align: left;
  white-space: normal;
  box-shadow: none;
}

.case-queue-item:hover {
  border-color: rgba(56, 203, 180, 0.45);
  background: #f7fdfb;
}

.case-queue-item strong,
.case-queue-item span,
.case-queue-item small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.case-queue-item > .urgency-pill {
  grid-row: span 3;
  align-self: start;
}

.case-queue-item > span:not(.urgency-pill),
.case-queue-item small {
  color: var(--muted);
  font-size: 13px;
}

.urgency-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--brand-navy);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.urgency-pill.danger {
  background: #fee2e2;
  color: #b91c1c;
}

.urgency-pill.warning {
  background: #fef3c7;
  color: #92400e;
}

.urgency-pill.success {
  background: #dcfce7;
  color: #15803d;
}

.urgency-pill.muted {
  background: var(--panel-soft);
  color: var(--muted);
}

.data-model-list,
.audit-list {
  display: grid;
  gap: 8px;
}

.data-model-list div,
.audit-list div {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

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

.data-model-list span,
.audit-list span {
  color: var(--muted);
  font-size: 13px;
}

.data-model-list em {
  color: var(--primary);
  font-style: normal;
  font-weight: 800;
}

.lock-note {
  display: block;
  margin-top: 6px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
}

.workflow-action-panel {
  background: #fbfffe;
}

.workflow-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 18px 18px 0;
}

.workflow-status-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.workflow-status-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.workflow-status-grid strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.workflow-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 18px 8px;
}

.workflow-action-panel .panel-copy {
  margin: 0;
  padding: 0 18px 18px;
}

.manager-action-panel {
  background: #fbfffe;
}

.manager-action-form {
  border-bottom: 1px solid var(--line);
}

.manager-action-list {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.manager-action-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.manager-action-card.done {
  background: #f4faf9;
}

.manager-action-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.manager-action-head small,
.manager-action-meta,
.manager-response small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.manager-action-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.manager-response {
  padding: 10px;
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  background: #f4faf9;
}

.manager-response-form {
  display: grid;
  gap: 8px;
}

.filter-panel {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(130px, 1fr));
  gap: 10px;
  padding: 14px;
  box-shadow: none;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
}

.field-grid.single {
  grid-template-columns: 1fr;
  padding: 0;
}

.field-grid .wide {
  grid-column: 1 / -1;
}

.location-control {
  display: grid;
  gap: 8px;
}

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

.access-note,
.permission-grid {
  display: grid;
  gap: 8px;
}

.access-note {
  padding: 12px;
  border: 1px solid rgba(56, 203, 180, 0.35);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--primary);
}

.access-note span {
  color: var(--muted);
  font-size: 14px;
}

.permission-grid {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}

.field-manager,
.crm-field-map {
  display: grid;
  gap: 14px;
}

.field-manager-group {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfffe;
}

.field-manager-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.field-manager-heading span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field-map-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.field-map-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(150px, 0.8fr) minmax(96px, 0.5fr) minmax(160px, 0.7fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.field-map-row:last-child {
  border-bottom: 0;
}

.field-map-head {
  background: #f4faf9;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field-map-row code {
  color: var(--primary);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.field-map-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.field-name-editor,
.field-group-editor {
  display: grid;
  gap: 6px;
  margin: 0;
}

.field-name-editor span,
.field-group-editor span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.field-name-editor input,
.field-group-editor select {
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.field-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.field-switches label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.field-switches input {
  width: 16px;
  min-height: 16px;
}

.field-options-preview {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.field-options-preview div {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f4faf9;
}

.field-options-preview b {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
}

.option-editor {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.option-editor textarea {
  min-height: 76px;
  padding: 8px 10px;
  font-size: 13px;
}

.field-rule {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.field-rule strong {
  color: var(--ink);
}

.field-rule label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.field-rule input {
  width: 16px;
  min-height: 16px;
}

.custom-rule {
  background: rgba(56, 203, 180, 0.08);
}

.custom-field-form {
  padding: 16px 0 0;
}

.purchase-group-grid {
  display: grid;
  gap: 14px;
}

.purchase-group {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfffe;
}

.purchase-group-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.purchase-icon {
  width: 34px;
  height: 34px;
  padding: 7px;
  border: 1px solid rgba(56, 203, 180, 0.4);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--brand-navy);
}

.purchase-group h4 {
  margin: 0 0 4px;
  font-size: 16px;
}

.purchase-group p {
  color: var(--muted);
  font-size: 13px;
}

.locked-option {
  border-color: rgba(56, 203, 180, 0.45);
  background: rgba(56, 203, 180, 0.1);
}

.padded {
  padding: 0;
}

.editor-form {
  display: grid;
  gap: 14px;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.section-index {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--brand-navy), var(--brand-teal));
  color: white;
  font-weight: 900;
}

.question {
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.question:last-child {
  border-bottom: 0;
}

.question-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.limit-note {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.hint {
  max-width: 760px;
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 14px;
  white-space: pre-line;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 10px;
}

.option-grid.dense {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.option {
  display: flex;
  align-items: center;
  min-height: 44px;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
}

.single-option {
  width: fit-content;
  min-width: 96px;
}

.option input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--primary);
}

.option span {
  overflow-wrap: anywhere;
}

.other-input,
.inline-followup {
  margin-top: 10px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.table-wrap.flat {
  box-shadow: none;
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

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

th {
  background: #f4faf9;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(11, 61, 82, 0.46);
  backdrop-filter: blur(6px);
}

.case-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1180px, 100%);
  max-height: min(92vh, 980px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 24px 70px rgba(11, 61, 82, 0.22);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: white;
}

.modal-body {
  display: grid;
  gap: 16px;
  min-height: 0;
  overflow: auto;
  padding: 18px;
}

.advanced-details {
  display: grid;
  gap: 14px;
}

.advanced-details > summary {
  cursor: pointer;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--primary);
  font-weight: 900;
  box-shadow: var(--soft-shadow);
}

.advanced-details[open] > summary {
  margin-bottom: 14px;
}

tr:last-child td {
  border-bottom: 0;
}

td small {
  color: var(--muted);
}

td input:not([type="checkbox"]):not([type="radio"]) {
  min-width: 120px;
}

.retention {
  display: flex;
  gap: 10px;
}

.contact-log {
  padding: 18px;
}

.contact-entry {
  grid-template-columns: 1fr 1fr;
  padding: 18px;
}

.contact-log .contact-entry {
  padding: 0 0 18px;
}

.scale-pill {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(14, 54, 75, 0.08);
  color: #0e364b;
  font-size: 11px;
  font-weight: 700;
}

.section-note {
  margin: 0 18px 6px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(56, 203, 180, 0.08);
  border: 1px solid rgba(56, 203, 180, 0.25);
  color: #0e7a66;
  font-size: 12.5px;
  line-height: 1.6;
}

.linked-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(56, 203, 180, 0.16);
  color: #0e7a66;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

input.linked-field {
  background: #f4f7f6;
  color: var(--muted);
  cursor: not-allowed;
  border-style: dashed;
}

.password-reset-group {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.password-reset-group input {
  flex: 1;
  min-width: 0;
}

.password-reset-group button.ghost.small {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 0 14px;
  font-size: 12px;
}

.person-force-reset {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
}

.person-force-reset input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.force-reset-backdrop {
  z-index: 2000;
  background: rgba(6, 19, 27, 0.78);
  backdrop-filter: blur(4px);
}

.force-reset-modal {
  max-width: 460px;
  border-top: 4px solid var(--primary);
}

.install-chip {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 1500;
  padding: 12px 20px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #0e364b 0%, #16a38b 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 12px 32px rgba(14, 54, 75, 0.3);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.18s ease;
}

.install-chip::before {
  content: "↓";
  display: inline-block;
  margin-right: 8px;
  font-weight: 800;
}

.install-chip:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(14, 54, 75, 0.36);
}

@media (display-mode: standalone) {
  .install-chip { display: none; }
}

@media (max-width: 520px) {
  .install-chip {
    right: 14px;
    bottom: 14px;
    padding: 10px 16px;
    font-size: 12px;
  }
}

.attachment-uploader {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.attachment-uploader input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  background: #f7fdfb;
  border: 1px dashed rgba(56, 203, 180, 0.5);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
}

.attachment-uploader input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 6px 14px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.attachment-uploader input[type="file"]::file-selector-button:hover {
  background: #16a38b;
}

.attachment-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.attachment-progress {
  height: 6px;
  border-radius: 999px;
  background: rgba(14, 54, 75, 0.08);
  overflow: hidden;
}

.attachment-progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #39cfab, #16a38b);
  transition: width 0.2s ease;
}

.attachment-row {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.attachment-row strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

.attachment-row .attachment-meta {
  display: inline-block;
  margin-left: 8px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.attachment-row p {
  margin: 4px 0 6px;
  font-size: 13px;
  word-break: break-all;
}

.attachment-row small {
  color: var(--muted);
  font-size: 11px;
}

.attachment-row button.ghost.small {
  flex-shrink: 0;
  padding: 4px 12px;
  font-size: 12px;
}

.contact-entry button {
  align-self: end;
}

.dt-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dt-picker-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 8px;
}

.dt-picker input.dt-date,
.dt-picker input.dt-time {
  height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.dt-picker input.dt-date:focus,
.dt-picker input.dt-time:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(56, 203, 180, 0.18);
}

.dt-picker-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dt-chip {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(56, 203, 180, 0.08);
  color: #16a38b;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.dt-chip:hover {
  background: rgba(56, 203, 180, 0.16);
  border-color: rgba(56, 203, 180, 0.4);
}

.dt-chip-clear {
  background: transparent;
  color: var(--muted);
}

.dt-chip-clear:hover {
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
  border-color: rgba(220, 38, 38, 0.2);
}

@media (max-width: 520px) {
  .dt-picker-fields {
    grid-template-columns: 1fr;
  }
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline article,
.empty-state {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.timeline article small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.timeline-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-right: 8px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.timeline p,
.empty,
.empty-state p {
  color: var(--muted);
}

.diagnosis-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 24px;
}

.diagnosis-card {
  overflow: hidden;
}

.embedded-diagnosis-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfffe;
}

.inline-progress {
  margin: 0;
  box-shadow: none;
}

.embedded-diagnosis-form {
  padding: 18px;
}

.sidebar {
  position: sticky;
  top: 102px;
  align-self: start;
}

.progress-panel {
  margin-bottom: 14px;
  padding: 16px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dcebe8;
}

.progress-track > div {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-navy), var(--brand-teal));
  transition: width 0.2s ease;
}

#sectionNav {
  display: grid;
  gap: 6px;
}

#sectionNav a {
  display: block;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
}

#sectionNav a:hover {
  border-color: var(--line);
  background: white;
  color: var(--primary);
}

.form-shell {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
}

.review-panel {
  padding: 20px;
}

.review-panel h2 {
  margin-bottom: 12px;
}

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

.review-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--muted);
}

.review-item strong {
  color: var(--ink);
}

.review-item.warn strong {
  color: var(--danger);
}

.calendar-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.calendar-strip {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  gap: 6px;
}

.calendar-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 64px;
  padding: 8px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(34, 168, 142, calc(var(--intensity, 0) * 0.45));
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.calendar-cell:hover {
  border-color: var(--primary);
}

.calendar-cell.today {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary) inset;
}

.calendar-cell .calendar-weekday {
  font-size: 11px;
  color: var(--muted);
}

.calendar-cell .calendar-date {
  font-size: 12px;
  color: var(--muted);
}

.calendar-cell strong {
  font-size: 18px;
  color: var(--ink);
  line-height: 1;
}

.filter-chip {
  padding: 8px 12px;
  border: 1px solid var(--primary);
  border-radius: 999px;
  background: rgba(34, 168, 142, 0.1);
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
}

.filter-chip:hover {
  background: rgba(34, 168, 142, 0.2);
}

.bulk-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  margin-bottom: 12px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-strong);
  border-radius: 10px;
}

.bulk-actions > span {
  white-space: nowrap;
  font-weight: 700;
  color: var(--primary);
}

.bulk-actions select {
  width: auto;
  min-width: 220px;
  max-width: 320px;
  flex: 1 1 220px;
}

.login-ok {
  color: var(--muted);
}

.login-caution {
  color: #b8860b;
  font-weight: 700;
}

.login-warn {
  color: var(--danger);
  font-weight: 800;
}

.tier-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  vertical-align: middle;
}

.tier-pill.tier-vip {
  background: #fef3c7;
  color: #92400e;
}

.tier-pill.tier-chain {
  background: #dbeafe;
  color: #1e40af;
}

.tier-pill.tier-watch {
  background: #f3f4f6;
  color: #6b7280;
}

.tier-pill.tier-normal {
  background: #ecfdf5;
  color: #047857;
}

.approval-panel .approval-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.approval-panel .approval-note {
  margin: 10px 0;
  padding: 10px 14px;
  background: #fef3c7;
  border-radius: 8px;
  color: #92400e;
}

.approval-panel .approval-meta {
  color: var(--muted);
  font-size: 13px;
}

.approval-panel .approval-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.view-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-right: 10px;
}

.view-toggle button {
  padding: 6px 16px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.view-toggle button.active {
  background: var(--primary);
  color: white;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding: 4px;
}

.kanban-column {
  background: #f8fafa;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  min-height: 480px;
}

.kanban-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-weight: 800;
  color: var(--ink);
}

.kanban-header h3 {
  margin: 0;
  font-size: 14px;
}

.kanban-header span {
  font-size: 12px;
  color: var(--muted);
  background: white;
  border-radius: 999px;
  padding: 2px 10px;
}

.kanban-dropzone {
  flex: 1;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100px;
}

.kanban-dropzone.drop-target {
  background: rgba(34, 168, 142, 0.08);
  outline: 2px dashed var(--primary);
  outline-offset: -8px;
}

.kanban-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  cursor: grab;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: box-shadow 0.15s ease;
}

.kanban-card:hover {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.kanban-card.dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.kanban-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.kanban-card-owner {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.kanban-card-foot {
  margin: 0;
}

.kanban-empty {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 12px 0;
  margin: 0;
}

.field-editor-layout {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.field-editor-list {
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 130px);
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field-list-search input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  background: #f8fafa;
}

.field-list-search input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
}

.field-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-list-group {
  border-radius: 8px;
  background: transparent;
}

.field-list-group > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  cursor: pointer;
  padding: 8px 10px;
  font-weight: 800;
  color: var(--ink);
  font-size: 13px;
  border-radius: 8px;
}

.field-list-group > summary::-webkit-details-marker {
  display: none;
}

.field-list-group > summary::before {
  content: "▸";
  display: inline-block;
  width: 14px;
  color: var(--muted);
  font-size: 11px;
  transition: transform 0.15s ease;
}

.field-list-group[open] > summary::before {
  transform: rotate(90deg);
}

.field-list-group > summary:hover {
  background: #f4faf9;
}

.field-group-title {
  flex: 1;
  margin-left: 4px;
}

.field-group-count {
  font-size: 11px;
  color: var(--muted);
  background: #f4faf9;
  border-radius: 999px;
  padding: 2px 8px;
  font-weight: 700;
}

.field-list-items {
  list-style: none;
  padding: 0;
  margin: 4px 0 4px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.field-list-item {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font: inherit;
  color: inherit;
}

.field-list-item:hover {
  background: #f4faf9;
}

.field-list-item.active {
  background: rgba(34, 168, 142, 0.12);
  border-color: var(--primary);
}

.field-list-name {
  font-weight: 700;
  color: var(--ink);
  font-size: 13px;
}

.field-list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.field-list-meta .tag {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  letter-spacing: 0.4px;
}

.field-list-meta .tag.custom {
  background: #fef3c7;
  color: #92400e;
}

.field-list-meta .tag.required {
  background: #fee2e2;
  color: #b91c1c;
}

.field-list-meta .tag.muted {
  background: #f3f4f6;
  color: #6b7280;
}

.field-editor-detail {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.field-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.field-detail-head .eyebrow {
  margin: 0 0 4px;
}

.field-detail-head h3 {
  margin: 0 0 6px;
  font-size: 22px;
}

.field-code {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  background: #f4faf9;
  color: var(--primary);
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.ghost.danger {
  border-color: var(--danger);
  color: var(--danger);
}

.ghost.danger:hover {
  background: rgba(220, 38, 38, 0.08);
}

.field-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.field-detail-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field-detail-row input,
.field-detail-row select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink);
  font-weight: 600;
  background: white;
}

.field-detail-row input:disabled,
.field-detail-row select:disabled {
  background: #f8fafa;
  color: var(--muted);
}

.field-detail-toggles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.field-toggle {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafa;
  cursor: pointer;
}

.field-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.field-toggle strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.field-toggle small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.field-options-editor {
  background: #f8fafa;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-options-editor header {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.field-options-editor header h4 {
  margin: 0;
  font-size: 14px;
}

.field-options-editor header small {
  color: var(--muted);
  font-size: 12px;
}

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

.option-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px 12px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.option-chip button {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 0;
  background: #f3f4f6;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.option-chip button:hover {
  background: var(--danger);
  color: white;
}

.chip-add-form {
  display: flex;
  gap: 8px;
}

.chip-add-form input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}

.chip-add-form button {
  padding: 8px 16px;
  font-size: 13px;
}

.field-sample {
  background: #f8fafa;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
}

.field-sample h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.field-sample input,
.field-sample select,
.field-sample textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  font-size: 14px;
}

.field-sample-control {
  display: flex;
  gap: 8px;
  align-items: center;
}

.add-field-modal {
  width: min(560px, 100%);
  background: white;
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(11, 61, 82, 0.22);
  display: flex;
  flex-direction: column;
}

.add-field-body {
  padding: 20px 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.add-field-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.add-field-row.wide {
  grid-column: 1 / -1;
}

.add-field-row input,
.add-field-row select,
.add-field-row textarea {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink);
  font-weight: 600;
}

.add-field-row textarea {
  min-height: 90px;
  font-family: inherit;
}

.add-field-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px 20px;
  border-top: 1px solid var(--line);
}

@media (max-width: 960px) {
  .field-editor-layout {
    grid-template-columns: 1fr;
  }
  .field-editor-list {
    position: static;
    max-height: none;
  }
}

.fields-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin: 16px 0 12px;
}

.fields-search-wrap {
  flex: 1 1 240px;
  max-width: 360px;
}

.fields-search-wrap input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  background: #f8fafa;
}

.fields-search-wrap input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
}

.fields-group-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.group-chip {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.group-chip span {
  font-size: 11px;
  color: var(--muted);
  background: #f4faf9;
  padding: 1px 7px;
  border-radius: 999px;
}

.group-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.group-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.group-chip.active span {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

.fields-table-wrap {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
}

.fields-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.fields-table thead {
  background: #f4faf9;
}

.fields-table th {
  padding: 12px 14px;
  text-align: left;
  font-weight: 800;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}

.fields-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.fields-table tbody tr:last-child td {
  border-bottom: 0;
}

.fields-table tbody tr:hover {
  background: #f8fafa;
}

.fields-table .row-hidden {
  opacity: 0.55;
}

.fields-table .row-name strong {
  cursor: pointer;
  color: var(--ink);
  font-size: 14px;
}

.fields-table .row-name strong:hover {
  color: var(--primary);
}

.fields-table .row-name code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--muted);
}

.fields-table .row-name .tag {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  margin-left: 6px;
}

.fields-table .row-options {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 12px;
  font-weight: 700;
}

.fields-table .row-options.muted {
  background: #f3f4f6;
  color: #9ca3af;
}

.fields-table .empty-row {
  text-align: center;
  color: var(--muted);
  padding: 32px;
}

.row-toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  margin: 0;
  cursor: pointer;
}

.row-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.row-toggle span {
  position: absolute;
  inset: 0;
  background: #e5e7eb;
  border-radius: 999px;
  transition: background 0.15s ease;
}

.row-toggle span::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.row-toggle input:checked + span {
  background: var(--primary);
}

.row-toggle input:checked + span::before {
  transform: translateX(16px);
}

.field-drawer-host {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  visibility: hidden;
}

.field-drawer-host.open {
  pointer-events: auto;
  visibility: visible;
}

.field-drawer-host .drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 61, 82, 0.36);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.field-drawer-host.open .drawer-backdrop {
  opacity: 1;
}

.field-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(520px, 92vw);
  background: white;
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 60px rgba(11, 61, 82, 0.16);
  transform: translateX(100%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
}

.field-drawer-host.open .field-drawer {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
}

.drawer-head .eyebrow {
  margin: 0 0 4px;
}

.drawer-head h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

.drawer-close {
  width: 36px;
  height: 36px;
  border: 0;
  background: #f4faf9;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  flex-shrink: 0;
}

.drawer-close:hover {
  background: #e5e7eb;
  color: var(--ink);
}

.drawer-body {
  flex: 1;
  overflow: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.drawer-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.drawer-section h4 {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.drawer-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.drawer-row input,
.drawer-row select {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink);
  font-weight: 600;
  background: white;
}

.drawer-row input:disabled,
.drawer-row select:disabled {
  background: #f8fafa;
  color: var(--muted);
}

.drawer-toggles {
  display: grid;
  gap: 10px;
}

.drawer-toggle {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafa;
  cursor: pointer;
}

.drawer-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.drawer-toggle strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.drawer-toggle small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.drawer-sample input,
.drawer-sample select,
.drawer-sample textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  font-size: 14px;
}

.drawer-sample .field-sample-control {
  display: flex;
  gap: 8px;
  align-items: center;
}

.drawer-danger {
  padding-top: 12px;
  border-top: 1px solid var(--line);
  align-items: flex-start;
}

.drawer-danger small {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 720px) {
  .fields-table thead {
    display: none;
  }
  .fields-table tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
  }
  .fields-table td {
    border: 0;
    padding: 4px 0;
  }
  .field-drawer {
    width: 100vw;
  }
}

.case-modal-tabbed {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.case-tab-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 18px;
  background: white;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
}

.case-tab {
  position: relative;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  min-height: auto;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.case-tab:hover {
  background: #f8fafa;
  color: var(--ink);
}

.case-tab.active {
  color: var(--accent-strong);
  border-bottom-color: var(--accent-strong);
  background: transparent;
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #f3f4f6;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.case-tab.active .tab-badge {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tab-badge.alert {
  background: #fee2e2;
  color: #b91c1c;
}

.case-tab-body {
  padding: 22px 24px;
}

.case-tab-pane {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.case-tab-pane[hidden] {
  display: none;
}

.contact-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin: 14px 0 20px;
}

.contact-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.contact-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.contact-card-head > div {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.contact-card-head strong {
  font-size: 15px;
  color: var(--ink);
}

.contact-card-head .tag {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 8px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  letter-spacing: 0.4px;
}

.contact-card-head .tag.primary {
  background: var(--accent-strong);
  color: white;
}

.contact-card-actions {
  display: flex;
  gap: 6px;
}

.contact-card-actions button.small {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.contact-card-actions button.danger {
  border-color: var(--danger);
  color: var(--danger);
}

.contact-card-actions button.danger:hover {
  background: rgba(220, 38, 38, 0.08);
}

.contact-card-row {
  display: flex;
  gap: 10px;
  margin: 0;
  color: var(--ink);
  font-size: 13px;
}

.contact-card-row span {
  min-width: 48px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 720px) {
  .case-tab-body {
    padding: 16px 14px;
  }
  .case-tab {
    padding: 12px 12px;
    font-size: 13px;
  }
}

.notification-bell-wrap {
  position: relative;
}

.notification-bell {
  position: relative;
  width: 40px;
  height: 40px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notification-bell .bell-icon {
  font-size: 18px;
  line-height: 1;
}

.bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-width: 92vw;
  max-height: 70vh;
  overflow: hidden;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(11, 61, 82, 0.18);
  z-index: 40;
  display: flex;
  flex-direction: column;
}

.notification-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.notification-panel-head h3 {
  margin: 0;
  font-size: 15px;
}

.notification-list {
  flex: 1;
  overflow: auto;
  min-height: 60px;
}

.notification-list > .empty {
  margin: 0;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.admin-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 16px;
  margin-top: 16px;
}

.admin-alerts-panel,
.admin-audit-panel {
  margin: 0;
}

.admin-alert-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border-left: 3px solid var(--muted);
  background: #f8fafa;
}

.admin-alert > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.admin-alert strong {
  font-size: 14px;
  color: var(--ink);
}

.admin-alert small {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-alert-count {
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: white;
  color: var(--ink);
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
}

.admin-alert-warn {
  background: #fef3c7;
  border-left-color: #f59e0b;
}

.admin-alert-warn .admin-alert-count {
  background: #fbbf24;
  color: white;
  border-color: #fbbf24;
}

.admin-alert-info {
  background: var(--accent-soft);
  border-left-color: var(--accent-strong);
}

.admin-alert-info .admin-alert-count {
  background: var(--accent-strong);
  color: white;
  border-color: var(--accent-strong);
}

@media (max-width: 900px) {
  .admin-dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.notification-item {
  width: 100%;
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: white;
  text-align: left;
  cursor: pointer;
  position: relative;
  border-radius: 0;
  min-height: 0;
  color: var(--ink);
  font-weight: 500;
}

.notification-item:last-child {
  border-bottom: 0;
}

.notification-item:hover {
  background: #f8fafa;
}

.notification-item.unread {
  background: #f0fdf9;
}

.notification-item.unread:hover {
  background: #d1fae5;
}

.notification-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.notification-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.notification-text strong {
  font-size: 14px;
  color: var(--ink);
}

.notification-text p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.notification-text small {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.notification-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-strong);
  flex-shrink: 0;
  margin-top: 6px;
}

.task-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 16px;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: box-shadow 0.15s ease;
}

.task-card:hover {
  box-shadow: 0 6px 18px rgba(11, 61, 82, 0.08);
}

.task-card.task-done {
  opacity: 0.6;
}

.task-card.task-done .task-head strong {
  text-decoration: line-through;
}

.task-check {
  margin: 0;
  padding-top: 2px;
}

.task-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.task-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.task-head strong {
  font-size: 15px;
  color: var(--ink);
}

.task-priority {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.task-priority.priority-高 {
  background: #fee2e2;
  color: #b91c1c;
}

.task-priority.priority-中 {
  background: #fef3c7;
  color: #92400e;
}

.task-priority.priority-低 {
  background: #ecfdf5;
  color: #047857;
}

.task-desc {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.link-button {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--accent-strong);
  font-weight: 700;
  cursor: pointer;
  min-height: 0;
  border-radius: 0;
}

.link-button:hover {
  text-decoration: underline;
  background: transparent;
}

[data-task-delete] {
  width: 32px;
  min-height: 32px;
  padding: 0;
  font-size: 16px;
  flex-shrink: 0;
}

.import-modal {
  width: min(720px, 100%);
  max-height: min(92vh, 900px);
  background: white;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(11, 61, 82, 0.22);
  display: flex;
  flex-direction: column;
}

.import-modal-body {
  flex: 1;
  overflow: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.import-step h4 {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.import-step input[type="file"] {
  padding: 9px 11px;
  border: 1px dashed var(--accent-strong);
  background: #f8fafa;
  cursor: pointer;
}

.import-mapping {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.import-mapping label {
  background: #f8fafa;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.import-mapping label span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 4px;
}

.import-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  background: white;
}

.import-preview table {
  min-width: auto;
  width: 100%;
}

.import-preview th {
  background: #f4faf9;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 8px 10px;
}

.import-preview td {
  padding: 8px 10px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}

.toast-host {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: calc(100vw - 40px);
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 280px;
  max-width: 420px;
  padding: 14px 16px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(11, 61, 82, 0.18);
  border-left: 4px solid var(--accent-strong);
  animation: toast-enter 0.2s ease;
}

.toast.toast-leaving {
  animation: toast-leave 0.3s ease forwards;
}

@keyframes toast-enter {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toast-leave {
  to { transform: translateX(20px); opacity: 0; }
}

.toast-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: white;
  background: var(--accent-strong);
  font-size: 14px;
}

.toast-msg {
  flex: 1;
  font-size: 14px;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.4;
}

.toast-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
}

.toast-close:hover {
  background: #f3f4f6;
  color: var(--ink);
}

.toast-success { border-left-color: var(--accent-strong); }
.toast-success .toast-icon { background: var(--accent-strong); }

.toast-error { border-left-color: var(--danger); }
.toast-error .toast-icon { background: var(--danger); }

.toast-warning { border-left-color: #f59e0b; }
.toast-warning .toast-icon { background: #f59e0b; }

.toast-info { border-left-color: #2563eb; }
.toast-info .toast-icon { background: #2563eb; }

.quick-add-modal {
  width: min(520px, 100%);
}

.person-modal {
  width: min(720px, 100%);
  max-height: min(92vh, 800px);
  display: flex;
  flex-direction: column;
}

.person-modal .add-field-body {
  overflow: auto;
  flex: 1;
}

.people-batch-preview {
  margin-top: 12px;
}

.add-field-row.checkbox-inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.add-field-row.checkbox-inline span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

#peopleBatchCsv {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
  min-height: 200px;
}

.people-batch-preview h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.batch-preview-wrap {
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.batch-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.batch-preview-table th {
  background: #f4faf9;
  padding: 8px 10px;
  text-align: left;
  font-weight: 700;
  color: var(--muted);
  position: sticky;
  top: 0;
}

.batch-preview-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
}

.batch-preview-table .preview-error {
  background: #fef2f2;
}

.batch-preview-table .preview-error td {
  color: var(--danger);
}

.people-table-wrap {
  margin-top: 16px;
}

.people-table {
  font-size: 14px;
}

.people-table th,
.people-table td {
  padding: 12px 14px;
  vertical-align: middle;
  white-space: nowrap;
}

.people-table th {
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--muted);
  background: #f4faf9;
}

.people-table td {
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
}

.people-table td strong {
  font-weight: 700;
  color: var(--ink);
}

.people-table .employee-id {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--primary);
  background: rgba(11, 61, 82, 0.06);
  padding: 2px 8px;
  border-radius: 6px;
}

.people-table .muted {
  color: var(--muted);
  opacity: 0.6;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

.status-dot.ok { background: var(--accent-strong); }
.status-dot.off { background: #d1d5db; }

.people-table .row-actions {
  display: inline-flex;
  gap: 4px;
  white-space: nowrap;
}

.people-table .row-actions .icon-btn {
  width: 30px;
  height: 30px;
  min-height: 30px;
  font-size: 13px;
}

.admin-customers-table {
  min-width: 1100px;
}

.admin-customers-table th,
.admin-customers-table td {
  white-space: nowrap;
  font-size: 13px;
  padding: 10px 14px;
}

.admin-customers-table th {
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
}

.admin-customers-table td strong {
  font-size: 14px;
}

.admin-customers-table .status-pill {
  min-height: 24px;
  padding: 0 10px;
  font-size: 12px;
}

.quick-add-modal .hint {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.quick-add-modal .modal-header h3 {
  margin: 0;
}

.quick-add-modal .add-field-actions {
  flex-wrap: wrap;
}

[data-quick-visit] {
  padding-left: 10px;
  padding-right: 10px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-btn:hover {
  border-color: var(--accent-strong);
  background: var(--accent-soft);
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.kanban-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.kanban-card-actions button {
  min-height: 26px;
  padding: 0 8px;
  font-size: 12px;
}

.report-range-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  margin: 12px 0;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.report-range-custom {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.report-range-custom input {
  width: auto;
  min-width: 150px;
}

.report-range-label {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.report-grid .panel {
  margin: 0;
}

.report-funnel-panel,
.report-ranking-panel {
  grid-column: 1 / -1;
}

.funnel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

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

.funnel-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.funnel-label span {
  font-weight: 700;
  color: var(--ink);
  font-size: 14px;
}

.funnel-label strong {
  font-size: 20px;
  color: var(--accent-strong);
  line-height: 1;
}

.funnel-label small {
  color: var(--muted);
  font-size: 11px;
}

.funnel-bar {
  width: 100%;
  background: #f4faf9;
  border-radius: 8px;
  overflow: hidden;
  height: 28px;
}

.funnel-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
  transition: width 0.3s ease;
}

.report-table-wrap {
  margin-top: 12px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.report-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  font-size: 14px;
}

.report-table th {
  background: #f4faf9;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.report-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.report-table tbody tr:last-child td {
  border-bottom: 0;
}

.report-table td small {
  color: var(--muted);
  font-size: 11px;
  margin-left: 4px;
}

.rank-1 { color: #d97706; }
.rank-2 { color: #6b7280; }
.rank-3 { color: #92400e; }

.empty-row {
  text-align: center;
  color: var(--muted);
  padding: 24px;
}

@media (max-width: 900px) {
  .report-grid {
    grid-template-columns: 1fr;
  }
  .funnel-row {
    grid-template-columns: 140px minmax(0, 1fr);
  }
}

.report-goal-panel {
  grid-column: 1 / -1;
}

.goal-bar {
  width: 100%;
  height: 8px;
  background: #f4faf9;
  border-radius: 999px;
  overflow: hidden;
}

.goal-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.achievement-pct {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
}

.achievement-done {
  background: #ecfdf5;
  color: #047857;
}

.achievement-ontrack {
  background: #dbeafe;
  color: #1e40af;
}

.achievement-warning {
  background: #fef3c7;
  color: #92400e;
}

.achievement-behind {
  background: #fee2e2;
  color: #b91c1c;
}

.my-goal-widget {
  margin-bottom: 16px;
  background: linear-gradient(135deg, white 0%, #f0fdf9 100%);
}

.my-goal-widget header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.my-goal-widget header h3 {
  margin: 0;
  font-size: 18px;
}

.my-goal-widget .achievement-pct {
  font-size: 18px;
  padding: 6px 16px;
}

.my-goal-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 12px;
}

.my-goal-stats > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.my-goal-stats span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.my-goal-stats strong {
  font-size: 22px;
  color: var(--ink);
  line-height: 1;
}

.my-goal-stats small {
  color: var(--muted);
  font-size: 11px;
}

.my-goal-note {
  margin: 12px 0 0;
  padding: 8px 12px;
  background: white;
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
}

.goal-progress-summary {
  margin-top: 12px;
  padding: 12px 14px;
  background: #f8fafa;
  border-radius: 8px;
}

.goal-progress-summary h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.goal-progress-summary p {
  margin: 6px 0 4px;
  font-size: 13px;
}

.quote-history-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quote-history-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  position: relative;
}

.quote-history-item::before {
  content: "";
  width: 4px;
  align-self: stretch;
  border-radius: 999px;
  background: var(--muted);
}

.quote-history-item.quote-diff-up::before {
  background: #16a34a;
}

.quote-history-item.quote-diff-down::before {
  background: #f59e0b;
}

.quote-history-item.quote-diff-first::before {
  background: var(--accent-strong);
}

.quote-history-amount {
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quote-history-amount strong {
  font-size: 18px;
  color: var(--ink);
  line-height: 1;
}

.quote-history-amount small {
  color: var(--muted);
  font-size: 11px;
  text-decoration: line-through;
}

.quote-history-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quote-history-meta span {
  font-size: 14px;
  color: var(--ink);
  font-weight: 700;
}

.quote-history-meta small {
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 1120px) {
  .dashboard-grid,
  .dashboard-chart-grid,
  .followup-board,
  .profile-grid,
  .chart-stat-grid,
  .field-manager,
  .field-map-row,
  .org-levels,
  .location-grid,
  .filter-panel,
  .field-grid,
  .diagnosis-layout,
  .embedded-diagnosis-toolbar,
  .workflow-status-grid {
    grid-template-columns: 1fr;
  }

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

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-sidebar,
  .sidebar {
    position: static;
  }

  .admin-sidebar {
    grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  }

  .summary-band {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-header,
  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-header,
  .admin-layout {
    padding-left: 16px;
    padding-right: 16px;
  }

  .header-actions,
  .toolbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .case-modal {
    max-height: 96vh;
  }

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

/* ====== 手機（≤640px）整體優化 ====== */
@media (max-width: 640px) {
  .app-header {
    gap: 12px;
    padding: 14px 16px;
  }
  .app-header .brand-lockup .eyebrow { display: none; }
  .header-logo { height: 30px; }
  #pageTitle, .app-header h1 { font-size: 18px; }

  .admin-layout {
    padding: 14px 12px 56px;
    gap: 14px;
  }

  /* 側邊導覽改成可橫向滑動的工具列 */
  .admin-sidebar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .admin-sidebar::-webkit-scrollbar { display: none; }
  .nav-button {
    flex: 0 0 auto;
    width: auto;
    min-height: 38px;
    padding: 0 14px;
    white-space: nowrap;
  }

  /* KPI 卡片：手機兩欄 */
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .metric-card { padding: 12px; min-height: 78px; }
  .metric-card strong { font-size: 22px; }
  .metric-card span { font-size: 12px; }

  /* 工具列：標題與按鈕分行，主按鈕滿版 */
  .toolbar { padding: 14px; gap: 12px; }
  .toolbar > button,
  .toolbar-actions > button,
  .toolbar-actions > select {
    width: 100%;
  }
  .toolbar-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  /* 面板 / 區塊內距縮小 */
  .panel,
  .form-section,
  .filter-panel,
  .review-panel { padding: 14px; }
  .panel h3 { font-size: 15px; }

  /* 表格：縮小內距、保留橫向捲動 */
  .table-wrap,
  .report-table-wrap,
  .people-table-wrap,
  .fields-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  th, td { padding: 9px 10px; font-size: 13px; }

  /* mini-table（CSS grid 多欄）改成可橫向捲動，不再擠壓 */
  .mini-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .mini-table .mini-table-row {
    min-width: 560px;
  }
  .sales-overview-table .mini-table-row {
    min-width: 760px;
  }

  /* 篩選列：搜尋滿版，下拉兩欄 */
  .filter-panel {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px;
  }
  .filter-panel > #caseSearch,
  .filter-panel > .filter-chip {
    grid-column: 1 / -1;
  }
  .filter-panel input,
  .filter-panel select { min-width: 0; }

  /* 清單/看板切換滿版平分 */
  .view-toggle { width: 100%; }
  .view-toggle button { flex: 1 1 0; }

  /* 案件 modal：全螢幕、tab 列可橫向滑動 */
  .modal-backdrop { padding: 0; }
  .case-modal,
  .case-modal-tabbed {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  .case-tab-strip {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  .case-tab-strip::-webkit-scrollbar { display: none; }
  .case-tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .modal-header { padding: 14px 16px; }
  .modal-body { padding: 14px 16px; }

  /* 一般快速 modal：留邊距、內距縮小 */
  .add-field-modal { width: calc(100% - 24px); max-width: calc(100% - 24px); max-height: 92vh; }
  .add-field-body { padding: 16px; }
  .add-field-actions { flex-wrap: wrap; gap: 8px; padding: 14px 16px; }
  .add-field-actions button { flex: 1 1 auto; }

  /* Kanban 欄位寬度適配手機 */
  .kanban-column { min-width: 80vw; }

  /* 安裝 chip 不擋底部操作 */
  .install-chip { bottom: 70px; }
}

/* 超小螢幕（≤380px）：KPI 卡片字再小一點 */
@media (max-width: 380px) {
  .metric-card strong { font-size: 20px; }
  .nav-button span { font-size: 13px; }
}

@media print {
  body {
    background: white;
  }

  .no-print,
  .admin-sidebar,
  .review-panel,
  .toolbar-actions {
    display: none !important;
  }

  .app-header {
    position: static;
    padding: 0 0 14px;
    border-bottom: 2px solid #111;
  }

  .admin-layout,
  .diagnosis-layout {
    display: block;
    padding: 0;
  }

  .form-section,
  .summary-band {
    break-inside: avoid;
    margin-bottom: 14px;
    box-shadow: none;
  }
}
