
:root {
  --clr-primary: #4A3420;
  --clr-primary-2: #5A4430;
  --clr-secondary: #EAE4DB;
  --clr-bg: #F5F1ED;
  --clr-card: #FFFFFF;
  --clr-text: #2A1A0A;
  --clr-text-light: #8A7460;
  --clr-muted: #B09070;
  --clr-border: rgba(74, 52, 32, .14);
  --clr-success: #4CAF50;
  --clr-warning: #FF9800;
  --clr-error: #D9534F;
  --shadow-card: 0 1px 4px rgba(50,30,10,.08), 0 0 0 .5px rgba(50,30,10,.06);
  --radius: 12px;
  --bottom-nav-h: 66px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--clr-bg);
  color: var(--clr-text);
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 90;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  min-height: 52px;
  padding: calc(6px + env(safe-area-inset-top)) 10px 6px;
  background: rgba(74, 52, 32, .98);
  color: #F0EAE2;
  box-shadow: 0 2px 8px rgba(30,18,8,.18);
}

.app-header h1 {
  margin: 0;
  text-align: center;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: .2px;
}

.app-icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: rgba(255,255,255,.08);
  color: #F0EAE2;
  font-size: 28px;
  line-height: 1;
}

.app-header-spacer {
  width: 44px;
  height: 1px;
}

.app-container {
  width: 100%;
  min-height: 100vh;
  padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
}

.app-container.with-header {
  min-height: calc(100vh - 52px);
}

.app-container.no-nav {
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav {
  position: fixed;
  z-index: 95;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: var(--bottom-nav-h);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
  background: rgba(248,245,240,.97);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: .5px solid rgba(61,40,23,.1);
  box-shadow: 0 -3px 16px rgba(50,30,10,.09);
}

.nav-item {
  border: none;
  background: transparent;
  color: var(--clr-text-light);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 48px;
  font-size: 11px;
  font-weight: 600;
}

.nav-item.active {
  color: var(--clr-primary);
  background: rgba(74,52,32,.08);
}

.nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  opacity: .45;
}

.nav-item.active .nav-dot {
  opacity: 1;
}

.container {
  padding: 14px 12px;
  max-width: 760px;
  margin: 0 auto;
}

.page-title {
  margin: 0 0 12px;
  font-size: 24px;
  letter-spacing: -0.4px;
}

.card {
  background: var(--clr-card);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-card);
}

.card-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 750;
}

.card-sub {
  margin: 0;
  color: var(--clr-text-light);
  font-size: 13px;
}

.btn {
  border: none;
  border-radius: 12px;
  min-height: 48px;
  padding: 0 14px;
  font-weight: 700;
  font-size: 15px;
}

.btn-primary {
  background: var(--clr-primary);
  color: #F0EAE2;
}

.btn-secondary {
  background: var(--clr-secondary);
  color: var(--clr-primary);
}

.btn-block {
  width: 100%;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat {
  background: var(--clr-card);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow-card);
}

.stat strong {
  display: block;
  font-size: 24px;
  letter-spacing: -0.5px;
}

.stat span {
  display: block;
  margin-top: 2px;
  color: var(--clr-text-light);
  font-size: 12px;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--clr-card);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow-card);
  border: none;
  text-align: left;
  width: 100%;
  color: inherit;
  text-decoration: none;
}

.list-item-main {
  flex: 1;
  min-width: 0;
}

.list-item-title {
  margin: 0;
  font-weight: 750;
  font-size: 15px;
}

.list-item-sub {
  margin: 3px 0 0;
  color: var(--clr-text-light);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(74,52,32,.08);
  color: var(--clr-primary);
  font-size: 11px;
  font-weight: 700;
}

.loading {
  min-height: 70vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--clr-text-light);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(74,52,32,.15);
  border-top-color: var(--clr-primary);
  border-radius: 999px;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.toast-container {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--bottom-nav-h) + 14px + env(safe-area-inset-bottom));
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  margin: 0 auto;
  max-width: 520px;
  width: fit-content;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(42,26,10,.94);
  color: #F0EAE2;
  box-shadow: 0 4px 16px rgba(20,10,4,.3);
  font-size: 13px;
  font-weight: 650;
}

.toast.success { background: rgba(60,120,64,.96); }
.toast.warning { background: rgba(150,100,35,.96); }
.toast.error { background: rgba(160,60,50,.96); }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #4A3420, #6A5138);
  color: #F0EAE2;
}

.login-card {
  width: min(420px, 100%);
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 24px;
  padding: 24px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 20px 50px rgba(0,0,0,.22);
}

.login-logo {
  font-family: Georgia, serif;
  font-size: 30px;
  margin-bottom: 6px;
}

.login-card p {
  margin: 0 0 22px;
  color: rgba(240,234,226,.78);
}

.login-card .btn {
  background: #F0EAE2;
  color: #4A3420;
}

.text-muted { color: var(--clr-text-light); }
.text-center { text-align: center; }
.mt-md { margin-top: 16px; }
