:root {
  color-scheme: light;
  --bg: #f6f6f5;
  --ink: #09090b;
  --muted: #66666d;
  --soft: #e7e7e4;
  --panel: #ffffff;
  --line: #d8d8d3;
  --topbar-bg: #050505;
  --control-bg: #5d5d5d;
  --control-bg-hover: #6a6a6a;
  --control-border: #777777;
  --control-text: #ffffff;
  --dark: #111113;
  --dark-2: #232326;
  --danger: #a6111b;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button,
.link-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--dark);
  border-radius: 8px;
  background: var(--dark);
  color: #fff;
  cursor: pointer;
  padding: 0 16px;
  text-align: center;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

button:hover,
.link-button:hover {
  transform: translateY(-1px);
  border-color: #c91524;
  background: #c91524;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

input,
select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
}

select {
  border-color: var(--control-border);
  background: var(--control-bg);
  color: var(--control-text);
  font-weight: 750;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

label input,
label select {
  font-weight: 500;
}

label input {
  color: var(--ink);
}

label select {
  color: var(--control-text);
}

.auth-shell {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(246, 246, 245, 0.92)),
    radial-gradient(circle at top left, #ffffff 0, #e9e9e5 42%, #d6d6d0 100%);
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-panel {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  padding: 34px;
}

.mark {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  margin-bottom: 22px;
}

.mark img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(32px, 7vw, 54px);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: 24px;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
}

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

.stack {
  display: grid;
  gap: 16px;
}

.compact {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.primary {
  border-color: var(--dark);
  background: var(--dark);
  color: #fff;
  font-weight: 750;
}

.alert {
  border: 1px solid rgba(166, 17, 27, 0.25);
  border-radius: 8px;
  background: rgba(166, 17, 27, 0.06);
  color: var(--danger);
  padding: 12px 14px;
  font-weight: 700;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  background: var(--topbar-bg);
  color: #fff;
  padding: 8px max(16px, calc((100vw - 1180px) / 2));
}

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

.bar-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.24);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 850;
  white-space: nowrap;
}

.brand img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.brand-title {
  display: grid;
  gap: 1px;
  font-size: 14px;
  line-height: 0.9;
}

.topbar nav,
.desktop-nav {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.topbar nav a,
.topbar nav button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
}

.topbar nav a.active,
.topbar nav button.active,
.subnav a.active {
  border-color: var(--control-border);
  background: var(--control-bg);
  color: var(--control-text);
}

.topbar nav a,
.topbar nav button {
  border-color: var(--control-border);
  background: var(--control-bg);
  color: var(--control-text);
}

.topbar nav a:hover,
.topbar nav button:hover {
  border-color: #8d8d8d;
  background: var(--control-bg-hover);
  transform: none;
}

.topbar form {
  margin: 0;
}

.tool-switcher {
  position: relative;
  min-width: min(320px, 44vw);
}

.mobile-nav {
  display: none;
}

.custom-menu {
  position: relative;
}

.custom-menu summary {
  list-style: none;
}

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

.menu-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  width: 100%;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--control-bg);
  color: var(--control-text);
  cursor: pointer;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 800;
}

.menu-button:hover {
  background: var(--control-bg-hover);
}

.menu-caret {
  width: 9px;
  height: 9px;
  display: inline-block;
  flex: 0 0 9px;
  border-right: 2px solid rgba(255, 255, 255, 0.78);
  border-bottom: 2px solid rgba(255, 255, 255, 0.78);
  transform: translateY(-2px) rotate(45deg);
}

.menu-list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 40;
  min-width: 260px;
  overflow: hidden;
  border: 1px solid var(--control-border);
  border-radius: 10px;
  background: var(--control-bg);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.22);
  padding: 6px;
}

.language-list {
  right: 0;
  left: auto;
  min-width: 130px;
}

.menu-row {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--control-text);
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 800;
  text-align: left;
  white-space: nowrap;
}

.menu-row:hover,
.menu-row.selected {
  background: var(--control-bg-hover);
  transform: none;
}

.overview-row {
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.1);
  font-size: 15px;
  font-weight: 900;
}

.menu-divider {
  height: 1px;
  margin: 6px 4px;
  background: rgba(255, 255, 255, 0.24);
}

.flag-icon {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #fff;
  font-size: 15px;
  line-height: 1;
}

.tool-button {
  max-width: 320px;
  border-color: #8e8e8e;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  font-size: 14px;
  font-weight: 900;
}

.tool-button-label {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-app-icon,
.menu-list-icon,
.app-list-icon {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 7px;
}

.app-list-icon {
  display: grid;
  grid-template-columns: repeat(2, 5px);
  grid-template-rows: repeat(2, 5px);
  place-content: center;
  gap: 3px;
  border: 1px solid var(--line);
  background: #fff;
}

.app-list-icon span {
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: #4b4b4b;
}

.menu-list-icon {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #fff;
  color: #424248;
  font-size: 14px;
}

.mobile-menu-button {
  width: auto;
  min-width: 94px;
  justify-content: center;
}

.mobile-menu-icon {
  width: 18px;
  display: grid;
  gap: 4px;
}

.mobile-menu-icon span {
  display: block;
  height: 2px;
  border-radius: 999px;
  background: #fff;
}

.mobile-menu-list {
  right: 0;
  left: auto;
  min-width: 230px;
}

.mobile-menu-list .language-form,
.mobile-menu-list form {
  width: 100%;
}

.mobile-menu-list > a,
.mobile-menu-list > form button {
  width: 100%;
  min-height: 42px;
  justify-content: flex-start;
}

.subnav {
  position: sticky;
  top: 50px;
  z-index: 10;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 246, 245, 0.94);
  padding: 10px max(16px, calc((100vw - 1180px) / 2));
}

.subnav a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.subnav a.active {
  border-color: var(--control-border);
  background: var(--control-bg);
  color: var(--control-text);
}

.page {
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 80px;
}

.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.page-head h1 {
  margin: 0;
}

.dashboard-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.dashboard-meta .eyebrow {
  margin: 0;
}

.pill,
.mode {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid var(--control-border);
  border-radius: 999px;
  background: var(--control-bg);
  color: var(--control-text);
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.view-actions,
.card-actions,
.table-actions,
.section-title,
.inline-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.view-actions .link-button {
  border-color: #c9c9c4;
  background: transparent;
  color: var(--ink);
}

.view-actions .link-button:hover {
  border-color: #c91524;
  background: #c91524;
  color: #fff;
}

.view-actions .link-button.active {
  border-color: #c91524;
  background: #c91524;
  color: #fff;
}

.section-title {
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-title h2,
.section-title p,
.inline-form {
  margin: 0;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.app-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.app-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

.app-card {
  min-height: 240px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 18px 0;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.app-card.disabled {
  opacity: 0.58;
}

.app-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.app-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  object-fit: contain;
  padding: 6px;
}

.app-icon.fallback {
  display: grid;
  place-items: center;
  background: var(--dark);
  color: #fff;
  font-weight: 850;
  padding: 0;
}

.app-icon.menu-app-icon {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 7px;
  padding: 3px;
}

.lock-badge {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
}

.lock-badge svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.app-card:hover {
  transform: translateY(-2px);
  border-color: #9d9d9d;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.08);
}

.app-card p {
  color: var(--muted);
  line-height: 1.55;
}

.app-slug {
  margin: 16px -18px 0;
  border-top: 1px solid var(--line);
  border-radius: 0 0 10px 10px;
  background: #f3f3f1;
  color: #77777c;
  font-size: 12px;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  padding: 10px 18px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.data-table {
  min-width: 860px;
}

.data-head,
.data-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) 150px 150px 120px 220px;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.data-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  background: #fafafa;
}

.data-row:last-child {
  border-bottom: 0;
}

.table-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.table-title small {
  display: block;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.panel {
  padding: 22px;
}

.narrow {
  width: min(860px, calc(100% - 40px));
}

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

.form-grid.single {
  grid-template-columns: 1fr;
}

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

.icon-upload-panel {
  margin-bottom: 18px;
}

.upload-form {
  align-items: end;
}

input[type="file"] {
  height: auto;
  min-height: 44px;
  padding: 8px;
}

.translation-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
  padding: 14px;
}

.span-2 {
  grid-column: 1 / -1;
}

fieldset {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

legend {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  padding: 0 6px;
}

.checks {
  display: grid;
  gap: 10px;
}

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

.table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.row:last-child {
  border-bottom: 0;
}

.row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.row form {
  margin: 0;
}

.check {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  flex-direction: row;
  color: var(--ink);
  font-weight: 650;
}

.check input {
  width: auto;
  height: auto;
  min-height: auto;
}

.success {
  border: 1px solid #b7c7b8;
  border-radius: 8px;
  background: #eef5ee;
  color: #244828;
  padding: 12px 14px;
  font-weight: 750;
}

.user-list {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.user-edit {
  display: grid;
  gap: 18px;
}

.compact-list {
  gap: 12px;
}

.user-row-card {
  padding: 16px 18px;
}

.password-panel {
  margin-top: 18px;
}

.app-shell-body {
  overflow: hidden;
}

.app-frame-wrap {
  height: calc(100vh - 50px);
  background: #fff;
}

.app-frame {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: #fff;
}

.not-found {
  min-height: 100vh;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 14px;
  padding: 28px;
  text-align: center;
}

.not-found img {
  width: 82px;
  height: 82px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 10px;
}

.not-found h1 {
  max-width: 680px;
  margin: 0;
}

@media (max-width: 860px) {
  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    position: sticky;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px;
  }

  .topbar-left {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
  }

  .topbar nav.desktop-nav {
    display: none;
  }

  .mobile-nav {
    display: block;
    justify-self: end;
  }

  .tool-switcher {
    width: 100%;
    min-width: 0;
    grid-column: 1 / -1;
  }

  .brand {
    gap: 8px;
  }

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

  .brand-title {
    font-size: 12px;
  }

  .subnav {
    top: 106px;
  }

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

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

  .form-grid,
  .checks.two-col,
  .translation-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  .app-grid.four {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
