/* yescom PWA — base styles */
:root {
  --brand: #2A4DAD;
  --primary: #2563EB;
  --primary-strong: #1D4ED8;
  --secondary: #6B7280;
  --secondary-soft: #E5E7EB;
  --danger: #DC2626;
  --danger-soft: #FEE2E2;
  --success: #16A34A;
  --success-soft: #DCFCE7;
  --warning: #D97706;
  --warning-soft: #FEF3C7;
  --indigo: #4F46E5;
  --indigo-soft: #E0E7FF;
  --amber: #B45309;
  --amber-soft: #FEF3C7;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --ink-900: #0F172A;
  --ink-700: #334155;
  --ink-500: #64748B;
  --ink-300: #94A3B8;
  --line: #E2E8F0;
  --radius: 12px;
  --radius-lg: 14px;
  --shadow-1: 0 1px 2px rgba(15,23,42,.06), 0 4px 12px rgba(15,23,42,.04);
  --shadow-2: 0 4px 16px rgba(15,23,42,.08);
  --tap: 48px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
/* HTML5 hidden 속성이 .topbar/.tabbar/.chip의 display 선언에 덮어쓰이지 않도록 보장 */
[hidden] { display: none !important; }
body {
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  font-size: 16px;
  color: var(--ink-900);
  background: var(--surface);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; }

.app {
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  position: relative;
  padding-top: var(--safe-top);
}
/* 인증 단계 — 풀스크린 흰 배경, 탭바 없음, CTA 하단 고정 */
.app--auth .view {
  display: flex;
  padding: 0 16px;
  padding-bottom: var(--safe-bottom);
}
.app--auth .auth-wrap { width: 100%; }

/* ============= TOPBAR ============= */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 8px;
  height: 56px;
  padding: 0 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar__icon {
  width: 40px; height: 40px;
  flex: 0 0 40px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: 10px;
  color: var(--ink-700);
  cursor: pointer;
}
.topbar__icon:active { background: #F8FAFC; }
/* 좌측 brand — 우측 그룹이 늘어도 절대 침범 안 됨 (min-width:0 + overflow:hidden) */
.topbar__brand {
  flex: 1 1 auto;
  min-width: 0; overflow: hidden;
  display: flex; align-items: center; gap: 8px;
}
.topbar__brand img {
  height: 28px; max-height: 28px;
  max-width: 100%;
  object-fit: contain;
  display: block;
}
/* 우측 그룹은 자기 콘텐츠만큼만 — 줄어들 일 없게 명시 */
.topbar__right {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 6px;
  position: relative;
}
.chip {
  display: inline-flex; align-items: center;
  height: 28px; max-width: 110px; padding: 0 10px;
  font-size: 12px; color: var(--ink-700);
  background: #F8FAFC; border: 1px solid var(--line); border-radius: 999px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip b { color: var(--primary); margin-left: 4px; font-weight: 700; }

.dropdown {
  position: absolute; top: 48px; right: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  z-index: 40;
}
.dropdown__head { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.dropdown__name { font-weight: 600; }
.dropdown__phone { font-size: 12px; color: var(--ink-500); margin-top: 2px; }
.dropdown__item {
  display: block; width: 100%; padding: 12px 14px;
  background: transparent; border: 0; text-align: left;
  font-size: 14px; color: var(--ink-700); cursor: pointer;
}
.dropdown__item:hover { background: var(--surface-2); }

/* ============= VIEW ============= */
.view {
  flex: 1;
  padding: 16px;
  padding-bottom: calc(72px + var(--safe-bottom));
}

/* ============= TABBAR ============= */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; width: 100%; max-width: 480px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  z-index: 20;
  padding-bottom: var(--safe-bottom);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 10px 0;
  color: var(--ink-500); text-decoration: none; font-size: 11px;
}
.tab.active { color: var(--primary); }
.tab svg { width: 22px; height: 22px; }

/* ============= INSTALL BANNER ============= */
.install-banner {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 4px 0;
  padding: 12px 12px 12px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, #EFF6FF, #DBEAFE);
  border: 1px solid #BFDBFE;
  color: var(--ink-900);
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.install-banner__icon {
  width: 36px; height: 36px; flex: 0 0 36px;
  border-radius: 8px; overflow: hidden;
  background: var(--surface);
}
.install-banner__icon img { width: 100%; height: 100%; object-fit: contain; }
.install-banner__copy { flex: 1; min-width: 0; line-height: 1.35; }
.install-banner__title { font-size: 14px; font-weight: 700; }
.install-banner__sub { font-size: 12px; color: var(--ink-700); margin-top: 2px; }
.install-banner__sub b { color: var(--primary); font-weight: 700; }
.install-banner__btn {
  flex: 0 0 auto;
  height: 32px; padding: 0 14px;
  background: var(--primary); color: #fff;
  border: 0; border-radius: 999px;
  font-size: 13px; font-weight: 700;
  cursor: pointer;
}
.install-banner__btn:hover { background: var(--primary-strong); }
.install-banner__close {
  flex: 0 0 28px;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: 999px;
  color: var(--ink-500); cursor: pointer;
}
.install-banner__close:hover { background: rgba(15,23,42,.06); color: var(--ink-900); }

/* ============= AUTH/LOGIN ============= */
.auth-wrap {
  position: relative;
  max-width: 380px; margin: 0 auto;
  padding: 16px 4px 24px;
  display: flex; flex-direction: column; align-items: stretch;
}
/* 인증 화면 좌상단 뒤로가기 — iOS/Android 공통(시스템 백 비의존) */
.auth-back {
  position: absolute; top: 4px; left: 0; z-index: 5;
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: 10px;
  color: var(--ink-700); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.auth-back:active { background: #F8FAFC; }
.auth-logo {
  display: flex; justify-content: center;
  margin: 16px 0 28px;
}
.auth-logo img { height: 140px; max-height: 22vh; object-fit: contain; }
.auth-title {
  text-align: center; font-size: 20px; font-weight: 700; color: var(--ink-900);
  letter-spacing: -0.02em;
  margin: 0 0 24px;
}
.auth-fields { display: flex; flex-direction: column; gap: 14px; }
.auth-foot {
  margin-top: 32px;
  display: flex; flex-direction: column; gap: 20px;
}

.field { margin-bottom: 16px; }
.field__label {
  display: block; font-size: 13px; font-weight: 500; color: var(--ink-700);
  margin-bottom: 6px;
}
.input {
  width: 100%; height: var(--tap);
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; color: var(--ink-900);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.input--invalid { border-color: var(--danger); }
.input--center { text-align: center; letter-spacing: 4px; font-weight: 600; }

.phone-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.phone-row .input { text-align: center; }

.otp-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center;
}
.timer { font-size: 14px; color: var(--ink-500); padding: 0 8px; min-width: 48px; text-align: center; }
.timer--danger { color: var(--danger); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; height: var(--tap);
  padding: 0 16px;
  border: 0; border-radius: var(--radius);
  font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-strong); }
.btn--secondary { background: var(--secondary); color: #fff; }
.btn--secondary:hover { background: #4B5563; }
.btn--danger { background: var(--danger); color: #fff; }
.btn--success { background: var(--success); color: #fff; }
.btn--ghost { background: transparent; color: var(--ink-700); border: 1px solid var(--line); }
.btn--small { height: 36px; font-size: 13px; padding: 0 12px; width: auto; }

.btn-stack { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.btn--lg { height: 52px; font-size: 16px; border-radius: 14px; }

.check-row { display: flex; gap: 16px; margin-top: 14px; }
.check {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--ink-700);
  cursor: pointer;
}
.check input { width: 16px; height: 16px; accent-color: var(--primary); }

/* ============= HOME / STATUS ============= */

/* 사이트 선택 — 커스텀 dropdown (native select 대체) */
.site-picker { position: relative; margin-bottom: 14px; }
.site-picker__trigger {
  width: 100%; height: 60px;
  padding: 0 14px;
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  font-size: 15px; color: var(--ink-900);
  text-align: left;
  transition: border-color .12s, background .12s;
}
.site-picker__trigger:hover { background: #FAFBFC; }
.site-picker.is-open .site-picker__trigger { border-color: var(--primary); }
.site-picker__logo {
  width: 56px; height: 40px;
  flex: 0 0 56px;
  object-fit: contain;
  border-radius: 6px;
  background: transparent;
  padding: 0;
}
.site-picker__name {
  flex: 1; min-width: 0;
  font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.site-picker__chevron {
  flex: 0 0 auto; color: var(--ink-500);
  transition: transform .15s;
}
.site-picker.is-open .site-picker__chevron { transform: rotate(180deg); }
.site-picker__menu {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-2);
  list-style: none; margin: 0; padding: 6px;
  z-index: 25;
  max-height: 320px; overflow-y: auto;
}
.site-picker__menu li { margin: 0; }
.site-picker__item {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: transparent; border: 0;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font-size: 14px; color: var(--ink-900);
}
.site-picker__item:hover { background: #F8FAFC; }
.site-picker__item img {
  width: 52px; height: 36px;
  flex: 0 0 52px;
  object-fit: contain;
  border-radius: 6px;
  background: transparent;
  padding: 0;
}
.site-picker__item-name { flex: 1; min-width: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-picker__item.is-active { background: rgba(37,99,235,.06); color: var(--primary); font-weight: 600; }
.site-picker__check { flex: 0 0 auto; color: var(--primary); }

/* B안 — slim picker: 로고 제거, 높이 낮춤 */
.site-picker--slim .site-picker__trigger { height: 44px; padding: 0 12px; }
.site-picker--slim .site-picker__item { padding: 8px 10px; }

.status-card {
  position: relative;
  height: 240px;
  border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-1);
  background: var(--surface);
  margin-bottom: 14px;
}
/* 두 배경 레이어 — 상태에 따라 cross-fade */
.status-card__img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0;
  transition: opacity .5s ease;
}
.status-card[data-status="armed"]    .status-card__img--armed    { opacity: 1; }
.status-card[data-status="disarmed"] .status-card__img--disarmed { opacity: 1; }
.status-card__overlay {
  position: absolute; inset: 0;
  display: flex; align-items: flex-end;
  padding: 18px 20px 20px;
  background: linear-gradient(180deg, transparent 35%, rgba(15,23,42,.78));
  color: #fff;
  z-index: 1;
}
.status-card__row {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; min-width: 0;
}
.status-card__copy {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-align: center; min-width: 0;
}
.status-card__text {
  font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2;
  text-shadow: 0 1px 6px rgba(0,0,0,.45);
}
.status-card__sub {
  font-size: 13px; font-weight: 500; line-height: 1.4;
  color: rgba(255,255,255,.88);
  text-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.status-card__text b.armed { color: #FCA5A5; }
.status-card__text b.disarmed { color: #86EFAC; }
.status-card__text b.home_armed { color: #C7D2FE; }
.status-card__text b.door_opening { color: #FCD34D; }

/* ============= B안 — 페이지 9 스타일 ============= */
.status-b {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px;
  border-radius: 20px;
  padding: 48px 16px 36px;
  color: #fff;
  box-shadow: 0 8px 24px rgba(15,23,42,.12);
  margin-bottom: 18px;
}
/* 큰 아이콘 — 흰색 채움, 테두리/배경 없음 */
.status-b__icon { color: #fff; line-height: 0; }
.status-b__icon svg { width: 128px; height: 128px; display: block; }
.status-b__label {
  font-size: 26px; font-weight: 800; letter-spacing: -0.02em;
  text-shadow: 0 1px 6px rgba(0,0,0,.16);
}
.status-b__sub {
  font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,.92);
  margin-top: -10px;
}
.status-b--armed        { background: #2A4DAD; }
.status-b--disarmed     { background: #EA7C3C; }
.status-b--home_armed   { background: #4F46E5; }
.status-b--door_opening { background: #D97706; }

/* B안 — 2버튼 (텍스트만, 솔리드 컬러 : 경계=파랑 / 해제=주황) */
.bbtn-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 18px;
}
.bbtn {
  height: 64px;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--primary); color: #fff;
  border: 0; border-radius: 12px;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(15,23,42,.10);
  transition: transform .05s, box-shadow .15s, background .15s;
  line-height: 1.15;
}
.bbtn:active { transform: scale(.98); }
.bbtn__ko { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.bbtn__en { font-size: 11px; font-weight: 600; opacity: 0.85; }
.bbtn--arm        { background: #2A4DAD; }   /* 경계 — 파랑 */
.bbtn--arm:hover        { background: #1E3A8A; }
.bbtn--disarm     { background: #EA7C3C; }   /* 해제 — 주황 */
.bbtn--disarm:hover     { background: #C2410C; }
.bbtn--home_arm   { background: #64748B; }
.bbtn--home_arm:hover   { background: #475569; }
.bbtn--door_open  { background: #494949; }
.bbtn--door_open:hover  { background: #2F2F2F; }
.bbtn.is-active { box-shadow: 0 0 0 3px rgba(15,23,42,.25), 0 6px 14px rgba(0,0,0,.18); }

/* B안 알림 — 한 줄, 아이콘 없음 */
.alert-list--b { gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.alertrow {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 12px;
  padding: 11px 14px;
  font-size: 13px;
  color: var(--ink-900);
  border-bottom: 1px solid var(--line);
}
.alertrow:last-child { border-bottom: 0; }
.alertrow__date { color: var(--ink-700); font-variant-numeric: tabular-nums; }
.alertrow__time { color: var(--ink-500); font-variant-numeric: tabular-nums; }
.alertrow__tag  { color: var(--ink-900); font-weight: 600; }

.action-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 14px;
}
.action {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  height: 80px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  font-size: 17px; font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-900); cursor: pointer;
  transition: transform .05s, box-shadow .15s, border-color .15s;
}
.action:active { transform: scale(.98); }
/* 액션 아이콘 — 누끼 (배경 박스 없음) */
.action__dot {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0;
}
.action__dot svg { width: 34px; height: 34px; }
.action__dot img { width: 100%; height: 100%; object-fit: contain; }
/* 자물쇠 PNG는 여백 거의 없는 누끼 — 컨테이너에 거의 가득 */
.action__img { width: 42px; height: 44px; }
.action--arm .action__dot    { color: var(--danger); }
.action--disarm .action__dot { color: var(--success); }
.action--home .action__dot   { color: var(--indigo); }
.action--door .action__dot   { color: var(--amber); }
/* 액션 선택 강조 — 액션별 자기 색으로 강조 */
.action.is-active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.18); background: rgba(37,99,235,.05); }
.action--arm.is-active    { border-color: var(--danger);  box-shadow: 0 0 0 3px rgba(220,38,38,.20); background: rgba(220,38,38,.06); }
.action--disarm.is-active { border-color: var(--success); box-shadow: 0 0 0 3px rgba(22,163,74,.20); background: rgba(22,163,74,.06); }
.action--home.is-active   { border-color: var(--indigo);  box-shadow: 0 0 0 3px rgba(79,70,229,.20); background: rgba(79,70,229,.06); }
.action--door.is-active   { border-color: var(--amber);   box-shadow: 0 0 0 3px rgba(180,83,9,.22);  background: rgba(180,83,9,.06); }

.section-title {
  font-size: 13px; font-weight: 600; color: var(--ink-500);
  margin: 4px 0 8px;
}
/* 최근 알림 — 클릭하면 알림 화면으로 */
.alerts-header {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  padding: 4px 2px 8px;
  background: transparent; border: 0;
  font-family: inherit; cursor: pointer;
}
.alerts-header__title { font-size: 13px; font-weight: 600; color: var(--ink-500); }
.alerts-header__more {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 12px; font-weight: 600; color: var(--primary);
}
.alert-list--clickable { cursor: pointer; }
.alert-list--clickable:active { opacity: 0.85; }

.alert-list { display: flex; flex-direction: column; gap: 6px; }
.alert {
  display: grid; grid-template-columns: 32px 1fr; gap: 10px;
  padding: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.alert__icon { width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
.alert__icon--arm { background: var(--danger-soft); color: var(--danger); }
.alert__icon--disarm { background: var(--success-soft); color: var(--success); }
.alert__icon--intrusion { background: var(--warning-soft); color: var(--warning); }
.alert__icon--door { background: var(--amber-soft); color: var(--amber); }
.alert__time { font-size: 11px; color: var(--ink-500); margin-bottom: 2px; }
.alert__msg { font-size: 13px; color: var(--ink-900); line-height: 1.45; }

/* ============= ALERTS PAGE ============= */
.filter-row { display: flex; gap: 6px; margin-bottom: 10px; overflow-x: auto; }
.filter-row .btn--small { white-space: nowrap; }

/* ============= SETTINGS ============= */
.setting-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px; margin-bottom: 12px;
}
.setting-card h3 { margin: 0 0 12px; font-size: 14px; font-weight: 700; color: var(--ink-900); }
.radio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.radio {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: #F8FAFC; border: 1px solid var(--line); border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
}
.radio input { accent-color: var(--primary); }
.radio.is-active { background: rgba(37,99,235,.06); border-color: var(--primary); color: var(--primary); }

.days-grid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px;
}
.day {
  display: flex; align-items: center; justify-content: center;
  height: 32px;
  background: #F8FAFC; border: 1px solid var(--line); border-radius: 8px;
  font-size: 12px; font-weight: 500; color: var(--ink-700);
  cursor: pointer;
  user-select: none;
}
.day.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ============= DISPATCHER ============= */
.dispatcher {
  display: flex; flex-direction: column; align-items: center;
  padding: 24px 16px;
  gap: 18px;
}
.dispatcher__num {
  font-size: 28px; font-weight: 700; color: var(--ink-900);
  letter-spacing: 0.02em;
}
.dispatcher__sub { color: var(--ink-500); font-size: 13px; }
.dial-btn {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: var(--success); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; cursor: pointer; box-shadow: var(--shadow-2);
}
.dial-btn:active { transform: scale(.96); }

/* ============= TOAST ============= */
.toast-root {
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%);
  z-index: 60;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  background: rgba(15,23,42,.92); color: #fff;
  padding: 10px 14px; border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow-2);
  animation: toastIn .2s ease-out, toastOut .25s ease-in 2.4s forwards;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* ============= MODAL ============= */
.modal-root { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.modal-root.is-open { pointer-events: auto; }
.modal-backdrop {
  position: absolute; inset: 0; background: rgba(15,23,42,.5);
  opacity: 0; transition: opacity .15s;
}
.modal-root.is-open .modal-backdrop { opacity: 1; }
.modal-card {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.96);
  width: calc(100% - 48px); max-width: 360px;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2); padding: 20px; opacity: 0;
  transition: opacity .15s, transform .15s;
}
.modal-root.is-open .modal-card { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.modal-card h3 { margin: 0 0 8px; font-size: 16px; font-weight: 700; }
.modal-card p { margin: 0 0 16px; font-size: 14px; color: var(--ink-700); line-height: 1.5; }
.modal-actions { display: flex; gap: 8px; }
.modal-actions .btn { width: auto; flex: 1; }

/* ============= LOADING ============= */
.loading {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============= EMPTY ============= */
.empty {
  text-align: center; padding: 32px 16px; color: var(--ink-500); font-size: 14px;
}
