:root {
  color-scheme: dark;
  --bg: #0b1118;
  --bg-soft: #101924;
  --card: rgba(15, 23, 33, 0.82);
  --card-strong: rgba(20, 31, 44, 0.96);
  --line: rgba(255, 255, 255, 0.09);
  --text: #f5f7fb;
  --muted: #99a7b8;
  --primary: #d9b27a;
  --primary-dark: #c89d63;
  --primary-ink: #1a1208;
  --secondary-bg: rgba(255, 255, 255, 0.08);
  --secondary-bg-hover: rgba(255, 255, 255, 0.12);
  --danger: #ffb4b4;
  --danger-bg: rgba(185, 28, 28, 0.16);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(142, 185, 255, 0.16), transparent 34%),
    radial-gradient(circle at top right, rgba(217, 178, 122, 0.18), transparent 28%),
    linear-gradient(180deg, #0d1621 0%, #0b1118 58%, #0a0f16 100%);
  color: var(--text);
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 24px auto 48px;
}

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 24px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(16px);
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.card-head h1,
.card-head h2 {
  margin: 0 0 6px;
  letter-spacing: -0.03em;
}

.card-head h1 {
  font-size: clamp(32px, 4vw, 42px);
}

.card-head h2 {
  font-size: 24px;
}

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

.compact { margin-bottom: 14px; }

.login-card {
  max-width: 500px;
  margin: 72px auto 0;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02)),
    linear-gradient(135deg, rgba(142,185,255,0.14), rgba(217,178,122,0.08) 55%, rgba(15,23,33,0.96));
  box-shadow: var(--shadow);
}

.app-shell {
  display: grid;
  gap: 20px;
}

.auth-switch {
  margin-top: 14px;
  text-align: center;
}

.link-inline {
  padding: 0;
  background: transparent;
  border: 0;
  color: #f1d2a3;
  box-shadow: none;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.register-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.form-note {
  border: 1px solid rgba(217, 178, 122, 0.18);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(217, 178, 122, 0.08);
  color: #e8d4b5;
  font-size: 13px;
  line-height: 1.5;
}

.auth-buttons {
  align-items: stretch;
}

.auth-buttons button {
  flex: 1 1 180px;
}

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

label span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
  color: #d8e3f2;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input::placeholder,
textarea::placeholder {
  color: #7f8da0;
}

textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(217, 178, 122, 0.5);
  box-shadow: 0 0 0 4px rgba(217, 178, 122, 0.12);
  background: rgba(255, 255, 255, 0.08);
}

button {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 700;
  transition: transform .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease;
}

button:hover,
.link-button:hover {
  transform: translateY(-1px);
}

.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--primary-ink);
  box-shadow: 0 16px 36px rgba(201, 154, 93, 0.22);
}

.primary:hover { filter: brightness(1.02); }

.secondary {
  background: var(--secondary-bg);
  color: var(--text);
  border: 1px solid var(--line);
}

.secondary:hover { background: var(--secondary-bg-hover); }

.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(255, 180, 180, 0.14);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 0;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02)),
    linear-gradient(135deg, rgba(142,185,255,0.14), rgba(217,178,122,0.08) 55%, rgba(15,23,33,0.96));
  box-shadow: var(--shadow);
}

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

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

.tool-sections {
  display: grid;
  gap: 18px;
}

.tool-section {
  display: grid;
  gap: 12px;
}

.tool-section-head h3 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.tool-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.portal-tool-card {
  display: grid;
  gap: 8px;
  min-height: 150px;
  padding: 20px;
  border-radius: 22px;
  border: 1px solid rgba(217, 178, 122, 0.22);
  background:
    radial-gradient(circle at top right, rgba(217, 178, 122, 0.18), transparent 42%),
    linear-gradient(135deg, rgba(255,255,255,0.07), rgba(255,255,255,0.03));
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.portal-tool-card:hover {
  transform: translateY(-2px);
  border-color: rgba(217, 178, 122, 0.42);
  box-shadow: 0 24px 58px rgba(0, 0, 0, 0.26);
}

.portal-tool-card strong {
  font-size: 24px;
  letter-spacing: -0.04em;
  line-height: 1.08;
}

.portal-tool-card span {
  color: var(--muted);
  font-size: 15px;
}

.portal-tool-card .tool-card-kicker {
  align-self: start;
  color: #f1d2a3;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.list {
  display: grid;
  gap: 12px;
}

.list-item {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255,255,255,0.04);
}

.list-item h3 {
  margin: 0 0 6px;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.row input {
  flex: 1 1 220px;
}

.error {
  margin-top: 12px;
  color: var(--danger);
  min-height: 20px;
}

.hidden { display: none !important; }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: rgba(15, 23, 33, 0.96);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--primary-ink);
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 700;
}

.empty {
  border: 1px dashed rgba(255,255,255,0.16);
  border-radius: 18px;
  padding: 18px;
  color: var(--muted);
  background: rgba(255,255,255,0.03);
}

.two-up > * {
  flex: 1 1 260px;
}

@media (max-width: 860px) {
  .shell {
    width: min(100vw - 20px, 1180px);
    margin-top: 12px;
  }

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