:root {
  --mq-ink: #121c19;
  --mq-ink-secondary: #3d4f4a;
  --mq-ink-muted: #667874;
  --mq-accent: #1a6458;
  --mq-accent-hover: #1f7567;
  --mq-accent-soft: rgba(26, 100, 88, 0.11);
  --mq-accent-glow: rgba(26, 100, 88, 0.18);
  --mq-surface: rgba(255, 255, 255, 0.58);
  --mq-surface-strong: rgba(255, 255, 255, 0.74);
  --mq-surface-muted: rgba(255, 255, 255, 0.34);
  --mq-glass-border: rgba(255, 255, 255, 0.78);
  --mq-glass-edge: rgba(20, 48, 42, 0.06);
  --mq-shadow-soft:
    0 1px 2px rgba(18, 38, 34, 0.04),
    0 10px 36px rgba(18, 38, 34, 0.07);
  --mq-shadow-lift:
    0 2px 6px rgba(18, 38, 34, 0.06),
    0 18px 52px rgba(18, 38, 34, 0.11);
  --mq-radius-sm: 8px;
  --mq-radius-md: 12px;
  --mq-radius-lg: 16px;
  --mq-radius-xl: 20px;
  --mq-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --mq-fluid-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--mq-ink);
  background: #e6eee9;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

html,
body,
#root {
  height: 100%;
  min-height: 0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 8% 0%, rgba(168, 214, 196, 0.28), transparent 55%),
    radial-gradient(ellipse 70% 55% at 92% 8%, rgba(186, 198, 232, 0.22), transparent 52%),
    radial-gradient(ellipse 60% 50% at 50% 100%, rgba(210, 228, 218, 0.2), transparent 58%),
    linear-gradient(160deg, #e8f0ec 0%, #e4eaf2 48%, #e6eee9 100%);
}

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

button {
  border: 0;
  cursor: pointer;
  color: inherit;
  background: rgba(255, 255, 255, 0.42);
  transition:
    background 160ms var(--mq-ease),
    box-shadow 160ms var(--mq-ease),
    color 160ms var(--mq-ease),
    transform 160ms var(--mq-ease);
}

button:hover {
  background: rgba(255, 255, 255, 0.72);
}

button:active {
  transform: scale(0.98);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(26, 100, 88, 0.38);
  outline-offset: 2px;
}

button svg {
  flex: none;
}

input,
select,
textarea {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--mq-ink);
  background: rgba(255, 255, 255, 0.62);
  border-radius: var(--mq-radius-md);
  padding: 10px 12px;
  box-shadow: inset 0 0 0 1px var(--mq-glass-edge);
  transition:
    box-shadow 160ms var(--mq-ease),
    background 160ms var(--mq-ease);
}

input:focus,
select:focus,
textarea:focus {
  background: rgba(255, 255, 255, 0.82);
  box-shadow:
    inset 0 0 0 1px rgba(26, 100, 88, 0.18),
    0 0 0 3px rgba(26, 100, 88, 0.08);
}

select {
  min-height: 40px;
  cursor: pointer;
}

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

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 312px) 1fr;
  gap: 14px;
  height: 100dvh;
  min-height: 0;
  max-height: 100dvh;
  overflow: hidden;
  padding: 14px;
}

.glass {
  background: var(--mq-surface);
  -webkit-backdrop-filter: blur(28px) saturate(1.35);
  backdrop-filter: blur(28px) saturate(1.35);
  border: 1px solid var(--mq-glass-border);
  box-shadow: var(--mq-shadow-soft);
}

.sidebar,
.workspace-header,
.primary-panel {
  border-radius: var(--mq-radius-xl);
}

.sidebar {
  position: relative;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  min-height: 0;
  padding: 14px;
  max-height: calc(100vh - 28px);
  overflow: hidden;
}

.explorer-zone {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 9px;
  min-height: 0;
  flex: 1;
}

.sidebar-bottom {
  display: grid;
  gap: 8px;
  flex: none;
  margin-top: auto;
  max-height: min(42vh, 320px);
  overflow: auto;
}

.brand-row,
.workspace-header,
.panel-toolbar,
.section-title,
.candidate-head,
.row-actions,
.header-actions,
.brand-actions,
.folder-title-row,
.tree-node,
.tree-label,
.editor-title-row,
.tag-input-row,
.editable-tag-row button,
.compact-input,
.context-menu button,
.icon-label,
.search-field {
  display: flex;
  align-items: center;
}

.brand-row,
.workspace-header,
.section-title {
  justify-content: space-between;
  gap: 12px;
}

.brand-actions,
.folder-title-row {
  gap: 10px;
  min-width: 0;
}

.brand-title {
  min-width: 0;
}

.home-nav-button {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  border-radius: 12px;
  color: var(--mq-ink-secondary);
  background: rgba(255, 255, 255, 0.48);
}

.home-nav-button:hover {
  background: rgba(255, 255, 255, 0.68);
}

.home-nav-button:hover,
.home-nav-button.selected,
.home-toggle-button.selected {
  color: var(--mq-accent);
  background: rgba(255, 255, 255, 0.72);
}

.sidebar-cloud-status {
  display: flex;
  min-width: 0;
}

.sidebar-cloud-status .status-pill {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
}

.folder-title-copy {
  min-width: 0;
}

.folder-title-copy h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.explorer-toggle-button,
.explorer-close-button,
.home-toggle-button {
  display: none;
}

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

.tab-label {
  display: none;
}

.brand-row h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--mq-ink-muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1,
h2 {
  margin-bottom: 0;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.375rem;
  font-weight: 650;
}

.status-pill {
  flex: none;
  border-radius: 999px;
  padding: 5px 9px;
  color: #24564d;
  background: rgba(186, 228, 214, 0.55);
  box-shadow: inset 0 0 0 1px rgba(26, 100, 88, 0.08);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.archive-pill {
  color: #6f4035;
  background: rgba(244, 218, 208, 0.72);
  box-shadow: inset 0 0 0 1px rgba(111, 64, 53, 0.08);
}

.danger-pill {
  color: #7a2f36;
  background: rgba(248, 222, 225, 0.78);
  box-shadow: inset 0 0 0 1px rgba(122, 47, 54, 0.1);
}

.notice {
  border-radius: var(--mq-radius-lg);
  padding: 10px 12px;
  font-size: 0.84rem;
  background: rgba(255, 255, 255, 0.52);
  box-shadow: inset 0 0 0 1px var(--mq-glass-edge);
}

.danger,
.quiet-danger {
  color: #7a2f36;
}

.auth-card {
  display: grid;
  gap: 8px;
  border-radius: var(--mq-radius-lg);
  padding: 10px;
  background: rgba(255, 255, 255, 0.42);
  box-shadow: inset 0 0 0 1px rgba(20, 48, 42, 0.05);
}

.auth-card.signed-in {
  background: rgba(218, 241, 233, 0.54);
}

.auth-state-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.auth-state-row > div {
  min-width: 0;
}

.auth-state-row svg {
  color: var(--mq-accent);
}

.auth-state-row strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--mq-ink);
  font-size: 0.88rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-card input {
  min-height: 36px;
  border-radius: var(--mq-radius-sm);
  padding: 8px 10px;
  font-size: 0.84rem;
}

.auth-note {
  margin: 0;
  color: var(--mq-ink-muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
}

.auth-actions button,
.auth-wide-button {
  min-height: 36px;
  border-radius: 999px;
}

button:disabled {
  cursor: default;
  opacity: 0.58;
  transform: none;
}

.section-title {
  display: inline-flex;
  gap: 6px;
  color: var(--mq-ink-secondary);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.explorer-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.folder-search {
  min-width: 0;
  min-height: 36px;
  padding: 0 9px;
}

.folder-search input {
  min-height: 36px;
  padding: 7px 4px;
  background: transparent;
  box-shadow: none;
  font-size: 0.84rem;
}

.folder-search input:focus,
.folder-search input:focus-visible {
  outline: 0;
  background: transparent;
  box-shadow: none;
}

.new-folder-button,
.settings-launch {
  width: 34px;
  min-width: 34px;
  height: 34px;
  color: var(--mq-ink-secondary);
  background: rgba(255, 255, 255, 0.54);
}

.explorer-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 2px 2px 0;
}

.explorer-head .section-title {
  justify-content: flex-start;
  min-width: 0;
}

.tiny-count {
  min-width: 0;
  overflow: hidden;
  color: var(--mq-ink-muted);
  font-size: 0.72rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-list {
  position: relative;
  display: grid;
  align-content: start;
  gap: 1px;
  min-height: 0;
  overflow: auto;
  overflow-x: hidden;
  border-radius: var(--mq-radius-md);
  padding: 4px;
  background: var(--mq-surface-muted);
  box-shadow: inset 0 0 0 1px rgba(20, 48, 42, 0.04);
}

.user-dock {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
  border-radius: var(--mq-radius-lg);
  padding: 8px;
  background: rgba(255, 255, 255, 0.44);
  box-shadow: inset 0 0 0 1px rgba(20, 48, 42, 0.05);
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--mq-accent);
  background: rgba(186, 228, 214, 0.48);
}

.user-copy {
  min-width: 0;
}

.user-copy span {
  display: block;
  color: var(--mq-ink-muted);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.user-copy strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--mq-ink);
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-group {
  display: grid;
  gap: 2px;
}

.tree-node {
  gap: 2px;
  width: 100%;
  min-width: 0;
  min-height: 30px;
  border-radius: var(--mq-radius-sm);
  color: var(--mq-ink);
}

.tree-toggle,
.icon-button {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  min-width: 26px;
  height: 26px;
  border-radius: 7px;
  padding: 0;
  background: transparent;
  color: var(--mq-ink-muted);
}

.tree-toggle:hover,
.icon-button:hover {
  background: rgba(255, 255, 255, 0.55);
  color: var(--mq-ink-secondary);
  transform: none;
}

.explorer-toggle-button,
.explorer-close-button,
.home-toggle-button {
  display: none;
}

.tree-label,
.folder-node {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-width: 0;
  min-height: 30px;
  border-radius: 7px;
  padding: 4px 7px;
  text-align: left;
  background: transparent;
  font-size: 0.86rem;
  font-weight: 500;
}

.folder-node {
  padding-left: 6px;
}

.folder-row {
  display: flex;
  align-items: center;
  min-width: 0;
  padding-left: calc(var(--depth, 0) * 14px);
  transition: background 140ms var(--mq-ease);
}

.folder-row:hover {
  background: rgba(255, 255, 255, 0.38);
}

.tree-node.selected {
  background: var(--mq-accent-soft);
  box-shadow: inset 0 0 0 1px rgba(26, 100, 88, 0.1);
}

.tree-node.selected .folder-node {
  color: #134840;
  font-weight: 600;
}

.folder-tree-group,
.folder-children {
  display: grid;
  gap: 1px;
}

.tree-spacer {
  flex: none;
  width: 26px;
  min-width: 26px;
  height: 26px;
}

.tree-node span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-node small {
  flex: none;
  min-width: 20px;
  margin-left: auto;
  color: var(--mq-ink-muted);
  font-size: 0.68rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.tree-empty {
  border-radius: var(--mq-radius-sm);
  padding: 14px 12px;
  color: var(--mq-ink-muted);
  background: rgba(255, 255, 255, 0.38);
  font-size: 0.84rem;
  line-height: 1.4;
}

.row-kebab {
  width: 24px;
  min-width: 24px;
  opacity: 0;
  transition: opacity 140ms var(--mq-ease);
}

.folder-row:hover .row-kebab,
.folder-row.selected .row-kebab {
  opacity: 1;
}

.tree-rename {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px 28px;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.tree-rename input {
  min-height: 28px;
  border-radius: 7px;
  padding: 4px 7px;
  font-size: 0.84rem;
}

.context-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
}

.context-menu {
  position: fixed;
  z-index: 81;
  display: grid;
  gap: 2px;
  min-width: 196px;
  padding: 6px;
  border-radius: var(--mq-radius-md);
  background: rgba(252, 254, 253, 0.88);
  -webkit-backdrop-filter: blur(32px) saturate(1.4);
  backdrop-filter: blur(32px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--mq-shadow-lift);
}

.context-menu button {
  gap: 8px;
  min-height: 32px;
  justify-content: flex-start;
  border-radius: 7px;
  padding: 6px 9px;
  background: transparent;
  font-size: 0.84rem;
  font-weight: 500;
}

.context-menu button:hover {
  background: rgba(26, 100, 88, 0.08);
  transform: none;
}

.danger-action {
  color: #7a2f36;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(24, 42, 38, 0.32);
  -webkit-backdrop-filter: blur(14px) saturate(1.05);
  backdrop-filter: blur(14px) saturate(1.05);
  animation: fade-in 160ms var(--mq-ease);
}

.modal-card,
.settings-modal {
  width: min(100%, 440px);
  border-radius: var(--mq-radius-xl);
  background: rgba(250, 253, 252, 0.94);
  animation: modal-in 180ms var(--mq-ease);
}

.modal-card {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.folder-modal {
  max-width: 420px;
}

.folder-modal .modal-actions button {
  display: grid;
  place-items: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
}

.folder-modal .modal-actions .primary-action {
  border-radius: var(--mq-radius-md);
}

.auth-required-modal {
  max-width: 460px;
}

.auth-required-modal .auth-card {
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.auth-required-copy {
  margin: 0;
  color: var(--mq-ink-secondary);
  font-size: 0.92rem;
  line-height: 1.45;
}

.modal-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.settings-modal {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  width: min(100%, 720px);
  max-width: 720px;
  min-height: 430px;
  overflow: hidden;
}

.candidate-modal {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 12px;
  width: min(100%, 980px);
  max-height: min(86vh, 820px);
  border-radius: var(--mq-radius-xl);
  padding: 18px;
  background: rgba(250, 253, 252, 0.985);
  box-shadow:
    0 28px 80px rgba(18, 38, 34, 0.28),
    inset 0 0 0 1px rgba(255, 255, 255, 0.72);
  animation: modal-in 180ms var(--mq-ease);
}

.candidate-modal-toolbar,
.candidate-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.candidate-modal-toolbar {
  justify-content: space-between;
}

.candidate-modal-actions {
  justify-content: flex-end;
}

.candidate-modal-list {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.settings-tabs {
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 16px;
  background: rgba(235, 244, 240, 0.82);
  box-shadow: inset -1px 0 0 rgba(20, 48, 42, 0.06);
}

.settings-title {
  margin-bottom: 8px;
}

.settings-tab {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 36px;
  border-radius: var(--mq-radius-md);
  padding: 8px 10px;
  background: transparent;
  color: var(--mq-ink-secondary);
  font-size: 0.88rem;
  font-weight: 600;
}

.settings-tab:hover,
.settings-tab.selected {
  background: rgba(255, 255, 255, 0.68);
  color: var(--mq-accent);
  transform: none;
}

.settings-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
  padding: 18px;
  min-width: 0;
  background: rgba(250, 253, 252, 0.72);
}

.settings-form {
  display: grid;
  align-content: start;
  gap: 14px;
}

.settings-field {
  display: grid;
  gap: 7px;
  color: var(--mq-ink-secondary);
  font-size: 0.8rem;
  font-weight: 650;
}

.settings-field input {
  min-height: 42px;
}

.settings-status-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-radius: var(--mq-radius-lg);
  padding: 10px;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 0 0 1px rgba(20, 48, 42, 0.05);
}

.settings-status-row svg {
  color: var(--mq-accent);
}

.settings-status-row span {
  display: block;
  color: var(--mq-ink-muted);
  font-size: 0.72rem;
  font-weight: 650;
}

.settings-status-row strong {
  display: block;
  color: var(--mq-ink);
  font-size: 0.9rem;
}

.settings-signout {
  justify-self: start;
}

.settings-inline-action {
  min-height: 34px;
  padding: 0 12px;
}

.settings-actions {
  padding-top: 4px;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.header-actions button,
.row-actions button,
.candidate-head button,
.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  border-radius: var(--mq-radius-md);
  padding: 8px 11px;
  font-weight: 550;
}

.workspace {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
  height: 100%;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.workspace.home-workspace {
  grid-template-rows: minmax(0, 1fr);
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}

.header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.panel-tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.32);
  box-shadow: inset 0 0 0 1px rgba(20, 48, 42, 0.05);
}

.fluid-panel-tabs {
  position: relative;
  gap: 0;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.05),
    inset 0 -2px 6px rgba(255, 255, 255, 0.78);
  overflow: hidden;
}

.fluid-tab-thumb {
  position: absolute;
  top: 6px;
  bottom: 6px;
  width: calc((100% - 12px) / 4);
  border-radius: 999px;
  background: linear-gradient(180deg, #1f7567 0%, var(--mq-accent) 100%);
  box-shadow: 0 4px 12px rgba(26, 100, 88, 0.34);
  pointer-events: none;
  z-index: 0;
  transition: left 0.52s var(--mq-fluid-ease);
}

.fluid-panel-tabs--cards .fluid-tab-thumb {
  left: 6px;
  animation: fluid-tab-stretch 0.52s var(--mq-fluid-ease);
}

.fluid-panel-tabs--study .fluid-tab-thumb {
  left: calc(6px + (100% - 12px) / 4);
  animation: fluid-tab-stretch 0.52s var(--mq-fluid-ease);
}

.fluid-panel-tabs--ai .fluid-tab-thumb {
  left: calc(6px + 2 * (100% - 12px) / 4);
  animation: fluid-tab-stretch 0.52s var(--mq-fluid-ease);
}

.fluid-panel-tabs--stats .fluid-tab-thumb {
  left: calc(6px + 3 * (100% - 12px) / 4);
  animation: fluid-tab-stretch 0.52s var(--mq-fluid-ease);
}

@keyframes fluid-tab-stretch {
  0%,
  100% {
    transform: scaleX(1);
    border-radius: 999px;
  }

  45% {
    transform: scaleX(1.14);
    border-radius: 18px;
  }
}

.fluid-panel-tabs .tab-button {
  position: relative;
  z-index: 1;
  flex: 1;
  background: transparent;
  box-shadow: none;
  border-radius: 999px;
}

.fluid-panel-tabs .tab-button:hover {
  background: transparent;
  transform: none;
}

.fluid-panel-tabs .tab-button.selected {
  color: #f6fffc;
  background: transparent;
  box-shadow: none;
}

.fluid-panel-tabs .tab-button.selected:hover {
  color: #f6fffc;
  background: transparent;
}

.tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 36px;
  border-radius: 10px;
  padding: 0 10px;
  background: transparent;
  color: var(--mq-ink-muted);
}

.tab-button:hover {
  background: rgba(255, 255, 255, 0.55);
  transform: none;
}

.tab-button.selected {
  color: var(--mq-accent);
  background: rgba(255, 255, 255, 0.88);
  box-shadow:
    0 1px 2px rgba(18, 38, 34, 0.06),
    inset 0 0 0 1px rgba(255, 255, 255, 0.9);
}

.tab-button.selected:hover {
  background: rgba(255, 255, 255, 0.92);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
  overflow: hidden;
}

.primary-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 16px;
  overflow: hidden;
}

.home-page {
  display: grid;
  align-content: center;
  gap: 16px;
  height: 100%;
  min-height: 0;
  overflow: auto;
  padding: 14px;
  scrollbar-gutter: stable;
}

.home-welcome {
  display: grid;
  gap: 12px;
  align-items: start;
  border-radius: var(--mq-radius-lg);
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(222, 244, 239, 0.78), rgba(237, 242, 255, 0.62)),
    rgba(255, 255, 255, 0.42);
  box-shadow: inset 0 0 0 1px var(--mq-glass-edge);
}

.home-welcome-copy {
  max-width: 720px;
}

.home-welcome h3,
.home-area-card h4,
.home-window h3,
.tutorial-copy h4,
.future-card h4 {
  margin: 0;
  letter-spacing: 0;
}

.home-welcome h3 {
  font-size: 2rem;
  line-height: 1.05;
}

.home-welcome p:not(.eyebrow),
.home-area-card p:not(.eyebrow),
.tutorial-copy p,
.future-card p {
  margin: 8px 0 0;
  color: var(--mq-ink-muted);
  line-height: 1.45;
}

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

.home-area-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 188px;
  border-radius: var(--mq-radius-lg);
  padding: 18px;
  text-align: left;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 0 0 1px var(--mq-glass-edge);
}

.home-area-card:hover {
  background: rgba(255, 255, 255, 0.72);
  transform: translateY(-1px);
}

.home-area-card h4 {
  color: var(--mq-ink);
  font-size: 1.05rem;
}

.home-area-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: var(--mq-ink-secondary);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 0 0 1px rgba(20, 48, 42, 0.04);
}

.home-window {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  width: min(100%, 1040px);
  max-height: min(88vh, 820px);
  border-radius: var(--mq-radius-xl);
  padding: 22px;
  background: #fafdfe;
  box-shadow:
    0 30px 80px rgba(18, 38, 34, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.78);
  animation: modal-in 180ms var(--mq-ease);
}

.home-window-backdrop {
  background: rgba(24, 42, 38, 0.38);
}

.home-window-body {
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
  scrollbar-gutter: stable;
}

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

.tutorial-card {
  display: grid;
  grid-template-columns: minmax(140px, 0.9fr) minmax(0, 1fr);
  min-height: 178px;
  overflow: hidden;
  border-radius: var(--mq-radius-lg);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 0 0 1px var(--mq-glass-edge);
}

.tutorial-card img {
  width: 100%;
  height: 100%;
  min-height: 178px;
  object-fit: cover;
  object-position: top left;
  background: rgba(230, 238, 233, 0.68);
}

.tutorial-copy {
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 16px;
}

.step-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: var(--mq-accent);
  background: rgba(186, 228, 214, 0.62);
  font-size: 0.78rem;
  font-weight: 850;
}

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

.future-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-height: 132px;
  border-radius: var(--mq-radius-lg);
  padding: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 0 0 1px var(--mq-glass-edge);
}

.future-card svg {
  color: var(--mq-ink-muted);
}

.cards-panel,
.study-wrap,
.stats-page {
  min-height: 0;
  height: 100%;
}

.study-wrap,
.stats-page {
  overflow: auto;
  scrollbar-gutter: stable;
}

.cards-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-editor-panel {
  display: grid;
  flex: none;
  gap: 14px;
  margin-bottom: 14px;
  border-radius: var(--mq-radius-xl);
  padding: 16px;
  max-height: min(42vh, 380px);
  overflow: auto;
  background: var(--mq-surface-strong);
  box-shadow:
    inset 0 0 0 1px var(--mq-glass-edge),
    0 8px 28px rgba(18, 38, 34, 0.04);
}

.editor-title-row {
  justify-content: space-between;
  gap: 12px;
}

.editor-title-row h3 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

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

.editor-field,
.tag-editor {
  display: grid;
  gap: 7px;
}

.editor-field span,
.tag-editor .section-title {
  color: var(--mq-ink-secondary);
  font-size: 0.8rem;
  font-weight: 650;
}

.editor-field textarea {
  min-height: 128px;
}

.tag-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 8px;
}

.tag-input-row button {
  display: grid;
  place-items: center;
  min-height: 40px;
  border-radius: var(--mq-radius-md);
}

.editable-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.editable-tag-row button {
  gap: 5px;
  border-radius: 999px;
  padding: 5px 9px;
  color: #2a524b;
  background: rgba(186, 228, 214, 0.58);
  box-shadow: inset 0 0 0 1px rgba(26, 100, 88, 0.06);
  font-size: 0.74rem;
  font-weight: 650;
}

.editor-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 2px;
}

.panel-toolbar {
  flex: none;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-toolbar.center {
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  padding: 5px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.36);
  box-shadow: inset 0 0 0 1px var(--mq-glass-edge);
}

.panel-toolbar.center > button:first-child {
  color: var(--mq-ink-secondary);
  background: transparent;
  font-weight: 600;
}

.panel-toolbar.center > button:first-child:hover {
  background: rgba(255, 255, 255, 0.55);
}

.mode-banner {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  border-radius: var(--mq-radius-lg);
  padding: 12px 14px;
  background: rgba(228, 244, 238, 0.55);
  box-shadow: inset 0 0 0 1px rgba(26, 100, 88, 0.06);
}

.mode-banner.archive-mode {
  background: rgba(248, 234, 228, 0.62);
  box-shadow: inset 0 0 0 1px rgba(111, 64, 53, 0.06);
}

.mode-banner-copy,
.mode-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mode-banner-copy h3 {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.mode-banner-copy svg {
  color: var(--mq-accent);
  flex: none;
}

.archive-mode .mode-banner-copy svg {
  color: #8a4b3d;
}

.mode-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mode-switch,
.mode-actions button {
  min-width: 0;
}

.search-field {
  gap: 8px;
  width: min(100%, 360px);
  border-radius: 14px;
  padding: 0 12px 0 11px;
  min-height: 40px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 0 0 1px var(--mq-glass-edge);
  color: var(--mq-ink-muted);
}

.search-field .search-input {
  background: transparent;
  box-shadow: none;
  padding-left: 0;
  min-height: 38px;
}

.search-input {
  max-width: 360px;
}

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

.card-list {
  display: grid;
  align-content: start;
  flex: 1 1 auto;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
  scrollbar-gutter: stable;
}

.cards-panel > .empty-state {
  flex: 1 1 auto;
  min-height: 0;
}

.flashcard-row,
.candidate-row,
.empty-state {
  border-radius: var(--mq-radius-xl);
  background: rgba(255, 255, 255, 0.46);
  box-shadow: inset 0 0 0 1px var(--mq-glass-edge);
  transition:
    background 160ms var(--mq-ease),
    box-shadow 160ms var(--mq-ease),
    transform 160ms var(--mq-ease);
}

.flashcard-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 14px 16px;
}

.flashcard-row:hover {
  background: rgba(255, 255, 255, 0.62);
  box-shadow:
    inset 0 0 0 1px rgba(26, 100, 88, 0.08),
    0 6px 20px rgba(18, 38, 34, 0.04);
}

.card-front {
  margin-bottom: 6px;
  font-weight: 650;
  font-size: 0.96rem;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.card-back {
  margin-bottom: 10px;
  color: var(--mq-ink-secondary);
  font-size: 0.9rem;
  line-height: 1.45;
}

.rich-text {
  display: grid;
  gap: 0.55em;
  min-width: 0;
}

.rich-text > * {
  margin: 0;
}

.rich-text ul,
.rich-text ol {
  display: grid;
  gap: 0.28em;
  padding-left: 1.25em;
}

.rich-text table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: var(--mq-radius-md);
  font-size: 0.86rem;
}

.rich-text th,
.rich-text td {
  border: 1px solid rgba(20, 48, 42, 0.08);
  padding: 7px 9px;
  text-align: left;
  vertical-align: top;
}

.rich-text th {
  background: rgba(186, 228, 214, 0.36);
}

.rich-text code {
  border-radius: 6px;
  padding: 0.08em 0.35em;
  background: rgba(236, 246, 242, 0.9);
  color: #184a41;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88em;
}

.rich-text pre {
  overflow: auto;
  border-radius: var(--mq-radius-md);
  padding: 10px;
  background: rgba(236, 246, 242, 0.72);
}

.rich-text blockquote {
  border-left: 3px solid rgba(26, 100, 88, 0.22);
  padding-left: 10px;
  color: var(--mq-ink-secondary);
}

.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag-row span {
  border-radius: 999px;
  padding: 3px 8px;
  color: #2f524b;
  background: rgba(186, 228, 214, 0.52);
  box-shadow: inset 0 0 0 1px rgba(26, 100, 88, 0.05);
  font-size: 0.72rem;
  font-weight: 650;
}

.row-actions {
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 4px;
  min-width: 118px;
}

.row-actions button {
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 10px;
  color: var(--mq-ink-muted);
  background: transparent;
}

.row-actions button:hover {
  background: rgba(255, 255, 255, 0.72);
  color: var(--mq-ink-secondary);
  transform: none;
}

.row-actions small {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  border-radius: 999px;
  color: #2f524b;
  background: rgba(186, 228, 214, 0.52);
  box-shadow: inset 0 0 0 1px rgba(26, 100, 88, 0.06);
  font-size: 0.76rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.primary-action {
  color: #f6fffc;
  background: linear-gradient(180deg, #1f7567 0%, var(--mq-accent) 100%);
  border-radius: 999px;
  box-shadow:
    0 1px 2px rgba(18, 38, 34, 0.08),
    0 8px 22px var(--mq-accent-glow);
  font-weight: 600;
}

.icon-label {
  gap: 6px;
}

.primary-action:hover {
  background: linear-gradient(180deg, #228877 0%, var(--mq-accent-hover) 100%);
  transform: none;
}

.primary-action:active {
  transform: scale(0.98);
}

.ghost {
  background: rgba(255, 255, 255, 0.38);
  color: var(--mq-ink-secondary);
  font-weight: 550;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 36px 28px;
  text-align: center;
}

.empty-state h3 {
  margin-bottom: 6px;
  font-size: 1.02rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.empty-state p {
  max-width: 300px;
  margin-bottom: 0;
  color: var(--mq-ink-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 14px;
  color: var(--mq-ink-muted);
  font-size: 0.86rem;
}

.meta-grid strong {
  color: var(--mq-ink);
}

.ai-primary-panel {
  display: grid;
  height: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.ai-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0;
  height: 100%;
  min-height: 0;
  max-height: none;
}

.ai-chat-scroll {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding: 18px 18px 14px;
}

.ai-empty-chat {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  max-width: 560px;
  margin: 7vh auto 0;
  border-radius: var(--mq-radius-xl);
  padding: 16px;
  background: rgba(255, 255, 255, 0.38);
  box-shadow: inset 0 0 0 1px var(--mq-glass-edge);
}

.ai-empty-chat h3 {
  margin-bottom: 4px;
  font-size: 1rem;
}

.ai-empty-chat p:not(.eyebrow) {
  margin-bottom: 0;
  color: var(--mq-ink-muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.ai-chat-composer-spotlight {
  position: relative;
  margin: 0 18px 18px;
  padding: 2px;
  border-radius: 34px;
  overflow: hidden;
  isolation: isolate;
  background: rgba(20, 48, 42, 0.06);
}

.ai-chat-composer-spotlight::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200%;
  height: 200%;
  transform: translate(-50%, -50%);
  background: conic-gradient(
    from var(--mq-spotlight-angle),
    transparent 70%,
    var(--mq-accent) 85%,
    #34d399 100%
  );
  animation: mq-spotlight-spin 4s linear infinite;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 0;
}

.ai-chat-composer-spotlight:hover::before,
.ai-chat-composer-spotlight:focus-within::before {
  opacity: 1;
}

@property --mq-spotlight-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

@keyframes mq-spotlight-spin {
  to {
    --mq-spotlight-angle: 360deg;
  }
}

.ai-chat-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 1;
  margin: 0;
  border-radius: 32px;
  padding: 11px 13px 11px 18px;
  min-height: 94px;
  background: #fafdfc;
  box-shadow:
    0 16px 44px rgba(18, 38, 34, 0.13),
    inset 0 0 0 1px rgba(20, 48, 42, 0.05);
}

.ai-composer-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.ai-chat-input {
  display: block;
  width: 100%;
  min-height: 34px;
  max-height: 172px;
  border-radius: 16px;
  padding: 7px 2px;
  background: transparent;
  box-shadow: none;
  font-size: 1.04rem;
  line-height: 1.35;
  overflow-y: hidden;
  resize: none;
}

.ai-chat-input:focus {
  outline: none;
  background: transparent;
  box-shadow: none;
}

.ai-chat-input::placeholder {
  color: rgba(61, 79, 74, 0.72);
}

.ai-composer-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.model-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 220px;
  min-height: 32px;
  border-radius: 999px;
  padding: 0 11px;
  color: var(--mq-ink);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(235, 240, 238, 0.88));
  box-shadow:
    inset 0 0 0 1px rgba(20, 48, 42, 0.05),
    0 7px 16px rgba(18, 38, 34, 0.08);
  cursor: pointer;
}

.model-chip-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  color: #d34586;
  background: rgba(255, 225, 239, 0.92);
}

.model-chip > svg {
  color: var(--mq-ink-muted);
}

.model-chip-label {
  min-width: 0;
  overflow: hidden;
  color: var(--mq-ink);
  font-size: 0.84rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-chip-icon svg {
  color: #d34586;
}

.model-chip select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  background: transparent;
  cursor: pointer;
}

.composer-card-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  border-radius: 999px;
  padding: 0 12px;
  color: var(--mq-ink-muted);
  background: rgba(238, 242, 240, 0.78);
  box-shadow: inset 0 0 0 1px rgba(20, 48, 42, 0.05);
  font-size: 0.82rem;
  font-weight: 750;
}

.composer-card-toggle svg {
  color: var(--mq-accent);
}

.composer-card-toggle.selected {
  color: var(--mq-accent-deep);
  background: rgba(190, 232, 217, 0.82);
  box-shadow:
    inset 0 0 0 1px rgba(26, 100, 88, 0.12),
    0 8px 18px rgba(26, 100, 88, 0.08);
}

.composer-coverage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  min-height: 32px;
  border-radius: 999px;
  padding: 3px;
  background: rgba(238, 242, 240, 0.78);
  box-shadow: inset 0 0 0 1px rgba(20, 48, 42, 0.05);
}

.composer-coverage .segment-option {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
}

.composer-count {
  width: 64px;
  min-height: 32px;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.84rem;
  font-weight: 650;
}

.ai-send-button {
  display: grid;
  place-items: center;
  width: 54px;
  min-width: 54px;
  height: 54px;
  border-radius: 50%;
  color: #ffffff;
  background:
    radial-gradient(circle at 40% 30%, rgba(161, 233, 255, 0.9), transparent 36%),
    linear-gradient(180deg, #2cb8ff 0%, #1379e6 100%);
  box-shadow:
    0 8px 18px rgba(19, 121, 230, 0.28),
    inset 0 0 0 2px rgba(255, 255, 255, 0.62);
}

.ai-send-button:hover {
  color: #ffffff;
  background:
    radial-gradient(circle at 40% 30%, rgba(189, 241, 255, 0.96), transparent 36%),
    linear-gradient(180deg, #39c4ff 0%, #126fe0 100%);
}

.ai-send-button:disabled {
  color: rgba(61, 79, 74, 0.52);
  background: rgba(238, 242, 240, 0.92);
  box-shadow: inset 0 0 0 1px rgba(20, 48, 42, 0.06);
}

.ai-accept-row {
  display: flex;
  justify-content: flex-end;
}

.ai-chat-cards {
  padding-bottom: 4px;
}

.candidate-pack-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: min(680px, 88%);
  justify-self: start;
  border-radius: 18px;
  padding: 13px 14px;
  text-align: left;
  color: var(--mq-ink);
  background: rgba(255, 255, 255, 0.54);
  box-shadow: inset 0 0 0 1px var(--mq-glass-edge);
  animation: rise-in 200ms var(--mq-ease) both;
}

.candidate-pack-card:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.68);
  box-shadow:
    inset 0 0 0 1px rgba(26, 100, 88, 0.1),
    0 10px 28px rgba(18, 38, 34, 0.08);
}

.candidate-pack-card.pending {
  cursor: default;
  background: rgba(222, 241, 236, 0.54);
}

.candidate-pack-card.pending:hover {
  transform: none;
  background: rgba(222, 241, 236, 0.54);
  box-shadow: inset 0 0 0 1px rgba(26, 100, 88, 0.08);
}

.candidate-pack-card h3 {
  margin: 0 0 2px;
  font-size: 0.98rem;
}

.candidate-pack-card p:not(.eyebrow) {
  margin: 0;
  color: var(--mq-ink-muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

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

.ai-message {
  display: grid;
  gap: 5px;
  width: min(680px, 88%);
  border-radius: 18px;
  padding: 12px 14px;
  animation: rise-in 200ms var(--mq-ease) both;
}

.ai-message span {
  color: var(--mq-ink-muted);
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
}

.ai-message .rich-text {
  color: var(--mq-ink);
  font-size: 0.9rem;
  line-height: 1.45;
}

.ai-message.user {
  justify-self: end;
  background: rgba(26, 100, 88, 0.12);
  box-shadow: inset 0 0 0 1px rgba(26, 100, 88, 0.08);
}

.ai-message.assistant {
  justify-self: start;
  background: rgba(255, 255, 255, 0.48);
  box-shadow: inset 0 0 0 1px var(--mq-glass-edge);
}

.ai-message.streaming {
  border: 1px solid rgba(26, 100, 88, 0.08);
}

.ai-live-stream {
  display: grid;
  gap: 10px;
}

.ai-stream-panel {
  display: grid;
  gap: 8px;
  width: min(680px, 88%);
  justify-self: start;
  border-radius: 18px;
  padding: 12px 14px;
  background: rgba(222, 241, 236, 0.54);
  box-shadow: inset 0 0 0 1px rgba(26, 100, 88, 0.08);
  animation: rise-in 200ms var(--mq-ease) both;
}

.ai-stream-head {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #24564d;
  font-size: 0.74rem;
  font-weight: 750;
  text-transform: uppercase;
}

.ai-stream-panel .rich-text {
  max-height: 150px;
  overflow: auto;
  color: var(--mq-ink-secondary);
  font-size: 0.82rem;
  line-height: 1.45;
}

.ai-reasoning-details {
  width: min(680px, 88%);
  justify-self: start;
  border-radius: 16px;
  background: rgba(222, 241, 236, 0.48);
  box-shadow: inset 0 0 0 1px rgba(26, 100, 88, 0.08);
  overflow: hidden;
  animation: rise-in 200ms var(--mq-ease) both;
}

.ai-reasoning-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  color: #24564d;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 750;
  text-transform: uppercase;
  list-style: none;
}

.ai-reasoning-details summary::-webkit-details-marker {
  display: none;
}

.ai-reasoning-details summary svg {
  transition: transform 160ms var(--mq-ease);
}

.ai-reasoning-details[open] summary svg {
  transform: rotate(180deg);
}

.ai-reasoning-body {
  max-height: 220px;
  overflow: auto;
  padding: 0 12px 12px;
  color: var(--mq-ink-secondary);
  font-size: 0.82rem;
  line-height: 1.45;
}

.typing-line {
  margin: 0;
  color: var(--mq-ink-muted);
  font-size: 0.88rem;
}

.ai-progress-card,
.area-panel,
.metric-tile {
  border-radius: var(--mq-radius-lg);
  background: rgba(255, 255, 255, 0.4);
  box-shadow: inset 0 0 0 1px var(--mq-glass-edge);
}

.mini-field,
.model-field,
.coverage-field {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 6px;
  color: var(--mq-ink-secondary);
  font-size: 0.84rem;
  font-weight: 650;
}

.mini-field span,
.model-field span,
.coverage-field > span,
.ai-comment-field span {
  min-height: 18px;
  line-height: 1.2;
}

.coverage-field small {
  color: var(--mq-ink-muted);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.2;
}

.coverage-segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  min-height: 40px;
  border-radius: var(--mq-radius-md);
  padding: 3px;
  background: rgba(255, 255, 255, 0.48);
  box-shadow: inset 0 0 0 1px var(--mq-glass-edge);
}

.segment-option {
  border-radius: 9px;
  padding: 8px 10px;
  color: var(--mq-ink-secondary);
  font-size: 0.84rem;
  font-weight: 650;
  background: transparent;
}

.segment-option:hover {
  transform: none;
}

.segment-option.selected,
.segment-option.selected:hover {
  color: #134840;
  background: rgba(186, 228, 214, 0.62);
  box-shadow: inset 0 0 0 1px rgba(26, 100, 88, 0.08);
}

.coverage-number {
  min-height: 40px;
  border-radius: var(--mq-radius-md);
  padding: 10px 12px;
}

.ai-generate-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  align-self: end;
  min-height: 40px;
  border-radius: var(--mq-radius-md);
  padding: 10px 14px;
  white-space: nowrap;
}

.provider-note {
  margin: 0;
  color: var(--mq-ink-muted);
  font-size: 0.82rem;
}

.ai-progress-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 88px;
  padding: 14px;
  animation: rise-in 200ms var(--mq-ease) both;
}

.ai-progress-card h3 {
  margin-bottom: 3px;
  font-size: 0.94rem;
  font-weight: 650;
  line-height: 1.2;
}

.ai-progress-card p:not(.eyebrow) {
  margin-bottom: 0;
  color: var(--mq-ink-muted);
  font-size: 0.86rem;
}

.live-card-preview {
  margin-top: 6px;
  color: #1e3833 !important;
  font-weight: 650;
}

.progress-orb {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #1a6458;
  background: rgba(186, 228, 214, 0.62);
  box-shadow: inset 0 0 0 1px rgba(26, 100, 88, 0.08);
}

.progress-orb.pulse {
  animation: soft-pulse 1.4s ease-in-out infinite;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes soft-pulse {
  0%,
  100% {
    box-shadow:
      inset 0 0 0 1px rgba(26, 100, 88, 0.08),
      0 0 0 0 rgba(26, 100, 88, 0.2);
  }
  50% {
    box-shadow:
      inset 0 0 0 1px rgba(26, 100, 88, 0.08),
      0 0 0 8px rgba(26, 100, 88, 0);
  }
}

.usage-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: -2px;
}

.usage-row span {
  border-radius: 999px;
  padding: 4px 8px;
  color: #2f524b;
  background: rgba(186, 228, 214, 0.48);
  font-size: 0.72rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.ai-output-details {
  border-radius: var(--mq-radius-lg);
  background: rgba(255, 255, 255, 0.32);
  box-shadow: inset 0 0 0 1px var(--mq-glass-edge);
  overflow: hidden;
}

.ai-output-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  color: var(--mq-ink-secondary);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 650;
  list-style: none;
}

.ai-output-details summary::-webkit-details-marker {
  display: none;
}

.ai-output-details summary svg {
  transition: transform 160ms var(--mq-ease);
}

.ai-output-details[open] summary svg {
  transform: rotate(180deg);
}

.output-sections {
  display: grid;
  gap: 10px;
  padding: 0 14px 14px;
  animation: rise-in 200ms var(--mq-ease) both;
}

.output-sections h4 {
  margin: 0 0 6px;
  color: var(--mq-ink-secondary);
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.output-sections pre {
  max-height: 220px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border-radius: var(--mq-radius-md);
  padding: 12px;
  color: #1c302c;
  background: rgba(236, 246, 242, 0.72);
  box-shadow: inset 0 0 0 1px rgba(26, 100, 88, 0.05);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.76rem;
  line-height: 1.45;
}

.candidate-row {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.candidate-row textarea {
  min-height: 84px;
  line-height: 1.4;
}

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

.candidate-preview-grid section {
  display: grid;
  gap: 6px;
  border-radius: var(--mq-radius-lg);
  padding: 10px;
  background: rgba(236, 246, 242, 0.55);
  box-shadow: inset 0 0 0 1px rgba(26, 100, 88, 0.05);
}

.candidate-preview-grid span {
  color: var(--mq-ink-muted);
  font-size: 0.7rem;
  font-weight: 750;
  text-transform: uppercase;
}

.candidate-preview-grid .rich-text {
  color: var(--mq-ink);
  font-size: 0.86rem;
  line-height: 1.4;
}

.candidate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.candidate-head label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #24564d;
  font-weight: 650;
  font-size: 0.88rem;
}

.candidate-head input {
  width: auto;
}

.accept-action {
  justify-self: end;
  min-height: 42px;
  border-radius: var(--mq-radius-md);
  padding: 10px 14px;
}

.study-wrap {
  display: grid;
  position: relative;
  align-content: center;
  grid-template-rows: auto auto;
  gap: 18px;
  padding-top: 4px;
}

.study-filter-dock {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
}

.study-session-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.study-session-actions .primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 999px;
  padding: 0 14px;
  white-space: nowrap;
}

.study-icon-button,
.study-text-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--mq-ink-secondary);
  background: rgba(255, 255, 255, 0.56);
  box-shadow:
    0 1px 2px rgba(18, 38, 34, 0.04),
    0 10px 24px rgba(18, 38, 34, 0.07);
}

.study-icon-button:hover,
.study-text-action:hover {
  color: var(--mq-ink);
  background: rgba(255, 255, 255, 0.78);
  transform: translateY(-1px);
}

.study-icon-button {
  width: 44px;
  height: 44px;
  padding: 0;
}

.study-text-action {
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  font-size: 0.82rem;
  font-weight: 780;
  white-space: nowrap;
}

.session-config-action {
  color: var(--mq-accent);
  background: rgba(219, 246, 238, 0.72);
}

.study-session-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 22px;
  width: min(100%, 860px);
  max-height: min(88vh, 760px);
  border: 0;
  border-radius: 28px;
  padding: 26px;
  background: rgba(252, 255, 254, 0.98);
  box-shadow:
    0 30px 80px rgba(18, 38, 34, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.78);
  animation: modal-in 180ms var(--mq-ease);
}

.study-session-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(252px, 0.72fr);
  align-items: stretch;
  gap: 18px;
  min-height: 0;
}

.session-focus-card,
.session-result-card {
  display: grid;
  gap: 14px;
  align-content: start;
  border-radius: 22px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 0 0 1px rgba(20, 48, 42, 0.04);
}

.session-result-card {
  grid-template-rows: auto auto auto auto auto;
  background: rgba(226, 248, 241, 0.58);
}

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

.session-section-head h4 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 760;
}

.step-dot {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: var(--mq-accent);
  background: rgba(190, 232, 217, 0.72);
  font-size: 0.78rem;
  font-weight: 850;
}

.study-picker-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: stretch;
  gap: 7px;
}

.study-picker-actions button {
  flex: 1;
}

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

.focus-option {
  display: grid;
  grid-template-rows: auto auto;
  align-content: center;
  justify-items: center;
  gap: 10px;
  min-height: 94px;
  border-radius: 20px;
  padding: 14px 10px;
  text-align: center;
  color: var(--mq-ink-secondary);
  background: rgba(255, 255, 255, 0.74);
  box-shadow:
    inset 0 0 0 1px rgba(20, 48, 42, 0.045),
    0 10px 24px rgba(18, 38, 34, 0.035);
}

.focus-option:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.9);
}

.focus-option.active {
  color: #143f38;
  background: rgba(219, 246, 238, 0.86);
  box-shadow:
    inset 0 0 0 1px rgba(26, 100, 88, 0.13),
    0 16px 34px rgba(26, 100, 88, 0.12);
}

.focus-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--mq-ink-muted);
  box-shadow: 0 8px 20px rgba(18, 38, 34, 0.045);
}

.focus-option strong {
  font-size: 0.86rem;
  font-weight: 800;
}

.focus-option small {
  grid-area: note;
  color: var(--mq-ink-muted);
  font-size: 0.74rem;
  font-weight: 650;
}

.custom-threshold-card,
.card-picker-launch {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 0 0 1px rgba(20, 48, 42, 0.04);
}

.custom-threshold-card summary,
.card-picker-launch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  color: var(--mq-ink-secondary);
  font-size: 0.82rem;
  font-weight: 750;
}

.custom-threshold-card summary::-webkit-details-marker {
  display: none;
}

.custom-threshold-card summary strong,
.card-picker-launch small {
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--mq-accent);
  background: rgba(190, 232, 217, 0.58);
  font-size: 0.72rem;
  font-weight: 800;
}

.study-custom-filter {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  padding: 0 12px 12px;
}

.study-custom-filter input {
  width: 70px;
  min-height: 34px;
  border-radius: 999px;
  padding: 7px 10px;
  font-weight: 700;
}

.study-custom-filter > span {
  color: var(--mq-ink-muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.session-count-hero {
  display: grid;
  justify-items: center;
  gap: 1px;
  border-radius: 20px;
  padding: 22px 12px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(20, 48, 42, 0.035);
}

.session-count-hero strong {
  color: var(--mq-accent);
  font-size: 2.5rem;
  line-height: 1;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.session-count-hero span,
.session-choice-summary {
  color: var(--mq-ink-muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.session-choice-summary {
  margin: 0;
  color: var(--mq-ink-secondary);
  font-size: 0.86rem;
}

.start-session-action {
  justify-self: center;
  width: auto;
  min-width: 168px;
  color: var(--mq-accent);
  background: rgba(219, 246, 238, 0.76);
}

.card-picker-launch {
  margin-top: 4px;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  min-width: 204px;
  min-height: 42px;
  padding: 0 14px;
  position: relative;
  text-align: center;
  background: rgba(255, 255, 255, 0.56);
}

.card-picker-launch:hover {
  transform: translateY(-1px);
}

.card-picker-launch small {
  position: absolute;
  right: -2px;
  top: -2px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  color: #19483f;
  background: rgba(190, 232, 217, 0.96);
  font-size: 0.68rem;
  font-weight: 850;
  box-shadow: 0 6px 14px rgba(18, 38, 34, 0.1);
}

.card-picker-screen {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 0;
}

.picker-topbar,
.picker-summary-strip,
.picker-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.picker-topbar {
  align-items: stretch;
}

.picker-back {
  min-width: 82px;
}

.picker-topbar > .ghost,
.picker-footer > .ghost,
.picker-footer > .primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 999px;
  padding: 0 14px;
  white-space: nowrap;
}

.picker-topbar > .study-text-action,
.picker-footer > .study-text-action {
  flex: none;
  min-height: 44px;
}

.picker-topbar > .picker-back {
  min-width: 88px;
}

.picker-search {
  flex: 1;
  min-width: 220px;
}

.picker-summary-strip {
  padding: 10px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.34);
  box-shadow: none;
}

.picker-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 8px;
  min-height: 0;
  max-height: min(48vh, 430px);
  overflow: auto;
  padding: 2px;
}

.picker-card-grid .study-pick-row {
  min-height: 64px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.56);
  box-shadow: 0 8px 22px rgba(18, 38, 34, 0.035);
  transition:
    background 160ms var(--mq-ease),
    box-shadow 160ms var(--mq-ease);
}

.picker-card-grid .study-pick-row.selected {
  background: linear-gradient(180deg, rgba(217, 246, 237, 0.94), rgba(190, 232, 217, 0.76));
  box-shadow: 0 10px 24px rgba(26, 100, 88, 0.1);
}

.picker-card-grid .study-pick-row input {
  accent-color: var(--mq-accent);
}

.picker-card-grid .study-pick-row span {
  white-space: normal;
  line-height: 1.25;
}

.picker-footer {
  justify-content: flex-end;
  padding-top: 2px;
}

.picker-empty {
  grid-column: 1 / -1;
  min-height: 180px;
}

.study-pick-list {
  display: grid;
  gap: 6px;
  max-height: min(320px, 42vh);
  overflow: auto;
  padding: 0 8px 8px;
}

.study-pick-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border-radius: var(--mq-radius-md);
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.42);
  box-shadow: inset 0 0 0 1px rgba(20, 48, 42, 0.04);
}

.study-pick-row input {
  width: auto;
}

.study-pick-row span {
  min-width: 0;
  overflow: hidden;
  color: var(--mq-ink);
  font-size: 0.84rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.study-pick-row strong {
  color: #24564d;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.stats-page {
  display: grid;
  gap: 12px;
}

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

.metric-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 96px;
  gap: 12px;
  padding: 14px;
  transition:
    background 160ms var(--mq-ease),
    box-shadow 160ms var(--mq-ease);
}

.metric-tile:hover {
  background: rgba(255, 255, 255, 0.52);
}

.metric-tile span,
.metric-tile small,
.quiet-copy {
  color: var(--mq-ink-muted);
}

.metric-tile span,
.metric-tile small {
  display: block;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.metric-tile strong {
  display: block;
  margin: 4px 0;
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

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

.area-panel {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.stats-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border-radius: var(--mq-radius-xl);
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.4);
  box-shadow: inset 0 0 0 1px var(--mq-glass-edge);
}

.stats-hero h3 {
  margin-bottom: 6px;
  font-size: 1.12rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.stats-hero p:not(.eyebrow) {
  margin-bottom: 0;
  color: var(--mq-ink-muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.big-percent {
  display: grid;
  place-items: center;
  min-width: 132px;
  min-height: 132px;
  border-radius: 50%;
  background: conic-gradient(
    #8fd6bf 0deg,
    #8fd6bf var(--known-deg, 0deg),
    rgba(255, 255, 255, 0.55) var(--known-deg, 0deg)
  );
  box-shadow:
    inset 0 0 0 12px rgba(255, 255, 255, 0.62),
    0 4px 16px rgba(18, 38, 34, 0.05);
}

.big-percent strong {
  font-size: 1.75rem;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.big-percent span {
  color: var(--mq-ink-muted);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tag-summary-list {
  display: grid;
  gap: 6px;
}

.tag-summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 10px;
  align-items: center;
  border-radius: var(--mq-radius-md);
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.38);
  transition: background 140ms var(--mq-ease);
}

.tag-summary-row:hover {
  background: rgba(255, 255, 255, 0.52);
}

.tag-summary-row span {
  min-width: 0;
  overflow: hidden;
  font-weight: 650;
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-summary-row strong {
  color: #24564d;
  font-variant-numeric: tabular-nums;
}

.tag-summary-row small {
  grid-column: 1 / -1;
  color: var(--mq-ink-muted);
  font-size: 0.74rem;
  font-weight: 550;
}

.quiet-copy {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.4;
}

.study-card-area {
  position: relative;
  width: min(100%, 680px);
  margin: 0 auto;
  perspective: 1200px;
}

.study-card-magnetic {
  position: relative;
  transform-style: preserve-3d;
  border-radius: var(--mq-radius-xl);
  will-change: transform;
}

.study-card-flipper {
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.62s cubic-bezier(0.4, 0.2, 0.2, 1);
  border-radius: inherit;
}

.study-card-flipper.is-flipped {
  transform: rotateY(180deg);
}

.study-card-face {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.study-card-face.back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
}

.study-card {
  display: grid;
  position: relative;
  gap: 16px;
  width: 100%;
  min-height: 340px;
  padding: 32px 28px;
  text-align: center;
  overflow: hidden;
  border-radius: var(--mq-radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.58);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  backdrop-filter: blur(16px) saturate(1.15);
  box-shadow:
    0 20px 40px rgba(18, 38, 34, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.24);
  transition:
    background 300ms var(--mq-ease),
    box-shadow 300ms var(--mq-ease);
}

.study-card-magnetic:hover .study-card {
  background: rgba(255, 255, 255, 0.64);
  box-shadow:
    0 24px 48px rgba(18, 38, 34, 0.1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.focused-study-card {
  grid-template-rows: auto 1fr auto;
}

.study-card-content {
  transform: translateZ(36px);
}

.study-card-text {
  display: grid;
  place-items: center;
  min-width: 0;
}

.study-card-text .rich-text {
  justify-items: center;
  max-width: 100%;
  font-weight: 650;
  font-size: 1.32rem;
  line-height: 1.35;
}

.study-card-meta {
  display: flex;
  justify-content: center;
}

.study-actions {
  flex-wrap: wrap;
  margin-top: 18px;
}

.study-actions.panel-toolbar.center {
  gap: 10px;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.study-flip-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border-radius: 999px;
  padding: 0 18px;
  color: var(--mq-accent);
  background: rgba(219, 246, 238, 0.74);
  box-shadow:
    0 1px 2px rgba(18, 38, 34, 0.04),
    0 10px 24px rgba(18, 38, 34, 0.08);
  font-size: 0.84rem;
  font-weight: 820;
}

.study-actions.panel-toolbar.center > .study-flip-action:first-child {
  background: rgba(219, 246, 238, 0.74);
}

.study-flip-action:hover {
  color: var(--mq-accent-hover);
  background: rgba(205, 240, 229, 0.86);
}

.study-card-shuffle-slot {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 8;
  display: flex;
  inline-size: 96px;
  min-height: 34px;
  contain: layout paint;
  isolation: isolate;
  pointer-events: auto;
  transform: translateZ(42px);
}

.study-card-shuffle {
  position: relative;
  top: auto;
  right: auto;
  z-index: 1;
  transform: none;
  transform-style: flat;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 34px;
  border-radius: 999px;
  padding: 0 10px;
  color: var(--mq-ink-muted);
  background: rgba(255, 255, 255, 0.52);
  box-shadow: inset 0 0 0 1px rgba(20, 48, 42, 0.04);
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
  transition: none;
}

.study-card-shuffle.active {
  color: var(--mq-accent);
  background: rgba(219, 246, 238, 0.74);
}

button.study-card-shuffle,
button.study-card-shuffle:hover,
button.study-card-shuffle:active {
  transform: none !important;
  transition: none;
  touch-action: manipulation;
}

button.study-card-shuffle:hover {
  color: var(--mq-ink-muted);
  background: rgba(255, 255, 255, 0.52);
  box-shadow: inset 0 0 0 1px rgba(20, 48, 42, 0.04);
}

button.study-card-shuffle.active:hover {
  color: var(--mq-accent);
  background: rgba(219, 246, 238, 0.74);
  box-shadow: inset 0 0 0 1px rgba(20, 48, 42, 0.04);
}

.knowledge-meter {
  display: grid;
  gap: 5px;
  justify-items: center;
}

.knowledge-meter strong {
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.knowledge-meter span {
  color: var(--mq-ink-muted);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.knowledge-bar {
  width: min(100%, 240px);
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(26, 100, 88, 0.08);
}

.knowledge-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d87b86, #e5ca72, #6fbfaa);
  transition: width 200ms var(--mq-ease);
}

.study-card span {
  color: var(--mq-ink-muted);
  font-size: 0.84rem;
  font-weight: 650;
}

.study-card-shuffle span {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.study-card strong {
  align-self: center;
  font-size: 1.32rem;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: -0.02em;
  white-space: pre-wrap;
}

.grade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 92px;
  min-height: 44px;
  border-radius: 999px;
  padding: 0 12px;
  box-shadow:
    0 1px 2px rgba(18, 38, 34, 0.04),
    0 10px 24px rgba(18, 38, 34, 0.08);
  font-size: 0.8rem;
  font-weight: 820;
  white-space: nowrap;
}

.grade:hover {
  transform: none;
}

.grade.again {
  color: #743238;
  background: rgba(255, 232, 235, 0.82);
}

.study-actions.panel-toolbar.center > .grade.again:first-child {
  background: rgba(255, 232, 235, 0.82);
}

.grade.extra-hard {
  color: #79453a;
  background: rgba(255, 238, 224, 0.84);
}

.grade.hard {
  color: #6b5522;
  background: rgba(255, 247, 218, 0.84);
}

.grade.good {
  color: #28574f;
  background: rgba(226, 249, 242, 0.84);
}

.grade.easy {
  color: #204c43;
  background: rgba(211, 246, 234, 0.84);
}

.grade-key {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  color: currentColor;
  background: rgba(255, 255, 255, 0.58);
  font-size: 0.68rem;
  font-weight: 850;
}

.question-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  border-radius: 999px;
  padding: 0 12px;
  color: var(--mq-ink-secondary);
  background: rgba(255, 255, 255, 0.58);
  box-shadow:
    0 1px 2px rgba(18, 38, 34, 0.04),
    0 10px 24px rgba(18, 38, 34, 0.08);
  font-size: 0.8rem;
  font-weight: 820;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
    padding: 10px;
    gap: 0;
  }

  .sidebar {
    position: fixed;
    inset: 10px auto 10px 10px;
    z-index: 90;
    width: min(86vw, 344px);
    height: auto;
    max-height: none;
    transform: translateX(calc(-100% - 24px));
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    transition:
      transform 190ms var(--mq-ease),
      opacity 160ms var(--mq-ease);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
    background: rgba(250, 253, 252, 0.96);
  }

  .mobile-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: block;
    padding: 0;
    border-radius: 0;
    background: rgba(11, 26, 23, 0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms var(--mq-ease);
  }

  .mobile-sidebar-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-sidebar-backdrop:hover,
  .mobile-sidebar-backdrop:active {
    background: rgba(11, 26, 23, 0.28);
    transform: none;
  }

  .explorer-zone {
    flex: 1;
    min-height: 0;
  }

  .tree-list {
    min-height: 0;
  }

  .sidebar-bottom {
    margin-top: auto;
    max-height: min(36vh, 320px);
    overflow: auto;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .explorer-toggle-button,
  .explorer-close-button,
  .home-toggle-button {
    display: inline-flex;
  }
}

@media (max-width: 640px) {
  .app-shell {
    grid-template-rows: minmax(0, 1fr);
    padding: 10px;
    gap: 0;
  }

  .sidebar,
  .workspace-header,
  .primary-panel {
    border-radius: var(--mq-radius-lg);
  }

  .workspace-header {
    display: grid;
    align-items: stretch;
    grid-template-rows: auto auto;
    gap: 10px;
    padding: 12px;
  }

  .folder-title-row {
    width: 100%;
  }

  .folder-title-copy h2 {
    font-size: 1.18rem;
  }

  .explorer-toggle-button,
  .explorer-close-button,
  .home-toggle-button {
    width: 42px;
    min-width: 42px;
    height: 42px;
  }

  .home-welcome {
    padding: 16px;
  }

  .home-welcome h3 {
    font-size: 1.65rem;
  }

  .home-area-grid,
  .tutorial-grid,
  .future-grid {
    grid-template-columns: 1fr;
  }

  .home-area-card {
    min-height: 148px;
  }

  .home-window {
    width: min(100%, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    padding: 14px;
  }

  .tutorial-card {
    grid-template-columns: 1fr;
  }

  .tutorial-card img {
    height: 164px;
    min-height: 164px;
  }

  .header-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    width: 100%;
    justify-content: stretch;
    gap: 8px;
  }

  .panel-tabs {
    width: 100%;
    min-width: 0;
    justify-content: space-between;
  }

  .fluid-panel-tabs {
    justify-content: stretch;
  }

  .fluid-tab-thumb {
    width: calc((100% - 12px) / 4);
  }

  .tab-button {
    flex: 1;
    gap: 4px;
    min-width: 0;
    min-height: 42px;
    padding: 0 6px;
  }

  .workspace-header .tab-button svg {
    display: none;
  }

  .tab-label {
    display: inline;
    overflow: visible;
    font-size: 0.76rem;
    font-weight: 650;
    white-space: nowrap;
  }

  .primary-action.icon-label {
    flex: none;
    min-width: 48px;
  }

  .workspace-header .primary-action.icon-label {
    width: 48px;
    padding: 0;
  }

  .workspace-header .primary-action.icon-label span {
    display: none;
  }

  .friendly-editor-grid {
    grid-template-columns: 1fr;
  }

  .settings-modal {
    grid-template-columns: 1fr;
    width: min(100%, calc(100vw - 28px));
    max-height: calc(100vh - 28px);
    min-height: 0;
    overflow: auto;
  }

  .candidate-modal {
    width: min(100%, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    padding: 14px;
  }

  .study-session-modal {
    width: min(100%, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    padding: 14px;
    overflow: auto;
  }

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

  .picker-topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .picker-search {
    min-width: 0;
  }

  .picker-back {
    min-width: 72px;
  }

  .picker-card-grid {
    grid-template-columns: 1fr;
    max-height: 42vh;
  }

  .session-count-hero {
    grid-template-columns: auto auto;
    justify-content: center;
    gap: 8px;
    padding: 12px;
  }

  .session-count-hero strong {
    font-size: 1.55rem;
  }

  .candidate-modal-toolbar,
  .candidate-modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .candidate-modal-actions button,
  .candidate-modal-toolbar .search-field {
    width: 100%;
  }

  .candidate-preview-grid {
    grid-template-columns: 1fr;
  }

  .settings-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 12px;
    box-shadow: inset 0 -1px 0 rgba(20, 48, 42, 0.06);
  }

  .settings-title {
    grid-column: 1 / -1;
  }

  .settings-tab {
    justify-content: center;
    padding: 8px;
  }

  .settings-tab span {
    display: none;
  }

  .mode-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .mode-actions {
    width: 100%;
    justify-content: stretch;
  }

  .mode-actions button {
    flex: 1;
  }

  .flashcard-row {
    grid-template-columns: 1fr;
  }

  .row-actions {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    min-width: 0;
    padding-top: 4px;
  }

  .search-field {
    width: 100%;
  }

  .search-input {
    max-width: none;
  }

  .study-session-actions {
    align-items: center;
    justify-content: flex-end;
    flex-direction: row;
  }

  .study-session-actions .status-pill {
    flex: none;
  }

  .study-session-actions .study-icon-button,
  .study-session-actions .study-text-action {
    flex: none;
    min-height: 46px;
  }

  .study-picker-head {
    align-items: stretch;
    flex-direction: column;
  }

  .study-picker-actions {
    justify-content: stretch;
  }

  .study-picker-actions button {
    flex: 1;
  }

  .study-card-area {
    width: 100%;
  }

  .study-card {
    min-height: 210px;
    padding: 18px 16px;
  }

  .study-card-text .rich-text {
    font-size: 1.12rem;
  }

  .knowledge-meter strong {
    font-size: 1.55rem;
  }

  .knowledge-bar {
    height: 5px;
  }

  .study-card strong {
    font-size: 1.12rem;
  }

  .panel-toolbar.center {
    gap: 6px;
  }

  .panel-toolbar.center button {
    padding: 8px 10px;
    font-size: 0.8rem;
  }

  .study-actions.panel-toolbar.center {
    width: 100%;
    justify-content: center;
    gap: 7px;
    margin-top: 8px;
  }

  .study-actions .grade,
  .study-actions .question-action {
    min-width: 78px;
    min-height: 44px;
    padding: 0 10px;
  }

  .study-actions .grade-key {
    display: none;
  }

  .study-actions .study-flip-action {
    min-height: 46px;
  }

  .study-stats-grid,
  .area-grid,
  .stats-hero {
    grid-template-columns: 1fr;
  }

  .ai-panel {
    height: 100%;
    min-height: 0;
    max-height: none;
  }

  .ai-chat-scroll {
    padding: 14px 14px 10px;
  }

  .ai-empty-chat {
    grid-template-columns: 1fr;
    margin-top: 24px;
    text-align: center;
    justify-items: center;
  }

  .ai-chat-composer-spotlight {
    margin: 0 12px 12px;
    border-radius: 30px;
  }

  .ai-chat-composer {
    border-radius: 28px;
    padding: 10px 11px 10px 14px;
    min-height: 88px;
    gap: 10px;
  }

  .ai-chat-input {
    min-height: 32px;
    max-height: 144px;
    font-size: 0.98rem;
  }

  .ai-composer-controls {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .model-chip {
    max-width: 178px;
  }

  .ai-message {
    width: 100%;
  }

  .ai-stream-panel,
  .ai-reasoning-details,
  .candidate-pack-card {
    width: 100%;
  }

  .ai-send-button {
    width: 52px;
    min-width: 52px;
    height: 52px;
  }

  .big-percent {
    justify-self: center;
  }
}
