:root {
  --bg: #1d1a17;
  --panel: #2b2724;
  --panel-soft: #39322c;
  --sidebar: #2e2925;
  --line: rgba(226, 214, 203, 0.2);
  --line-strong: rgba(226, 214, 203, 0.3);
  --text: #f3eee8;
  --muted: #cabca9;
  --primary: #d7b98d;
  --primary-soft: rgba(215, 185, 141, 0.16);
  --accent: #b99873;
  --success: #9bb89a;
  --success-soft: rgba(155, 184, 154, 0.18);
  --warning: #d9bf7f;
  --warning-soft: rgba(217, 191, 127, 0.18);
  --danger: #d58d7d;
  --danger-soft: rgba(213, 141, 125, 0.15);
  --shadow: 0 12px 30px rgba(10, 8, 7, 0.25);
}

.btn:focus-visible,
.sidebar nav a:focus-visible,
.logout:focus-visible,
.data-table a:focus-visible,
.add-form summary:focus-visible {
  outline: 2px solid #e4c99f;
  outline-offset: 3px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", Arial, sans-serif;
  background: linear-gradient(180deg, #201d1b 0%, #2a241f 100%);
  color: var(--text);
}

a { color: inherit; }
button, input, select { font: inherit; }

.app {
  display: flex;
  min-height: 100vh;
  background: linear-gradient(90deg, #201d1b 0%, #2a241f 100%);
}

.sidebar {
  width: 270px;
  background: rgba(46, 41, 37, 0.92);
  border-right: 1px solid var(--line);
  padding: 18px 14px 16px;
  display: flex;
  flex-direction: column;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.02);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
  text-decoration: none;
  padding: 8px 8px 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--primary), #b8895f);
  color: #251b15;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 6px 15px rgba(215, 185, 141, 0.25);
}

.brand b {
  display: block;
  font-size: 18px;
  letter-spacing: 0.5px;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.nav-caption {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
  margin: 12px 8px 8px;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  border-radius: 9px;
  transition: all 0.2s ease;
}

.sidebar nav a span {
  width: 18px;
  display: inline-block;
  text-align: center;
  color: var(--primary);
  font-size: 15px;
}

.sidebar nav a .nav-sticker {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #f4e9d7;
  border-radius: 11px;
  color: #fff;
  font-size: 19px;
  line-height: 1;
  box-shadow: 0 3px 8px rgba(10, 8, 7, 0.22);
  transition: transform 0.18s ease;
}

.sidebar nav a:hover .nav-sticker {
  transform: rotate(-7deg) scale(1.08);
}

.nav-sticker.mint { background: #718c6d; }
.nav-sticker.clay { background: #aa7054; }
.nav-sticker.gold { background: #bd9657; }
.nav-sticker.blue { background: #668293; }
.nav-sticker.pink { background: #a97778; }

.sidebar nav a .nav-label {
  width: auto;
  color: inherit;
  text-align: left;
  font-size: inherit;
}

.sidebar nav a.active {
  background: linear-gradient(135deg, rgba(215, 185, 141, 0.16), rgba(255, 255, 255, 0.02));
  color: var(--primary);
  border-left: 3px solid var(--primary);
  padding-left: 9px;
  box-shadow: inset 0 0 0 1px rgba(215, 185, 141, 0.06);
}

.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.user-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--text);
}

.avatar {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(215, 185, 141, 0.28), rgba(184, 153, 115, 0.16));
  color: #f0d9b6;
  font-weight: 700;
  font-size: 12px;
}

.user-mini b,
.top-right b {
  display: block;
  font-size: 13px;
}

.user-mini small,
.top-right small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  padding: 4px 6px;
}

.main {
  flex: 1;
  padding: 16px 20px 30px;
  background: rgba(32, 29, 27, 0.12);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 4px 0 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.01);
}

.hamburger {
  display: none;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 22px;
  color: var(--text);
  cursor: pointer;
}

.topbar-title {
  flex: 1;
}

.topbar-title small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-title b {
  font-size: 18px;
  color: var(--text);
}

.top-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.notification {
  font-size: 18px;
  color: var(--primary);
  line-height: 1;
}

.content {
  padding-top: 18px;
}

.welcome {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.welcome-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.sticker-stack {
  position: relative;
  width: 132px;
  height: 92px;
  flex: 0 0 132px;
}

.sticker {
  position: absolute;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 3px solid #f5ead9;
  border-radius: 18px;
  font-size: 27px;
  box-shadow: 0 8px 18px rgba(10, 8, 7, 0.28);
  animation: sticker-float 3.2s ease-in-out infinite;
}

.sticker-box {
  top: 18px;
  left: 0;
  z-index: 2;
  background: #a66f4e;
  transform: rotate(-11deg);
}

.sticker-books {
  top: 0;
  left: 42px;
  z-index: 1;
  background: #74876b;
  animation-delay: -1s;
}

.sticker-plant {
  top: 28px;
  right: 0;
  background: #c99e5b;
  transform: rotate(10deg);
  animation-delay: -2s;
}

@keyframes sticker-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -5px; }
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-size: 48px;
  line-height: 1.08;
  color: #f6f0e8;
}

.muted {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.btn {
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  color: var(--text);
  padding: 11px 18px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(12, 9, 7, 0.18);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(215, 185, 141, 0.5);
  box-shadow: 0 9px 20px rgba(12, 9, 7, 0.25);
}

.btn.primary {
  background: linear-gradient(135deg, rgba(215, 185, 141, 0.24), rgba(184, 153, 115, 0.12));
  color: var(--primary);
  border-color: rgba(215, 185, 141, 0.45);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 16px;
  margin: 16px 0 28px;
}

.stat {
  background: rgba(47, 42, 38, 0.72);
  border: 1px solid rgba(226, 214, 203, 0.12);
  border-radius: 12px;
  padding: 15px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
}

.icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
}

.icon.blue { background: var(--primary-soft); color: var(--primary); }
.icon.green { background: var(--success-soft); color: var(--success); }
.icon.amber { background: var(--warning-soft); color: var(--warning); }
.icon.red { background: var(--danger-soft); color: var(--danger); }

.stat small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.stat strong {
  display: block;
  font-size: 20px;
  margin-bottom: 4px;
  color: var(--text);
}

.stat p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.panel {
  background: rgba(46, 41, 37, 0.74);
  border: 1px solid rgba(226, 214, 203, 0.12);
  border-radius: 14px;
  padding: 18px 18px 12px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-bottom: 12px;
}

.panel-head h2 {
  margin: 0;
  font-size: 22px;
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(226, 214, 203, 0.2);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 9px;
  padding: 8px 10px;
  min-width: 230px;
  color: var(--muted);
}

.search:focus-within {
  border-color: rgba(215, 185, 141, 0.65);
  box-shadow: 0 0 0 3px rgba(215, 185, 141, 0.1);
}

.search input {
  border: none;
  outline: none;
  width: 100%;
  background: transparent;
  color: var(--text);
}

.add-form {
  border: 1px solid rgba(226, 214, 203, 0.2);
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(58, 50, 43, 0.88), rgba(43, 39, 36, 0.9));
  margin: 18px 0;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(10, 8, 7, 0.16);
}

.add-form summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 18px;
  font-weight: 700;
  color: #f2e4cf;
  background: rgba(215, 185, 141, 0.055);
  transition: background 0.2s ease, color 0.2s ease;
}

.add-form summary:hover {
  background: rgba(215, 185, 141, 0.11);
}

.add-form summary::marker {
  color: var(--primary);
}

.add-form[open] summary {
  border-bottom: 1px solid rgba(226, 214, 203, 0.16);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 16px 20px;
  padding: 20px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #e8ded2;
}

.form-grid input,
.form-grid select {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(226, 214, 203, 0.24);
  border-radius: 9px;
  padding: 10px 12px;
  background: #211e1b;
  color: #f5efe7;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.form-grid input::placeholder {
  color: #9f9284;
}

.form-grid input:focus,
.form-grid select:focus,
.search input:focus {
  outline: none;
}

.form-grid input:focus,
.form-grid select:focus {
  border-color: rgba(215, 185, 141, 0.75);
  background: #27221e;
  box-shadow: 0 0 0 3px rgba(215, 185, 141, 0.12);
}

.form-grid input[type="date"] {
  color-scheme: dark;
}

.form-grid button {
  align-self: end;
  min-height: 44px;
}

.settings-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  align-items: end;
  gap: 16px 20px;
  padding: 18px 0 6px;
}

.settings-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #e8ded2;
  font-size: 13px;
  font-weight: 700;
}

.settings-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(226, 214, 203, 0.24);
  border-radius: 9px;
  padding: 10px 12px;
  background: #211e1b;
  color: #f5efe7;
}

.settings-form input:focus {
  outline: none;
  border-color: rgba(215, 185, 141, 0.75);
  box-shadow: 0 0 0 3px rgba(215, 185, 141, 0.12);
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(226, 214, 203, 0.12);
  border-radius: 12px;
  overflow: hidden;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid rgba(226, 214, 203, 0.1);
  text-align: left;
  padding: 14px 12px;
  vertical-align: middle;
}

.data-table th {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #e1cba9;
  background: rgba(215, 185, 141, 0.08);
  white-space: nowrap;
}

.data-table tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.018);
}

.data-table tbody tr {
  transition: background 0.16s ease;
}

.data-table tbody tr:hover {
  background: rgba(215, 185, 141, 0.075);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr[hidden] {
  display: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge.good {
  background: var(--success-soft);
  color: #b8d5b7;
}

.badge.warning {
  background: var(--warning-soft);
  color: #ecd69a;
}

.badge.danger {
  background: var(--danger-soft);
  color: #edb0a2;
}

.data-table td a {
  color: #e0c396;
  font-weight: 600;
  text-decoration: none;
}

.data-table td a:hover {
  color: #f3dfbf;
  text-decoration: underline;
}

.alert {
  width: fit-content;
  max-width: 600px;
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  border: 1px solid transparent;
}

.alert.success {
  background: var(--success-soft);
  border-color: #cfead8;
  color: var(--success);
}

.alert.error {
  background: var(--danger-soft);
  border-color: #f0c2c2;
  color: var(--danger);
}

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #201d1b 0%, #352b23 100%);
}

.login-card {
  width: min(420px, calc(100vw - 32px));
  background: #2e2925;
  border: 1px solid rgba(226, 214, 203, 0.18);
  border-radius: 14px;
  padding: 28px 24px 22px;
  box-shadow: var(--shadow);
}

.login-card .brand {
  border: none;
  margin: 0 0 18px;
  padding: 0;
}

.login-card h1 {
  font-size: 34px;
  margin-bottom: 8px;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
}

.login-card label {
  font-weight: 700;
  color: #e8ded2;
}

.login-card input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(226, 214, 203, 0.24);
  border-radius: 8px;
  margin-top: 6px;
  background: #211e1b;
  color: #f5efe7;
}

.login-card .btn.full {
  width: 100%;
  margin-top: 8px;
}

.login-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 980px) {
  .app {
    display: block;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .main {
    padding: 16px 14px 26px;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 640px) {
  .hamburger { display: inline-block; }
  .topbar { flex-wrap: wrap; }
  .top-right { margin-left: auto; }
  .stats,
  .form-grid,
  .settings-form { grid-template-columns: 1fr; }
  .welcome { flex-direction: column; align-items: flex-start; }
  .welcome-actions { width: 100%; justify-content: space-between; }
  h1 { font-size: 32px; }
  .panel-head { flex-direction: column; align-items: flex-start; }
  .search { width: 100%; min-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .sticker { animation: none; }
}
