:root {
  --radius: 3px;
  --font-sm: 14px;
  --font-md: 15px;
  --font-lg: 18px;
  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-soft: #f8f9fa;
  --surface-hover: #f1f3f4;
  --surface-selected: #edf2f4;
  --text: #30363a;
  --muted: #6c767c;
  --muted-soft: #929ba0;
  --line: #e3e7e9;
  --line-strong: #d2d8dc;
  --primary: #617078;
  --primary-dark: #4f5d64;
  --primary-soft: #edf2f4;
  --success: #4d8a65;
  --success-soft: #eef6f1;
  --info: #4f759f;
  --info-soft: #eef3f8;
  --danger: #a35c5c;
  --danger-soft: #f8eeee;
  --warning: #7e7150;
  --warning-soft: #f6f3eb;
  --layout-gap: 15px;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  font-size: var(--font-sm);
  line-height: 1.6;
  letter-spacing: 0;
}

button, input, select, textarea { color: inherit; font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--primary-dark); text-decoration: none; }
a:hover { color: var(--text); }
img { max-width: 100%; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(97, 112, 120, 0.32);
  outline-offset: 2px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: 18px; line-height: 1.4; }
h2 { margin-bottom: 8px; font-size: 16px; line-height: 1.45; }
h3 { margin-bottom: 8px; font-size: 15px; line-height: 1.45; }

.muted, .help { color: var(--muted); }
.help { margin-top: 5px; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.required, .field-error { color: var(--danger); }

.app-shell, .app-main { min-height: 100vh; }
.app-main { margin-left: 0; }

.top-navbar {
  position: relative;
  z-index: 50;
  display: flex;
  width: calc(100% - 50px);
  min-height: 75px;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin: 25px auto 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.top-navbar-brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--primary);
  background: var(--surface-soft);
  font-size: 15px;
  font-weight: 600;
}

.brand-copy { display: grid; min-width: 0; gap: 0; line-height: 1.3; }
.brand-copy strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.brand-copy small { color: var(--muted-soft); font-size: 10px; font-weight: 400; white-space: nowrap; }

.top-navbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}

.top-navbar-user {
  margin-left: 4px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.top-navbar-admin, .top-navbar-logout {
  border-color: transparent;
  color: var(--muted);
  background: transparent;
}

.top-navbar-admin:hover, .top-navbar-admin.active, .top-navbar-logout:hover {
  border-color: transparent;
  color: var(--text);
  background: var(--surface-hover);
}

.top-navbar-menu {
  display: none;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}

.top-navbar-menu span { display: block; width: 18px; height: 1px; background: currentColor; }

.page-wrap {
  width: calc(100% - 50px);
  margin: 15px auto 25px;
  padding: 0;
}

.page-head {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 15px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.page-head p { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.page-actions, .inline-actions, .button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.detail-page-actions { gap: 15px; }
.detail-page-actions > form { margin: 0; }

.btn {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  line-height: 1.2;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, opacity 140ms ease;
}

.btn-primary { border-color: var(--primary); color: #fff; background: var(--primary); }
.btn-primary:hover { border-color: var(--primary-dark); color: #fff; background: var(--primary-dark); }
.btn-secondary { border-color: var(--line-strong); color: var(--text); background: var(--surface); }
.btn-secondary:hover { background: var(--surface-hover); }
.btn-danger { border-color: #e0caca; color: var(--danger); background: var(--danger-soft); }
.btn-danger:hover { border-color: var(--danger); background: #f5e7e7; }
.btn-quiet { border-color: transparent; color: var(--muted); background: transparent; }
.btn-quiet:hover { color: var(--text); background: var(--surface-hover); }
.btn-sm { min-height: 30px; padding: 4px 8px; font-size: 12px; }
.btn:disabled, .btn[aria-disabled="true"] { cursor: not-allowed; opacity: 0.55; }

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.card-head {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}
.card-head h2, .card-head h3 { margin-bottom: 0; }
.card-body { padding: 16px 20px; }
.form-page-head { min-height: 68px; padding: 12px 18px; }
.form-page-head h1 { margin-bottom: 4px; }
.form-page-head p { margin-bottom: 0; color: var(--muted); font-size: 13px; }

.grid { display: grid; gap: 15px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.section-stack > * + * { margin-top: 15px; }

.metric-card { min-height: 50px; padding: 12px; }
.metric-label, .metric-foot { color: var(--muted); font-size: 12px; }
.metric-value { margin: 4px 0; font-size: 18px; font-weight: 600; }

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(420px, 1.45fr);
  gap: 10px;
  padding: 12px;
}
.search-box { min-width: 0; }
.customer-filter-selects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.customer-table-card { margin-top: 15px; }
.table-wrap { width: 100%; overflow-x: auto; }

.data-table { width: 100%; border-collapse: collapse; background: var(--surface); }
.data-table th, .data-table td {
  min-height: 40px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
.data-table th { color: var(--muted); background: var(--surface-soft); font-size: 12px; font-weight: 600; white-space: nowrap; }
.data-table tbody, .data-table tbody * { font-weight: 400; }
.data-table tbody tr:hover { background: var(--surface-hover); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table.operation-log-table { min-width: 760px; border: 1px solid var(--line); }
.data-table.operation-log-table th,
.data-table.operation-log-table td {
  padding-right: 15px;
  padding-left: 15px;
  border: 1px solid var(--line);
}
.data-table.operation-log-table th { height: 40px; }
.operation-log-table th:nth-child(-n+3),
.operation-log-table td:nth-child(-n+3) { white-space: nowrap; }
.operation-log-table th:nth-child(4),
.operation-log-table td:nth-child(4) { white-space: normal; overflow-wrap: anywhere; }
.data-table.operation-log-table tbody tr:last-child td { border-bottom: 1px solid var(--line); }
.customer-table-card .data-table { min-width: 960px; table-layout: auto; }
.customer-table-card .data-table th, .customer-table-card .data-table td { height: 75px; padding: 15px; }
.customer-table-card .data-table th { font-size: 14px; }
.customer-table-card .data-table tbody tr:hover { background: #F8F8F8; }
.customer-table-card .data-table tbody tr[data-customer-href] { cursor: pointer; }
.customer-table-card .data-table tbody tr[data-customer-href]:focus-visible { outline: 2px solid rgba(97, 112, 120, 0.32); outline-offset: -2px; }
.customer-table-card th { white-space: normal; }
.customer-table-card td { overflow-wrap: anywhere; }
.customer-table-card td[data-label*="时间"] > span:first-child { white-space: nowrap; }
.customer-status-link { color: inherit; background: transparent; border: 0; }
.customer-status-link:hover { color: var(--primary-dark); }
.status-summary { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.status-followup-count { color: var(--muted); font-size: 13px; line-height: 1.4; white-space: nowrap; }
.table-sort-button { display: inline-flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; padding: 0; border: 0; color: inherit; background: transparent; font: inherit; font-weight: inherit; text-align: left; cursor: pointer; }
.table-sort-button:hover, .table-sort-button.active { color: var(--text); }
.sort-icon { display: inline-grid; width: 9px; flex: 0 0 9px; gap: 2px; }
.sort-icon i { display: block; width: 0; height: 0; border-right: 4px solid transparent; border-left: 4px solid transparent; opacity: .35; }
.sort-icon .sort-up { border-bottom: 5px solid currentColor; }
.sort-icon .sort-down { border-top: 5px solid currentColor; }
.table-sort-button[data-direction="asc"] .sort-up, .table-sort-button[data-direction="desc"] .sort-down { opacity: 1; }
.primary-cell strong, .primary-cell .customer-name span, .two-line-cell > span { display: block; }
.primary-cell .customer-name span, .two-line-cell > span + span { margin-top: 2px; color: var(--muted); font-size: 12px; }

.customer-cell-layout { display: flex; align-items: stretch; gap: 7px; }
.customer-row-number { display: flex; width: 44px; height: 44px; flex: 0 0 44px; align-items: center; justify-content: center; border-radius: var(--radius); color: var(--muted); background: #ECEFF1; font-size: 14px; line-height: 1; }
.customer-name { min-width: 0; }
.priority-indicator { display: flex; flex: 0 0 auto; flex-direction: column; align-self: stretch; gap: 2px; }
.priority-indicator i { display: block; width: 10px; min-height: 0; flex: 1 1 0; border-radius: var(--radius); background: var(--muted-soft); }
.priority-high i { background: var(--danger); }
.priority-medium i { background: var(--info); }
.priority-low i { background: var(--muted-soft); }

.badge, .tag {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
}
.badge-blue { border-color: #cbd7e2; color: var(--info); background: var(--info-soft); }
.badge-green { border-color: #c8dccf; color: var(--success); background: var(--success-soft); }
.badge-yellow { border-color: #ddd5c3; color: var(--warning); background: var(--warning-soft); }
.badge-red { border-color: #e0caca; color: var(--danger); background: var(--danger-soft); }
.badge-gray, .tag { color: var(--muted); background: var(--surface); }
.priority-dot { width: 7px; height: 7px; border-radius: var(--radius); background: currentColor; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }

.pagination { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); }
.customer-pagination { min-height: 75px; margin-top: 15px; padding: 15px; }
.page-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.page-button { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--text); background: var(--surface); }
.page-button:hover { background: var(--surface-hover); }
.page-button.active { border-color: var(--primary); color: #fff; background: var(--primary); }
.page-button.page-nav { width: auto; min-width: 56px; padding: 0 12px; }
.page-button.disabled { border-color: var(--line); color: var(--muted-soft); background: var(--surface-soft); pointer-events: none; cursor: not-allowed; }
.empty-state { min-height: 40px; padding: 10px 0; color: var(--muted); text-align: left; }

.field { min-width: 0; }
.field > label, .field > .field-label { display: block; margin-bottom: 6px; font-weight: 600; }
.input, .select, .textarea { width: 100%; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); background: var(--surface); }
.input, .select { height: 46px; padding: 0 15px; }
.select,
select {
  padding-right: 43px;
  appearance: none;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='m3 5 4 4 4-4' fill='none' stroke='%236c767c' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 14px 14px;
  cursor: pointer;
  text-overflow: ellipsis;
}
select::-ms-expand { display: none; }
select:disabled,
.select:disabled {
  color: var(--muted);
  background-color: var(--surface-soft);
  cursor: not-allowed;
  opacity: 1;
}
select option { color: var(--text); background: var(--surface); }
.custom-select { position: relative; width: 100%; min-width: 0; }
.custom-select > select.custom-select-native {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
.custom-select-trigger {
  display: flex;
  width: 100%;
  height: 46px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 43px 0 15px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='m3 5 4 4 4-4' fill='none' stroke='%236c767c' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 14px 14px;
  cursor: pointer;
  text-align: left;
}
.custom-select-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.custom-select-trigger:hover { border-color: var(--line-strong); background-color: var(--surface-hover); }
.custom-select-trigger:focus-visible { outline: 2px solid rgba(97, 112, 120, 0.32); outline-offset: 2px; }
.custom-select.open .custom-select-trigger { border-color: var(--line-strong); background-color: var(--surface); }
.custom-select-trigger:disabled { color: var(--muted); background-color: var(--surface-soft); cursor: not-allowed; }
.custom-select-panel {
  position: absolute;
  z-index: 100;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  display: grid;
  gap: 1px;
  max-height: 242px;
  padding: 4px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  scrollbar-color: var(--line-strong) var(--surface-soft);
  scrollbar-width: thin;
}
.custom-select-panel[hidden] { display: none; }
.custom-select-panel::-webkit-scrollbar { width: 8px; }
.custom-select-panel::-webkit-scrollbar-track { border-radius: var(--radius); background: var(--surface-soft); }
.custom-select-panel::-webkit-scrollbar-thumb { border: 2px solid var(--surface-soft); border-radius: var(--radius); background: var(--line-strong); }
.custom-select-panel::-webkit-scrollbar-thumb:hover { background: var(--primary); }
.custom-select.drop-up .custom-select-panel { top: auto; bottom: calc(100% + 4px); }
.custom-select-option {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 15px;
  border: 0;
  border-radius: var(--radius);
  color: var(--text);
  background: transparent;
  cursor: pointer;
  line-height: 1.4;
  text-align: left;
}
.custom-select-option:hover,
.custom-select-option:focus-visible { outline: 0; background: var(--surface-hover); }
.custom-select-option[aria-selected="true"] { background: var(--surface-selected); }
.custom-select-option[aria-disabled="true"] { color: var(--muted-soft); cursor: not-allowed; }
.custom-select-count { min-width: 24px; flex: 0 0 auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.custom-select-check { position: relative; width: 12px; height: 10px; flex: 0 0 auto; }
.custom-select-check[hidden] { display: none; }
.custom-select-check:not([hidden]) { display: inline-block; }
.custom-select-check::before { position: absolute; top: 1px; left: 2px; width: 7px; height: 4px; border-bottom: 2px solid var(--primary); border-left: 2px solid var(--primary); content: ""; transform: rotate(-45deg); transform-origin: center; }
.textarea { min-height: 96px; padding: 10px 11px; resize: vertical; overflow-y: hidden; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--line); outline: 0; background: var(--surface); }
.select:focus-visible,
select:focus-visible { outline: 2px solid rgba(97, 112, 120, 0.32); outline-offset: 2px; }
.input::placeholder, .textarea::placeholder { color: var(--muted-soft); opacity: 1; }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); background: var(--danger-soft); }
.field-error { margin-top: 4px; }

.form-grid { display: grid; gap: 15px; }
.form-grid.two-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.form-section + .form-section { margin-top: 15px; }
.customer-profile-card { border-top-width: 2px; border-bottom-width: 2px; }
.customer-profile-card > .form-page-head { border-bottom-width: 2px; }
.form-footer-card { border-top-width: 2px; border-bottom-width: 2px; }
.form-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; padding: 15px 16px; background: var(--surface-soft); }
.profile-extras { display: grid; gap: 15px; margin: 15px 0; }
.profile-extras[hidden] { display: none; }
.detail-profile-footer { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.profile-extras > .first-inquiry-section { border: 1px solid var(--line); border-radius: var(--radius); }
.first-inquiry-section .card-head { border-bottom: 1px solid var(--line); }

.customer-form-rows { display: grid; gap: 15px; }
.customer-form-rows > .field { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: start; gap: 15px; }
.customer-form-rows > .field > label {
  display: flex;
  height: 46px;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  text-align: center;
}
.customer-form-rows > .field:has(> .textarea) > label { height: auto; align-self: stretch; }
.customer-form-rows > .field:has(.input:focus, .textarea:focus, .select:focus, .custom-select-trigger:focus, .custom-select.open) > label { color: var(--danger); }
.customer-form-rows .input:focus,
.customer-form-rows .textarea:focus,
.customer-form-rows .select:focus,
.customer-form-rows .custom-select-trigger:focus,
.customer-form-rows .custom-select.open .custom-select-trigger { border-color: var(--primary); }
.customer-form-rows > .field > .tag-row { min-height: 46px; align-items: center; gap: 15px; }
.customer-form-rows > .field > .tag-row .tag { position: relative; min-height: 46px; padding: 0 12px; overflow: hidden; font-size: inherit; cursor: pointer; }
.customer-form-rows > .field > .tag-row .tag input { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.customer-form-rows > .field > .tag-row .tag:has(input:checked) { border-color: var(--primary); }
.customer-form-rows > .field > .tag-row .tag .ri-check-line { position: absolute; right: -1px; bottom: -1px; display: none; width: 16px; height: 16px; place-items: center; border: 1px solid var(--primary); border-radius: var(--radius) 0 0 0; background: var(--primary); font-style: normal; }
.customer-form-rows > .field > .tag-row .tag .ri-check-line::before { content: ""; width: 7px; height: 4px; margin-top: -1px; border-bottom: 2px solid var(--surface); border-left: 2px solid var(--surface); transform: rotate(-45deg); transform-origin: center; }
.customer-form-rows > .field > .tag-row .tag:has(input:checked) .ri-check-line { display: grid; }
.customer-form-rows > .field-section-divider { padding-top: 15px; border-top: 1px dashed var(--line-strong); }
.contact-method-control { display: grid; min-width: 0; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 15px; }
.contact-traits-control { display: grid; min-width: 0; grid-template-columns: minmax(0, 1fr) 48px; align-items: center; gap: 15px; }
.contact-avatar { position: relative; display: grid; width: 48px; height: 48px; place-items: center; overflow: hidden; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); background: var(--surface-soft); cursor: pointer; }
.contact-avatar:hover { background: var(--surface-hover); }
.contact-avatar img { width: 100%; height: 100%; object-fit: cover; }
.contact-avatar-placeholder { font-size: 12px; }
.contact-reached { position: relative; display: inline-flex; min-height: 46px; align-items: center; justify-self: start; padding: 0 12px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--muted); background: var(--surface); font-weight: 400; white-space: nowrap; cursor: pointer; }
.contact-reached input { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.contact-reached:has(input:checked) { border-color: var(--primary); }
.contact-reached .ri-check-line { position: absolute; right: -1px; bottom: -1px; display: none; width: 16px; height: 16px; place-items: center; border: 1px solid var(--primary); border-radius: var(--radius) 0 0 0; background: var(--primary); font-style: normal; }
.contact-reached .ri-check-line::before { content: ""; width: 7px; height: 4px; margin-top: -1px; border-bottom: 2px solid var(--surface); border-left: 2px solid var(--surface); transform: rotate(-45deg); transform-origin: center; }
.contact-reached:has(input:checked) .ri-check-line { display: grid; }
.check-row input { accent-color: var(--primary); }
.check-row { display: flex; align-items: center; gap: 8px; color: var(--muted); }

.notice { display: flex; gap: 10px; padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--warning); background: var(--warning-soft); }
.notice[hidden] { display: none; }
.notice strong { display: block; margin-bottom: 3px; }
.notice-success { border-color: #c8dccf; color: var(--success); background: var(--success-soft); }
.form-notice { margin-bottom: 15px; }

.tabs { display: flex; height: 75px; gap: 2px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -ms-overflow-style: none; border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.tabs::-webkit-scrollbar { display: none; width: 0; height: 0; }
.tab-button { min-width: max-content; height: 75px; min-height: 75px; padding: 10px 25px; border: 0; color: var(--muted); background: transparent; cursor: pointer; }
.tab-button:hover { color: var(--text); background: var(--surface-hover); }
.tab-button.active { color: var(--text); background: var(--surface-selected); font-weight: 600; }
.tab-panel { padding: 16px 20px; }
.tab-panel[hidden] { display: none; }

.detail-hero { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 18px 20px; }
.detail-title { display: flex; min-width: 0; flex: 1 1 auto; align-items: center; gap: 10px; }
.detail-title h1 { margin-bottom: 6px; font-size: 26px; line-height: 1.25; overflow-wrap: anywhere; }
.detail-status { display: flex; flex: 0 0 auto; align-items: center; justify-content: flex-end; gap: 8px; }
.detail-status .badge { height: 32px; min-height: 32px; padding-right: 10px; padding-left: 10px; }
.detail-avatar { width: 56px; height: 56px; object-fit: cover; border-radius: var(--radius); }
.summary-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0 20px 15px; padding: 12px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); }
.summary-item { min-width: 0; padding: 0 15px; text-align: center; }
.summary-item + .summary-item { border-left: 1px solid var(--line); }
.summary-item span, .summary-item strong { display: block; }
.summary-item span { color: var(--muted); font-size: 12px; }
.summary-item strong { margin-top: 2px; font-size: 15px; font-weight: 600; }
.current-blocker-editor { padding: 0 20px 12px; }
.current-blocker-row { display: grid; min-width: 0; grid-template-columns: 120px repeat(3, minmax(0, 1fr)) auto; align-items: center; gap: 15px; }
.current-blocker-row > .current-blocker-heading { display: flex; height: 46px; align-items: center; justify-content: center; margin: 0; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); text-align: center; font-weight: 600; }
.current-blocker-row:has(.input:focus, .select:focus, .date-time-control:focus-within) > .current-blocker-heading { color: var(--danger); }
.current-blocker-save { min-height: 46px; height: 46px; align-self: stretch; white-space: nowrap; }

.description-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.description-item { min-width: 0; padding: 10px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.description-item:nth-child(3n) { border-right: 0; }
.description-item span, .description-item strong { display: block; overflow-wrap: anywhere; }
.description-item span { margin-bottom: 3px; color: var(--muted); font-size: 12px; }
.description-item strong { font-weight: 500; }

.followup-toolbar { justify-content: flex-end; margin-bottom: 15px; }
.followup-composer { margin-bottom: 15px; border-color: var(--line-strong); background: var(--primary-soft); }
.followup-composer.is-collapsed .card-body { display: none; }
.followup-composer.is-expanded .card-body { padding-top: 0; }
.followup-composer-toggle {
  display: flex;
  width: calc(100% - 30px);
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 15px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface-soft);
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
}
.followup-composer-toggle:hover { border-color: var(--line-strong); background: var(--surface-hover); }
.followup-composer-toggle:focus-visible { outline-offset: -3px; }
.followup-composer-toggle > i, .record-edit-toggle > i {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--muted);
  background-color: currentColor;
  font-size: 0;
  font-style: normal;
  line-height: 1;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.record-edit-toggle > i { width: 22px; height: 22px; flex-basis: 22px; }
.followup-composer-toggle .ri-arrow-down-double-line, .record-edit-toggle .ri-arrow-down-double-line {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 19.1642L18.2071 12.9571L16.7929 11.5429L12 16.3358L7.20712 11.5429L5.79291 12.9571L12 19.1642ZM12 13.5143L18.2071 7.30722L16.7929 5.89301L12 10.6859L7.20712 5.89301L5.79291 7.30722L12 13.5143Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 19.1642L18.2071 12.9571L16.7929 11.5429L12 16.3358L7.20712 11.5429L5.79291 12.9571L12 19.1642ZM12 13.5143L18.2071 7.30722L16.7929 5.89301L12 10.6859L7.20712 5.89301L5.79291 7.30722L12 13.5143Z'/%3E%3C/svg%3E");
}
.followup-composer-toggle .ri-arrow-up-double-line, .record-edit-toggle .ri-arrow-up-double-line {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4.83582L5.79291 11.0429L7.20712 12.4571L12 7.66424L16.7929 12.4571L18.2071 11.0429L12 4.83582ZM12 10.4857L5.79291 16.6928L7.20712 18.107L12 13.3141L16.7929 18.107L18.2071 16.6928L12 10.4857Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4.83582L5.79291 11.0429L7.20712 12.4571L12 7.66424L16.7929 12.4571L18.2071 11.0429L12 4.83582ZM12 10.4857L5.79291 16.6928L7.20712 18.107L12 13.3141L16.7929 18.107L18.2071 16.6928L12 10.4857Z'/%3E%3C/svg%3E");
}
.followup-composer .card-body { padding: 15px; }
.followup-compose-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) 110px 110px; gap: var(--layout-gap); }
.followup-content-field > .textarea { display: block; }
.followup-title-field, .followup-content-field, .followup-file-list-field { grid-column: 1 / -1; }
.followup-upload-field, .followup-save-field { width: 110px; }
.followup-upload-button, .followup-save-button { width: 110px; height: 46px; justify-content: center; }
.followup-time-field .date-time-control { width: 100%; }
.followup-upload-field > .followup-upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0;
  font-weight: 400;
  text-align: center;
  background: var(--surface-soft);
}
.followup-file-button { display: inline-flex; align-items: center; margin: 0; cursor: pointer; }
.followup-file-list-field:empty { display: none; }
.followup-file-list { display: grid; min-width: 0; flex: 1; gap: 6px; }
.followup-file-item { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); }

.timeline { display: grid; gap: 15px; }
.timeline-item { position: relative; min-width: 0; padding: 0 15px 15px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.timeline-seq { display: inline-grid; width: 32px; height: 32px; flex: 0 0 32px; place-items: center; border: 1px solid var(--primary); border-radius: 50%; color: var(--surface); background: var(--primary); font-size: 16px; font-weight: 600; line-height: 1; }
.record-title-row { display: flex; min-width: 0; align-items: center; gap: 12px; min-height: 60px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.record-content-box:has(> .record-detail[hidden]) > .record-title-row { border-bottom: 0; }
.record-title { min-width: 0; overflow: hidden; flex: 1 1 auto; color: var(--text); font-size: 16px; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
.record-title-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.record-title-actions form { margin: 0; }
.record-title-actions .btn { min-width: 56px; height: 34px; padding: 4px 10px; }
.record-detail { min-width: 0; }
.record-detail[hidden] { display: none; }
.timeline-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-height: 60px; margin: 0 -15px 12px; padding: 10px 15px; border-bottom: 1px solid var(--line); color: var(--muted); background: var(--surface-soft); font-size: 14px; line-height: 1.45; }
.timeline-meta .badge { min-height: 26px; padding: 4px 8px; border-color: transparent; font-size: 13px; }
.timeline-meta strong { color: var(--text); font-size: 15px; font-weight: 500; }
.timeline-channel { color: var(--muted); }
.timeline-stamp { display: inline-flex; align-items: center; gap: 10px; margin-left: auto; white-space: nowrap; }
.timeline-user { color: var(--text); font-weight: 500; }
.timeline-meta time { color: var(--text); white-space: nowrap; }
.timeline-content { min-width: 0; }
.record-content-box { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.record-body { margin: 15px 0 0; color: var(--text); font-size: 14px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.record-attachment-row { display: flex; min-width: 0; align-items: flex-end; gap: 15px; margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--line); }
.record-edit-toggle { display: inline-flex; width: auto; height: 34px; min-height: 34px; flex: 0 0 auto; align-items: center; justify-content: center; margin-left: 0; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--primary); background: var(--surface-soft); font-size: 14px; line-height: 1.4; cursor: pointer; }
.record-edit-toggle:hover { border-color: var(--primary); }
.record-edit-toggle:focus-visible { outline: 2px solid rgba(97, 112, 120, 0.32); outline-offset: 2px; }
.record-edit { margin-top: 15px; padding: 15px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.record-edit[hidden] { display: none; }
.record-edit-form { display: grid; gap: 15px; }
.record-edit-form > .field { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: start; gap: 15px; }
.record-edit-form > .field > label { display: flex; height: 46px; align-items: center; justify-content: center; margin: 0; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); text-align: center; }
.record-edit-form > .field:has(> .textarea) > label { height: auto; align-self: stretch; }
.record-edit-form > .field:has(.input:focus, .textarea:focus) > label { color: var(--danger); }
.record-edit-form .input:focus, .record-edit-form .textarea:focus { border-color: var(--primary); }
.date-time-control { position: relative; display: grid; min-width: 0; height: 46px; grid-template-columns: minmax(0, 1fr) 46px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.date-time-control:focus-within { border-color: var(--primary); }
.date-time-control .input { min-width: 0; height: 44px; border: 0; border-radius: 2px 0 0 2px; }
.date-time-control .input:focus { border: 0; }
.date-time-control input.date-time-input { padding-right: 10px; }
.date-time-trigger { display: grid; width: 46px; height: 44px; place-items: center; border: 0; border-left: 1px solid var(--line); border-radius: 0 2px 2px 0; color: var(--muted); background: var(--surface-soft); cursor: pointer; }
.date-time-trigger:hover { color: var(--text); background: var(--surface-hover); }
.date-time-trigger:focus-visible { outline: 2px solid rgba(97, 112, 120, 0.32); outline-offset: -3px; }
.date-time-trigger i { position: relative; display: block; width: 16px; height: 15px; border: 1px solid currentColor; border-radius: 2px; font-style: normal; }
.date-time-trigger i::before { position: absolute; top: 3px; right: 1px; left: 1px; border-top: 1px solid currentColor; content: ""; }
.date-time-trigger i::after { position: absolute; top: -3px; left: 3px; width: 8px; height: 4px; border-right: 1px solid currentColor; border-left: 1px solid currentColor; content: ""; }
.date-time-panel { position: absolute; z-index: 120; top: calc(100% + 4px); right: 0; display: grid; width: min(196px, calc(100vw - 30px)); grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 3px; padding: 7px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.date-time-panel::after { position: absolute; right: 7px; bottom: 41px; left: 7px; height: 1px; background: var(--line); content: ""; }
.date-time-panel[hidden] { display: none; }
.date-time-control.drop-up .date-time-panel { top: auto; bottom: calc(100% + 4px); }
.date-time-panel-head, .date-time-panel-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.date-time-panel-head { grid-column: 1 / -1; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.date-time-panel-head strong { color: var(--text); font-size: 12px; font-weight: 600; }
.date-time-panel-button { display: grid; width: 25px; height: 25px; place-items: center; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); background: var(--surface-soft); font-size: 16px; line-height: 1; cursor: pointer; }
.date-time-panel-button:hover { background: var(--surface-hover); }
.date-time-week, .date-time-grid { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(7, 24px); justify-content: center; gap: 2px; }
.date-time-week { padding: 6px 0 2px; color: var(--muted); font-size: 10px; text-align: center; }
.date-time-day { display: grid; width: 24px; height: 24px; min-height: 24px; place-items: center; padding: 0; border: 1px solid transparent; border-radius: var(--radius); color: var(--text); background: transparent; font-size: 11px; line-height: 1; cursor: pointer; }
.date-time-day:hover { background: var(--surface-hover); }
.date-time-day.outside { color: var(--muted-soft); }
.date-time-day.selected { border-color: var(--primary); color: #fff; background: var(--primary); }
.date-time-panel-time { position: relative; display: grid; grid-column: 1; grid-row: 4; grid-template-columns: minmax(0, 1fr); align-items: center; gap: 0; margin-top: 10px; padding-top: 7px; cursor: pointer; }
.date-time-panel-time::before { position: absolute; z-index: 0; top: 7px; right: 0; bottom: 0; left: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); content: ""; }
.date-time-panel-time:focus-within::before { border-color: var(--primary); }
.date-time-panel-time .input { position: relative; z-index: 1; height: 25px; padding: 0 10px; border: 0; background: transparent; font-size: 12px; cursor: text; }
.date-time-panel-time .input:focus { border: 0; }
.date-time-panel-time input[type="time"] { appearance: none; }
.date-time-panel-time input[type="time"]::-webkit-calendar-picker-indicator { display: none; }
.date-time-panel-actions { position: relative; z-index: 1; display: grid; grid-column: 2 / 4; grid-row: 4; grid-template-columns: repeat(2, minmax(0, 1fr)); align-self: end; gap: 3px; margin-top: 10px; padding-top: 7px; }
.date-time-panel-actions .btn { width: 100%; min-width: 0; min-height: 25px; height: 25px; padding: 2px 4px; font-size: 11px; line-height: 1; }
.time-select-panel { position: absolute; z-index: 3; bottom: calc(100% + 5px); left: 0; width: 92px; padding: 6px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); cursor: default; }
.time-select-panel[hidden] { display: none; }
.time-select-head, .time-select-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.time-select-head { padding: 0 1px 5px; color: var(--muted); font-size: 10px; text-align: center; }
.time-option-list { display: grid; max-height: 132px; gap: 1px; padding-right: 1px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); scrollbar-color: var(--line-strong) var(--surface-soft); scrollbar-width: thin; }
.time-option-list::-webkit-scrollbar { width: 7px; }
.time-option-list::-webkit-scrollbar-track { background: var(--surface-soft); }
.time-option-list::-webkit-scrollbar-thumb { border: 2px solid var(--surface-soft); border-radius: var(--radius); background: var(--line-strong); }
.time-option { min-height: 28px; border: 0; border-radius: var(--radius); color: var(--text); background: transparent; font-size: 11px; cursor: pointer; }
.time-option:hover { background: var(--surface-hover); }
.time-option.selected { color: #fff; background: var(--primary); }
.record-edit-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--line); }
.record-edit-actions form { margin: 0; }
.record-delete { margin: 0; }
summary { cursor: pointer; color: var(--primary-dark); }

.translation-box { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); }
.translation-box > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.translation-box p { margin: 0; }

.attachment-list { display: flex; width: 100%; flex-wrap: wrap; gap: 8px; margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--line); }
.record-attachment-row > .attachment-list { width: auto; min-width: 0; flex: 1 1 auto; margin: 0; padding: 0; border-top: 0; }
.followup-attachment { display: grid; width: fit-content; max-width: 100%; min-width: 0; grid-template-columns: 38px minmax(0, auto) auto; align-items: center; gap: 8px; padding: 7px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); }
.attachment-thumbnail { position: relative; display: flex; width: 38px; height: 40px; align-items: center; justify-content: center; padding: 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--info); background: var(--surface); font-size: 11px; font-weight: 400; }
.attachment-thumbnail-image { cursor: pointer; }
.attachment-thumbnail-image:hover { background: var(--surface-hover); }
.attachment-thumbnail-image img { display: block; width: 100%; height: 100%; object-fit: contain; }
.attachment-thumbnail-file::after { position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-bottom: 1px solid var(--line-strong); border-left: 1px solid var(--line-strong); content: ""; }
.attachment-info { min-width: 0; overflow: hidden; }
.attachment-name, .attachment-size { display: block; overflow-wrap: anywhere; }
.attachment-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-size { margin-top: 2px; color: var(--muted); font-size: 12px; }

.admin-settings-grid { align-items: start; }
.admin-settings-grid .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
[data-ai-settings] > .button-row { grid-column: 1 / -1; }
.secret-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.admin-actions, .admin-dictionary-row, .admin-trash-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.admin-dictionaries { display: grid; gap: 8px; }
.admin-dictionary-row { padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); }
.admin-dictionary-row > .input:first-of-type { min-width: 180px; flex: 1; }
.admin-dictionary-row .sort-input { width: 85px; }
.admin-dictionary-row .select { width: 115px; }
.admin-dictionary-row .custom-select { width: 115px; }
.admin-dictionary-row .check-row { white-space: nowrap; }
.admin-trash-row { min-height: 48px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.admin-trash-row > div:first-child { min-width: 200px; flex: 1; }
.admin-test-form, .admin-section-title { margin-top: 15px; }
.admin-actions .input { max-width: 230px; }
.backup-path { white-space: pre-wrap; overflow-wrap: anywhere; }

.flash-stack { position: fixed; z-index: 80; right: 16px; bottom: 16px; display: grid; gap: 6px; width: min(340px, calc(100vw - 20px)); }
.flash, .toast { padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.flash-success { border-color: #c8dccf; color: var(--success); background: var(--success-soft); }
.flash-error { border-color: #e0caca; color: var(--danger); background: var(--danger-soft); }
.toast { position: fixed; right: 16px; bottom: 16px; z-index: 80; max-width: 340px; color: var(--primary-dark); transform: translateY(10px); opacity: 0; pointer-events: none; transition: opacity 140ms ease, transform 140ms ease; }
.toast.show { transform: translateY(0); opacity: 1; }

.login-body { overflow-x: hidden; background: #07111e; }
.login-page {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  padding: 25px;
  background: #07111e;
}
.login-page::before, .login-page::after { position: absolute; z-index: -1; pointer-events: none; content: ""; }
.login-page::before {
  inset: 0;
  opacity: .42;
  background-image:
    radial-gradient(circle, rgba(216, 235, 245, .62) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(151, 190, 204, .42) 0 1px, transparent 1.5px);
  background-position: 0 0, 64px 92px;
  background-size: 137px 137px, 211px 211px;
  animation: login-star-drift 48s linear infinite;
}
.login-page::after {
  inset: -20%;
  opacity: .86;
  filter: blur(28px);
  background-image:
    radial-gradient(ellipse 43% 28% at 12% 32%, rgba(29, 164, 158, .28), transparent 72%),
    radial-gradient(ellipse 38% 34% at 83% 22%, rgba(79, 117, 159, .32), transparent 74%),
    radial-gradient(ellipse 45% 30% at 73% 82%, rgba(77, 138, 101, .24), transparent 72%),
    radial-gradient(ellipse 34% 27% at 26% 78%, rgba(105, 111, 157, .22), transparent 74%),
    linear-gradient(116deg, transparent 22%, rgba(54, 147, 145, .10) 43%, rgba(104, 112, 159, .10) 58%, transparent 78%);
  background-position: 0% 30%, 100% 20%, 95% 100%, 10% 90%, 0 0;
  background-size: 78% 88%, 76% 84%, 82% 82%, 75% 88%, 100% 100%;
  animation: login-aurora-flow 28s ease-in-out infinite alternate;
}
@keyframes login-star-drift {
  from { background-position: 0 0, 64px 92px; }
  to { background-position: 343px 337px, -321px 409px; }
}
@keyframes login-aurora-flow {
  from {
    background-position: 0% 30%, 100% 20%, 95% 100%, 10% 90%, 0 0;
    transform: scale(1.02) rotate(-1deg);
  }
  to {
    background-position: 86% 74%, 12% 83%, 6% 18%, 94% 24%, 0 0;
    transform: scale(1.10) rotate(1deg);
  }
}
.nav-icon { display: grid; width: 24px; height: 24px; flex: 0 0 24px; place-items: center; border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--primary); background: var(--surface-soft); font-size: 11px; font-weight: 600; }
.login-main { position: relative; z-index: 1; width: min(430px, calc(100vw - 50px)); min-width: 0; }
.auth-card, .auth-form, .auth-form .field { min-width: 0; }
.auth-card { width: 100%; border-color: rgba(97, 112, 120, .28); }
.auth-card .card-body { padding: 22px; }
.auth-title { margin-bottom: 16px; text-align: center; }
.auth-title p { margin-bottom: 0; color: var(--muted); }
.auth-switch { display: grid; grid-template-columns: repeat(2, 1fr); margin-bottom: 16px; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.auth-switch button { min-height: 42px; border: 0; background: var(--surface); cursor: pointer; }
.auth-switch button:hover { background: var(--surface-hover); }
.auth-switch button.active { color: var(--text); background: var(--surface-selected); font-weight: 600; }
.auth-form { display: grid; gap: 15px; }
.auth-form[hidden] { display: none; }
.auth-footer { margin-top: 16px; color: var(--muted); text-align: center; }
.install-card { max-width: 720px; }
.install-section-title { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.install-page .auth-card { width: min(720px, 100%); }

@media (max-width: 800px) {
  .top-navbar {
    display: grid;
    width: calc(100% - 50px);
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 15px;
    row-gap: 0;
    margin-top: 25px;
  }
  .top-navbar-menu { display: grid; gap: 4px; }
  .top-navbar-actions {
    display: grid;
    max-height: 0;
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
    gap: 6px;
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
    transition: max-height 180ms ease, opacity 140ms ease, padding 140ms ease;
  }
  .top-navbar.open .top-navbar-actions { max-height: 320px; padding-top: 10px; border-top: 1px solid var(--line); visibility: visible; opacity: 1; }
  .top-navbar-actions .btn, .top-navbar-actions > form, .top-navbar-actions > form .btn { width: 100%; }
  .top-navbar-user { display: flex; min-height: 48px; align-items: center; margin: 0; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius); }
  .page-wrap { width: calc(100% - 50px); margin-top: 10px; }
  .page-head { min-height: auto; flex-direction: column; align-items: stretch; padding: 12px; }
  .form-page-head { min-height: auto; flex-direction: column; align-items: stretch; padding: 12px; }
  .page-actions { width: 100%; }
  .page-actions .btn { min-height: 48px; }
  .form-page-head .page-actions .btn { width: 100%; }
  .toolbar { grid-template-columns: 1fr; }
  .customer-filter-selects { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4, .form-grid.two-cols, .admin-settings-grid,
  .admin-settings-grid .form-grid { grid-template-columns: 1fr; }
  .detail-hero { flex-direction: column; padding: 14px; }
  .detail-title, .detail-status { width: 100%; }
  .detail-status { justify-content: flex-end; }
  .detail-title h1 { font-size: 22px; }
  .summary-strip { grid-template-columns: 1fr; padding: 0; }
  .summary-item { padding: 12px 14px; }
  .summary-item + .summary-item { border-top: 1px solid var(--line); border-left: 0; }
  .current-blocker-editor { padding: 0 14px 12px; }
  .current-blocker-row { grid-template-columns: 1fr; gap: 12px; }
  .current-blocker-row > .current-blocker-heading, .current-blocker-save { grid-column: 1 / -1; }
  .current-blocker-editor .btn { width: 100%; min-height: 46px; height: 46px; }
  .description-list { grid-template-columns: 1fr; }
  .description-item, .description-item:nth-child(3n) { border-right: 0; }
  .followup-compose-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); justify-content: stretch; }
  .followup-title-field, .followup-content-field, .followup-source-field, .followup-direction-field, .followup-file-list-field { grid-column: 1 / -1; }
  .followup-upload-field { grid-column: 1; }
  .followup-save-field { grid-column: 2; }
  .attachment-list { grid-template-columns: 1fr; }
  .customer-form-rows > .field { grid-template-columns: 120px minmax(0, 1fr); }
  .responsive-table thead { display: none; }
  .customer-table-card .data-table { min-width: 0; table-layout: auto; }
  .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
  .responsive-table tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .responsive-table td { display: grid; min-height: 48px; grid-template-columns: 102px minmax(0, 1fr); align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
  .customer-table-card .responsive-table tr { padding: 0; }
  .customer-table-card .responsive-table td { height: auto; min-height: 75px; grid-template-columns: 112px minmax(0, 1fr); padding: 15px; }
  .responsive-table td:last-child { border-bottom: 0; }
  .responsive-table td[colspan] { display: block; }
  .responsive-table td[colspan]::before { content: none; }
  .responsive-table td::before { color: var(--muted); font-size: 12px; content: attr(data-label); }
  .responsive-table .customer-cell-layout { grid-column: 2; }
  .responsive-table .two-line-cell::before { grid-row: 1 / span 2; }
  .responsive-table .two-line-cell > span { grid-column: 2; }
  .responsive-table td[data-label="状态"] .status-summary { grid-column: 2; grid-row: 1; }
  .login-page { padding: 25px; }
}

@media (max-width: 520px) {
  .top-navbar, .page-wrap { width: calc(100% - 50px); }
  .brand-copy small { display: none; }
  .card-body, .tab-panel { padding: 12px; }
  .card-head { padding: 10px 12px; }
  .customer-form-rows > .field { grid-template-columns: 1fr; gap: 5px; }
  .customer-form-rows > .field:has(> .textarea) > label { height: 46px; align-self: start; }
  .record-edit-form > .field { grid-template-columns: 1fr; gap: 5px; }
  .record-edit-form > .field:has(> .textarea) > label { height: 46px; align-self: start; }
  .contact-method-control { grid-template-columns: 1fr; }
  .form-footer .btn { min-height: 48px; }
  .followup-upload-row { flex-direction: column; }
  .followup-file-button { width: 100%; min-height: 48px; }
  .timeline-item { padding-right: 12px; padding-left: 12px; }
  .timeline-meta { margin-right: -12px; margin-left: -12px; padding-right: 12px; padding-left: 12px; }
  .attachment-list { grid-template-columns: 1fr; }
  .followup-attachment { grid-template-columns: 38px minmax(0, 1fr) auto; }
  .followup-attachment .attachment-preview { grid-column: auto; justify-self: auto; }
  .tabs { scrollbar-width: none; }
  .flash-stack, .toast { right: 8px; bottom: 8px; left: 8px; width: auto; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
  .login-page::before, .login-page::after { animation: none !important; }
}
