/* სახლის ჰაბი — shared styles (login + app) */
:root {
  --font: 'Noto Sans Georgian', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --bg: #F4F1EC; --surface: #FFFFFF; --inset: #F3F0EB; --line: #E8E2D9; --line-strong: #D6CEC2;
  --text: #1C1917; --muted: #78716C; --faint: #A8A29E;
  --solid: #1C1917; --solid-text: #FFFFFF;
  --brand: #F59E0B; --brand-soft: rgba(245, 158, 11, .14);
  --ok: #15803D; --ok-bg: #ECFDF3; --ok-line: #BBF7D0;
  --warn: #B45309; --warn-bg: #FFF7E6; --warn-line: #FDE3A7;
  --danger: #DC2626; --focus: rgba(245, 158, 11, .5);
  --scrim: rgba(28, 25, 23, .45);
  --shadow: 0 1px 2px rgba(28, 25, 23, .04), 0 8px 24px -12px rgba(28, 25, 23, .12);
  --shadow-pop: 0 30px 60px -20px rgba(28, 25, 23, .35), 0 0 0 1px rgba(28, 25, 23, .05);
  --toast-bg: #1C1917; --toast-fg: #FAFAF9;
  --r-xl: 22px; --r-lg: 16px; --r-md: 12px; --r-sm: 10px;
  --ease: cubic-bezier(.2, .8, .2, 1); --dur: 180ms;
  --tabbar-h: 64px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0E0E10; --surface: #17171A; --inset: #111113; --line: #26262B; --line-strong: #34343B;
  --text: #FAFAF9; --muted: #A1A1AA; --faint: #71717A;
  --solid: #FAFAF9; --solid-text: #111113;
  --brand-soft: rgba(245, 158, 11, .16);
  --ok: #4ADE80; --ok-bg: rgba(34, 197, 94, .12); --ok-line: rgba(34, 197, 94, .3);
  --warn: #FCD34D; --warn-bg: rgba(245, 158, 11, .12); --warn-line: rgba(245, 158, 11, .3);
  --danger: #F87171; --scrim: rgba(0, 0, 0, .65);
  --shadow: none; --shadow-pop: 0 30px 60px -20px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .06);
  --toast-bg: #FAFAF9; --toast-fg: #1C1917;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  font-family: var(--font); font-size: 14.5px; line-height: 1.45; background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%;
  touch-action: manipulation; overscroll-behavior: none; -webkit-user-select: none; user-select: none;
}
input, textarea { -webkit-user-select: text; user-select: text; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
button:disabled { cursor: default; opacity: .45; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ic { display: block; flex-shrink: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.scroll { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(120, 113, 108, .3) transparent; }

/* ---------- primitives ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px;
  border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px;
  white-space: nowrap; text-decoration: none; color: inherit;
  transition: transform var(--dur) var(--ease), background-color var(--dur), border-color var(--dur), opacity var(--dur);
}
.btn:hover { border-color: var(--line-strong); }
.btn:active { transform: scale(.97); }
.btn-solid { background: var(--solid); color: var(--solid-text) !important; border-color: transparent; }
.btn-solid:hover { opacity: .9; }
.btn-brand { background: var(--brand); color: #1C1917 !important; border-color: transparent; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; border-radius: var(--r-sm); }
.btn-block { width: 100%; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); transition: background-color var(--dur), color var(--dur); }
.icon-btn:hover { background: var(--inset); color: var(--text); }
.field {
  width: 100%; height: 48px; padding: 0 14px; border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--inset); font-size: 16px; transition: border-color var(--dur), box-shadow var(--dur), background-color var(--dur);
}
.field::placeholder { color: var(--faint); }
.field:focus { outline: none; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px var(--brand-soft); }
.label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 0 0 6px 2px; }
.error { min-height: 20px; margin-top: 8px; font-size: 13px; color: var(--danger); }

.avatar {
  --h: 30; width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; overflow: hidden;
  font-size: 16px; font-weight: 700; background: hsl(var(--h) 80% 92%); color: hsl(var(--h) 50% 30%);
}
[data-theme="dark"] .avatar { background: hsl(var(--h) 35% 20%); color: hsl(var(--h) 80% 78%); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow); }

/* ---------- toasts ---------- */
.toasts {
  position: fixed; z-index: 80; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px);
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
}
.toast {
  pointer-events: auto; position: relative; overflow: hidden; width: 100%; max-width: 420px; min-height: 52px;
  display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: var(--r-lg);
  background: var(--toast-bg); color: var(--toast-fg); box-shadow: var(--shadow-pop); font-size: 14px; font-weight: 500;
  opacity: 0; transform: translateY(12px) scale(.97); transition: opacity 220ms var(--ease), transform 220ms var(--ease);
}
.toast.in { opacity: 1; transform: none; }
.toast-msg { flex: 1; min-width: 0; }
.toast button { height: 36px; padding: 0 12px; border-radius: 10px; font-weight: 700; color: var(--brand); display: inline-flex; align-items: center; gap: 6px; }
.toast-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--brand); transform-origin: left; animation: shrink var(--ms, 5s) linear forwards; }
@keyframes shrink { to { transform: scaleX(0); } }

/* ---------- login ---------- */
.login { height: 100%; display: grid; grid-template-columns: 1fr; overflow-y: auto; }
@media (min-width: 900px) { .login { grid-template-columns: 1.05fr 1fr; } }
.login-photo { display: none; position: relative; overflow: hidden; }
@media (min-width: 900px) { .login-photo { display: block; } }
.login-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 35%; }
.login-photo::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, .55)); }
.login-photo figcaption { position: absolute; left: 40px; bottom: 36px; z-index: 1; color: #fff; font-size: 15px; opacity: .92; }
.login-main { display: flex; align-items: center; justify-content: center; padding: calc(32px + env(safe-area-inset-top)) 20px calc(32px + env(safe-area-inset-bottom)); }
.login-box { width: 100%; max-width: 400px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.brand-mark { width: 44px; height: 44px; border-radius: 13px; overflow: hidden; flex-shrink: 0; }
.brand-mark img { width: 100%; height: 100%; display: block; }
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.brand-sub { font-size: 13px; color: var(--muted); }
.login h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 6px; }
.login .lead { color: var(--muted); margin-bottom: 22px; }
.who-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.who {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px 14px; border-radius: var(--r-lg);
  background: var(--surface); border: 1.5px solid var(--line); font-weight: 600;
  transition: border-color var(--dur), transform var(--dur) var(--ease), box-shadow var(--dur);
}
.who:hover { border-color: var(--line-strong); }
.who:active { transform: scale(.97); }
.who[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.who small { font-size: 11px; font-weight: 500; color: var(--faint); }
.pw-step { margin-top: 18px; animation: rise 260ms var(--ease); }
.remember { margin-top: 14px; font-size: 12.5px; color: var(--muted); text-align: center; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
