:root {
  --bg: #ffffff;
  --surface: #f5f5f7;
  --surface-hover: #ececf0;
  --surface-elevated: #ffffff;
  --hairline: rgba(0, 0, 0, 0.08);
  --hairline-strong: rgba(0, 0, 0, 0.14);

  --ink: #1d1d1f;
  --ink-secondary: #6e6e73;
  --ink-tertiary: #86868b;

  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.08);

  --danger: #d70015;
  --danger-dot: #ff3b30;
  --danger-soft: rgba(255, 59, 48, 0.08);

  --warn: #b25000;
  --warn-dot: #ff9500;
  --warn-soft: rgba(255, 149, 0, 0.1);

  --success: #1b7f37;
  --success-dot: #34c759;
  --success-soft: rgba(52, 199, 89, 0.1);

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-pill: 980px;

  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", sans-serif;
  --font-text: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-text);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--ink-secondary);
}

.small {
  font-size: 13px;
}

.mt-10 {
  margin-top: 10px;
}

.mt-16 {
  margin-top: 16px;
}

.icon-svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* Status Dots */
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-danger {
  background: var(--danger-dot);
}

.dot-warn {
  background: var(--warn-dot);
}

.dot-success {
  background: var(--success-dot);
}

.dot-neutral {
  background: var(--ink-tertiary);
}

/* Auth Screen */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 340px;
  text-align: center;
}

.auth-brand {
  margin-bottom: 28px;
}

.auth-icon {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  margin-bottom: 16px;
}

.auth-card h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.auth-card p {
  margin: 6px 0 0;
  font-size: 14px;
}

.auth-card input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--hairline-strong);
  border-radius: 12px;
  font-size: 16px;
  text-align: center;
  background: var(--bg);
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.auth-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px rgba(0, 113, 227, 0.16);
}

.error-text {
  color: var(--danger);
  font-size: 13px;
  margin: 12px 0 0;
}

/* Global Apple-Style Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
  padding-top: env(safe-area-inset-top);
}

.topbar-inner {
  max-width: 980px;
  margin: 0 auto;
  height: 56px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  flex-shrink: 0;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 13px;
  font-weight: 400;
  color: var(--ink-tertiary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-link {
  background: transparent;
  border: none;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 400;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.04);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease, transform 0.12s ease;
}

.btn:hover {
  text-decoration: none;
}

.btn:active:not(:disabled) {
  transform: scale(0.985);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-pill {
  border-radius: var(--radius-pill);
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-soft {
  background: var(--surface);
  color: var(--ink);
}

.btn-soft:hover {
  background: var(--surface-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
}

.btn-ghost:hover {
  background: var(--accent-soft);
}

.btn-sm {
  height: 30px;
  padding: 0 12px;
  font-size: 12.5px;
}

.btn-xs {
  height: 26px;
  padding: 0 10px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
  height: 42px;
  font-size: 14.5px;
}

.text-link {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.text-link:hover {
  text-decoration: underline;
}

.text-link.muted-link {
  color: var(--ink-secondary);
}

.text-link.muted-link:hover {
  color: var(--ink);
  text-decoration: none;
}

.text-link.danger-link {
  color: var(--ink-tertiary);
}

.text-link.danger-link:hover {
  color: var(--danger);
  text-decoration: none;
}

.text-link.success-link {
  color: var(--success);
}

/* Main Container */
.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 44px 22px 104px;
}

/* Page Hero */
.page-hero {
  margin-bottom: 32px;
}

.hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.12;
  color: var(--ink);
}

.hero-subtitle {
  margin: 8px 0 0;
  font-size: 15px;
  color: var(--ink-secondary);
  font-weight: 400;
}

/* High-Risk Auto-Renew Notice */
.danger-banner {
  background: #fbfbfd;
  border: 1px solid rgba(255, 59, 48, 0.22);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 24px;
}

.danger-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.danger-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14px;
}

.danger-title-wrap strong {
  font-weight: 600;
  color: var(--ink);
}

.danger-sub {
  font-size: 13px;
  color: var(--ink-secondary);
}

.danger-list {
  display: flex;
  flex-direction: column;
}

.danger-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 11px 0;
  border-top: 1px solid var(--hairline);
}

.danger-item-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 14px;
}

.danger-item-info strong {
  font-weight: 600;
}

.danger-item-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* KPI Overview Strip — Unified Apple Bento Surface */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface);
  border-radius: var(--radius-lg);
  margin-bottom: 40px;
  overflow: hidden;
}

.kpi-card {
  padding: 24px 24px 22px;
  position: relative;
}

.kpi-card:not(:first-child)::before {
  content: "";
  position: absolute;
  left: 0;
  top: 22px;
  bottom: 22px;
  width: 1px;
  background: var(--hairline);
}

.kpi-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-secondary);
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  margin: 10px 0 6px;
}

.kpi-foot {
  font-size: 12px;
  color: var(--ink-tertiary);
  font-variant-numeric: tabular-nums;
}

/* Toolbar & Apple Segmented Control */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.segmented {
  display: inline-flex;
  align-items: center;
  background: var(--surface);
  padding: 3px;
  border-radius: var(--radius-pill);
  gap: 2px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.segmented::-webkit-scrollbar {
  display: none;
}

.tab,
.voice-mode-btn {
  background: transparent;
  border: none;
  color: var(--ink-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.tab:hover,
.voice-mode-btn:hover {
  color: var(--ink);
}

.tab.active,
.voice-mode-btn.active {
  background: var(--surface-elevated);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 0.5px 1px rgba(0, 0, 0, 0.04);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.select-input {
  height: 36px;
  line-height: 20px;
  padding: 8px 14px;
  border: none;
  border-radius: var(--radius-pill);
  background-color: var(--surface);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  outline: none;
  transition: background-color 0.15s ease;
}

.select-input:hover {
  background-color: var(--surface-hover);
}

.select-input:focus {
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.16);
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 14px;
  height: 14px;
  color: var(--ink-tertiary);
  pointer-events: none;
}

.search-input {
  width: 210px;
  height: 36px;
  padding: 0 12px 0 34px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: background-color 0.15s ease, width 0.2s ease, box-shadow 0.15s ease;
}

.search-input::placeholder {
  color: var(--ink-tertiary);
}

.search-input:focus {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px rgba(0, 113, 227, 0.14);
}

/* Subscription List — Crisp Hairline-Divided Rows */
.sub-list {
  border-top: 1px solid var(--hairline);
}

.sub-card {
  padding: 22px 8px;
  border-bottom: 1px solid var(--hairline);
  transition: background 0.15s ease;
}

.sub-card:hover {
  background: rgba(245, 245, 247, 0.55);
}

.sub-card.status-expired {
  opacity: 0.56;
}

.sub-row-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.sub-left {
  min-width: 0;
  flex: 1;
}

.sub-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sub-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.018em;
  color: var(--ink);
}

.sub-category {
  font-size: 12.5px;
  color: var(--ink-tertiary);
}

.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
}

.status-tag-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

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

.status-tag-neutral {
  background: var(--surface);
  color: var(--ink-secondary);
}

.sub-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
}

.meta-sep {
  color: var(--ink-tertiary);
  user-select: none;
}

.sub-notes {
  margin-top: 8px;
  padding-left: 10px;
  border-left: 2px solid var(--hairline-strong);
  font-size: 13px;
  color: var(--ink-secondary);
  line-height: 1.5;
}

.sub-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0;
  text-align: right;
}

.sub-price-line {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}

.sub-cycle-unit {
  font-size: 13px;
  font-weight: 400;
  color: var(--ink-secondary);
}

.sub-cny-sub {
  font-size: 12px;
  color: var(--ink-tertiary);
  font-variant-numeric: tabular-nums;
}

.countdown-badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.countdown-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.countdown-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.countdown-normal {
  background: var(--surface);
  color: var(--ink-secondary);
}

.countdown-muted {
  background: var(--surface);
  color: var(--ink-tertiary);
}

.sub-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.sub-actions-left,
.sub-actions-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 72px 24px;
  border-top: 1px solid var(--hairline);
}

.empty-mark {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  color: var(--ink-tertiary);
}

.empty-state h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.empty-state p {
  max-width: 400px;
  margin: 0 auto 24px;
  font-size: 14.5px;
}

.empty-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Mobile Floating Action Bar */
.fab-group {
  display: none;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 30;
  gap: 8px;
  align-items: center;
  padding: 5px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.1);
}

.fab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  border: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.fab-primary {
  background: var(--accent);
  color: #ffffff;
}

.fab-soft {
  background: var(--surface);
  color: var(--ink);
}

/* Modals / Apple Sheets */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.modal {
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  background: var(--bg);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--surface);
  color: var(--ink-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn svg {
  width: 14px;
  height: 14px;
}

.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.modal-body {
  padding: 20px 24px 24px;
  overflow-y: auto;
}

.sheet-intro {
  margin: 0 0 18px;
  font-size: 13.5px;
  color: var(--ink-secondary);
  line-height: 1.6;
}

.inline-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--ink-secondary);
  margin-bottom: 18px;
}

/* Presets / Chips */
.preset-section {
  margin-bottom: 18px;
}

.preset-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-tertiary);
  margin-bottom: 8px;
}

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

.chip {
  background: var(--surface);
  border: none;
  color: var(--ink);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.15s ease;
}

.chip:hover {
  background: var(--surface-hover);
}

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

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

.field.span-2 {
  grid-column: span 2;
}

.field label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-secondary);
}

.field input[type="text"],
.field input[type="number"],
.field input[type="date"],
.field input[type="url"],
.field input[type="password"],
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--hairline-strong);
  border-radius: 11px;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.field input:disabled {
  background: var(--surface);
  color: var(--ink-tertiary);
}

.field textarea {
  resize: vertical;
  line-height: 1.5;
}

.input-with-btn {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input-with-btn input {
  flex: 1;
}

/* iOS-Style Switch Row */
.switch-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
}

.switch-copy strong {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.switch-copy p {
  margin: 2px 0 0;
  line-height: 1.45;
}

.ios-switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: rgba(120, 120, 128, 0.24);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease;
  outline: none;
  border: none;
}

.ios-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.ios-switch:checked {
  background: var(--accent);
}

.ios-switch.ios-switch-danger:checked {
  background: var(--danger-dot);
}

.ios-switch:checked::after {
  transform: translateX(18px);
}

.ios-switch:focus-visible {
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.22);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
}

/* Import & Sync Blocks */
.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.import-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.divider {
  border: none;
  border-top: 1px solid var(--hairline);
  margin: 22px 0;
}

.export-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.export-row strong {
  font-size: 14.5px;
  font-weight: 600;
}

.export-row p {
  margin: 2px 0 0;
}

.export-btns {
  display: flex;
  gap: 8px;
}

.modal-segmented {
  margin-bottom: 18px;
}

.sync-pane {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.surface-block {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}

.surface-block strong {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}

.surface-block p {
  margin: 4px 0 0;
  line-height: 1.55;
}

.sync-btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.sync-status {
  margin-top: 12px !important;
  font-size: 12.5px;
  color: var(--ink-tertiary);
}

.copy-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.copy-row input {
  flex: 1;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--hairline-strong);
  border-radius: 9px;
  font-size: 12.5px;
  background: var(--bg);
  color: var(--ink);
  outline: none;
}

.lan-url-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.code-block {
  background: var(--ink);
  color: #f5f5f7;
  padding: 12px 14px;
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12.5px;
  overflow-x: auto;
  margin: 12px 0 0;
}

/* Voice Modal */
.voice-modal-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.engine-badge {
  background: var(--surface);
  border: none;
  color: var(--ink-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.engine-badge:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.engine-badge.ai-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.voice-hero {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.voice-segmented {
  background: rgba(0, 0, 0, 0.05);
}

.mic-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  padding: 8px 16px;
  cursor: pointer;
  color: var(--ink);
}

.mic-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--ink);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.mic-circle svg {
  width: 24px;
  height: 24px;
}

.mic-btn:hover .mic-circle {
  transform: scale(1.04);
  background: #000000;
}

.mic-btn.recording .mic-circle {
  background: var(--danger-dot);
  animation: micPulse 1.5s infinite;
}

@keyframes micPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.38);
  }
  70% {
    box-shadow: 0 0 0 16px rgba(255, 59, 48, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0);
  }
}

.mic-label {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 2px;
}

.mic-sub {
  font-size: 12.5px;
  color: var(--ink-secondary);
}

.voice-env-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--warn);
  background: var(--warn-soft);
  border-radius: 10px;
  padding: 9px 13px;
  max-width: 500px;
  line-height: 1.5;
}

.voice-examples {
  margin-top: 12px;
}

.voice-parse-bar {
  margin-top: 16px;
}

.voice-result-section {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
}

.voice-result-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.voice-result-header strong {
  font-size: 15px;
  font-weight: 600;
}

.warn-box {
  background: var(--warn-soft);
  color: var(--warn);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 12.5px;
  margin-bottom: 12px;
}

.voice-parsed-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.voice-item-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px;
}

.voice-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.voice-item-head strong {
  font-size: 14.5px;
  font-weight: 600;
}

.voice-item-reason {
  font-size: 12.5px;
  color: var(--ink-secondary);
  background: var(--bg);
  border-radius: 9px;
  padding: 8px 11px;
  margin-bottom: 12px;
  line-height: 1.45;
}

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

.voice-item-grid .vf-span-2 {
  grid-column: span 2;
}

.voice-item-grid .vf-span-3 {
  grid-column: span 3;
}

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

.voice-field label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-secondary);
}

.voice-field input:not([type="checkbox"]),
.voice-field select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--hairline-strong);
  border-radius: 9px;
  font-size: 13px;
  background: var(--bg);
  color: var(--ink);
  outline: none;
}

.voice-field input:not([type="checkbox"]):focus,
.voice-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2.5px rgba(0, 113, 227, 0.14);
}

.voice-check-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 11px;
  border-radius: 9px;
  background: var(--bg);
  border: 1px solid var(--hairline);
  font-size: 12.5px;
  color: var(--ink);
  cursor: pointer;
  min-height: 36px;
}

.voice-save-footer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.voice-sync-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-secondary);
  cursor: pointer;
}

.voice-sync-check input {
  accent-color: var(--accent);
}

.voice-footer-btns {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 80;
  background: rgba(29, 29, 31, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 400;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  max-width: 90vw;
  text-align: center;
}

/* Responsive */
@media (max-width: 820px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kpi-card:nth-child(3)::before {
    display: none;
  }
  .kpi-card:nth-child(3),
  .kpi-card:nth-child(4) {
    border-top: 1px solid var(--hairline);
  }
}

@media (max-width: 640px) {
  .topbar-inner {
    padding: 0 16px;
  }
  .brand-sub {
    display: none;
  }
  #btnOpenAdd,
  #btnOpenVoice {
    display: none;
  }
  .fab-group {
    display: flex;
  }
  .container {
    padding: 28px 16px 96px;
  }
  .hero-title {
    font-size: 30px;
  }
  .kpi-card {
    padding: 18px 16px;
  }
  .kpi-value {
    font-size: 26px;
  }
  .toolbar-right {
    width: 100%;
  }
  .search-wrap {
    flex: 1;
  }
  .search-input {
    width: 100%;
  }
  .sub-row-main {
    flex-direction: column;
    gap: 10px;
  }
  .sub-right {
    align-items: flex-start;
    text-align: left;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .field.span-2 {
    grid-column: span 1;
  }
  .copy-row {
    flex-wrap: wrap;
  }
  .voice-item-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .voice-item-grid .vf-span-3 {
    grid-column: span 2;
  }
  .voice-save-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .voice-footer-btns {
    margin-left: 0;
    justify-content: flex-end;
  }
}
