/* ==========================================================================
   XUNCHAO · Google & Android Settings Design System (Material Design 3)
   Canonical layer loaded after workflow.css, dashboard.css, and feature CSS.
   Tonal surface layering (#F0F4F9 canvas + #FFFFFF 24px grouped cards),
   Google Blue (#0B57D0 / #D3E3FD tonal pills), full-pill M3 navigation &
   search, segmented preference groups, and expressive Material 3 switches.
   ========================================================================== */

:root {
  /* M3 Tonal Surface Roles */
  --bg: #f0f4f9;
  --surface-canvas: #f0f4f9;
  --neutral-50: #f0f4f9;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-overlay: #ffffff;
  --neutral-0: #ffffff;
  --surface-tint: #f7f9fc;
  --surface-alt: #e9eef6;
  --sunken: #e9eef6;
  --neutral-100: #e9eef6;
  --sunken-hover: #dfe6f2;
  --nav-hover: #e3e9f3;
  --track: #e1e7f1;

  /* M3 On-Surface Ink & Outline Roles */
  --ink: #1f1f1f;
  --text: #1f1f1f;
  --text-primary: #1f1f1f;
  --neutral-900: #1f1f1f;
  --ink-2: #444746;
  --muted: #444746;
  --text-secondary: #444746;
  --neutral-600: #444746;
  --ink-3: #5f6368;
  --faint: #5f6368;
  --neutral-500: #5f6368;

  --line: #e1e5ec;
  --border-default: #e1e5ec;
  --neutral-200: #e1e5ec;
  --line-strong: #c4c7c5;
  --neutral-300: #c4c7c5;
  --line-subtle: #edf1f7;

  /* Google M3 Primary & Tonal Container */
  --blue: #0b57d0;
  --indigo-600: #0b57d0;
  --blue-hover: #0842a0;
  --blue-strong: #0842a0;
  --indigo-700: #0842a0;
  --blue-soft: #d3e3fd;
  --indigo-50: #d3e3fd;
  --blue-ink: #041e49;
  --blue-tint: #e8f0fe;
  --indigo-100: #c2d7fa;
  --blue-ring: rgba(11, 87, 208, 0.22);
  --focus-ring: rgba(11, 87, 208, 0.22);

  /* M3 Extended FAB Secondary Container */
  --fab-bg: #c2e7ff;
  --fab-bg-hover: #b2dffd;
  --fab-ink: #001d35;

  /* Functional Semantic Status Colors (M3 Tonal) */
  --green: #146c2e;
  --green-soft: #e6f4ea;
  --amber: #9a5b00;
  --amber-soft: #fef7e0;
  --red: #b3261e;
  --red-soft: #fce8e6;

  /* Google Clean Sans + CJK Readability */
  --font-sans: "Google Sans Text", "Roboto", "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Google Sans", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Roboto Mono", Menlo, Monaco, Consolas, monospace;

  /* M3 Layout & Shape Scale */
  --sidebar: 264px;
  --topbar-h: 64px;
  --content-max: 1120px;
  --settings-max: 1020px;
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius: 24px;
  --radius-xl: 28px;
  --radius-pill: 9999px;

  /* M3 Subtle Elevation (Tonal First) */
  --card-border: 1px solid rgba(11, 87, 208, 0.06);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.07), 0 6px 20px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.08), 0 16px 40px rgba(15, 23, 42, 0.14);
  --shadow-overlay: 0 4px 12px rgba(0, 0, 0, 0.08), 0 16px 40px rgba(15, 23, 42, 0.14);

  --motion-fast: 140ms;
  --motion-panel: 220ms;
  --ease-out: cubic-bezier(0.2, 0, 0, 1);

  font-family: var(--font-sans);
  color-scheme: light;
}

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

/* The viewport keeps its native scrollbar. Inner panels scroll without one. */
:where(body, body *) {
  scrollbar-width: none;
}

:where(body, body *)::-webkit-scrollbar:vertical {
  width: 0;
}

html {
  scrollbar-gutter: stable;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--blue-soft);
  color: var(--blue-ink);
}

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

:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* Uniform Material 3 dropdown chevron for native <select> controls */
select:not(.console-select-native) {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235f6368' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
  padding-right: 36px;
}

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

/* ==========================================================================
   1. Seamless Two-Pane Google / Android Settings Navigation Shell
   ========================================================================== */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100dvh;
  background: var(--bg);
}

aside.sidebar {
  position: sticky;
  top: 0;
  width: var(--sidebar);
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-right: 0;
  z-index: 30;
  overflow: visible;
  padding: 0;
  color: var(--ink-2);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  padding: 0 20px;
  margin: 0;
  border-bottom: 0;
  background: transparent;
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  background: transparent;
  overflow: hidden;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(11, 87, 208, 0.16);
}

.brand-mark img,
.brand-icon img,
.minxun-brand-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.brand-name {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ink);
  line-height: 1.2;
}

.brand-name strong {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
  line-height: 1.2;
}

.brand-name small {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 400;
  color: var(--ink-3);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  margin: 0;
  padding: 6px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.navigation-heading,
.nav-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0 4px;
  padding: 0 4px 0 14px;
}

.sidebar-label,
.nav-section-title {
  margin: 16px 0 6px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: 0.01em;
  line-height: 1.35;
}

.navigation-heading .sidebar-label,
.nav-section-head .nav-section-title {
  margin: 0;
  padding: 0;
}

.navigation-customize {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color var(--motion-fast), color var(--motion-fast);
}

.navigation-customize svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.navigation-customize:hover {
  background: var(--nav-hover);
  color: var(--ink);
}

.navigation-customize[data-pointer-return]:focus-visible { outline: none; }

.sidebar nav,
.navigation-group,
.sidebar-nav,
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
}

/* Material 3 Full-Pill Navigation Drawer Items */
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--motion-fast), color var(--motion-fast);
}

/* Remove legacy 3px left bar from workflow.css */
.nav-item.active::before,
.nav-item.is-active::before {
  content: none !important;
  display: none !important;
}

.nav-item:hover {
  background: var(--nav-hover);
  color: var(--ink);
}

.nav-item.active,
.nav-item.is-active {
  background: var(--blue-soft);
  color: var(--blue-ink);
  font-weight: 600;
}

.nav-item.active:hover,
.nav-item.is-active:hover {
  background: #c7dbfc;
  color: var(--blue-ink);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--ink-2);
  stroke-width: 1.85;
}

.nav-item.active svg,
.nav-item.is-active svg {
  color: var(--blue-ink);
  stroke-width: 2.1;
}

.nav-item > span:not(.nav-count):not(.nav-number) {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-count,
.nav-number {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  flex-shrink: 0;
}

.nav-item.active .nav-count,
.nav-item.active .nav-number,
.nav-item.is-active .nav-count,
.nav-item.is-active .nav-number {
  color: var(--blue-ink);
  font-weight: 600;
}

.nav-item.operations-nav-link {
  margin-top: 10px;
}

/* Bottom-Left Account Anchor & Google Material 3 Floating Account Popover */
@keyframes sidebarAccountPop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.sidebar-account {
  position: relative;
  display: block;
  flex: none;
  margin: 6px 12px 12px;
  padding: 0;
  border: var(--card-border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: background-color var(--motion-fast), border-color var(--motion-fast), box-shadow var(--motion-fast);
}

.sidebar-account:has(.sidebar-account-profile:focus-visible) {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.sidebar-account:has(.sidebar-profile[open]) {
  background: var(--blue-soft);
  border-color: transparent;
  box-shadow: none;
}

.sidebar-profile {
  min-width: 0;
}

.sidebar-account-profile,
.sidebar-account-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 54px;
  padding: 8px 8px 8px 10px;
  border-radius: 18px;
  color: var(--ink);
}

.sidebar-account-profile {
  width: calc(100% - 46px);
  list-style: none;
  cursor: pointer;
}

.sidebar-account-profile::-webkit-details-marker {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .sidebar-account:has(.sidebar-profile:not([open]) > summary:hover) {
    border-color: rgba(11, 87, 208, 0.14);
    box-shadow: var(--shadow-sm);
  }

  .sidebar-account-quick:hover {
    color: var(--blue);
    background: var(--blue-tint);
  }

  .sidebar-account:has(.sidebar-profile[open]) .sidebar-account-quick:hover {
    color: var(--blue-ink);
    background: rgba(11, 87, 208, 0.12);
  }
}

.sidebar-account-profile:focus-visible {
  outline: none;
}

.sidebar-profile[open] > summary {
  width: calc(100% - 46px);
  background: transparent;
  border-radius: 18px;
}

.sidebar-account-avatar {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue-ink);
  font: 600 13.5px/1 var(--font-display);
  letter-spacing: 0.02em;
  transition: background-color var(--motion-fast), color var(--motion-fast);
}

.sidebar-profile[open] .sidebar-account-avatar {
  background: var(--blue);
  color: #ffffff;
}

.sidebar-account-info {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.sidebar-account-info > strong,
.sidebar-account-info > span {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-account-info > strong {
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
}

.sidebar-account-info > span {
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.35;
}

.sidebar-profile[open] .sidebar-account-info > strong {
  color: var(--blue-ink);
}

.sidebar-profile[open] .sidebar-account-info > span {
  color: rgba(4, 30, 73, 0.72);
}

.sidebar-account .sidebar-profile-chevron {
  flex: none;
  width: 15px;
  height: 15px;
  color: var(--ink-3);
  transition: transform 180ms var(--ease-out), color var(--motion-fast);
}

.sidebar-profile[open] .sidebar-profile-chevron {
  transform: rotate(180deg);
  color: var(--blue-ink);
}

.sidebar-account-quick {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: 0;
  border: 0;
  border-radius: 50%;
  color: var(--ink-3);
  background: transparent;
  transition: background-color var(--motion-fast), color var(--motion-fast);
}

.sidebar-account-quick:focus-visible {
  color: var(--blue);
  background: var(--blue-tint);
}

.sidebar-account:has(.sidebar-profile[open]) .sidebar-account-quick {
  color: var(--blue-ink);
}

.sidebar-account svg {
  color: inherit;
}

/* Floating Material 3 Account Card Popover */
.sidebar-profile-content {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 10px);
  z-index: 60;
  width: auto;
  max-height: min(60dvh, 360px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
  border: 1px solid rgba(11, 87, 208, 0.08);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08), 0 16px 36px rgba(15, 23, 42, 0.14);
  animation: sidebarAccountPop 160ms var(--ease-out);
}

/* Unified Inset Identity + Validity Card */
.sidebar-profile-rail-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 11px 12px 9px;
  border-radius: 14px 14px 0 0;
  background: var(--bg);
}

.sidebar-profile-rail-name strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.sidebar-profile-rail-name span {
  flex: none;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--blue-soft);
  color: var(--blue-ink);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}

.sidebar-profile-term {
  margin: 0 0 6px;
  padding: 8px 12px 10px;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 0 0 14px 14px;
  background: var(--bg);
}

.sidebar-profile-term dt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.4;
}

.sidebar-profile-term dt span {
  margin-inline-start: auto;
  font-size: 11px;
  font-weight: 400;
  opacity: 0.85;
}

.sidebar-profile-term dd {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.sidebar-profile-term time {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.sidebar-profile-term time span {
  white-space: nowrap;
}

.sidebar-profile-term time span + span {
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
}

.sidebar-profile-term.unlimited {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-profile-term.unlimited dd {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--green);
}

/* Uniform Left-Aligned Android Settings Action List */
.sidebar-profile-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-profile-actions a {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  height: 40px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--ink);
  background: transparent;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color var(--motion-fast), color var(--motion-fast);
}

.sidebar-profile-actions a svg {
  width: 17px;
  height: 17px;
  color: var(--ink-3);
  transition: color var(--motion-fast);
}

.sidebar-profile-actions a:is(:hover, :focus-visible) {
  background: var(--bg);
  color: var(--blue);
}

.sidebar-profile-actions a:is(:hover, :focus-visible) svg {
  color: var(--blue);
}

.sidebar-profile-content form {
  display: block;
  margin: 6px 0 0;
  padding: 6px 0 0;
  border-top: 1px solid var(--line-subtle);
}

.sidebar-profile-content form button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  height: 40px;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  color: var(--ink-2);
  background: transparent;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--motion-fast), color var(--motion-fast);
}

.sidebar-profile-content form button svg {
  width: 17px;
  height: 17px;
  color: var(--ink-3);
  transition: color var(--motion-fast);
}

.sidebar-profile-content form button:is(:hover, :focus-visible) {
  color: var(--red);
  background: var(--red-soft);
}

.sidebar-profile-content form button:is(:hover, :focus-visible) svg {
  color: var(--red);
}

.mobile-nav-backdrop {
  display: none;
}

/* ==========================================================================
   2. Main Surface & Seamless Material 3 Topbar
   ========================================================================== */

#main,
main,
main.main,
.main {
  margin: 0 !important;
  margin-left: 0 !important;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--bg);
  overflow-x: clip;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  height: auto;
  min-height: var(--topbar-h);
  padding: 10px 36px;
  background: rgba(240, 244, 249, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(31, 31, 31, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: nowrap;
}

.topbar-left {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-button,
#menu-toggle,
#navigation-toggle,
.navigation-toggle,
#navigation-close,
.navigation-close {
  display: none;
}

.topbar:has(#workflow-rail:not([hidden])) .breadcrumb,
.topbar-left:has(#workflow-rail:not([hidden])) .breadcrumb {
  display: none;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.breadcrumb strong {
  color: var(--ink);
  font-weight: 500;
}

/* 3-Step Workflow Rail — Material 3 Segmented Pill Track */
.workflow-rail {
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  align-self: center;
  gap: 4px;
  padding: 4px;
  background: var(--track);
  border: 0;
  border-radius: var(--radius-pill);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.workflow-rail::-webkit-scrollbar {
  display: none;
}

.workflow-step {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  height: 34px;
  min-height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--motion-fast), color var(--motion-fast), box-shadow var(--motion-fast);
}

.workflow-step::after,
.workflow-step.active::after,
.workflow-step.is-active::after {
  content: none !important;
  display: none !important;
}

.workflow-step:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.58);
}

.workflow-step.active,
.workflow-step.is-active {
  background: var(--surface);
  color: var(--blue);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.workflow-step-index,
.workflow-step-number {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
}

.workflow-step.active .workflow-step-index,
.workflow-step.active .workflow-step-number,
.workflow-step.is-active .workflow-step-index,
.workflow-step.is-active .workflow-step-number {
  color: var(--blue);
}

.workflow-step-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.workflow-step-copy strong {
  font-size: 13px;
  font-weight: inherit;
  color: inherit;
}

.workflow-step-copy small {
  display: none !important;
}

.workflow-step-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  min-width: 22px;
  padding: 0 7px;
  margin-left: 2px;
  border-radius: var(--radius-pill);
  background: rgba(31, 31, 31, 0.07);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
}

.workflow-step.active .workflow-step-count,
.workflow-step.is-active .workflow-step-count {
  background: var(--blue-soft);
  color: var(--blue-ink);
}

/* Segmented Scope Toggle (广泛 / 聚焦) */
.filter-level-pill,
.filter-level-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-3);
  white-space: nowrap;
  margin-left: auto;
}

.filter-level-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
}

.filter-level-options {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  background: var(--track);
  border: 0;
  border-radius: var(--radius-pill);
  gap: 2px;
}

.filter-level-option,
.filter-level-options > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  min-height: 28px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 0 !important;
  box-shadow: none;
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--motion-fast), color var(--motion-fast), box-shadow var(--motion-fast);
}

.filter-level-option:hover,
.filter-level-options > button:hover {
  color: var(--ink);
}

.filter-level-option.is-active,
.filter-level-options > button[aria-pressed="true"],
.filter-level-options > button.is-active {
  background: var(--surface) !important;
  color: var(--blue-ink) !important;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08) !important;
}

.topbar-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.topbar-action,
.notify-toggle,
.refresh-button,
.push-trigger,
#reload.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color var(--motion-fast), color var(--motion-fast);
}

.refresh-button,
#reload.icon-button {
  width: 38px;
  padding: 0;
  border-radius: 50%;
}

.topbar-action:hover,
.notify-toggle:hover,
.refresh-button:hover,
.push-trigger:hover,
#reload.icon-button:hover {
  background: var(--nav-hover);
  color: var(--ink);
}

.topbar-action svg,
.notify-toggle svg,
.refresh-button svg,
.push-trigger svg,
#reload.icon-button svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.push-control {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.push-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 65;
  width: min(344px, calc(100vw - 28px));
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
}

.topbar-date {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-3);
  padding: 0 6px;
  white-space: nowrap;
}

.logout-form {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  display: inline-flex;
}

.logout-button,
.user-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast);
}

.logout-button:hover,
.user-chip:hover {
  background: var(--sunken);
  border-color: var(--line-strong);
  color: var(--ink);
}

.account-menu {
  position: relative;
}

.account-menu > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.account-menu > summary::-webkit-details-marker {
  display: none;
}

.account-menu-content {
  border-radius: 20px;
  padding: 8px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}

.account-menu-content > a,
.account-menu-content .logout-button {
  border-radius: var(--radius-pill);
}

/* ==========================================================================
   3. Google / Android Settings Content Column, Canvas Header & Metric Strip
   ========================================================================== */

.page-content {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  max-width: calc(var(--content-max) + 72px);
  margin: 0 auto;
  padding: 16px 36px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Google Settings Canvas-Level Page Header (No Heavy Box) */
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  min-height: 0;
  margin: 0 0 2px;
  padding: 8px 4px 10px;
  background: transparent;
  border-bottom: 0;
}

.page-heading-copy,
.page-heading > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.page-heading h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.25;
}

.page-heading p {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.5;
}

.page-heading-tools {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 16px;
}

.runtime-line {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-size: 12px;
  color: var(--ink-3);
}

.collection-state { color: var(--ink-2); font-size: 13px; font-weight: 500; line-height: 1.5; }
#last-seen { font-variant-numeric: tabular-nums; }
#last-seen:empty { display: none; }

.heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.heading-actions #monitor {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

.heading-actions #monitor:disabled {
  background: var(--sunken);
  border-color: transparent;
  color: var(--ink-3);
  opacity: 0.72;
}

/* Workspace Summary Container */
.workspace-summary {
  position: static !important;
  margin: 0 0 18px !important;
  padding: 0 !important;
  width: 100%;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* Notice Banners — M3 Tonal Cards */
.notice,
.notice-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 14px 18px;
  border-radius: 20px;
  border: var(--card-border);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.5;
  box-shadow: var(--shadow-xs);
}

.notice svg,
.notice-banner svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.notice-muted,
.notice-banner--warm {
  background: var(--amber-soft);
  border-color: transparent;
  color: var(--amber);
}

.notice-error,
.notice-banner--danger {
  background: var(--red-soft);
  border-color: transparent;
  color: var(--red);
}

.topic-arrival-notice {
  border-radius: 20px;
  border: 0;
  background: var(--blue-tint);
  padding: 14px 20px;
  margin: 0;
}

.topic-arrival-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
}

/* Unified M3 24px Grouped Stats Strip */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  background: var(--surface);
  border: var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.metrics > .metric,
.metrics > .metric:first-child,
.metrics > .metric:last-child,
.metrics > .metric:nth-child(n) {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  gap: 4px;
  padding: 20px 24px;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  min-width: 0;
  transition: background-color var(--motion-fast);
}

.metrics > .metric + .metric {
  border-left: 1px solid var(--line-subtle);
}

.metrics > .metric:hover {
  background: var(--surface-tint);
}

.metrics > .metric--primary,
.metrics > .metric:last-child {
  background: #f5f8fe;
}

.metrics > .metric--primary:hover,
.metrics > .metric:last-child:hover {
  background: #edf3fe;
}

.metric-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  line-height: 1.35;
}

.metric-index {
  display: none;
}

.metric strong,
.metric-value {
  display: block;
  align-self: flex-start;
  grid-row: auto;
  grid-column: auto;
  width: 100%;
  text-align: left;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.18;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin: 4px 0 2px;
}

.metric--warn strong,
#metric-relevant.metric-value {
  color: var(--amber);
}

.metric--primary strong,
#metric-reviewed.metric-value {
  color: var(--green);
}

.metric-hint,
.metric-foot,
.metric small {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.4;
}

.dot,
.tiny-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  flex-shrink: 0;
  display: inline-block;
  background: var(--green);
}

.dot--amber,
.tiny-dot.amber {
  background: var(--amber);
}

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

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

/* ==========================================================================
   4. Material Design 3 Pill Buttons & Controls
   ========================================================================== */

.button,
.btn,
.ghost-button,
.primary-button,
.secondary-button,
.danger-button,
.rule-rescreen,
.page-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  min-height: 38px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: none;
  transition: background-color var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast), box-shadow var(--motion-fast);
}

.button svg,
.btn svg,
.rule-rescreen svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.button:hover:not(:disabled),
.button-outline:hover:not(:disabled),
.btn:hover:not(:disabled),
.rule-rescreen:hover:not(:disabled),
.page-button:hover:not(:disabled) {
  background: var(--sunken);
  border-color: var(--line-strong);
  color: var(--ink);
}

.button-dark,
.btn-primary,
.primary-button {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
  font-weight: 500;
}

.button-dark:hover:not(:disabled),
.btn-primary:hover:not(:disabled),
.primary-button:hover:not(:disabled) {
  background: var(--blue-hover);
  border-color: var(--blue-hover);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(11, 87, 208, 0.28);
}

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

.btn-danger,
.danger-button {
  border-color: rgba(179, 38, 30, 0.35);
  background: var(--surface);
  color: var(--red);
}

.btn-danger:hover:not(:disabled),
.danger-button:hover:not(:disabled) {
  background: var(--red-soft);
  border-color: var(--red);
  color: var(--red);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color var(--motion-fast), color var(--motion-fast);
}

.icon-button.navigation-close,
.icon-button.navigation-toggle {
  display: none;
}

.icon-button:hover:not(:disabled) {
  background: var(--nav-hover);
  color: var(--ink);
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--blue);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.text-button:hover:not(:disabled) {
  background: var(--blue-tint);
}

.btn:disabled,
button:disabled {
  opacity: 0.46;
  cursor: not-allowed;
}

/* ==========================================================================
   5. Grouped Queue Settings Card, Source Preference Header & Pill Search
   ========================================================================== */

.queue-panel,
.panel {
  width: 100%;
  background: var(--surface);
  border: var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: clip;
}

/* Android Settings Expandable Preference Header ("来源动态") */
.collection-panel {
  padding: 0;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--line-subtle);
  background: var(--surface-tint);
}

.collection-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  flex-wrap: wrap;
}

.collection-heading > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}

.collection-heading h2 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.collection-source-count {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: var(--sunken);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 500;
}

.collection-heading p {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-3);
}

.collection-toggle {
  height: 36px;
  min-height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--blue);
  font-size: 13px;
  font-weight: 500;
}

.collection-toggle:hover:not(:disabled) {
  background: var(--blue-tint);
  border-color: transparent;
  color: var(--blue);
}

.collection-toggle[aria-expanded="true"] {
  background: var(--blue-soft);
  border-color: transparent;
  color: var(--blue-ink);
}

.collection-toggle svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  transition: transform var(--motion-fast) var(--ease-out);
}

.collection-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

#collection-body {
  padding: 0 24px 20px;
}

.collection-sources {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 6px;
  align-items: stretch;
}

.collection-source {
  min-width: 0;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}

.collection-source:hover {
  border-color: var(--line-strong);
}

.collection-source[open] {
  grid-column: 1 / -1;
  border-color: var(--indigo-100);
  box-shadow: var(--shadow-xs);
}

.collection-source > summary {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 13px 16px;
  min-height: 74px;
  list-style: none;
  cursor: pointer;
}

.collection-source > summary::-webkit-details-marker {
  display: none;
}

.collection-source-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.collection-source-top strong {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-count {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.collection-source-time {
  display: block;
  margin: 0;
  padding-right: 26px;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collection-chevron {
  position: absolute;
  right: 16px;
  bottom: 15px;
  width: 14px;
  height: 14px;
  color: var(--ink-3);
  transition: transform var(--motion-fast) var(--ease-out);
}

.collection-source[open] .collection-chevron {
  transform: rotate(180deg);
}

.collection-source.has-warning > summary .collection-source-time,
.collection-source.has-error > summary .collection-source-time {
  padding-right: 68px;
  color: var(--amber);
}

.collection-source.has-error > summary .collection-source-time {
  color: var(--red);
}

.source-retry {
  position: absolute;
  right: 14px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 26px;
  min-height: 26px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  border: 0;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.collection-source-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--line-subtle);
  background: var(--surface-tint);
  font-size: 12px;
  color: var(--ink-3);
}

.collection-source-actions .button {
  height: 32px;
  min-height: 32px;
  padding: 0 14px;
  font-size: 12px;
}

.collection-items {
  margin: 0;
  padding: 0;
  list-style: none;
}

.collection-items li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--line-subtle);
  font-size: 13.5px;
  transition: background-color var(--motion-fast);
}

.collection-items li:hover {
  background: var(--surface-tint);
}

.collection-items li > span:first-child {
  min-width: 26px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.collection-items li > a,
.collection-items li > .source-link,
.collection-items li > span:nth-child(2) {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.45;
}

.collection-items li > a:hover,
.collection-items li > .source-link:hover {
  color: var(--blue);
  text-decoration: underline;
}

.collection-import {
  flex-shrink: 0;
  height: 32px;
  min-height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--blue);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.collection-import:hover:not(:disabled) {
  background: var(--blue-tint);
  border-color: transparent;
}

.collection-footer {
  margin-top: 12px;
  padding: 0 2px;
}

.collection-foot {
  font-size: 12px;
  color: var(--ink-3);
}

/* Queue Heading */
.panel-head,
.queue-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--line-subtle);
  background: var(--surface);
  flex-wrap: wrap;
}

.queue-heading > div:first-child {
  margin-right: auto;
  min-width: 0;
}

.panel-head h2,
.queue-heading h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.queue-heading h2 > #queue-title {
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
}

.queue-heading p {
  display: none;
}

.count-pill,
#result-count,
#keyword-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 24px;
  padding: 0 10px;
  margin-left: 2px;
  border-radius: var(--radius-pill);
  background: var(--sunken);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
}

.queue-next-actions,
.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.section-kicker {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  background: var(--sunken);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
}

/* Layout Mode Toggle (卡片 / 紧凑) — M3 Segmented Pill */
.view-switch,
.feed-layout-control {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  background: var(--sunken);
  border: 0;
  border-radius: var(--radius-pill);
  gap: 2px;
}

.view-switch > button,
.view-switch-btn,
.feed-layout-control > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  min-height: 30px;
  padding: 0 13px;
  border-radius: var(--radius-pill);
  border: 0 !important;
  outline: none;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--motion-fast), color var(--motion-fast), box-shadow var(--motion-fast);
}

.view-switch > button svg,
.view-switch-btn svg,
.feed-layout-control > button svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.view-switch > button.is-active,
.view-switch-btn.is-active,
.feed-layout-control > button[aria-pressed="true"],
.feed-layout-control > button.is-active {
  background: var(--surface) !important;
  color: var(--blue-ink) !important;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08) !important;
}

/* Review Stages Tabs — Material 3 Indicator Tabs */
.review-stages {
  padding: 0 24px;
  margin: 0;
  gap: 24px;
  border-bottom: 1px solid var(--line-subtle);
  background: var(--surface);
}

.review-stages > button {
  position: relative;
  min-height: 48px;
  padding: 12px 4px;
  border: 0;
  border-bottom: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
}

.review-stages > button[aria-pressed="true"] {
  color: var(--blue);
  font-weight: 600;
}

.review-stages > button[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--blue);
}

.review-stages > button > span {
  margin-left: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--sunken);
  color: var(--ink-2);
  font-size: 11.5px;
}

.review-stages > button[aria-pressed="true"] > span {
  background: var(--blue-soft);
  color: var(--blue-ink);
}

.rule-screen-bar,
.review-batch-bar {
  padding: 14px 24px;
  background: var(--surface-tint);
  border-bottom: 1px solid var(--line-subtle);
}

.verification-handoff {
  padding: 14px 24px;
  background: var(--green-soft);
  color: var(--green);
  border-bottom: 1px solid rgba(20, 108, 46, 0.12);
}

/* Google Settings Search Bar & Filter Controls */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 16px 24px 10px;
  background: var(--surface);
}

.filter-bar.discover-filters,
.filter-bar.observation-filters,
.filter-bar.review-filters,
.filter-bar.watchlist-filters,
.filter-bar.discover-filters.advanced-expanded,
.filter-bar.observation-filters.advanced-expanded {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.search-field {
  position: relative;
  flex: 1 1 280px;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  min-height: 44px;
  padding: 0 14px 0 18px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: var(--bg);
  transition: background-color var(--motion-fast), border-color var(--motion-fast), box-shadow var(--motion-fast);
}

.search-field:hover {
  background: var(--sunken);
}

.search-field:focus-within {
  background: var(--surface);
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-ring);
}

.search-field svg {
  width: 18px;
  height: 18px;
  color: var(--ink-3);
  flex-shrink: 0;
}

.search-field input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  outline: none;
}

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

.search-field kbd,
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
}

.filter-bar .select-wrap {
  flex: 0 1 154px;
  min-width: 132px;
  display: inline-flex;
}

.filter-bar select:not(.console-select-native) {
  width: 100%;
  height: 40px;
  min-height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background-color: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  padding: 0 36px 0 14px;
  min-width: 0;
}

#more-filters {
  flex: 0 0 auto;
  height: 40px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

#more-filters:hover {
  background: var(--sunken);
  color: var(--ink);
}

#more-filters[aria-expanded="true"] {
  background: var(--blue-soft);
  border-color: transparent;
  color: var(--blue-ink);
}

/* Custom Select (themed-select.js) — M3 Rounded Trigger & Menu */
.console-select,
.themed-select {
  position: relative;
  display: inline-flex;
  width: 100%;
  min-width: 0;
}

select.console-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
}

.console-select-trigger,
.themed-select-trigger {
  width: 100%;
  height: 40px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  transition: background-color var(--motion-fast), border-color var(--motion-fast), box-shadow var(--motion-fast);
}

.console-select-trigger:hover,
.themed-select-trigger:hover {
  background: var(--surface-tint);
  border-color: var(--ink-3);
}

.console-select-trigger[aria-expanded="true"],
.themed-select-trigger:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-ring);
}

.console-select-value {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.console-select-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--ink-3);
  position: relative;
}

.console-select-chevron::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 4px;
  width: 6px;
  height: 6px;
  border-right: 1.7px solid currentColor;
  border-bottom: 1.7px solid currentColor;
  transform: rotate(45deg);
  transition: transform var(--motion-fast);
}

.console-select-trigger[aria-expanded="true"] .console-select-chevron::before {
  top: 6px;
  transform: rotate(-135deg);
}

.console-select-popup,
.themed-select-menu {
  position: fixed;
  z-index: 95;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.console-select-option,
.themed-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}

.console-select-option:hover,
.console-select-option.is-active,
.themed-select-option:hover,
.themed-select-option.is-selected {
  background: var(--sunken);
  color: var(--ink);
}

.console-select-option[aria-selected="true"] {
  background: var(--blue-soft);
  color: var(--blue-ink);
  font-weight: 600;
}

.console-select-check {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.console-select-option[aria-selected="true"] .console-select-check::before {
  content: "✓";
  font-size: 13px;
  font-weight: 700;
}

.console-select-empty {
  padding: 12px;
  text-align: center;
  color: var(--ink-3);
  font-size: 12.5px;
}

/* Source Platform Filter — Material 3 Filter Chips */
#source-filter-hint,
.source-filter-hint {
  margin: 0;
  padding: 0 24px 4px;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.35;
}

.source-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 24px 14px;
  border-bottom: 1px solid var(--line-subtle);
  background: var(--surface);
  overflow-x: auto;
  scrollbar-width: none;
}

.source-tabs::-webkit-scrollbar {
  display: none;
}

.source-tab {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  height: 34px;
  min-height: 34px;
  padding: 0 14px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast);
}

.source-tab.active::after,
.source-tab.is-active::after {
  content: none !important;
  display: none !important;
}

.source-tab:hover {
  background: var(--sunken);
  border-color: var(--line-strong);
  color: var(--ink);
}

.source-tab.active,
.source-tab.is-active {
  background: var(--blue-soft);
  border-color: transparent;
  color: var(--blue-ink);
  font-weight: 600;
}

.source-tab.active:hover,
.source-tab.is-active:hover {
  background: #c7dbfc;
  color: var(--blue-ink);
}

.source-tab .source-mark {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: transparent;
}

.source-tab-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.source-tab-name {
  font-size: 13px;
  font-weight: inherit;
}

.source-tab .source-count,
.source-tab-copy > span:last-child:not(.source-tab-name) {
  font-size: 12px;
  color: var(--ink-3);
}

.source-tab.active .source-count,
.source-tab.active .source-tab-copy > span:last-child:not(.source-tab-name),
.source-tab.is-active .source-count {
  color: var(--blue-ink);
  opacity: 0.85;
}

/* Bulk Action Bar */
.basket-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 24px;
  background: var(--surface-tint);
  border-top: 0;
  border-bottom: 1px solid var(--line-subtle);
  flex-wrap: wrap;
}

.select-page,
.bulk-select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
}

.select-page input,
.bulk-select-all input,
input.topic-select {
  width: 17px;
  height: 17px;
  accent-color: var(--blue);
  cursor: pointer;
  flex-shrink: 0;
}

#selection-count,
.bulk-selection-status {
  font-size: 12.5px;
  color: var(--ink-3);
}

.basket-bulk-actions,
.bulk-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

.basket-bulk-actions .button {
  height: 34px;
  min-height: 34px;
  padding: 0 14px;
  font-size: 12.5px;
}

.basket-bulk-actions .button-dark {
  background: var(--blue-soft);
  border-color: transparent;
  color: var(--blue-ink);
}

.basket-bulk-actions .button-dark:hover:not(:disabled) {
  background: #c2d9fc;
  color: var(--blue-ink);
}

/* ==========================================================================
   6. Topic Feed — M3 Rounded Cards & Android Settings Grouped List Mode
   ========================================================================== */

.feed-columns {
  display: none !important;
}

/* Card Mode (Default) */
.topic-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 24px 22px;
  background: var(--surface-tint);
}

.topic-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  text-align: left;
  gap: 12px;
  padding: 18px 20px;
  min-width: 0;
  min-height: 0;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: none;
  position: relative;
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast), background-color var(--motion-fast);
}

body:not([data-feed-layout="list"]) .topic-list > .topic-row:last-child {
  border-bottom: 1px solid var(--line);
}

.topic-row.is-online,
.topic-row.is-unread,
.topic-row.is-new,
.topic-row.topic-row-unread,
.topic-row.topic-row-onboard,
.topic-row.new-arrival,
.topic-row.topic-row-new,
.topic-row.just-verified {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: none;
}

.topic-row.topic-row-offboard,
.topic-row.topic-row-offboard.topic-row-new,
.topic-row.topic-row-offboard.just-verified {
  background: #f8fafd;
  border-color: var(--line-subtle);
  box-shadow: none;
}

.topic-row:hover,
.topic-row.topic-row-onboard:hover,
.topic-row.new-arrival:hover,
.topic-row.topic-row-new:hover,
.topic-row.just-verified:hover,
.topic-row.topic-row-offboard:hover {
  background: var(--surface);
  border-color: #b8ccf0;
  box-shadow: 0 2px 10px rgba(11, 87, 208, 0.08);
}

.topic-row.is-selected,
.topic-row:has(.topic-select:checked) {
  border-color: var(--blue);
  background: #f6f9ff;
  box-shadow: 0 0 0 1px rgba(11, 87, 208, 0.16);
}

.topic-platform {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-subtle);
  min-width: 0;
  text-align: left;
}

.source-mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: transparent;
}

.source-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.topic-platform > div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}

.platform-name {
  display: inline-flex;
  align-items: center;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  margin: 0;
}

.topic-rank {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-3);
  line-height: 1.3;
  margin: 0;
}

.topic-rank strong {
  color: var(--blue);
  font-weight: 600;
  font-size: 13.5px;
}

.topic-row-top-ten .topic-rank strong {
  color: var(--amber);
  font-size: 14px;
  font-weight: 700;
}

.topic-row-offboard .topic-rank strong {
  color: var(--ink-3);
}

/* M3 Tonal Board Status Pills (replaces loud bright blue box) */
.board-status,
.board-status.is-offboard {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 0 auto;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--sunken);
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  letter-spacing: 0;
}

.board-status.is-onboard,
.board-status.is-online {
  margin: 0 0 0 auto;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--blue-tint);
  color: var(--blue);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0;
}

.board-status.is-onboard::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: 1px;
  border-radius: 50%;
  background: var(--blue);
}

.topic-lead {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  min-width: 0;
  text-align: left;
}

.topic-lead input.topic-select {
  margin-top: 3px;
}

.topic-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
}

.topic-title-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 8px;
  width: 100%;
}

.topic-observation-pin,
.topic-read-meta .topic-new-badge {
  flex: none;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

a.topic-title,
.topic-title {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.45;
  text-decoration: none;
  word-break: break-word;
  transition: color var(--motion-fast);
}

.topic-row-onboard .topic-title,
.topic-row-onboard.topic-row-read .topic-title {
  color: var(--ink);
  font-weight: 600;
}

.topic-row-read .topic-title {
  color: var(--ink-2);
  font-weight: 500;
}

.topic-row-offboard .topic-title {
  color: var(--ink-3);
  font-weight: 500;
}

a.topic-title[href]:hover {
  color: var(--blue);
  text-decoration: none;
}

/* FIXED Inline Provenance Row (No Broken Vertical Arrow Line!) */
.topic-provenance {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 7px;
  width: 100%;
  min-width: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.topic-provenance > svg {
  width: 12px;
  height: 12px;
  color: var(--ink-3);
  flex-shrink: 0;
}

.evidence-label {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  border: 0;
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.4;
}

.evidence-anchor {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
}

.topic-excerpt {
  flex: 1 0 100%;
  width: 100%;
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-align: left;
}

.topic-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px 12px;
  width: 100%;
  margin-top: 0;
  padding-top: 2px;
  font-size: 12px;
  color: var(--ink-3);
  text-align: left;
}

.topic-read-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  white-space: nowrap;
}

.topic-read-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 0;
  background: var(--line-strong);
  flex-shrink: 0;
}

.topic-read-status.is-unread {
  color: var(--blue);
  font-weight: 600;
}

.topic-read-status.is-unread::before {
  background: var(--blue);
}

.topic-listed-time {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
}

.topic-time {
  margin-left: auto;
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.topic-time > strong {
  display: inline;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.topic-time > small {
  margin: 0;
  font-size: 11.5px;
  color: var(--ink-3);
}

.topic-row-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line-subtle);
}

.topic-ai {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-right: auto;
}

.ai-badge,
.ai-pill,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  border: 0;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  background: var(--sunken);
  color: var(--ink-2);
}

.ai-badge.relevant,
.ai-pill.is-ok,
.tag--green {
  background: var(--green-soft);
  color: var(--green);
}

.ai-badge.pending,
.ai-badge.stale,
.ai-pill.is-pending {
  background: var(--sunken);
  color: var(--ink-2);
}

.ai-badge.uncertain,
.ai-badge.weak,
.tag--amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.ai-badge.irrelevant,
.ai-badge.filtered,
.ai-pill.is-bad,
.tag--red {
  background: var(--red-soft);
  color: var(--red);
}

.topic-meta .ai-badge,
.ai-badge.is-manual-review {
  height: auto;
  padding: 0;
  background: transparent;
  line-height: 1.45;
}

.ai-badge.is-manual-review {
  gap: 4px;
  color: var(--amber);
  font-weight: 650;
}

.ai-badge.is-manual-review::before { display: none; }
.ai-badge.is-manual-review svg { width: 15px; height: 15px; flex: none; }

.review-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 30px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}

.review-action-primary {
  background: var(--blue-soft);
  border: 0;
  color: var(--blue-ink);
  font-weight: 600;
}

.review-action-primary:hover:not(:disabled) {
  background: #c2d9fc;
  color: var(--blue-ink);
}

.topic-row-utility {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.topic-action-btn,
.row-open,
.row-basket-save,
.topic-dismiss-button,
.topic-row-utility button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast);
}

.row-basket-save:hover:not(:disabled),
.row-open:hover:not(:disabled),
.topic-action-btn:hover:not(:disabled) {
  background: var(--sunken);
  border-color: var(--line-strong);
  color: var(--ink);
}

.topic-dismiss-button {
  border-color: transparent;
  background: transparent;
  color: var(--ink-3);
}

.topic-dismiss-button:hover:not(:disabled) {
  background: var(--red-soft);
  border-color: transparent;
  color: var(--red);
}

.topic-restore-button {
  color: var(--blue);
}

.topic-restore-button:hover:not(:disabled) {
  background: var(--blue-tint);
  color: var(--blue);
}

.row-open {
  width: max-content;
  border-color: transparent;
  background: var(--bg);
  color: var(--ink);
  font-weight: 500;
}

.row-open:hover:not(:disabled) {
  background: var(--blue-soft);
  border-color: transparent;
  color: var(--blue-ink);
}

/* --- Compact List Mode (`body[data-feed-layout="list"]`) — Pure Android Settings Grouped List --- */
body[data-feed-layout="list"] .topic-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  background: var(--surface);
}

body[data-feed-layout="list"] .topic-row {
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr) 172px auto;
  align-items: center;
  gap: 0 18px;
  height: auto;
  padding: 15px 24px;
  border: 0;
  border-bottom: 1px solid var(--line-subtle);
  border-radius: 0;
  box-shadow: none;
  background: var(--surface);
}

body[data-feed-layout="list"] .topic-row.topic-row-offboard,
body[data-feed-layout="list"] .topic-row.topic-row-offboard.topic-row-new,
body[data-feed-layout="list"] .topic-row.topic-row-offboard.just-verified {
  background: #fafbfd;
}

body[data-feed-layout="list"] .topic-row:last-child {
  border-bottom: 0;
}

body[data-feed-layout="list"] .topic-row:hover,
body[data-feed-layout="list"] .topic-row.topic-row-onboard:hover,
body[data-feed-layout="list"] .topic-row.topic-row-offboard:hover {
  background: var(--surface-tint);
  box-shadow: none;
}

body[data-feed-layout="list"] .topic-row.is-selected,
body[data-feed-layout="list"] .topic-row:has(.topic-select:checked) {
  background: #f2f6ff;
  box-shadow: none;
}

body[data-feed-layout="list"] .topic-platform {
  padding-bottom: 0;
  border-bottom: 0;
  align-items: flex-start;
  gap: 10px;
}

body[data-feed-layout="list"] .topic-platform > div {
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

body[data-feed-layout="list"] .board-status,
body[data-feed-layout="list"] .board-status.is-onboard,
body[data-feed-layout="list"] .board-status.is-offboard {
  margin-left: 0;
  padding: 2px 8px;
  font-size: 11px;
}

body[data-feed-layout="list"] .topic-main {
  gap: 5px;
}

body[data-feed-layout="list"] .topic-excerpt {
  -webkit-line-clamp: 1;
  color: var(--ink-3);
  font-size: 12.5px;
}

body[data-feed-layout="list"] .topic-meta {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding-top: 0;
}

body[data-feed-layout="list"] .topic-time {
  margin-left: 0;
}

body[data-feed-layout="list"] .topic-row-actions {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
  width: auto;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 6px;
}

/* Override workflow.css @container workspace so Card & List Modes Stay Clean */
@media (min-width: 761px) {
  @container workspace (max-width: 1080px) {
    body:not([data-feed-layout="list"]) .topic-row {
      display: flex;
      flex-direction: column;
      grid-template-columns: none;
      gap: 12px;
      padding: 18px 20px;
    }

    body:not([data-feed-layout="list"]) .topic-time {
      display: inline-flex;
    }

    .topic-dismiss-button:not(.is-processing) svg,
    .row-open svg {
      display: inline-block;
    }

    .topic-dismiss-button {
      min-width: auto;
      padding: 0 11px;
    }

    .row-open {
      min-width: auto;
    }
  }

  @container workspace (max-width: 750px) {
    body:not([data-feed-layout="list"]) .topic-list {
      grid-template-columns: 1fr;
    }

    body:not([data-feed-layout="list"]) .topic-row {
      display: flex;
      flex-direction: column;
      gap: 12px;
      padding: 16px 18px;
    }

    body:not([data-feed-layout="list"]) .topic-lead,
    body:not([data-feed-layout="list"]) .topic-platform,
    body:not([data-feed-layout="list"]) .topic-meta,
    body:not([data-feed-layout="list"]) .topic-ai,
    body:not([data-feed-layout="list"]) .topic-row-actions {
      grid-row: auto;
      grid-column: auto;
    }
  }
}

/* All topic feeds use the same card and compact list geometry. */
.topic-list .topic-row > .topic-platform,
.topic-list .topic-row > .topic-row-actions {
  border: 0;
  padding-block: 0;
  background: transparent;
}

.topic-list .topic-row .board-status {
  padding: 0;
  background: transparent;
  font-weight: 500;
}

.topic-selection {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  margin: -4px -4px -4px 0;
  cursor: pointer;
}

.topic-platform .topic-selection input { margin: 0; }
.topic-list .topic-row[data-observation-pinned="true"]:not(:has(.topic-select:checked)) {
  background-color: var(--blue-tint);
}
.topic-read-meta { display: inline-flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.topic-read-meta .topic-new-badge { align-self: baseline; border: 0; padding: 0; background: transparent; }
.topic-read-meta:has(.topic-observation-pin, .topic-new-badge) .topic-read-status { color: var(--ink-3); font-weight: 400; }
.topic-read-meta:has(.topic-observation-pin, .topic-new-badge) .topic-read-status::before { display: none; }
.topic-list .topic-row > .topic-platform > div:has(> .topic-rank-note) { row-gap: 3px; }
.topic-list .topic-platform:has(.topic-rank-note) > :is(.source-mark, .topic-selection) { align-self: flex-start; }
.topic-rank-note {
  display: grid;
  grid-template-columns: 18px max-content;
  justify-content: start;
  align-items: center;
  gap: 5px;
  order: 1;
  flex: 0 0 100%;
  margin-block-start: 2px;
  color: var(--amber);
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.4;
  white-space: nowrap;
}
.topic-rank-icon {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: var(--amber-soft);
}
.topic-rank-icon svg { width: 15px; height: 15px; stroke-width: 2.1; }
.topic-rank-note.is-current .topic-rank-icon { background: var(--amber); color: var(--surface); }
.topic-rank-note.is-current .topic-rank-icon svg { transform: rotate(-45deg); }
body[data-feed-layout="cards"] .topic-list .topic-row { gap: 8px; padding: 14px 16px; }
.topic-list .topic-main { gap: 5px; }
.topic-list .topic-provenance { display: grid; gap: 4px; }
.topic-evidence-summary { color: var(--ink-2); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.topic-evidence-summary strong { color: var(--ink); font-weight: 600; margin-inline-start: .15em; }
.basket-card-info > .topic-evidence-summary { display: block; margin-top: 4px; }
.topic-list .topic-excerpt { margin: 0; color: var(--ink-3); }

.topic-list .topic-row .topic-meta { gap: 4px 12px; }
.topic-card-status,
.topic-card-times {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: inherit;
  max-width: 100%;
}
.topic-list .topic-row .topic-listed-time,
.topic-list .topic-row .topic-time {
  display: inline;
  width: auto;
  margin: 0;
  padding: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 400;
}

.topic-list .topic-row > .topic-row-actions { justify-content: flex-end; }
.topic-list .topic-row-utility { margin-left: auto; }

body[data-feed-layout="list"] .topic-list .topic-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
  padding: 13px 18px;
}

body[data-feed-layout="list"] .topic-list .topic-platform > div,
body[data-feed-layout="list"] .topic-list .topic-meta {
  flex-direction: row;
  align-items: center;
}
body[data-feed-layout="list"] .topic-list .board-status { margin-left: auto; }
body[data-feed-layout="list"] .topic-list .topic-row-actions { width: 100%; flex-wrap: wrap; }

@container workspace (min-width: 760px) {
  body[data-feed-layout="list"] .topic-list .topic-row {
    display: grid;
    grid-template-columns: clamp(128px, 15cqi, 156px) minmax(0, 1fr) 122px max-content;
    grid-template-areas: "platform story times actions";
    align-items: center;
    gap: 0 clamp(10px, 1.5cqi, 20px);
    padding: 12px 20px;
  }
  body[data-feed-layout="list"] .topic-list .topic-platform { grid-area: platform; align-items: center; gap: 6px; }
  body[data-feed-layout="list"] .topic-list .topic-selection { order: -1; margin: 0; width: 24px; }
  body[data-feed-layout="list"] .topic-list .topic-platform > div { justify-content: center; gap: 3px 6px; }
  body[data-feed-layout="list"] .topic-list .platform-name { flex-basis: 100%; justify-content: center; }
  body[data-feed-layout="list"] .topic-list .topic-rank-note { justify-content: center; }
  body[data-feed-layout="list"] .topic-list .topic-platform:has(.topic-rank-note) > :is(.source-mark, .topic-selection) { align-self: center; }
  body[data-feed-layout="list"] .topic-list .board-status { margin: 0; white-space: normal; }
  body[data-feed-layout="list"] .topic-list .topic-lead { grid-area: story; }
  body[data-feed-layout="list"] .topic-list .topic-meta {
    grid-area: times;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  body[data-feed-layout="list"] .topic-list .topic-card-status { gap: 2px 8px; }
  body[data-feed-layout="list"] .topic-list .topic-card-times { flex-direction: column; align-items: flex-start; }
  body[data-feed-layout="list"] .topic-list .topic-row-actions {
    grid-area: actions;
    display: grid;
    grid-template-columns: max-content max-content;
    justify-content: end;
    gap: 4px;
  }
  body[data-feed-layout="list"] .topic-list .topic-ai { grid-column: 1 / -1; justify-self: end; margin: 0; }
}

@media (max-width: 760px) {
  .topic-list .topic-selection { width: 44px; height: 44px; margin: -9px -9px -9px 0; }
  .topic-list .topic-row .topic-title { font-size: 16px; }
  .topic-list .topic-row-actions > .topic-ai:has(.review-action) { flex-basis: 100%; justify-content: flex-start; }
  .topic-list .topic-row-utility button,
  .topic-list .topic-row :is(.row-open, .review-action) { min-height: 44px; }
}

/* Pagination & Empty States */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  border-top: 1px solid var(--line-subtle);
  background: var(--surface);
  color: var(--ink-3);
  font-size: 12.5px;
  flex-wrap: wrap;
}

.pagination > div {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.page-button {
  height: 34px;
  min-height: 34px;
  min-width: 34px;
  padding: 0 12px;
}

.empty-state {
  padding: 56px 24px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13.5px;
}

.empty-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--blue);
  margin-bottom: 14px;
}

.empty-state h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
}

.basket-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 4px 0;
  font-size: 12px;
  color: var(--ink-3);
}

.page-footer { display: block; margin: 0; padding: 0; border: 0; color: var(--ink-3); }
.footer-disclosure > summary {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding-inline: 4px;
  border-radius: 6px; font-size: 12px; cursor: pointer; list-style: none;
}
.footer-disclosure > summary::-webkit-details-marker { display: none; }
.footer-disclosure > summary::after {
  content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-1px) rotate(45deg);
}
.footer-disclosure[open] > summary::after { transform: translateY(2px) rotate(225deg); }
.footer-disclosure > summary:is(:hover, :focus-visible) { color: var(--ink); }
.footer-disclosure > p { max-width: 62ch; margin: 0; padding: 2px 4px 6px; font-size: 12px; line-height: 1.65; }

.disclaimer {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 4px 14px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-subtle);
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1.65;
  text-align: left;
}

.disclaimer h2 {
  margin: 0;
  font-family: var(--font-sans) !important;
  font-size: 11.5px !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  line-height: 1.65 !important;
  color: var(--ink-3) !important;
}

.disclaimer p {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--ink-3);
}

/* ==========================================================================
   7. Accounts Settings Page (/accounts) — Android 15/16 Expressive Settings
   ========================================================================== */

.account-admin .topbar {
  padding-inline: 36px;
}

.account-admin .account-owner-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: var(--blue-tint);
  color: var(--blue);
  font-size: 12.5px;
  font-weight: 500;
}

.accounts-heading {
  width: 100%;
  max-width: calc(var(--settings-max) + 72px);
  margin: 0 auto;
  padding: 20px 36px 8px;
  background: transparent;
  border-bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
}

.accounts-heading h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.25;
}

.accounts-heading p {
  margin: 6px 0 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.5;
}

.accounts-heading .button {
  min-height: 42px;
  height: 42px;
  padding: 0 22px;
}

.accounts-content {
  width: 100%;
  max-width: calc(var(--settings-max) + 72px);
  margin: 0 auto;
  padding: 12px 36px 72px;
  min-width: 0;
}

/* Android 15/16 Segmented Preference Group: Top + Bottom Joined Cards */
.account-panel {
  background: var(--surface);
  border: var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

#work-control.research-mode {
  border-radius: 24px 24px 6px 6px;
  margin-bottom: 3px;
  padding: 22px 26px;
}

#research-mode.research-mode {
  border-radius: 6px 6px 24px 24px;
  margin-bottom: 20px;
  padding: 22px 26px;
}

.research-mode h2 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.research-mode h2 span {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--ink-3);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  margin-left: 0;
}

.research-mode p {
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.65;
}

.research-mode #research-mode-status,
.work-control #work-control-status {
  margin-top: 8px;
  font-size: 13px;
  color: var(--blue);
  font-weight: 500;
}

.work-control[data-stopped="true"] {
  background: #fff8f7;
  border-color: rgba(179, 38, 30, 0.35);
}

.work-control[data-stopped="true"] #work-control-status {
  color: var(--red);
}

/* Expressive Material Design 3 Toggle Switches */
.account-quota-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
}

.account-quota-switch:hover:not(:disabled) {
  color: var(--ink);
}

.account-switch-track {
  position: relative;
  width: 52px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-pill);
  background: var(--sunken);
  border: 2px solid #747775;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  transition: background-color 180ms var(--ease-out), border-color 180ms var(--ease-out);
}

.account-switch-track::after {
  content: "";
  position: absolute;
  left: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #747775;
  box-shadow: none;
  transition: transform 180ms var(--ease-out), width 180ms var(--ease-out), height 180ms var(--ease-out), background-color 180ms var(--ease-out);
}

.account-quota-switch[aria-checked="true"] .account-switch-track {
  background: var(--blue);
  border-color: var(--blue);
  justify-content: flex-start;
}

.account-quota-switch[aria-checked="true"] .account-switch-track::after {
  width: 24px;
  height: 24px;
  left: 2px;
  transform: translateX(20px);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16);
}

.work-control [aria-checked="true"] .account-switch-track {
  background: var(--red);
  border-color: var(--red);
}

/* Slightly Compact M3 Switch Inside Dense Account Table Cells */
.account-table .account-switch-track {
  width: 44px;
  height: 26px;
}

.account-table .account-switch-track::after {
  left: 4px;
  width: 14px;
  height: 14px;
}

.account-table .account-quota-switch[aria-checked="true"] .account-switch-track::after {
  width: 20px;
  height: 20px;
  left: 1px;
  transform: translateX(18px);
}

/* Account Summary Card */
.account-summary {
  margin-bottom: 20px;
  background: var(--surface);
  border: var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.account-summary > div {
  padding: 20px 24px;
}

.account-summary > div:first-child {
  background: #f5f8fe;
}

.account-summary > div + div {
  border-left: 1px solid var(--line-subtle);
}

.account-summary strong {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
}

/* Account Toolbar, Search Pill & M3 Tabs */
.account-toolbar {
  min-height: 60px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line-subtle);
}

.account-scope button {
  min-height: 60px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
}

.account-scope button[aria-selected="true"] {
  color: var(--blue);
  font-weight: 600;
}

.account-scope button[aria-selected="true"]::after {
  height: 3px;
  border-radius: 3px 3px 0 0;
  bottom: 0;
  background: var(--blue);
}

.account-search {
  width: 280px;
}

.account-search input {
  width: 100%;
  min-height: 40px;
  height: 40px;
  padding: 0 16px 0 38px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--ink);
  font-size: 13.5px;
}

.account-search input:focus {
  background: var(--surface);
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-ring);
  outline: none;
}

.account-table th {
  background: var(--surface-tint);
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 500;
  border-bottom: 1px solid var(--line-subtle);
}

@media (min-width: 1101px) {
  .account-table th,
  .account-table td,
  .account-table .account-number {
    text-align: center;
  }

  .account-table :is(th, td):is(:first-child, :last-child) {
    padding-inline: var(--space-4);
  }

  .account-table .account-identity,
  .account-table .account-state {
    justify-content: center;
  }

  .account-table .account-row-action {
    padding-inline: 7px;
  }
}

.account-table td {
  border-top: 1px solid var(--line-subtle);
}

.account-table tbody tr:hover {
  background: var(--surface-tint);
}

.account-avatar {
  background: var(--blue-tint);
  border: 0;
  color: var(--blue);
  font-weight: 600;
}

.account-row-action {
  border-radius: var(--radius-pill);
  padding: 4px 10px;
}

.account-row-action:hover {
  background: var(--sunken);
}

.account-row-action[data-action="delete"]:hover {
  background: var(--red-soft);
  color: var(--red);
}

.account-retention-note {
  margin-top: 18px;
  padding: 4px 20px;
  background: var(--surface);
  border: var(--card-border);
  border-radius: 20px;
}

.account-retention-note > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 0;
}

.account-retention-note > div {
  border-top-color: var(--line-subtle);
  padding: 16px 0 18px;
}

/* ==========================================================================
   8. Basket, Calendar Popover, Snapshots, Keywords & Video Verification
   ========================================================================== */

.basket-workbench,
.board-history,
.rules-layout,
.rules-list-panel,
.video-workspace {
  background: var(--surface);
  border: var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.basket-workbench {
  padding: 20px 24px;
  margin-bottom: 18px;
}

.basket-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--line-subtle);
}

.basket-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.basket-scopes,
.basket-tabs {
  display: inline-flex;
  align-items: center;
  padding: 4px;
  background: var(--track);
  border: 0;
  border-radius: var(--radius-pill);
  gap: 2px;
}

.basket-scopes button,
.basket-tab {
  height: 34px;
  min-height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.basket-scopes button.active,
.basket-tab.is-active {
  background: var(--surface);
  color: var(--blue);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.basket-more {
  position: relative;
}

.basket-more > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  min-height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.basket-more > summary::-webkit-details-marker {
  display: none;
}

.basket-more > summary:hover {
  background: var(--sunken);
  color: var(--ink);
}

.basket-more-actions {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  min-width: 176px;
  padding: 6px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.basket-more.opens-up .basket-more-actions {
  top: auto;
  bottom: calc(100% + 6px);
}

.basket-more-actions button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.basket-more-actions button:hover:not(:disabled) {
  background: var(--sunken);
  color: var(--ink);
}

.basket-more-actions button.basket-clear {
  color: var(--red);
}

.basket-more-actions button.basket-clear:hover:not(:disabled) {
  background: var(--red-soft);
}

.basket-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
  padding: 14px 0;
}

.basket-filter,
.basket-export-options {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0;
  margin: 0;
  font-size: 13px;
  color: var(--ink-2);
}

.basket-filter label,
.basket-export-options label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  margin: 0;
}

.basket-filter input[type="date"],
.basket-export-options select:not(.console-select-native) {
  height: 38px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background-color: var(--surface);
  color: var(--ink);
  font-size: 13px;
}

.basket-export-options select:not(.console-select-native) {
  padding: 0 36px 0 14px;
}

.basket-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--line-subtle);
}

.basket-context-copy {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  min-width: 0;
}

#basket-visible-count {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.basket-context-copy p {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-3);
}

.basket-add-toggle {
  background: var(--blue-tint);
  color: var(--blue);
  padding: 0 14px;
  min-height: 34px;
  border-radius: var(--radius-pill);
  font-weight: 500;
}

.basket-add-toggle:hover {
  background: var(--blue-soft);
  color: var(--blue-ink);
}

.basket-add:not([open]) {
  display: none;
}

.basket-add[open] {
  margin-top: 14px;
  margin-bottom: 0;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-tint);
  overflow: hidden;
}

.basket-add summary {
  padding: 12px 18px;
  min-height: 44px;
}

.basket-date-trigger {
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  min-height: 38px;
}

.basket-date-popup {
  position: fixed;
  z-index: 95;
  width: 312px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
}

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

.basket-calendar-heading strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.basket-calendar-heading button {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.basket-calendar-heading button:hover:not(:disabled) {
  background: var(--sunken);
  color: var(--ink);
}

.basket-calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
  margin-bottom: 4px;
}

.basket-calendar-weekdays span {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  padding: 4px 0;
}

.basket-calendar-grid {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.basket-calendar-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.basket-calendar-row [role="gridcell"] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.basket-calendar-row button[data-date] {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.basket-calendar-row button[data-date]:hover:not(:disabled) {
  background: var(--sunken);
}

.basket-calendar-row button[data-date][aria-current="date"] {
  border-color: var(--blue);
  color: var(--blue);
  font-weight: 600;
}

.basket-calendar-row [aria-selected="true"] button[data-date] {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

.basket-calendar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line-subtle);
}

.basket-calendar-footer button {
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--blue);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}

.basket-calendar-footer button:hover {
  background: var(--blue-tint);
}

.basket-card {
  background: var(--surface);
  border: var(--card-border);
  border-radius: 22px;
  padding: 20px 24px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
}

.basket-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 10px;
  margin: 0;
}

.basket-group-heading h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
}

.basket-board-times {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 20px;
  margin: 14px 0 0;
  padding: 14px 18px;
  border: 0;
  border-radius: 16px;
  background: var(--bg);
}

.basket-board-times > div {
  min-width: 0;
}

.basket-board-times dt {
  margin: 0 0 3px;
  font-size: 11.5px;
  color: var(--ink-3);
}

.basket-board-times dd {
  margin: 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.basket-ai-result {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--surface-tint);
  border: 1px solid var(--line-subtle);
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.65;
}

.basket-card-bottom {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
}

.basket-note-editor summary {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--ink-2);
  font-size: 12.5px;
}

/* Board Snapshots — Clean M3 Card & Controls */
.board-history-toolbar {
  padding: 22px 24px;
}

.board-history-toolbar h2 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  color: var(--ink);
}

.board-history-controls {
  --board-control-height: 40px;
  padding: 18px 24px;
  background: var(--surface-tint);
  border-top: 1px solid var(--line-subtle);
  align-items: flex-end;
}

.board-history-controls label {
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 500;
}

.board-history-controls select:not(.console-select-native),
.board-history-controls .console-select-trigger,
.board-history-controls input[type="date"] {
  height: var(--board-control-height);
  min-height: var(--board-control-height);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background-color: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
}

.board-history-controls select:not(.console-select-native) {
  padding: 0 36px 0 14px;
}

.board-history-controls input[type="date"],
.account-validity-dates :is(input[type="date"], input[type="time"]) {
  display: block;
  width: 100%;
  min-width: 0;
  appearance: none;
  -webkit-appearance: none;
}

.board-history-controls input[type="date"]::-webkit-date-and-time-value,
.account-validity-dates input::-webkit-date-and-time-value {
  min-height: 1.4em;
  text-align: left;
}

.board-history-controls .board-history-compare-toggle {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  align-self: flex-end;
  min-height: var(--board-control-height);
  margin-top: 0;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
  white-space: nowrap;
}

.board-history-controls .board-history-compare-toggle input {
  flex: none;
  margin: 0;
  accent-color: var(--blue);
}

.board-history-controls .board-history-compare-toggle:has(input:checked) {
  border-color: var(--blue);
  background: var(--blue-tint);
  color: var(--blue-ink);
}

.board-history-status {
  margin: 0;
  padding: 12px 24px;
  border-top: 1px solid var(--line-subtle);
  color: var(--ink-3);
  font-size: 12.5px;
}

.board-history-caption {
  padding: 20px 24px;
  border-top: 1px solid var(--line-subtle);
}

.board-history-caption h3 {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--ink);
}

.board-history-label {
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  background: var(--bg);
  color: var(--ink-2);
  font-weight: 500;
}

.board-history-baseline {
  background: #f3f7fe;
}

.board-history-table th {
  background: var(--surface-tint);
  color: var(--ink-3);
  font-size: 12.5px;
}

.board-history-table th,
.board-history-table td {
  padding: 14px 20px;
  border-top-color: var(--line-subtle);
  vertical-align: middle;
}

.board-history-table th:first-child,
.board-history-table .board-rank {
  width: 72px;
  text-align: center;
}

.board-history-table th:nth-child(3),
.board-history-table .board-previous {
  width: 92px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.board-change-badge {
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  background: var(--sunken);
  color: var(--ink-2);
  font-weight: 500;
}

.board-change-badge.is-entered,
.board-change-badge.is-up,
.board-change-badge.is-pinned {
  background: var(--green-soft);
  color: var(--green);
}

.board-change-badge.is-down,
.board-change-badge.is-unpinned {
  background: var(--amber-soft);
  color: var(--amber);
}

.board-history-foot {
  padding: 16px 24px;
  border-top-color: var(--line-subtle);
  color: var(--ink-3);
}

/* Keywords Settings Page — Android Settings Grouped List */
.rules-layout {
  padding: 28px;
  margin-bottom: 18px;
}

.rules-intro h2 {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--ink);
}

.keyword-flow li::before {
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue-ink);
}

.rules-panel {
  border-left-color: var(--line-subtle);
}

.rules-panel h2 {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--ink);
}

.rules-tip {
  border-radius: 18px;
  background: var(--bg);
  border: 0;
  padding: 14px 16px;
}

#keyword-form input,
#keyword-form select:not(.console-select-native),
#basket-form input {
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background-color: var(--surface);
  min-height: 42px;
  height: 42px;
  padding: 8px 14px;
  color: var(--ink);
}

#keyword-form select:not(.console-select-native) {
  padding: 0 36px 0 14px;
}

#keyword-form input:focus,
#keyword-form select:focus,
#basket-form input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-ring);
  outline: none;
}

.keyword-row {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 20px;
  min-height: 68px;
  padding: 16px 24px;
  border-top: 1px solid var(--line-subtle);
  transition: background-color var(--motion-fast);
}

.keyword-row:hover {
  background: var(--surface-tint);
}

.keyword-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.keyword-detail {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  font-size: 13px;
  color: var(--ink-2);
}

.keyword-detail small {
  display: block;
  font-size: 12px;
  color: var(--ink-3);
}

.keyword-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.keyword-row-actions .button {
  height: 34px;
  min-height: 34px;
  padding: 0 14px;
  font-size: 12.5px;
}

/* ==========================================================================
   9. Material 3 Dialogs, Topic Detail Sheet & AI Assistant
   ========================================================================== */

.drawer-backdrop,
.modal-backdrop,
dialog::backdrop {
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(4px);
}

/* Match the backdrop across the reserved viewport gutter while scrolling is locked. */
html:has(> body.drawer-open) {
  background-color: color-mix(in srgb, rgb(15 23 42) 36%, var(--bg));
}

/* --------------------------------------------------------------------------
   Topic Detail Sheet ("话题档案") — Rebuilt from Scratch:
   Android 16 / Material 3 Expressive Right-Docked Dual-Pane Inspector
   Desktop: Full-height right side sheet (Left 336px Context+Controls Rail,
            Right Luminous White Editorial Reading Studio).
   Mobile:  Native full-screen Android Settings detail page with sticky dock.
   -------------------------------------------------------------------------- */
.topic-sheet {
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  width: min(960px, calc(100vw - 48px));
  max-width: 960px;
  height: auto;
  max-height: min(780px, calc(100dvh - 48px));
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: var(--radius-xl);
  background: var(--bg);
  box-shadow: 0 12px 44px rgba(15, 23, 42, 0.18), 0 2px 10px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  transform: translate(-50%, calc(-50% + 14px));
}

.topic-sheet.is-visible {
  transform: translate(-50%, -50%);
}

.drawer-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px 10px 22px;
  min-height: 54px;
  border-bottom: 0;
  background: var(--bg);
}

.sheet-heading-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
}

.sheet-heading-label strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
}

.sheet-heading-label svg {
  width: 18px;
  height: 18px;
  color: var(--blue);
}

.sheet-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sheet-assistant-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  min-height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  border: 0;
  background: var(--fab-bg);
  color: var(--fab-ink);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--motion-fast), box-shadow var(--motion-fast);
}

.sheet-assistant-button svg {
  width: 15px;
  height: 15px;
}

.sheet-assistant-button:hover {
  background: var(--fab-bg-hover);
  box-shadow: var(--shadow-xs);
}

.sheet-close {
  height: 38px;
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: var(--shadow-xs);
}

.sheet-close:hover {
  background: var(--sunken);
  color: var(--ink);
}

/* Two-Pane Split Workspace — Right-Sized, Zero Dead Void */
.sheet-workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 316px minmax(0, 1fr);
  gap: 14px;
  padding: 0 18px 18px;
  align-items: stretch;
}

/* Left Sticky Context & Control Rail */
.sheet-rail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
}

/* Topic identity and listing history */
.sheet-summary {
  position: relative;
  margin: 0;
  padding: 16px 18px 0;
  border-radius: 22px;
  border: var(--card-border);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.sheet-summary .detail-platform {
  order: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 24px;
  padding-right: 0;
}

.sheet-summary .detail-platform strong {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.sheet-summary .sheet-board-status {
  margin-left: auto;
  padding: 0;
  background: transparent;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
}

.sheet-board-status.is-onboard {
  color: var(--blue);
}

.sheet-board-status.is-offboard {
  color: var(--ink-3);
}

.sheet-rank {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
}

.sheet-rank b {
  font-size: 14px;
  font-weight: 600;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}

.sheet-summary .detail-title {
  order: 3;
  max-width: none;
  margin: 12px 0 8px;
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 500;
  line-height: 1.46;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.sheet-summary .sheet-meta {
  order: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 10px;
  margin-bottom: 12px;
  padding-right: 0;
  font-size: 12px;
  color: var(--ink-3);
}

.sheet-original-link {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  margin: 4px 0 0;
  height: 34px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--bg);
  color: var(--blue);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color var(--motion-fast);
}

.sheet-original-link:hover {
  background: var(--blue-tint);
  text-decoration: none;
}

.sheet-timing {
  order: 5;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.sheet-timing > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.sheet-timing-round {
  margin-left: auto;
  color: var(--ink-3);
  font-size: 12px;
}

.sheet-board-times {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 0 12px;
  margin: 0;
}

.sheet-board-times > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  border: 0;
}

.sheet-board-times > div:first-child {
  border-top: 0;
  padding-top: 2px;
}

.sheet-board-times dt {
  margin: 0;
  font-size: 11.5px;
  color: var(--ink-3);
}

.sheet-board-times dd {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Card 2: Dedicated Decision & Manual Marking Control Card in Left Rail */
.sheet-footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 16px 18px;
  border: var(--card-border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}

.sheet-primary-actions {
  order: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.sheet-primary-actions .button {
  width: 100%;
  height: 40px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
}

.sheet-review-button {
  order: 1;
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

.sheet-review-button:hover:not(:disabled) {
  background: var(--blue-hover);
  border-color: var(--blue-hover);
  color: #ffffff;
}

.sheet-save-button {
  order: 2;
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.sheet-manual-actions {
  order: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line-subtle);
  color: var(--ink-3);
  font-size: 12px;
}

.sheet-manual-label {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 2px;
}

.sheet-manual-actions .human-feedback-chip {
  grid-column: 1 / -1;
  justify-self: start;
  margin-bottom: 4px;
}

.sheet-verdict-button {
  width: 100%;
  height: 34px;
  min-height: 34px;
  min-width: 0;
  padding: 0 6px;
  border-radius: 10px;
  border: 0;
  background: var(--bg);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--motion-fast), color var(--motion-fast);
}

.sheet-verdict-button:hover:not(:disabled) {
  background: var(--sunken-hover);
  color: var(--ink);
}

.sheet-verdict-button.selected {
  background: var(--blue-soft);
  border-color: transparent;
  color: var(--blue-ink);
  font-weight: 600;
}

.sheet-verdict-button[data-drawer-action="reject"].selected {
  background: var(--red-soft);
  border-color: transparent;
  color: var(--red);
  font-weight: 600;
}

.sheet-manual-actions > small {
  display: block;
  grid-column: 1 / -1;
  margin: 1px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--ink-3);
}

.keyword-review-note {
  order: 2;
  margin: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line-subtle);
  font-size: 11.5px;
  color: var(--ink-3);
}

.sheet-removal-actions {
  order: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 10px 0 0;
  border: 0;
  border-top: 1px solid var(--line-subtle);
}

.sheet-removal-actions .sheet-caption {
  display: block;
  font-size: 11px;
  line-height: 1.35;
  color: var(--ink-3);
}

.sheet-dismiss-button {
  height: 32px;
  min-height: 32px;
  min-width: 0;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  border: 0;
  background: var(--bg);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
}

.sheet-dismiss-button:hover:not(:disabled) {
  background: var(--red-soft);
  color: var(--red);
}

/* Right Luminous Editorial Reading Studio */
.drawer-scroll.sheet-stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  border-radius: 22px;
  border: var(--card-border);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.sheet-toolbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin: 0;
  padding: 12px 20px;
  border: 0;
  border-bottom: 1px solid var(--line-subtle);
  border-start-start-radius: inherit;
  border-start-end-radius: inherit;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.sheet-toolbar .sheet-tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--track);
}

.sheet-toolbar .sheet-tabs button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  min-height: 34px;
  padding: 0 15px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--motion-fast), color var(--motion-fast), box-shadow var(--motion-fast);
}

.sheet-toolbar .sheet-tabs button:hover {
  color: var(--ink);
}

.sheet-toolbar .sheet-tabs button[aria-selected="true"] {
  background: var(--surface);
  color: var(--blue);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.sheet-copy-controls {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
}

.sheet-copy-controls > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 2px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  white-space: nowrap;
}

.sheet-copy-controls button {
  height: 30px;
  min-height: 30px;
  min-width: 0;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  transition: background-color var(--motion-fast), color var(--motion-fast);
}

.sheet-copy-controls button:hover:not(:disabled) {
  background: var(--blue-tint);
  color: var(--blue);
  border-color: transparent;
}

.sheet-copy-controls button:disabled {
  background: var(--bg);
  border-color: transparent;
  color: var(--ink-3);
  opacity: 0.6;
}

.broadcast-history-notice,
.broadcast-attribution {
  margin: 12px 20px 0;
  padding: 10px 14px;
  border: 0;
  border-radius: 12px;
}

.sheet-content {
  padding: 18px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Only the unused part of a desktop reading pane can host a preview. */
.sheet-context-space, .sheet-context-preview { display: none; }

@media (min-width: 961px) {
  .drawer-scroll.sheet-stage > .sheet-content { flex: none; }
  .sheet-context-space {
    display: block;
    flex: 1 0 0px;
    min-height: 0;
    container: sheet-spare / size;
  }
}

@container sheet-spare (min-height: 58px) {
  .sheet-context-preview:not([hidden]) {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "title metric link";
    align-items: center;
    gap: 6px 12px;
    width: calc(100% - 40px);
    margin: 0 20px;
    padding: 12px 14px;
    border: 1px solid var(--line-subtle);
    border-radius: 14px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    text-align: start;
    cursor: pointer;
  }
  .sheet-context-preview:hover { background: var(--surface-tint); }
  .sheet-context-preview:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
  .sheet-preview-title { grid-area: title; font-size: 13px; }
  .sheet-preview-metric {
    grid-area: metric;
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
  }
  .sheet-preview-metric small, .sheet-preview-axis { color: var(--ink-3); font-size: 11px; }
  .sheet-preview-link {
    grid-area: link;
    justify-self: end;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--blue);
    font-size: 12px;
  }
  .sheet-preview-link svg { width: 14px; height: 14px; }
  .sheet-preview-source { grid-area: metric; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); font-size: 13px; }
  .sheet-preview-plot { display: none; }
}

@container sheet-spare (min-height: 100px) {
  .sheet-context-preview:has(.sheet-preview-plot) {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "title link" "metric plot";
    column-gap: 24px;
    padding-block: 10px;
  }
  .sheet-context-preview:has(.sheet-preview-plot) .sheet-preview-metric {
    flex-direction: column;
    gap: 1px;
    font-size: 17px;
  }
  .sheet-preview-plot { grid-area: plot; display: block; min-width: 0; }
  .sheet-preview-plot > svg { display: block; width: 100%; height: clamp(26px, calc(100cqh - 80px), 86px); }
  .sheet-preview-plot .rank-chart-line { stroke-width: 1.8; vector-effect: non-scaling-stroke; }
  .sheet-preview-point { stroke: var(--blue); stroke-width: 4; stroke-linecap: round; vector-effect: non-scaling-stroke; }
  .sheet-preview-axis { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
  .sheet-preview-gap-key { display: inline-flex; align-items: center; gap: 4px; }
  .sheet-preview-gap-key::before { content: ""; width: 8px; height: 8px; background: var(--neutral-100); border: 1px solid var(--line); border-radius: 2px; }
}

/* Review, evidence and source read as one document. */
.sheet-ai-result {
  padding: 2px 0 4px;
  border-radius: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.sheet-ai-result.is-manual-review {
  padding: 12px 16px;
  border: 0;
  border-radius: 14px;
  background: #fff9ec;
}

.sheet-result-heading {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.sheet-result-mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-top: 0;
  background: transparent;
}

.sheet-result-mark.relevant {
  background: transparent;
  color: var(--green);
}

.sheet-result-mark.uncertain,
.sheet-result-mark.weak,
.sheet-ai-result.is-manual-review .sheet-result-mark {
  background: transparent;
  color: var(--amber);
}

.sheet-result-mark.pending {
  background: transparent;
  color: var(--blue);
}

.sheet-result-mark.irrelevant {
  background: transparent;
  color: var(--red);
}

.sheet-result-mark svg {
  width: 20px;
  height: 20px;
}

.sheet-result-identity {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sheet-result-label {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink-3);
}

.sheet-ai-result h3,
.sheet-ai-result.relevant h3,
.sheet-ai-result.uncertain h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.sheet-result-body {
  margin: 10px 0 0;
}

.sheet-result-reason {
  font-size: 14.5px;
  line-height: 1.72;
  color: var(--ink);
}

.sheet-citation {
  margin-top: 14px;
}

.sheet-citation-label {
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
}

.sheet-citation-label .source-link {
  color: var(--blue);
  text-decoration: none;
  font-weight: 500;
}

.sheet-citation-label .source-link:hover {
  text-decoration: underline;
}

.sheet-citation .sheet-quote {
  padding: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink-2);
}

.sheet-citation .sheet-quote::before { content: none; }

.sheet-quote {
  position: relative;
  margin: 0;
  padding: 13px 16px 13px 22px;
  border: 0;
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.68;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.sheet-quote::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: var(--radius-pill);
  background: var(--blue);
}

.sheet-result-body > .sheet-caption {
  margin: 12px 0 0;
  font-size: 11.5px;
  color: var(--ink-3);
}

/* Rule Pre-screen Expandable Preference Card */
.sheet-rule-result {
  margin-top: 0;
  padding: 3px 14px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-tint);
  box-shadow: none;
}

.sheet-rule-result > summary {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 44px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.sheet-rule-status {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
}

.sheet-rule-result > summary > svg {
  color: var(--ink-3);
}

.sheet-rule-result p {
  margin: 8px 0 4px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink-2);
}

/* Evidence Tab Cards & 2x2 Balanced Fact Tiles */
.sheet-evidence-card {
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid var(--line-subtle);
  background: var(--surface-tint);
  box-shadow: none;
}

.sheet-evidence-card .sheet-card-heading {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.sheet-evidence-card .meta-tag {
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  background: var(--surface);
  color: var(--ink-2);
  font-weight: 500;
}

.sheet-evidence-title {
  margin: 10px 0 12px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.42;
  color: var(--ink);
}

.sheet-evidence-card .sheet-result-reason {
  margin-top: 12px;
  font-size: 13.5px;
  color: var(--ink-2);
}

.sheet-evidence-card .source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 0 16px;
  min-height: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--blue);
  font-weight: 500;
}

.sheet-evidence-card .source-link:hover {
  background: var(--blue-tint);
  border-color: transparent;
}

.sheet-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.sheet-facts > div {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg);
}

.sheet-facts dt {
  margin: 0 0 4px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-3);
}

.sheet-facts dd {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

/* History Tab Cards inside Right Studio */
.rank-dashboard,
.sheet-history-summary,
.rank-chart-records {
  padding: 18px 20px;
  margin: 0;
  border: 1px solid var(--line-subtle);
  border-radius: 18px;
  background: var(--surface-tint);
  box-shadow: none;
}

.sheet-history-table {
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-subtle);
}

@media (max-width: 1120px) and (min-width: 961px) {
  .sheet-workspace {
    grid-template-columns: 292px minmax(0, 1fr);
    gap: 12px;
  }
}

@media (max-width: 960px) {
  html:has(> body.drawer-open) {
    scrollbar-gutter: auto;
  }

  .topic-sheet {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    transform: translateY(16px);
  }

  .topic-sheet.is-visible {
    transform: translateY(0);
  }

  .sheet-workspace {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 0;
    gap: 12px;
  }

  .sheet-rail {
    display: contents;
  }

  .sheet-summary {
    order: 1;
    margin: 4px 16px 0;
    padding: 16px 18px 0;
    border-radius: 22px;
  }

  .drawer-scroll.sheet-stage {
    order: 2;
    flex: 1 0 auto;
    overflow: visible;
    margin: 0 16px 8px;
    border-radius: 22px;
  }

  .sheet-toolbar {
    position: static;
    flex-wrap: wrap;
    padding: 14px 16px;
    gap: 10px;
    background: var(--surface);
    backdrop-filter: none;
  }

  .sheet-toolbar .sheet-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sheet-toolbar .sheet-tabs button {
    width: 100%;
    padding: 0 6px;
  }

  .sheet-copy-controls {
    width: 100%;
    justify-content: flex-end;
    padding: 2px 0 0;
    border: 0;
  }

  .sheet-copy-controls > span {
    margin-right: auto;
  }

  .sheet-content {
    padding: 16px 16px 20px;
    gap: 12px;
  }

  .sheet-evidence-card {
    padding: 18px 16px;
    border-radius: 18px;
  }

  .sheet-ai-result h3,
  .sheet-ai-result.relevant h3,
  .sheet-ai-result.uncertain h3 {
    font-size: 18px;
  }

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

  .sheet-footer {
    order: 3;
    position: sticky;
    bottom: 0;
    z-index: 6;
    margin-top: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 8px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    border-radius: 22px 22px 0 0;
    border-top: 1px solid var(--line-subtle);
    box-shadow: 0 -4px 18px rgba(15, 23, 42, 0.08);
  }

  .sheet-primary-actions {
    grid-column: 1 / -1;
    grid-row: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .sheet-save-button {
    order: 1;
  }

  .sheet-review-button {
    order: 2;
  }

  .sheet-manual-actions {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    align-items: center;
    padding-top: 0;
    border-top: 0;
    gap: 5px;
  }

  .sheet-manual-label,
  .sheet-manual-actions > small,
  .sheet-removal-actions .sheet-caption {
    display: none;
  }

  .sheet-verdict-button {
    width: auto;
    min-width: 48px;
    height: 34px;
    min-height: 34px;
    padding: 0 12px;
    border-radius: var(--radius-pill);
  }

  .sheet-removal-actions {
    grid-column: 2;
    grid-row: 2;
    padding-top: 0;
    border-top: 0;
  }
}

/* Account dialogs */
.account-dialog {
  border: 0;
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.account-dialog > header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line-subtle);
}

.account-dialog > header h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
}

.account-dialog-body {
  padding: 20px 24px;
}

.account-dialog footer {
  padding: 14px 24px 18px;
  border-top: 1px solid var(--line-subtle);
  background: var(--surface);
}

.account-dialog input:not([type="radio"]):not([type="checkbox"]) {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
}

.account-validity-dialog {
  position: fixed;
  inset: 0;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: hidden;
}

.account-validity-dialog[open],
.account-validity-dialog form {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.account-validity-dialog > header,
.account-validity-dialog footer {
  flex: none;
}

.account-validity-heading {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 12px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.account-validity-heading h2:focus { outline: none; }
.account-validity-heading > div { min-width: 0; }
.account-validity-heading strong { font-weight: 500; color: var(--ink-2); }

.account-validity-mark {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--blue-soft);
  color: var(--blue-ink);
}

.account-validity-mark svg { width: 21px; height: 21px; }

.account-validity-dialog .icon-button,
.account-validity-dialog footer .button {
  min-width: 44px;
  min-height: 44px;
}

.account-validity-dialog .account-dialog-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  background: var(--surface-tint);
}

.account-validity-dialog fieldset { min-width: 0; }

.account-validity-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.account-validity-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

.account-validity-options input {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--blue);
}

.account-validity-options label:has(input:checked) {
  border-color: var(--blue);
  background: var(--blue-tint);
  color: var(--blue-ink);
}

.account-validity-dates {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.account-validity-time-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.account-validity-time-heading h3 { margin: 0; font-size: 14px; font-weight: 600; }

.account-validity-time-heading span {
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--blue-tint);
  color: var(--blue-ink);
  font-size: 12px;
}

.account-validity-time-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 8px;
}

.account-validity-time-fields label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--ink-3);
  font-size: 13px;
}

.account-validity-dialog .account-validity-dates input[type] {
  height: 46px;
  max-width: 100%;
  padding: 0 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
}

.account-validity-dialog .account-validity-dates input[aria-invalid="true"] {
  border-color: var(--red);
}

.account-validity-dates :is(.account-form-note, .account-field-error) {
  margin: 9px 0 0;
  line-height: 1.5;
}

/* AI Assistant — Material 3 Extended FAB & Floating Sheet */
.assistant-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 45;
  height: 52px;
  min-height: 52px;
  padding: 0 20px;
  border-radius: 16px;
  border: 0;
  background: var(--fab-bg);
  color: var(--fab-ink);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12), 0 6px 18px rgba(11, 87, 208, 0.14);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background-color var(--motion-fast), box-shadow var(--motion-fast), transform var(--motion-fast);
}

.assistant-launcher:hover {
  background: var(--fab-bg-hover);
  color: var(--fab-ink);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16), 0 10px 24px rgba(11, 87, 208, 0.18);
  transform: translateY(-1px);
}

.assistant-launcher svg {
  width: 20px;
  height: 20px;
  color: var(--blue);
}

.assistant-panel {
  border: 0;
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.assistant-header .assistant-identity-mark {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
  border-radius: 50%;
  background: var(--fab-bg);
  color: var(--blue);
}

.assistant-tabs {
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--track);
  padding: 3px;
}

.assistant-tabs > button {
  border-radius: var(--radius-pill);
  min-height: 32px;
}

.assistant-tabs > button[aria-selected="true"] {
  background: var(--surface);
  color: var(--blue);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.assistant-messages,
.assistant-tasks {
  background: var(--surface-tint);
}

.assistant-welcome-mark {
  border-radius: 50%;
  border: 0;
  background: var(--fab-bg);
  color: var(--blue);
}

.assistant-suggestions button {
  border-radius: 20px;
  border: var(--card-border);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.assistant-suggestions button:hover:not(:disabled) {
  background: #f4f8ff;
  border-color: var(--indigo-100);
}

.assistant-message.user {
  border: 0;
  border-radius: 20px 20px 6px 20px;
  background: var(--blue-tint);
  color: var(--blue-ink);
}

.assistant-action-card {
  border-radius: 20px;
  border: 1px solid var(--line);
}

.assistant-form {
  border-radius: 24px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
}

.assistant-form:focus-within {
  background: var(--surface);
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-ring);
}

.assistant-form .button {
  border-radius: var(--radius-pill);
}

.assistant-mode-control select {
  min-height: 34px;
  height: 34px;
  padding: 0 34px 0 14px;
  border-radius: var(--radius-pill);
  background-color: var(--surface);
  background-position: right 10px center;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
}

.toast,
.account-toast {
  border-radius: var(--radius-pill);
  background: #202124;
  color: #ffffff;
  padding: 12px 22px;
  box-shadow: var(--shadow-lg);
}

.review-success-notice,
.app-update {
  border-radius: 24px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}

.site-disclaimer {
  margin-top: auto;
  padding: 16px 36px;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.5;
}

/* ==========================================================================
   10. Login, Password & Usage Pages — Serene Google Account Auth Style
   ========================================================================== */

body:has(> .login-shell) {
  background: var(--bg);
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}

.login-shell {
  width: 100%;
  max-width: 1000px;
  min-height: 0;
  display: grid;
  grid-template-columns: 1.02fr 1fr;
  background: var(--surface);
  border: var(--card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.identity-panel {
  background: #f6f9fe;
  border-right: 1px solid var(--line-subtle);
  padding: 44px 48px 32px;
}

.identity-content {
  padding: 36px 0;
}

.identity-content h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(28px, 2.8vw, 36px);
  line-height: 1.35;
  color: var(--ink);
}

.preview-step > span {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue-ink);
  font-weight: 600;
}

.form-panel {
  background: var(--surface);
  padding: 44px 48px 32px;
}

.login-form-wrap {
  padding: 24px 0 32px;
}

.form-symbol {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--blue-tint);
  color: var(--blue);
}

#login-title,
.login-form-wrap > h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
}

.form-footer {
  margin-top: auto;
  padding-top: 12px;
}

.form-footer-brand {
  font-size: 11.5px;
  color: var(--ink-3);
}

#login-form input:not([type="hidden"]) {
  min-height: 48px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  font-size: 15px;
}

#login-form input:not([type="hidden"]):focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-ring);
}

#toggle-password {
  border-radius: var(--radius-pill);
}

.submit-button {
  min-height: 46px;
  border-radius: var(--radius-pill);
  background: var(--blue);
  border-color: var(--blue);
  font-size: 14.5px;
  font-weight: 500;
}

.submit-button:hover:not(:disabled) {
  background: var(--blue-hover);
  box-shadow: 0 1px 4px rgba(11, 87, 208, 0.28);
}

/* Password & Usage Security Settings Pages */
.password-page {
  background: var(--bg);
}

.security-header {
  background: transparent;
  border-bottom: 1px solid rgba(31, 31, 31, 0.06);
  min-height: 64px;
  padding: 10px 36px;
}

.security-back {
  border-radius: var(--radius-pill);
  padding: 0 16px;
  color: var(--blue);
  font-weight: 500;
}

.security-back:hover {
  background: var(--blue-tint);
  color: var(--blue);
}

.security-panel {
  max-width: 520px;
  padding: 36px 40px;
  border: var(--card-border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.security-symbol {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--blue-tint);
  color: var(--blue);
}

.security-panel h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
}

.password-page .security-input-wrap input {
  border-radius: var(--radius-sm);
  border-color: var(--line-strong);
}

.security-submit {
  min-height: 46px;
  border-radius: var(--radius-pill);
  background: var(--blue);
  border-color: var(--blue);
}

.security-submit:hover:not(:disabled) {
  background: var(--blue-hover);
}

/* ==========================================================================
   11. Responsive Breakpoints — Material 3 Adaptive Shell
   ========================================================================== */

@media (max-width: 1280px) {
  :root {
    --sidebar: 244px;
  }

  .topbar {
    padding: 10px 24px;
    gap: 10px;
  }

  .page-content,
  .accounts-content,
  .accounts-heading {
    padding-inline: 24px;
  }

  .workflow-step {
    padding: 0 11px;
    font-size: 12.5px;
    gap: 5px;
  }

  body[data-feed-layout="list"] .topic-row {
    grid-template-columns: 148px minmax(0, 1fr) 156px auto;
    gap: 0 14px;
    padding: 14px 20px;
  }
}

@media (max-width: 1080px) {
  .collection-sources {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topic-list {
    grid-template-columns: 1fr;
    padding: 16px 20px 20px;
    gap: 12px;
  }

  body[data-feed-layout="list"] .topic-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 16px 20px;
  }

  body[data-feed-layout="list"] .topic-platform {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line-subtle);
    align-items: center;
  }

  body[data-feed-layout="list"] .topic-platform > div {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
  }

  body[data-feed-layout="list"] .board-status,
  body[data-feed-layout="list"] .board-status.is-onboard {
    margin-left: auto;
  }

  body[data-feed-layout="list"] .topic-meta {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
  }

  body[data-feed-layout="list"] .topic-time {
    display: inline-flex;
    margin-left: auto;
  }

  body[data-feed-layout="list"] .topic-row-actions {
    width: 100%;
    padding-top: 10px;
    border-top: 1px solid var(--line-subtle);
    flex-wrap: wrap;
    justify-content: space-between;
  }
}

@media (max-width: 1050px) {
  .page-heading {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .page-heading-tools {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 10px 14px;
    margin-top: 0;
  }

  .runtime-line {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
  }

  .heading-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    width: auto;
    border-left: 0;
    padding-left: 0;
    gap: 8px;
  }
}

@media (min-width: 761px) and (max-width: 1000px) {
  .sidebar-account {
    width: 48px;
    margin: 6px auto 12px;
    border-radius: 50%;
  }

  .sidebar-account-profile,
  .sidebar-account-identity {
    width: 48px;
    min-height: 48px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }

  .sidebar-profile[open] > summary {
    width: 48px;
    border-radius: 50%;
  }

  .sidebar-account .sidebar-profile-chevron {
    display: none;
  }

  .sidebar-profile-content {
    position: fixed;
    left: calc(var(--sidebar) + 10px);
    right: auto;
    bottom: 12px;
    width: 248px;
    max-height: calc(100dvh - 24px);
    padding: 8px;
    border-radius: 22px;
  }
}

/* Tablet Material 3 Navigation Rail (761px..1000px) */
@media (max-width: 1000px) {
  :root {
    --sidebar: 76px;
  }

  .brand {
    justify-content: center;
    padding: 0;
  }

  .brand-name,
  .sidebar-label,
  .nav-section-title,
  .navigation-customize span,
  .nav-item > span,
  .nav-count,
  .nav-number,
  .sidebar-account-info,
  .sidebar-account-quick {
    display: none !important;
  }

  .navigation-heading,
  .nav-section-head {
    justify-content: center;
    padding: 4px 0 6px;
  }

  .navigation-customize {
    width: 44px;
    height: 32px;
    padding: 0;
    justify-content: center;
  }

  .nav-item {
    justify-content: center;
    width: 56px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    margin: 2px auto;
    border-radius: var(--radius-pill);
  }

  .sidebar-account-link {
    width: auto;
    justify-content: center;
    padding: 4px;
  }

  .topbar {
    padding: 10px 18px;
    gap: 8px;
  }

  .topbar-date,
  .filter-level-label,
  .workflow-step-number,
  .push-trigger > span,
  .logout-user {
    display: none;
  }

  .workflow-step {
    height: 32px;
    min-height: 32px;
    padding: 0 10px;
    font-size: 12.5px;
    gap: 5px;
  }

  .push-trigger {
    width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
  }

  .logout-button {
    padding: 0 12px;
  }

  .page-content,
  .accounts-content,
  .accounts-heading {
    padding-inline: 20px;
  }

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

  .metrics > .metric:nth-child(2n + 1) {
    border-left: 0;
  }

  .metrics > .metric:nth-child(2n) {
    border-left: 1px solid var(--line-subtle);
  }

  .metrics > .metric:nth-child(n + 3) {
    border-top: 1px solid var(--line-subtle);
  }
}

/* Mobile Layout & Material 3 Modal Navigation Drawer (<=760px) */
@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  aside.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 84vw);
    max-width: 84vw;
    z-index: 75;
    border-radius: 0 28px 28px 0;
    background: var(--bg);
    transform: translateX(-100%);
    transition: transform 240ms var(--ease-out);
    box-shadow: none;
  }

  body.navigation-open aside.sidebar,
  body.nav-open aside.sidebar {
    transform: translateX(0);
    visibility: visible;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.24);
  }

  body.navigation-open #navigation-backdrop,
  body.navigation-open .navigation-backdrop,
  body.nav-open .mobile-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 70;
    border: 0;
    padding: 0;
    background: rgba(15, 23, 42, 0.36);
  }

  #navigation-close,
  .navigation-close {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 13px;
    right: 14px;
    width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ink-2);
    z-index: 2;
  }

  aside.sidebar .brand {
    justify-content: flex-start;
    padding: 0 20px;
  }

  aside.sidebar .brand-name,
  aside.sidebar .sidebar-label,
  aside.sidebar .nav-section-title,
  aside.sidebar .navigation-customize span,
  aside.sidebar .nav-item > span,
  aside.sidebar .nav-count,
  aside.sidebar .nav-number,
  aside.sidebar .sidebar-account-info {
    display: flex !important;
  }

  aside.sidebar .sidebar-label,
  aside.sidebar .nav-section-title,
  aside.sidebar .navigation-customize span,
  aside.sidebar .nav-item > span:not(.nav-count):not(.nav-number) {
    display: block !important;
  }

  aside.sidebar .navigation-heading,
  aside.sidebar .nav-section-head {
    justify-content: space-between;
    padding: 0 4px 0 14px;
  }

  aside.sidebar .navigation-customize {
    width: auto;
    height: auto;
    padding: 4px 10px;
  }

  aside.sidebar .nav-item {
    width: 100%;
    height: 46px;
    min-height: 46px;
    padding: 0 16px;
    justify-content: flex-start;
    margin: 0;
  }

  aside.sidebar .sidebar-account {
    width: auto;
    margin: 6px 12px max(12px, env(safe-area-inset-bottom, 0px));
    padding: 0;
    border-radius: 18px;
  }

  aside.sidebar .sidebar-account-profile,
  aside.sidebar .sidebar-account-identity {
    width: 100%;
    min-height: 54px;
    justify-content: flex-start;
    padding: 8px 14px 8px 10px;
    border-radius: 18px;
  }

  aside.sidebar .sidebar-profile[open] > summary {
    width: 100%;
    border-radius: 18px;
  }

  .topbar {
    padding: 10px 16px;
    min-height: auto;
    flex-wrap: wrap;
    gap: 8px;
  }

  .topbar-left {
    display: contents;
  }

  .menu-button,
  #menu-toggle,
  #navigation-toggle,
  .navigation-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    border-radius: 50%;
    border: 0;
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-xs);
    cursor: pointer;
    flex-shrink: 0;
    order: 1;
  }

  .breadcrumb {
    display: none;
  }

  .filter-level-pill,
  .filter-level-control {
    order: 2;
    margin-left: 0;
  }

  .filter-level-label,
  .push-trigger > span,
  .topbar-date {
    display: none;
  }

  .push-trigger,
  #reload.icon-button {
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
  }

  .topbar-right {
    margin-left: auto;
    gap: 4px;
    order: 3;
  }

  .workflow-rail {
    order: 5;
    flex: 0 0 100%;
    width: 100%;
    justify-content: space-between;
  }

  .workflow-step {
    flex: 1 1 auto;
    justify-content: center;
    padding: 0 8px;
    height: 36px;
    min-height: 36px;
  }

  .page-content {
    padding: 12px 16px max(12px, env(safe-area-inset-bottom, 0px));
    gap: 14px;
  }

  .footer-disclosure > summary { min-height: 44px; }
  .footer-disclosure[open] { padding-bottom: 52px; }

  .page-heading {
    margin: 0;
    padding: 4px 2px 6px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .page-heading h1,
  .accounts-heading h1 {
    font-size: 24px;
  }

  .page-heading-tools {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .runtime-line {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
  }

  .heading-actions {
    border-left: 0;
    padding-left: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .heading-actions .button {
    min-height: 44px;
    height: 44px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-radius: 22px;
  }

  .metrics > .metric,
  .metrics > .metric:first-child,
  .metrics > .metric:last-child,
  .metrics > .metric:nth-child(n) {
    padding: 16px 18px;
  }

  .metrics .metric strong,
  .metrics .metric-value {
    font-size: 24px;
  }

  .queue-panel,
  .account-panel {
    border-radius: 22px;
  }

  .collection-heading,
  .queue-heading,
  .filter-bar,
  .source-tabs,
  .basket-bulk-bar,
  .pagination {
    padding-inline: 16px;
  }

  #collection-body {
    padding: 0 16px 16px;
  }

  .collection-sources {
    grid-template-columns: 1fr;
  }

  .filter-bar,
  .filter-bar.discover-filters,
  .filter-bar.observation-filters,
  .filter-bar.review-filters,
  .filter-bar.watchlist-filters,
  .filter-bar.discover-filters.advanced-expanded,
  .filter-bar.observation-filters.advanced-expanded {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .search-field {
    grid-column: 1 / -1;
    min-width: 0;
    height: 46px;
    min-height: 46px;
  }

  .search-field input {
    font-size: 16px;
  }

  .search-field kbd {
    display: none;
  }

  .filter-bar .select-wrap {
    min-width: 0;
    width: 100%;
  }

  .filter-bar select:not(.console-select-native),
  .filter-bar .console-select-trigger {
    height: 44px;
    min-height: 44px;
    font-size: 15px;
  }

  #more-filters {
    grid-column: 1 / -1;
    width: 100%;
    height: 44px;
    min-height: 44px;
  }

  .basket-workbench {
    padding: 16px;
    border-radius: 22px;
  }

  .basket-board-times {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .keyword-row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 16px;
  }

  .keyword-row-actions {
    justify-content: flex-start;
  }

  .board-history-toolbar,
  .board-history-controls {
    padding-inline: 16px;
  }

  .board-history-controls {
    --board-control-height: 44px;
  }

  .board-history-controls input[type="date"] {
    padding-inline: 10px;
    font-size: 16px;
  }

  .board-history-controls .console-select-trigger {
    gap: 4px;
    padding-inline: 10px;
  }

  .board-history-time .console-select-value {
    white-space: normal;
    line-height: 1.25;
  }

  .account-validity-dialog {
    inset: auto 0 0;
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 12px);
    max-height: calc(100dvh - max(12px, env(safe-area-inset-top)));
    margin: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }

  .account-validity-dialog > header {
    padding: 12px 16px;
  }

  .account-validity-dialog .account-dialog-body {
    padding: 16px;
  }

  .account-validity-dialog footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  }

  .topic-list {
    padding: 14px 14px 18px;
    gap: 12px;
  }

  .topic-row {
    padding: 16px;
    border-radius: 18px;
  }

  .topic-time {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }

  .topic-row-utility button,
  .row-open {
    height: 38px;
    min-height: 38px;
  }

  .accounts-heading {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px 4px;
    gap: 12px;
  }

  .accounts-heading .button {
    width: 100%;
    height: 44px;
    min-height: 44px;
  }

  .accounts-content {
    padding: 10px 16px 64px;
  }

  #work-control.research-mode,
  #research-mode.research-mode {
    padding: 18px;
  }

  .drawer-header {
    padding: 10px 16px 8px;
    min-height: 54px;
  }

  .sheet-summary .detail-title {
    font-size: 18px;
  }

  .assistant-launcher {
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    height: 48px;
    min-height: 48px;
    padding: 0 16px;
    border-radius: 16px;
  }

  body:has(> .login-shell) {
    padding: 16px;
    align-items: flex-start;
  }

  .login-shell {
    grid-template-columns: 1fr;
    border-radius: 24px;
  }

  .identity-panel {
    padding: 24px 24px 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line-subtle);
  }

  .form-panel {
    padding: 24px;
  }

  .security-panel {
    padding: 28px 22px;
    border-radius: 24px;
  }
}

@media (max-width: 360px) {
  .board-history-time .console-select-trigger {
    gap: 2px;
    padding-inline: 7px;
    font-size: 12px;
  }

  .board-history-time .console-select-chevron { width: 12px; }
}

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