/* Daylight — app shell styles (gate, keyholder dashboard, device stage).
   Reuses the design tokens defined in daylight.css :root. */

/* ---------- device stage: scale the fixed 820×1180 surface to the viewport ---------- */
.device-stage { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; overflow: hidden; }
.device-scaler { transform-origin: center; flex: none; }

/* ---------- gate (landing / pair / login / setup) ---------- */
.gate {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 40px 22px 70px; position: relative; isolation: isolate;
  background: radial-gradient(120% 90% at 50% -10%, #F1E8D7 0%, var(--bg) 60%);
}
.gate-sun { position: absolute; z-index: -1; left: 50%; top: -160px; width: 620px; height: 620px; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(231,178,90,.5), rgba(231,178,90,.1) 48%, transparent 72%); }
.gate-mark { font-family: var(--serif); font-size: 26px; display: flex; align-items: center; gap: 11px; margin-bottom: 30px; }
.wm-dot { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--gold-2), var(--gold)); box-shadow: 0 0 16px var(--gold-2); }
.wm-dot.big { width: 16px; height: 16px; }
.gate-h { font-family: var(--serif); font-weight: 300; font-size: clamp(2rem, 7vw, 3.2rem); line-height: 1.1; letter-spacing: -.02em; max-width: 16ch; }
.gate-h em { font-style: italic; color: var(--gold); }
.gate-sub { color: var(--ink-soft); font-size: 1.1rem; margin: 16px 0 26px; }
.gate-choices { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; width: 100%; max-width: 520px; }
.gate-choice { flex: 1; min-width: 210px; background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  padding: 28px 22px; cursor: pointer; box-shadow: var(--shadow); transition: transform .18s, box-shadow .25s, border-color .2s; text-align: center; }
.gate-choice:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--gold-2); }
.gc-ic { font-size: 34px; margin-bottom: 12px; }
.gc-t { font-family: var(--serif); font-size: 1.3rem; font-weight: 500; margin-bottom: 6px; }
.gc-s { color: var(--ink-soft); font-size: .92rem; }
.gate-in { width: 100%; max-width: 360px; font-size: 1.05rem; padding: 15px 18px; margin: 8px 0;
  border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); font-family: var(--sans); }
.gate-in:focus { outline: none; border-color: var(--gold-2); }
.gate-in.code { text-align: center; letter-spacing: .3em; font-size: 1.6rem; font-family: ui-monospace, monospace; text-transform: uppercase; }
.gate-btn { max-width: 360px; margin-top: 14px; }
.gate-link { background: none; border: none; color: var(--ink-faint); font-size: .95rem; margin-top: 18px; cursor: pointer; font-weight: 500; }
.gate-link:hover { color: var(--ink); }
.form-err { color: #a23b28; background: rgba(221,138,114,.14); border-radius: 10px; padding: 10px 14px; font-size: .9rem; margin: 6px 0; max-width: 360px; }
.form-err.center { text-align: center; }

/* ---------- keyholder dashboard ---------- */
.kh { min-height: 100vh; background: radial-gradient(120% 60% at 50% -10%, #F1E8D7 0%, var(--bg) 50%); padding-bottom: 60px; }
.kh-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; max-width: 760px; margin: 0 auto; }
.kh-brand { font-family: var(--serif); font-size: 1.5rem; display: flex; align-items: center; gap: 10px; }
.kh-right { display: flex; align-items: center; gap: 14px; }
.kh-who { display: flex; align-items: center; gap: 9px; }
.kh-badge { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600; background: linear-gradient(150deg, #e0a64f, #c0871f); }
.kh-whon { display: flex; flex-direction: column; line-height: 1.1; font-weight: 600; font-size: .95rem; text-align: left; }
.kh-whon small { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; }
.kh-signout { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: .85rem; cursor: pointer; color: var(--ink-soft); font-weight: 500; }
.kh-tabs { display: flex; gap: 18px; max-width: 760px; margin: 6px auto 0; padding: 0 22px; border-bottom: 1px solid var(--line); }
.kh-tab { background: none; border: none; padding: 12px 2px; font-size: 1rem; font-weight: 600; color: var(--ink-faint); cursor: pointer; border-bottom: 2px solid transparent; display: flex; align-items: center; gap: 8px; margin-bottom: -1px; }
.kh-tab.on { color: var(--ink); border-bottom-color: var(--gold); }
.kh-dot { background: var(--gold); color: #fff; font-size: 12px; min-width: 20px; height: 20px; border-radius: 999px; display: grid; place-items: center; padding: 0 5px; }
.kh-main { max-width: 760px; margin: 0 auto; padding: 20px 22px; }
.kh-empty { text-align: center; padding: 60px 20px; color: var(--ink-soft); position: relative; isolation: isolate; }
.kh-empty.small { padding: 30px; }
.kh-empty h3 { font-family: var(--serif); font-weight: 500; font-size: 1.5rem; color: var(--ink); margin-bottom: 8px; }
.kh-sun { position: absolute; z-index: -1; left: 50%; top: -30px; width: 300px; height: 300px; transform: translateX(-50%); background: radial-gradient(closest-side, rgba(231,178,90,.4), transparent 70%); }
.kh-list { display: flex; flex-direction: column; gap: 12px; }
.kh-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.kh-card-h { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; margin-bottom: 12px; }

.kh-req { display: flex; align-items: center; gap: 15px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow); }
.kh-req-body { flex: 1; min-width: 0; }
.kh-req-top { font-size: 1.05rem; }
.kh-req-why { color: var(--ink-soft); font-size: .92rem; margin-top: 3px; font-style: italic; }
.kh-req-why.dim { font-style: normal; color: var(--ink-faint); }
.kh-req-meta { font-size: .8rem; color: var(--ink-faint); margin-top: 4px; }
.kh-req-actions { display: flex; flex-direction: column; gap: 8px; }
.kh-btn { border: none; border-radius: 11px; padding: 11px 18px; font-size: .95rem; font-weight: 600; cursor: pointer; font-family: var(--sans); }
.kh-btn.ok { background: linear-gradient(150deg, #a9bf8f, #7e9a63); color: #fff; }
.kh-btn.no { background: none; border: 1.5px solid var(--line); color: var(--ink-soft); }
.kh-btn.ghost { background: none; border: 1.5px solid var(--line); color: var(--ink); }
.kh-btn.big { padding: 15px 26px; font-size: 1.05rem; }
.kh-btn:disabled { opacity: .5; cursor: default; }

.kh-form { display: flex; gap: 10px; flex-wrap: wrap; }
.kh-in { flex: 1; min-width: 130px; font-size: 1rem; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); font-family: var(--sans); }
.kh-in:focus { outline: none; border-color: var(--gold-2); }
.kh-codecard { background: linear-gradient(150deg, #f6ecd6, #f0e0c6); border: 1px solid var(--gold-2); border-radius: 18px; padding: 22px; margin-bottom: 16px; text-align: center; }
.kh-code-h { color: var(--ink-soft); font-size: .95rem; }
.kh-code { font-family: ui-monospace, monospace; font-size: 2.4rem; letter-spacing: .2em; font-weight: 600; color: var(--gold); margin: 10px 0; }
.kh-codecard p { color: var(--ink-soft); font-size: .9rem; max-width: 42ch; margin: 0 auto 14px; }

.kh-device { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; box-shadow: var(--shadow); }
.kh-dev-ico { width: 42px; height: 42px; border-radius: 11px; background: var(--bg-2); display: grid; place-items: center; font-size: 20px; }
.kh-dev-name { font-size: 1.05rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kh-dev-meta { font-size: .85rem; color: var(--ink-faint); margin-top: 2px; }
.kh-pair { color: var(--gold); }
.kh-ok { color: var(--sage); font-weight: 600; }
.kh-tagchip { font-size: 11px; background: var(--bg-2); border: 1px solid var(--line); color: var(--ink-soft); padding: 2px 9px; border-radius: 999px; font-weight: 600; }

.kh-devpick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.kh-pillbtn { background: var(--card); border: 1.5px solid var(--line); border-radius: 999px; padding: 8px 16px; font-weight: 600; cursor: pointer; color: var(--ink-soft); }
.kh-pillbtn.on { border-color: var(--gold); background: rgba(231,178,90,.12); color: var(--ink); }
.kh-rule { display: flex; align-items: center; gap: 14px; padding: 13px 2px; border-top: 1px solid var(--line); }
.kh-card .kh-rule:first-of-type { border-top: none; }
.kh-rule-t { flex: 1; }
.kh-rule-n { font-size: 1.05rem; font-weight: 600; }
.kh-rule-s { font-size: .85rem; color: var(--ink-soft); }
.kh-toggle { width: 52px; height: 30px; border-radius: 999px; border: none; background: var(--bg-3); cursor: pointer; position: relative; transition: background .2s; flex: 0 0 52px; }
.kh-toggle.on { background: linear-gradient(150deg, #e0a64f, #c0871f); }
.kh-knob { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .2s; }
.kh-toggle.on .kh-knob { left: 25px; }
.kh-caps { display: flex; gap: 6px; }
.kh-capbtn { border: 1.5px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 11px; font-weight: 600; cursor: pointer; color: var(--ink-soft); font-size: .9rem; }
.kh-capbtn.on { border-color: var(--gold); background: rgba(231,178,90,.14); color: var(--ink); }
.kh-save-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.kh-save-note { color: var(--ink-faint); font-size: .85rem; }

@media (max-width: 560px) {
  .kh-req { flex-wrap: wrap; }
  .kh-req-actions { flex-direction: row; width: 100%; }
  .kh-req-actions .kh-btn { flex: 1; }
}

/* device actions + change-password modal */
.kh-dev-actions { display: flex; gap: 6px; flex-shrink: 0; }
.kh-mini { background: none; border: 1px solid var(--line); border-radius: 9px; padding: 7px 11px; font-size: .82rem; font-weight: 600; color: var(--ink-soft); cursor: pointer; }
.kh-mini:hover { border-color: var(--gold-2); color: var(--ink); }
.kh-mini.danger:hover { border-color: var(--rose); color: #a23b28; }
.kh-modal-scrim { position: fixed; inset: 0; z-index: 100; background: rgba(34,28,20,.4); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; }
.kh-modal { background: var(--bg); border: 1px solid var(--line); border-radius: 22px; padding: 28px; width: 100%; max-width: 380px; box-shadow: var(--shadow-lg); }
.kh-modal h3 { font-family: var(--serif); font-weight: 500; font-size: 1.5rem; margin-bottom: 14px; }
.kh-modal-sub { color: var(--ink-soft); margin-bottom: 18px; }
.kh-modal .kh-in { width: 100%; margin: 8px 0; }
.kh-modal-row { display: flex; gap: 10px; margin-top: 16px; }
.kh-modal-row .kh-btn { flex: 1; }
@media (max-width: 560px) { .kh-device { flex-wrap: wrap; } .kh-dev-actions { width: 100%; } .kh-dev-actions .kh-mini { flex: 1; } }
