/* Bhaada — base: tokens, reset, layout */

:root {
  --ink: #111111;
  --ink-soft: #666666;
  --ink-faint: #999999;
  --paper: #ffffff;
  --paper-dim: #f5f5f3;
  --line: #e4e4e0;
  --accent: #ff2e00;
  --green: #1a8f3c;
  --green-bg: #e8f5ec;
  --amber: #b57a00;
  --amber-bg: #fdf3dd;
  --red: #d02b00;
  --red-bg: #fdeae5;
  --grey-bg: #f0f0ee;
  --radius: 14px;
  --tap: 48px;
  --pad: 16px;
  --tabbar-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html { height: 100%; }

body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  min-height: 100%;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button { font-family: inherit; font-size: inherit; border: none; background: none; color: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 16px; color: var(--ink); }
a { color: inherit; text-decoration: none; }

.hidden { display: none !important; }

/* ---- Main view ---- */

.view {
  max-width: 560px;
  margin: 0 auto;
  padding: var(--pad);
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px);
  padding-top: calc(var(--pad) + env(safe-area-inset-top));
}

/* ---- Typography ---- */

h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 10px;
}

.muted { color: var(--ink-soft); }
.small { font-size: 13.5px; }
.tiny  { font-size: 12px; color: var(--ink-faint); }

/* ---- Tab bar ---- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255,255,255,0.96);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 40;
}

.tab {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  color: var(--ink-faint);
  font-size: 11.5px;
  font-weight: 550;
}

.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--ink); }

/* ---- Backup banner ---- */

.backup-banner {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  background: #111; color: #fff;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
  font-size: 13.5px;
}
.backup-banner span { flex: 1; }
.banner-btn {
  background: var(--accent); color: #fff;
  padding: 7px 12px; border-radius: 9px;
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.banner-x { color: #999; font-size: 22px; padding: 0 4px; line-height: 1; }

/* ---- Toast ---- */

.toast {
  position: fixed;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
  left: 50%; transform: translateX(-50%);
  background: #111; color: #fff;
  padding: 11px 20px;
  border-radius: 100px;
  font-size: 14.5px; font-weight: 550;
  z-index: 90;
  max-width: 88vw;
  text-align: center;
  animation: toast-in 0.22s ease;
  box-shadow: 0 6px 24px rgba(0,0,0,0.22);
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---- Confirm dialog ---- */

.confirm-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 28px;
}
.confirm-box {
  background: #fff; border-radius: var(--radius);
  padding: 22px; width: 100%; max-width: 340px;
}
.confirm-box p { font-size: 16.5px; font-weight: 550; margin-bottom: 18px; line-height: 1.4; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---- Sheet (bottom drawer) ---- */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,0.45);
  animation: fade-in 0.2s ease;
}
@keyframes fade-in { from { opacity: 0; } }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: #fff;
  border-radius: 20px 20px 0 0;
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px var(--pad);
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto;
  animation: sheet-up 0.25s ease;
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0.4; } }

.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.sheet-head h2 { font-size: 21px; }
.sheet-close { font-size: 26px; color: var(--ink-faint); padding: 2px 8px; line-height: 1; }
