.console-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 240px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 16px;
  border-right: 1px solid var(--border-subtle);
  background: var(--latte);
  padding: 20px 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 18px;
  color: var(--ink);
  text-decoration: none;
}

.brand img {
  width: 28px;
  height: 28px;
}

.brand span {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.nav-list {
  display: grid;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  min-height: 36px;
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
}

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

.nav-button {
  width: 100%;
  background: transparent;
  cursor: pointer;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  padding: 14px 10px 0;
}

.sidebar-footer p:last-child {
  margin: 6px 0 0;
  color: var(--fg-muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

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

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--border-subtle);
  padding: 22px 32px 18px;
}

.topbar h1 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.topbar p:last-child {
  max-width: 680px;
  margin: 6px 0 0;
  color: var(--fg-muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 24px 32px 0;
}

.stat-card {
  padding: 18px;
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  color: var(--mare);
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.03em;
}

.stat-card span {
  display: block;
  margin-top: 4px;
  color: var(--fg-muted);
  font-size: 12px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  padding: 20px 32px 32px;
}

.words-card,
.admin-card,
.batch-card,
.preview-card {
  padding: 20px;
}

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

.section-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: min(460px, 52%);
}

.section-heading.compact {
  margin-bottom: 10px;
}

.section-heading h2,
.batch-card h2 {
  margin: 3px 0 0;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.search-field {
  min-width: 0;
  flex: 1 1 280px;
}

.search-field input,
.field select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--panna);
  color: var(--ink);
  padding: 8px 12px;
}

.tag-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 16px;
}

.tag-filter {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: var(--panna);
  color: var(--ink);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.tag-filter.active {
  background: var(--ink);
  color: var(--panna);
}

.tag-filter:disabled {
  background: var(--nebbia-50);
  color: var(--fg-muted);
  cursor: default;
  opacity: 1;
}

.a-pill.priority[data-priority="B1_CORE"] {
  background: var(--coralla-100);
  color: var(--ink);
}

.a-pill.priority[data-priority="B1_PLUS"] {
  background: var(--viola-100);
  color: var(--ink);
}

.a-pill.priority[data-priority="B1_NA"] {
  background: var(--nebbia-50);
  color: var(--fg-muted);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--panna);
}

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

th,
td {
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px;
  font-size: 13px;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--nebbia-50);
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.word-cell strong {
  display: block;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 17px;
  font-style: italic;
  font-weight: 500;
}

.word-cell small,
.srs-cell {
  color: var(--fg-muted);
  font-size: 12px;
}

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

.batch-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

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

.hidden {
  display: none !important;
}

.locked-copy {
  padding: 28px 18px;
  text-align: center;
}

.panel-copy,
.batch-status,
.empty {
  color: var(--fg-muted);
  font-size: 13px;
  line-height: 1.5;
}

.batch-status[data-mode="success"] {
  color: var(--ink);
  font-weight: 700;
}

.batch-status[data-mode="error"] {
  color: var(--danger);
  font-weight: 700;
}

.field {
  display: grid;
  gap: 7px;
  margin: 14px 0;
}

.field span {
  font-size: 12px;
  font-weight: 800;
}

.batch-card .a-button {
  width: 100%;
  margin-top: 8px;
}

.preview-list {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
}

.preview-item {
  display: grid;
  gap: 5px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--panna);
  padding: 11px 12px;
}

.preview-item strong {
  font-family: var(--font-serif);
  font-size: 16px;
  font-style: italic;
}

.preview-item p {
  margin: 0;
  color: var(--fg-muted);
  font-size: 12px;
  line-height: 1.45;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

@media (max-width: 1120px) {
  .workspace-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .console-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .topbar,
  .stats-grid,
  .workspace-grid {
    padding-right: 16px;
    padding-left: 16px;
  }

  .section-heading,
  .section-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .section-actions {
    min-width: 0;
  }

  .batch-panel {
    grid-template-columns: 1fr;
  }
}
