:root {
  color-scheme: dark;
  --bg: #080b12;
  --bg-2: #0c111b;
  --panel: #111722;
  --panel-2: #151d2a;
  --panel-3: #1b2637;
  --input: #0b111c;
  --line: #273448;
  --line-strong: #34455d;
  --text: #edf4ff;
  --muted: #96a7bb;
  --soft: #c6d4e5;
  --accent: #1461e3;
  --accent-2: #77a1ff;
  --cyan: #38d2e8;
  --green: #35c979;
  --amber: #f4b84a;
  --red: #ff5b6b;
  --purple: #a991ff;
  --shadow: rgba(0, 0, 0, 0.3);
  --radius: 8px;
  --sidebar-width: 244px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f7fb;
  --bg-2: #e9f0f7;
  --panel: #ffffff;
  --panel-2: #f4f8fb;
  --panel-3: #e9f2f8;
  --input: #ffffff;
  --line: #d6e0ea;
  --line-strong: #bdccd9;
  --text: #102033;
  --muted: #5f7084;
  --soft: #2e4055;
  --accent: #5eb4d6;
  --accent-2: #abddeb;
  --cyan: #2fbecb;
  --green: #118a54;
  --amber: #b87912;
  --red: #d93852;
  --purple: #7664d8;
  --shadow: rgba(22, 34, 51, 0.1);
}

* {
  box-sizing: border-box;
}

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

html {
  background: var(--bg);
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--line) 28%, transparent) 1px, transparent 1px),
    linear-gradient(180deg, color-mix(in srgb, var(--line) 18%, transparent) 1px, transparent 1px),
    linear-gradient(180deg, var(--bg-2), var(--bg) 420px);
  background-size: 48px 48px, 48px 48px, auto;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

body.modal-open {
  overflow: hidden;
}

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

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  padding: 8px 12px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

button:hover,
.button-link:hover {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
  background: color-mix(in srgb, var(--accent) 9%, var(--panel-2));
  box-shadow: 0 10px 22px var(--shadow);
  transform: translateY(-1px);
}

button:disabled,
.button-link:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

button.primary,
.button-link.primary {
  border-color: color-mix(in srgb, var(--accent) 82%, var(--line));
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 62%, var(--cyan)));
  color: #ffffff;
  font-weight: 800;
}

button.danger,
.button-link.danger {
  border-color: color-mix(in srgb, var(--red) 56%, var(--line));
  background: color-mix(in srgb, var(--red) 13%, var(--panel-2));
  color: var(--text);
}

button.ghost,
.button-link.ghost {
  background: transparent;
}

.seller-link {
  border-color: color-mix(in srgb, var(--green) 48%, var(--line));
  background: color-mix(in srgb, var(--green) 12%, var(--panel-2));
}

.admin-link {
  border-color: color-mix(in srgb, var(--purple) 48%, var(--line));
  background: color-mix(in srgb, var(--purple) 13%, var(--panel-2));
}

.lang-toggle {
  min-width: 56px;
  border-color: color-mix(in srgb, var(--cyan) 58%, var(--line));
  background: color-mix(in srgb, var(--cyan) 14%, var(--panel-2));
  color: var(--text);
  font-weight: 900;
}

.theme-toggle {
  border-color: color-mix(in srgb, var(--amber) 58%, var(--line));
  background: color-mix(in srgb, var(--amber) 14%, var(--panel-2));
}

.logout-button {
  border-color: color-mix(in srgb, var(--red) 58%, var(--line));
  background: color-mix(in srgb, var(--red) 13%, var(--panel-2));
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input);
  color: var(--text);
  padding: 8px 10px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

textarea {
  min-height: 132px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

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

a {
  color: var(--accent-2);
}

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

h1,
h2,
h3,
.brand-kicker,
.eyebrow {
  letter-spacing: 0;
}

code {
  color: var(--soft);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.hidden {
  display: none !important;
}

.page {
  min-height: 100vh;
}

.console-page {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.side-rail {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 16px;
  height: 100vh;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 150px),
    color-mix(in srgb, var(--panel) 96%, var(--bg));
  padding: 16px 12px;
  overflow: auto;
}

.brand-panel {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel-2) 76%, transparent);
}

.brand-mark,
.nav-icon,
.tile-icon {
  position: relative;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--accent) 62%, var(--line));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 80%, #ffffff), color-mix(in srgb, var(--cyan) 72%, var(--accent))),
    var(--accent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.94);
}

.admin-mark::before {
  width: 20px;
  height: 8px;
  top: 11px;
  left: 10px;
}

.admin-mark::after {
  width: 8px;
  height: 20px;
  right: 10px;
  bottom: 10px;
}

.seller-mark::before {
  width: 20px;
  height: 20px;
  inset: 10px auto auto 10px;
  border-radius: 50%;
  background: transparent;
  border: 5px solid rgba(255, 255, 255, 0.94);
}

.seller-mark::after {
  width: 18px;
  height: 6px;
  right: 8px;
  bottom: 10px;
  transform: rotate(-28deg);
}

.brand-panel strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-kicker,
.eyebrow {
  display: block;
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.brand-panel span:not(.brand-kicker) {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-section {
  display: grid;
  gap: 8px;
}

.rail-section-grow {
  align-content: start;
}

.rail-heading {
  display: grid;
  gap: 3px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.rail-heading small {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-weight: 500;
}

.rail-note {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 8%, var(--panel-2));
  padding: 10px;
}

.rail-note strong {
  font-size: 12px;
}

.rail-note span {
  color: var(--muted);
  font-size: 12px;
}

.tabs,
.view-tabs {
  display: grid;
  gap: 6px;
}

.app-tabs {
  max-height: 226px;
  overflow: auto;
  padding-right: 2px;
}

.tab,
.view-tab {
  justify-content: flex-start;
  width: 100%;
  min-height: 38px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  text-align: left;
}

.tab:hover,
.view-tab:hover {
  background: var(--panel-2);
  box-shadow: none;
  transform: none;
}

.tab.active,
.view-tab.active {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 24%, transparent), transparent),
    var(--panel-2);
  color: var(--text);
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-icon {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 18%, var(--panel-3));
}

.nav-icon::before,
.nav-icon::after,
.tile-icon::before,
.tile-icon::after {
  content: "";
  position: absolute;
  background: currentColor;
}

.view-tab .nav-icon {
  color: var(--accent-2);
}

.table-icon::before {
  inset: 5px 4px auto;
  height: 2px;
  box-shadow: 0 5px 0 currentColor, 0 10px 0 currentColor;
}

.table-icon::after {
  top: 4px;
  bottom: 4px;
  left: 9px;
  width: 2px;
}

.key-icon::before {
  width: 8px;
  height: 8px;
  left: 4px;
  top: 6px;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: transparent;
}

.key-icon::after {
  width: 10px;
  height: 2px;
  right: 4px;
  top: 10px;
  box-shadow: 4px 4px 0 -1px currentColor;
}

.users-icon::before {
  width: 7px;
  height: 7px;
  top: 4px;
  left: 6px;
  border-radius: 50%;
}

.users-icon::after {
  width: 14px;
  height: 7px;
  left: 3px;
  bottom: 4px;
  border-radius: 8px 8px 3px 3px;
}

.filter-icon::before {
  width: 14px;
  height: 3px;
  top: 5px;
  left: 3px;
  box-shadow: 3px 5px 0 -1px currentColor, 6px 10px 0 -2px currentColor;
}

.chart-icon::before {
  width: 3px;
  height: 8px;
  left: 5px;
  bottom: 4px;
  box-shadow: 5px -4px 0 currentColor, 10px -8px 0 currentColor;
}

.catalog-icon::before {
  width: 12px;
  height: 12px;
  top: 4px;
  left: 4px;
  border: 2px solid currentColor;
  border-radius: 3px;
  background: transparent;
}

.catalog-icon::after {
  width: 4px;
  height: 4px;
  right: 4px;
  top: 4px;
}

.receipt-icon::before {
  width: 12px;
  height: 14px;
  top: 3px;
  left: 4px;
  border-radius: 3px;
}

.receipt-icon::after {
  width: 8px;
  height: 2px;
  top: 7px;
  left: 6px;
  color: var(--panel-2);
  box-shadow: 0 4px 0 currentColor, 0 8px 0 currentColor;
}

.shield-icon::before {
  width: 12px;
  height: 14px;
  top: 3px;
  left: 4px;
  clip-path: polygon(50% 0, 100% 18%, 88% 78%, 50% 100%, 12% 78%, 0 18%);
}

.workbench {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
}

.commandbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-2) 92%, transparent);
  padding: 16px 22px;
}

.page-heading {
  min-width: 0;
}

.page-heading h1 {
  margin: 3px 0 3px;
  color: var(--text);
  font-size: 24px;
  line-height: 1.15;
}

.page-heading p,
.panel-title p,
.muted {
  margin-bottom: 0;
  color: var(--muted);
}

.page-heading p {
  max-width: 760px;
  font-size: 13px;
}

.toolbar,
.inline-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar select {
  width: min(260px, 100%);
}

.content-stack {
  display: grid;
  gap: 16px;
  padding: 16px 22px 28px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: grid;
  gap: 16px;
  animation: panelIn 180ms ease both;
}

.panel,
.metric {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  box-shadow: 0 12px 30px var(--shadow);
}

.panel {
  position: relative;
  overflow: hidden;
  padding: 16px;
}

.panel-pad {
  padding: 16px;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--cyan), var(--green));
  opacity: 0.8;
}

.accent-panel::before {
  background: linear-gradient(90deg, var(--cyan), var(--accent-2), var(--purple));
}

.danger-panel::before {
  background: linear-gradient(90deg, var(--red), var(--amber));
}

.panel-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-title h2,
.panel-title h3 {
  margin-bottom: 3px;
  font-size: 18px;
  line-height: 1.25;
}

.panel-title p {
  font-size: 13px;
}

.split-title {
  align-items: center;
}

.section-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.metric {
  min-height: 84px;
  padding: 14px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 11%, transparent), transparent 58%),
    var(--panel);
}

.metric span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric span b {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--accent) 20%, var(--panel-3));
  color: transparent;
  font-size: 0;
}

.metric span b::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--accent-2);
}

.metric:nth-child(2) span b {
  background: color-mix(in srgb, var(--cyan) 18%, var(--panel-3));
}

.metric:nth-child(2) span b::before {
  background: var(--cyan);
}

.metric:nth-child(3) span b {
  background: color-mix(in srgb, var(--green) 18%, var(--panel-3));
}

.metric:nth-child(3) span b::before {
  background: var(--green);
}

.metric:nth-child(4) span b {
  background: color-mix(in srgb, var(--amber) 18%, var(--panel-3));
}

.metric:nth-child(4) span b::before {
  background: var(--amber);
}

.metric strong {
  display: block;
  margin-top: 8px;
  overflow: hidden;
  color: var(--text);
  font-size: 22px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

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

.action-tile {
  display: grid;
  justify-items: start;
  min-height: 142px;
  border-color: var(--line);
  background: var(--panel-2);
  padding: 14px;
  text-align: left;
}

.action-tile:hover {
  background: color-mix(in srgb, var(--accent) 9%, var(--panel-2));
}

.action-tile strong {
  margin-top: 8px;
  color: var(--text);
  font-size: 15px;
}

.action-tile small {
  color: var(--muted);
  font-size: 12px;
}

.tile-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  color: #ffffff;
  background: var(--accent);
}

.primary-tile .tile-icon {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.cyan-tile .tile-icon {
  background: linear-gradient(135deg, var(--cyan), var(--accent));
}

.amber-tile .tile-icon {
  background: linear-gradient(135deg, var(--amber), var(--red));
}

.form-stack {
  display: grid;
  gap: 12px;
}

.divided-form {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

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

.compact-grid {
  align-items: start;
}

.form-row,
.filter-bar {
  display: grid;
  gap: 10px;
  align-items: end;
}

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

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

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

.filter-bar {
  grid-template-columns: minmax(260px, 1.4fr) minmax(150px, 0.65fr) minmax(132px, 0.45fr) minmax(142px, 0.45fr);
  margin-bottom: 12px;
}

.checkline {
  display: flex;
  align-items: center;
  min-height: 38px;
  gap: 8px;
  color: var(--muted);
}

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

.compact-field {
  width: min(280px, 100%);
}

.table-tools {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.table-filter {
  width: min(380px, 100%);
}

.table-tool-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.column-menu {
  position: relative;
}

.column-menu summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
}

.column-menu[open] summary {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
}

.column-list {
  position: absolute;
  right: 0;
  z-index: 35;
  display: grid;
  gap: 8px;
  width: 292px;
  max-height: 340px;
  overflow: auto;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 10px;
  box-shadow: 0 18px 42px var(--shadow);
}

.column-control {
  display: grid;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.column-control:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.column-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 12px;
}

.column-toggle input {
  width: auto;
  min-height: auto;
}

.column-filter-input {
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
}

.table-wrap {
  max-height: 64vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--panel);
}

.records-table table {
  min-width: 1320px;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 850;
  text-transform: uppercase;
}

td {
  position: relative;
  padding-right: 52px;
}

tbody tr {
  transition: background 120ms ease;
}

tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

td code {
  word-break: break-all;
}

.draggable-col {
  cursor: grab;
  user-select: none;
}

.draggable-col.dragging {
  opacity: 0.56;
}

.cell-copy {
  position: absolute;
  top: 50%;
  right: 6px;
  min-height: 24px;
  border-color: color-mix(in srgb, var(--cyan) 46%, var(--line));
  background: color-mix(in srgb, var(--cyan) 18%, var(--panel-2));
  padding: 2px 7px;
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%);
}

td:hover .cell-copy,
.cell-copy:focus {
  opacity: 1;
  pointer-events: auto;
}

.cell-copy:hover {
  transform: translateY(-50%);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  padding: 2px 8px;
  white-space: nowrap;
}

.badge.good {
  border-color: color-mix(in srgb, var(--green) 55%, var(--line));
  color: var(--green);
}

.badge.warn {
  border-color: color-mix(in srgb, var(--amber) 55%, var(--line));
  color: var(--amber);
}

.badge.bad {
  border-color: color-mix(in srgb, var(--red) 55%, var(--line));
  color: var(--red);
}

.preview-panel .panel-title {
  align-items: end;
}

.catalog-preview {
  display: grid;
  gap: 12px;
}

.shop-preview-card {
  display: grid;
  gap: 14px;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 52%),
    var(--panel-2);
  padding: 14px;
}

.shop-preview-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shop-preview-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  color: #ffffff;
  font-size: 20px;
  font-weight: 900;
}

.shop-preview-head h3 {
  margin: 0 0 3px;
  font-size: 20px;
}

.shop-preview-head p {
  margin: 0;
  color: var(--muted);
}

.shop-plan-grid {
  display: grid;
  gap: 8px;
}

.shop-plan {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.shop-plan:first-child {
  border-top: 0;
  padding-top: 0;
}

.shop-plan strong,
.shop-plan span {
  display: block;
}

.shop-plan span,
.shop-plan-stock {
  color: var(--muted);
  font-size: 12px;
}

.shop-plan-price {
  color: var(--cyan);
  font-weight: 900;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  padding: 14px;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(900px, 100%);
  padding: 0;
  overflow: hidden;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  min-height: 520px;
}

.auth-copy {
  display: grid;
  align-content: space-between;
  gap: 18px;
  padding: 32px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 36%, var(--panel)), color-mix(in srgb, var(--cyan) 18%, var(--panel))),
    var(--panel);
}

.auth-copy h1 {
  margin: 8px 0 10px;
  font-size: 34px;
  line-height: 1.06;
}

.auth-copy p {
  color: color-mix(in srgb, var(--text) 80%, var(--muted));
  margin: 0;
}

.auth-forms {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 28px;
  background: var(--panel);
}

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

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

.auth-tab.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--panel-2));
}

.auth-panel {
  display: none;
}

.auth-panel.active {
  display: grid;
  gap: 14px;
  animation: panelIn 160ms ease both;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(430px, calc(100vw - 36px));
  border: 1px solid color-mix(in srgb, var(--green) 48%, var(--line));
  border-radius: var(--radius);
  background: var(--panel);
  padding: 12px 14px;
  box-shadow: 0 18px 44px var(--shadow);
  animation: toastIn 160ms ease both;
}

.toast::before {
  content: "i";
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--green);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  flex: 0 0 auto;
}

.toast.bad {
  border-color: color-mix(in srgb, var(--red) 58%, var(--line));
}

.toast.bad::before {
  content: "!";
  background: var(--red);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.6);
}

.modal-backdrop.active {
  display: grid;
  animation: panelIn 160ms ease both;
}

.result-modal {
  display: grid;
  gap: 12px;
  width: min(780px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.42);
  padding: 14px;
}

.result-modal-head,
.result-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.result-modal-head h2 {
  margin: 2px 0 0;
  font-size: 18px;
}

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

.icon-button {
  min-width: 38px;
  padding-inline: 10px;
}

.result-content {
  display: grid;
  gap: 10px;
  max-height: min(580px, calc(100vh - 210px));
  overflow: auto;
}

.result-output {
  max-height: min(560px, calc(100vh - 220px));
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input);
  color: var(--text);
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.result-output.compact {
  max-height: 180px;
}

.result-card-grid {
  display: grid;
  gap: 10px;
}

.result-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input);
  padding: 12px;
}

.result-card-title {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 900;
}

.result-kv {
  display: grid;
  grid-template-columns: minmax(120px, 0.34fr) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  border-top: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  padding-top: 7px;
}

.result-kv:first-child {
  border-top: 0;
  padding-top: 0;
}

.result-kv span {
  color: var(--muted);
  font-size: 12px;
}

.result-kv strong {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
}

.context-menu {
  position: fixed;
  z-index: 90;
  display: none;
  min-width: 196px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 18px 46px var(--shadow);
  padding: 7px;
}

.context-menu.active {
  display: grid;
  gap: 4px;
}

.context-menu-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  padding: 5px 7px 7px;
  text-transform: uppercase;
}

.context-menu button {
  justify-content: flex-start;
  min-height: 32px;
  border-color: transparent;
  background: transparent;
  padding: 6px 8px;
  font-size: 12px;
}

.context-menu button:hover {
  background: color-mix(in srgb, var(--accent) 14%, var(--panel-2));
  box-shadow: none;
  transform: none;
}

.context-menu button.danger {
  color: var(--red);
}

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

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .side-rail {
    position: static;
    grid-template-rows: auto;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

@media (max-width: 980px) {
  .commandbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar {
    justify-content: stretch;
  }

  .toolbar button,
  .toolbar select,
  .toolbar .button-link {
    flex: 1 1 140px;
  }

  .metric-row,
  .split-grid,
  .action-tiles,
  .two-tiles,
  .form-row,
  .form-row.two,
  .form-row.three,
  .filter-bar,
  .auth-layout {
    grid-template-columns: 1fr;
  }

  .split-title,
  .preview-panel .panel-title {
    align-items: stretch;
    flex-direction: column;
  }

  .compact-field {
    width: 100%;
  }

  .shop-plan {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .side-rail,
  .commandbar,
  .content-stack {
    padding-inline: 12px;
  }

  .view-tabs,
  .tabs {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .auth-shell {
    padding: 12px;
  }

  .auth-copy,
  .auth-forms,
  .panel {
    padding: 14px;
  }

  .table-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .table-filter {
    width: 100%;
  }

  .column-list {
    left: 0;
    right: auto;
    width: min(292px, calc(100vw - 48px));
  }
}

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

  button:hover,
  .button-link:hover {
    transform: none;
  }
}
