:root {
  color-scheme: light;
  --ink: #21171d;
  --muted: #74636c;
  --line: #eadfe5;
  --soft: #fff7fb;
  --panel: #ffffff;
  --brand: #6e123f;
  --brand-2: #b40755;
  --green: #2d8a42;
  --blue: #1267cf;
  --amber: #b26b00;
  --shadow: 0 22px 60px rgba(84, 16, 44, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

/* Compact operations workspace. */
body { background: #f5f6f8; }
.auth-view { background: #f5f6f8; }
.auth-card, .panel, .stat-card, .hero-panel, .editor-card, .module-card, .queue-card { border-radius: 8px; box-shadow: none; }
.dashboard-grid > .panel { background: transparent; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.hero-panel { background: #fff; color: var(--ink); border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.hero-panel h2 { font-size: 24px; color: var(--ink); }
.hero-panel .light-button { background: var(--brand); color: #fff; }
.primary-button, .ghost-button, .light-button, .danger-button, input, select { border-radius: 6px; }
h1, h2, h3, p, .eyebrow { letter-spacing: 0; }
.stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-card:nth-child(2) span { color: var(--blue); }
.stat-card:nth-child(3) span { color: var(--green); }
.directory-tools { display: flex; gap: 12px; align-items: end; margin: 16px 0; }
.directory-tools input, .directory-tools label { flex: 1; min-width: 0; }
.directory-tools select { width: 160px; }
.table-scroll { overflow-x: auto; background: #fff; border: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; font-size: 13px; text-align: left; }
th { background: #f0f2f5; color: #53606c; font-weight: 600; }
td, th { padding: 12px 14px; border-bottom: 1px solid var(--line); }
td { overflow-wrap: anywhere; }
td button { white-space: nowrap; }
.team-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.milestone-detail { margin-top: 20px; padding: 16px; border-left: 3px solid var(--green); background: #fff; }
@media (max-width: 700px) { .directory-tools { flex-wrap: wrap; } .directory-tools label { flex-basis: 100%; } .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #fff8fb;
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.shell {
  min-height: 100vh;
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(180, 7, 85, 0.12), transparent 34%),
    linear-gradient(135deg, #fff8fb, #f8edf3);
}

.auth-card {
  width: min(100%, 430px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 32px;
  box-shadow: var(--shadow);
}

.brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(84, 16, 44, 0.12);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-mark.small {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  font-size: 13px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand-2);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.02em;
}

.auth-card h1 {
  margin-top: 18px;
  font-size: 34px;
}

.muted {
  color: var(--muted);
  line-height: 1.6;
}

.form-stack,
.editor-card {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: #4a3b43;
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 13px;
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(180, 7, 85, 0.55);
  box-shadow: 0 0 0 4px rgba(180, 7, 85, 0.08);
}

.primary-button,
.ghost-button,
.light-button,
.danger-button {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 900;
}

.primary-button {
  background: var(--brand);
  color: #ffffff;
}

.primary-button.compact {
  min-height: 40px;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.ghost-button.dark {
  background: #ffffff;
  color: var(--brand);
  border: 1px solid var(--line);
}

.workspace .ghost-button { color: var(--brand); background: #fff; border: 1px solid var(--line); }
.team-row { color: var(--ink); }

.light-button {
  background: #ffffff;
  color: var(--brand);
}

.danger-button {
  background: #fff0f3;
  color: #b42343;
  border: 1px solid #ffd0d9;
}

.message,
.toast {
  min-height: 20px;
  color: #b42343;
  font-size: 13px;
  font-weight: 800;
}

.admin-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #641139;
  color: #ffffff;
}

.brand-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 30px;
}

.brand-row .eyebrow {
  color: #f2bfd4;
}

.brand-row h2 {
  font-size: 24px;
}

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

.nav-list a {
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-weight: 800;
  padding: 12px 14px;
  border-radius: 14px;
}

.nav-list a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar,
.panel-header,
.button-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 22px;
}

.topbar h1 {
  font-size: clamp(28px, 4vw, 42px);
}

.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 900;
}

.status-pill.live {
  color: var(--green);
}

.blocked-panel,
.panel,
.stat-card,
.hero-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 12px 34px rgba(84, 16, 44, 0.06);
}

.blocked-panel {
  padding: 24px;
  max-width: 720px;
}

.uid-text {
  word-break: break-all;
  font-weight: 900;
  color: var(--brand);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}

.hero-panel {
  grid-column: span 8;
  min-height: 190px;
  padding: 26px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #ffffff;
}

.hero-panel .eyebrow {
  color: #f4bfd5;
}

.hero-panel h2 {
  max-width: 590px;
  font-size: clamp(28px, 4vw, 44px);
}

.hero-panel p {
  max-width: 560px;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.55;
}

.stats-grid {
  grid-column: span 4;
  display: grid;
  gap: 12px;
}

.stat-card {
  padding: 18px;
}

.stat-card span {
  font-size: 32px;
  font-weight: 950;
  color: var(--brand);
}

.stat-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.panel {
  grid-column: span 6;
  padding: 22px;
}

.wide-panel {
  grid-column: 1 / -1;
}

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

.form-grid.tight {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.module-list,
.list-column,
.queue-grid {
  display: grid;
  gap: 12px;
}

.module-card,
.article-row,
.queue-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffbfd;
  padding: 14px;
}

.module-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.module-card h3,
.article-row h3,
.queue-card h3 {
  margin: 0;
  font-size: 15px;
}

.module-card p,
.article-row p,
.queue-card p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 13px;
}

.switch {
  width: 54px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  padding: 3px;
  background: #d8ccd3;
}

.switch::after {
  content: "";
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 160ms ease;
}

.switch.is-on {
  background: var(--brand-2);
}

.switch.is-on::after {
  transform: translateX(24px);
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.article-row {
  text-align: left;
  cursor: pointer;
}

.article-row.is-active {
  border-color: rgba(180, 7, 85, 0.55);
  box-shadow: 0 0 0 4px rgba(180, 7, 85, 0.08);
}

.editor-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: #ffffff;
}

.check-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 9px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

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

.queue-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.queue-actions button {
  min-height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--brand);
  padding: 0 12px;
  font-weight: 900;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100vw - 48px));
  min-height: auto;
  padding: 14px 16px;
  border-radius: 16px;
  background: #21171d;
  color: #ffffff;
  box-shadow: var(--shadow);
}

@media (max-width: 980px) {
  .admin-view {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    gap: 18px;
  }

  .nav-list {
    grid-template-columns: repeat(3, 1fr);
  }

  .hero-panel,
  .stats-grid,
  .panel {
    grid-column: 1 / -1;
  }

  .split-grid,
  .form-grid,
  .form-grid.tight,
  .queue-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .panel-header,
  .hero-panel,
  .button-row {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-list {
    grid-template-columns: 1fr;
  }
}

body { background: #f5f6f8; }
.auth-view { background: #f5f6f8; }
.auth-card, .stat-card, .editor-card, .module-card, .queue-card { border-radius: 8px; box-shadow: none; }
.dashboard-grid > .panel { background: transparent; border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.hero-panel { background: #fff; color: var(--ink); border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.hero-panel h2 { font-size: 24px; color: var(--ink); }
.hero-panel .light-button { background: var(--brand); color: #fff; }
.primary-button, .ghost-button, .light-button, .danger-button, input, select { border-radius: 6px; }
h1, h2, h3, p, .eyebrow { letter-spacing: 0; }
.stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 700px) { .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.mobile-nav { display: none; }
.menu-button { display: none; }
.nav-list a[aria-current] { background: #ffffff20; color: #fff; }
.dashboard-grid > section { grid-column: 1 / -1; }
.topbar h1:focus { outline: none; }
.dashboard-grid > *, .form-grid > *, .split-grid > * { min-width: 0; }
#users, #team { grid-column: 1 / -1; }
.hero-panel .eyebrow { color: var(--brand); }
.switch { flex-shrink: 0; }
@media (max-width: 980px) {
  .sidebar { position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 12px 16px; }
  .sidebar > div { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 20px; min-width: 0; }
  .brand-row { margin: 0; }
  .brand-row h2 { font-size: 20px; }
  .brand-row .eyebrow { display: none; }
  .nav-list { display: none; }
  .mobile-nav { display: block; min-height: 40px; }
  #signOutButton { min-height: 40px; padding: 0 12px; }
  .workspace { padding: 20px; }
  .hero-panel { min-height: 0; padding: 16px 0; }
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .panel { padding: 20px 0; scroll-margin-top: 90px; }
  #overview { scroll-margin-top: 90px; }
}
@media (max-width: 600px) {
  .sidebar { gap: 8px; padding: 10px 12px; }
  .sidebar > div { gap: 10px; }
  .brand-row { gap: 0; }
  .brand-row > div:last-child { display: none; }
  .brand-mark.small { width: 36px; height: 36px; border-radius: 8px; }
  .mobile-nav { font-size: 13px; padding: 0 8px; }
  #signOutButton { font-size: 12px; padding: 0 8px; }
  .workspace { padding: 16px 12px; }
  .topbar { gap: 8px; margin-bottom: 12px; }
  .topbar h1 { font-size: 24px; }
  .topbar .status-pill { align-self: flex-start; padding: 6px 10px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-card span { font-size: 26px; }
  .stat-card p { font-size: 12px; }
  .panel-header { gap: 10px; margin-bottom: 14px; }
  .panel-header h2 { font-size: 20px; }
  .directory-tools { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .directory-tools select { width: 100%; }
  .team-row { flex-wrap: wrap; }
  .team-row > span { min-width: 0; flex: 1; }
  .table-scroll { overflow: visible; border: 0; background: transparent; }
  #users table, #users tbody { display: block; width: 100%; }
  #users thead { display: none; }
  #users tr { display: block; background: #fff; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; padding: 8px 12px; }
  #users td { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 8px; padding: 8px 0; font-size: 13px; }
  #users td::before { content: attr(data-label); color: var(--muted); font-size: 12px; }
  #users td:last-child { border-bottom: 0; }
  #users td:empty { display: none; }
  #users td button { white-space: normal; }
  .editor-card { padding: 12px; }
  .queue-actions { flex-wrap: wrap; }
  .auth-card { padding: 24px 18px; }
  .auth-view { padding: 16px; }
}

#signOutButton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; align-self: start; }
#signOutButton svg { width: 18px; height: 18px; flex-shrink: 0; }
.mobile-menu { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(300px, 88%); height: 100dvh; max-height: 100dvh; border: 0; padding: 20px; background: #fff; color: var(--ink); box-shadow: -8px 0 32px #0002; }
.mobile-menu::backdrop { background: #17151b80; }
.drawer-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.drawer-header h2 { font-size: 18px; }
.mobile-menu nav { display: grid; gap: 6px; }
.mobile-menu nav a { padding: 14px 12px; color: var(--ink); text-decoration: none; border-radius: 6px; font-size: 14px; font-weight: 600; }
.mobile-menu nav a:hover, .mobile-menu nav a[aria-current] { background: #f9eaf1; color: var(--brand); }
.menu-button { width: 44px; height: 44px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--brand); cursor: pointer; align-items: center; justify-content: center; }
.menu-button svg { width: 22px; height: 22px; }
.drawer-header .menu-button { display: inline-flex; }
@media (max-width: 980px) {
  .sidebar { display: flex; flex-direction: row; align-items: center; height: 64px; gap: 12px; padding: 10px 16px; }
  .sidebar > div { display: block; flex: 1; }
  .brand-row { display: flex; gap: 10px; }
  .brand-row > div:last-child { display: block; }
  .brand-row h2 { font-size: 18px; }
  .brand-mark.small { width: 36px; height: 36px; }
  .sidebar .menu-button { display: inline-flex; flex-shrink: 0; }
  #signOutButton { height: 40px; min-height: 40px; align-self: center; font-size: 13px; }
  .blocked-panel { padding: 20px; border-radius: 8px; box-shadow: none; }
  .blocked-panel h2 { font-size: 21px; }
  .blocked-panel p { font-size: 14px; line-height: 1.6; }
}
@media (max-width: 400px) { #signOutButton span { display: none; } #signOutButton { width: 40px; padding: 10px; } }
