﻿:root {
  color-scheme: light;
  --bg: #f6f2ed;
  --ink: #1a1a1a;
  --muted: #5f5a52;
  --card: #ffffff;
  --accent: #0f6d54;
  --accent-2: #f58b2a;
  --border: #e7e0d6;
  --shadow: 0 18px 45px rgba(27, 26, 26, 0.08);
  --pill: #f0e8db;
  --nav-bg: rgba(255, 255, 255, 0.78);
  --hero-grad-1: rgba(15, 109, 84, 0.12);
  --hero-grad-2: rgba(245, 139, 42, 0.18);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101115;
  --ink: #f2f3f6;
  --muted: #a5abb5;
  --card: #171a22;
  --accent: #25c08a;
  --accent-2: #ff9a3c;
  --border: #2a2f3b;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
  --pill: #1d2230;
  --nav-bg: rgba(23, 26, 34, 0.8);
  --hero-grad-1: rgba(37, 192, 138, 0.18);
  --hero-grad-2: rgba(255, 154, 60, 0.2);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Rubik", system-ui, -apple-system, Segoe UI, Arial;
  color: var(--ink);
  background:
    radial-gradient(900px 400px at 5% -10%, var(--hero-grad-1), transparent 60%),
    radial-gradient(700px 350px at 95% 0%, var(--hero-grad-2), transparent 55%),
    var(--bg);
  min-height: 100vh;
}

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

.shell {
  max-width: 1260px;
  margin: 0 auto;
  padding: 18px 18px 40px;
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--nav-bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 8px 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 12px;
  z-index: 10;
  min-height: 48px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.4px;
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.nav-links {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 14px;
  color: var(--muted);
}

.nav-links a {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--pill);
  transition: transform 0.15s ease;
}

.nav-links a.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }

.nav-links a:hover { transform: translateY(-1px); }

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

.theme-toggle input {
  width: 42px;
  height: 24px;
  appearance: none;
  background: var(--pill);
  border: 1px solid var(--border);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
}

.theme-toggle input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  transition: transform 0.2s ease;
}

.theme-toggle input:checked::after { transform: translateX(18px); }

.hero {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  align-items: stretch;
}

.hero-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.hero-card h1 {
  font-family: "Space Grotesk", sans-serif;
  margin: 0 0 8px;
  font-size: 30px;
}

.hero-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 15px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.stat {
  padding: 12px;
  border-radius: 14px;
  background: var(--pill);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  margin-top: 18px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

input, select, button {
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
  outline: none;
}

input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 109, 84, 0.12);
}

button {
  cursor: pointer;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 600;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); opacity: 0.9; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); font-size: 13px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--pill);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.err { color: #ff6b6b; font-weight: 700; margin-top: 10px; }

.suggest-wrap { position: relative; }
.suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 5;
  max-height: 240px;
  overflow: auto;
  display: none;
}
.suggestions button {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 10px 12px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 500;
}
.suggestions button:hover { background: rgba(0,0,0,0.05); }
:root[data-theme="dark"] .suggestions button:hover { background: rgba(255,255,255,0.06); }

.item-img {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  object-fit: contain;
  box-shadow: 0 14px 28px rgba(0,0,0,0.24);
}

table {
  border-collapse: collapse;
  width: 100%;
  margin-top: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

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

th {
  background: rgba(0, 0, 0, 0.06);
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

tr:last-child td { border-bottom: none; }

.content-section { margin-bottom: 18px; }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  nav { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 640px) {
  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .shell { padding: 10px 10px 22px; }

  nav {
    position: sticky;
    top: 0;
    border-radius: 14px;
    gap: 10px;
    padding: 6px 10px;
    justify-content: space-between;
    min-height: 42px;
  }

  .nav-links { display: none; }

  .theme-toggle { align-self: center; margin-left: 0; font-size: 11px; gap: 6px; }
  .theme-toggle span { display: none; }
  .theme-toggle input { width: 34px; height: 20px; }
  .theme-toggle input::after { width: 14px; height: 14px; }

  .brand { font-size: 16px; gap: 10px; }
  .brand img { width: 28px; height: 28px; border-radius: 8px; }

  .hero { grid-template-columns: 1fr; gap: 10px; margin-top: 10px; }
  .stat-grid { grid-template-columns: 1fr; display: none; }
  .layout { grid-template-columns: 1fr; }

  .card { padding: 12px; border-radius: 16px; }

  input, select, button {
    font-size: 15px;
    padding: 12px 12px;
  }

  button {
    min-height: 44px;
  }

  .pill { font-size: 11px; }

  table { width: 100%; }
  thead { display: none; }
  tbody, tr, td { display: block; width: 100%; }
  tr {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 10px;
    background: var(--card);
  }
  td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 0;
    font-size: 12px;
    line-height: 1.2;
    border-bottom: 1px solid rgba(0,0,0,0.06);
  }
  :root[data-theme="dark"] td { border-bottom: 1px solid rgba(255,255,255,0.06); }
  td:last-child { border-bottom: none; }
  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    flex: 0 0 90px;
  }

  .hero-card { padding: 14px; }
  .hero-card h1 { font-size: 20px; }
  .hero-card p { font-size: 13px; }
  .item-img { width: 52px; height: 52px; border-radius: 10px; }
}

.bottom-nav {
  display: none;
}

@media (max-width: 640px) {
  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    background: var(--nav-bg);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 8px;
    box-shadow: var(--shadow);
    z-index: 20;
  }

  .bottom-nav a {
    text-align: center;
    font-size: 12px;
    padding: 10px 8px;
    border-radius: 14px;
    background: var(--pill);
  }

  .bottom-nav a.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
  }

  .hero-card {
    padding: 16px;
  }

  .stat {
    font-size: 12px;
  }
}

@media (max-width: 420px) {
  .brand { font-size: 16px; }
  .brand img { width: 30px; height: 30px; }
  .hero-card h1 { font-size: 18px; }
  .item-img { width: 44px; height: 44px; }
}
