:root {
    color-scheme: light;
    --ink: #14231e;
    --muted: #64716c;
    --paper: #f7f8f4;
    --surface: #ffffff;
    --forest: #102f27;
    --forest-2: #174b3d;
    --green: #1c8c62;
    --mint: #c9f36a;
    --mint-soft: #edfad0;
    --coral: #ed715f;
    --red: #b9453b;
    --line: #dfe6e1;
    --shadow: 0 24px 70px rgba(16, 47, 39, .12);
    --radius: 22px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.page-glow { position: fixed; z-index: -1; border-radius: 999px; filter: blur(20px); pointer-events: none; }
.page-glow--one { width: 340px; height: 340px; right: -100px; top: 10%; background: rgba(201, 243, 106, .2); }
.page-glow--two { width: 280px; height: 280px; left: 35%; bottom: -150px; background: rgba(237, 113, 95, .1); }

.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.15rem; font-weight: 820; letter-spacing: -.03em; }
.brand svg { width: 30px; height: 30px; color: var(--green); stroke-width: 2; }
.brand--light { color: #fff; }
.brand--light svg { color: var(--mint); }
.eyebrow { margin: 0 0 10px; color: var(--green); font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, .9fr) minmax(520px, 1.1fr); }
.brand-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100vh;
    padding: clamp(34px, 5vw, 70px);
    color: #fff;
    background:
        radial-gradient(circle at 75% 20%, rgba(201, 243, 106, .18), transparent 28%),
        linear-gradient(145deg, #0d2922, #174b3d 68%, #1d5d4c);
    overflow: hidden;
}
.brand-copy { max-width: 590px; margin-block: 70px; }
.brand-copy .eyebrow { color: var(--mint); }
.brand-copy h1 { margin: 0; max-width: 10ch; font-size: clamp(3rem, 6vw, 6.5rem); font-weight: 760; line-height: .95; letter-spacing: -.065em; }
.brand-intro { max-width: 44ch; margin: 28px 0 0; color: rgba(255,255,255,.7); font-size: clamp(1rem, 1.5vw, 1.2rem); line-height: 1.7; }
.live-demo { --demo-accent: rgba(255,255,255,.76); width: min(100%, 560px); margin-top: 38px; padding: 21px; border: 1px solid rgba(255,255,255,.18); border-radius: 24px; background: rgba(5,30,23,.36); box-shadow: 0 24px 70px rgba(0,0,0,.18); backdrop-filter: blur(18px); transition: border-color .3s, background .3s, transform .3s; }
.live-demo.is-open { --demo-accent: #ff8b79; border-color: rgba(255,139,121,.42); background: rgba(72,29,24,.38); }
.live-demo.is-closed { --demo-accent: var(--mint); border-color: rgba(201,243,106,.38); }
.live-demo__top, .live-demo__footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: rgba(255,255,255,.58); font-size: .68rem; font-weight: 760; letter-spacing: .11em; text-transform: uppercase; }
.live-demo__top > span:first-child { color: #fff; }
.live-demo__signal { display: inline-flex; align-items: center; gap: 7px; }
.live-demo__signal i { width: 8px; height: 8px; border-radius: 50%; background: var(--demo-accent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--demo-accent) 15%, transparent); }
.live-demo.is-loading .live-demo__signal i { animation: demo-pulse 1.2s infinite; }
.live-demo__body { display: flex; align-items: center; gap: 21px; padding: 24px 0 22px; }
.live-demo__door { width: 92px; height: 92px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 27px; color: #102f27; background: var(--demo-accent); box-shadow: 0 16px 34px rgba(0,0,0,.2); transition: background .3s, transform .3s; }
.live-demo.is-open .live-demo__door { transform: rotateY(-12deg) translateX(-2px); }
.live-demo__door svg { width: 52px; height: 52px; stroke-width: 1.75; }
.live-demo__copy { min-width: 0; }
.live-demo__copy p { margin: 0 0 4px; color: rgba(255,255,255,.68); font-size: .88rem; font-weight: 700; }
.live-demo__copy strong { display: block; color: #fff; font-size: clamp(2.25rem, 4.2vw, 3.5rem); line-height: 1; letter-spacing: -.055em; }
.live-demo__copy > span { display: block; margin-top: 8px; color: var(--demo-accent); font-size: .8rem; font-weight: 720; font-variant-numeric: tabular-nums; }
.live-demo__footer { padding-top: 15px; border-top: 1px solid rgba(255,255,255,.12); letter-spacing: .04em; text-transform: none; }
@keyframes demo-pulse { 50% { opacity: .35; transform: scale(.8); } }
.brand-status { display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,.72); font-size: .9rem; }
.pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 7px rgba(201,243,106,.12); }
.auth-panel { display: grid; place-items: center; padding: 40px; }
.auth-card { width: min(100%, 440px); padding: 12px; }
.auth-heading h2 { margin: 0; font-size: clamp(2rem, 3.2vw, 3rem); letter-spacing: -.045em; }
.auth-heading > p:last-child { margin: 10px 0 0; color: var(--muted); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 34px 0 24px; padding: 5px; border-radius: 14px; background: #e9eeea; }
.auth-tab { padding: 11px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 750; cursor: pointer; }
.auth-tab.active { background: #fff; color: var(--ink); box-shadow: 0 3px 12px rgba(20,35,30,.08); }
.stack-form { display: grid; gap: 17px; }
label { display: grid; gap: 8px; color: #33423d; font-size: .86rem; font-weight: 750; }
input {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    outline: none;
    color: var(--ink);
    background: #fff;
    transition: border-color .18s, box-shadow .18s;
}
input:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(28,140,98,.12); }
input::placeholder { color: #9aa49f; }
.text-button { min-height: 44px; padding: 11px 17px; border: 0; border-radius: 12px; font-weight: 780; cursor: pointer; transition: transform .15s, background .15s, opacity .15s; }
.text-button:hover:not(:disabled) { transform: translateY(-1px); }
.text-button:disabled { opacity: .55; cursor: wait; }
.text-button--primary { color: #fff; background: var(--forest); box-shadow: 0 8px 22px rgba(16,47,39,.18); }
.text-button--primary:hover:not(:disabled) { background: var(--forest-2); }
.text-button--quiet { color: var(--forest); background: #e9efeb; }
.text-button--danger { color: #fff; background: var(--red); }
.link-button { width: fit-content; margin: -6px auto 0; border: 0; background: none; color: var(--green); font-size: .84rem; font-weight: 720; cursor: pointer; }
.divider { display: flex; align-items: center; gap: 12px; margin: 24px 0 18px; color: #8a9691; font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.google-button { min-height: 44px; display: grid; place-items: center; }
.form-error { min-height: 1.25em; margin: 12px 0 0; color: var(--red); font-size: .84rem; }

.dashboard { min-height: 100vh; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100vw - 1240px) / 2)); border-bottom: 1px solid var(--line); background: rgba(247,248,244,.88); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 10; }
.topbar-user { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: .9rem; }
.dashboard-main { width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 62px 0 90px; }
.dashboard-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.dashboard-heading h1 { margin: 0; font-size: clamp(2.6rem, 5vw, 4.6rem); letter-spacing: -.065em; line-height: 1; }
.dashboard-heading > div > p:last-child { margin: 14px 0 0; color: var(--muted); font-size: 1.02rem; }
.icon-button { width: 42px; height: 42px; display: inline-grid; place-items: center; flex: 0 0 auto; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; transition: transform .15s, border-color .15s, background .15s; }
.icon-button:hover { transform: translateY(-1px); border-color: #b9c8c0; background: #f2f6f3; }
.icon-button--add { width: 58px; height: 58px; border: 0; border-radius: 18px; color: var(--forest); background: var(--mint); box-shadow: 0 12px 30px rgba(77,112,34,.2); }
.icon-button--add svg { width: 25px; height: 25px; stroke-width: 2.2; }
.icon-button--danger { color: var(--red); }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 38px 0 20px; }
.summary-item { padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.66); }
.summary-item strong { display: block; font-size: 1.55rem; letter-spacing: -.04em; }
.summary-item span { color: var(--muted); font-size: .79rem; font-weight: 680; }
.door-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.skeleton { min-height: 220px; border-radius: var(--radius); background: linear-gradient(100deg, #e8ece9 30%, #f4f6f4 50%, #e8ece9 70%); background-size: 400% 100%; animation: shimmer 1.5s infinite; }
@keyframes shimmer { to { background-position: -100% 0; } }
.door-card { position: relative; min-height: 230px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 6px 25px rgba(16,47,39,.05); overflow: hidden; transition: transform .2s, box-shadow .2s, border-color .2s; }
.door-card:hover { transform: translateY(-4px); border-color: #c6d3cc; box-shadow: var(--shadow); }
.door-card__main { width: 100%; height: 100%; min-height: 230px; padding: 25px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.door-card__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.state-duration { color: var(--muted); font-size: .76rem; font-weight: 720; font-variant-numeric: tabular-nums; white-space: nowrap; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; font-size: .72rem; font-weight: 820; text-transform: uppercase; letter-spacing: .08em; }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status--opened { color: #b43f35; background: #ffebe7; }
.status--closed { color: #16704f; background: #e4f5ec; }
.status--unknown { color: #6c756f; background: #eef1ef; }
.door-card h2 { margin: 30px 0 6px; padding-right: 42px; font-size: 1.45rem; letter-spacing: -.035em; }
.door-location { min-height: 1.3em; margin: 0; color: var(--muted); }
.door-location svg { width: 15px; height: 15px; margin-right: 5px; vertical-align: -2px; }
.door-seen { display: flex; align-items: center; gap: 7px; margin: 28px 0 0; color: #87918d; font-size: .78rem; }
.door-seen svg { width: 15px; height: 15px; }
.door-card__actions { position: absolute; right: 16px; top: 66px; display: grid; gap: 8px; }
.door-card__actions .icon-button { width: 36px; height: 36px; }
.door-arrow { position: absolute; right: 22px; bottom: 22px; color: #99a49f; }
.empty-state { max-width: 580px; margin: 55px auto 0; padding: 62px 30px; border: 1px dashed #bdcbc4; border-radius: var(--radius); text-align: center; background: rgba(255,255,255,.55); }
.empty-state h2 { margin: 18px 0 8px; font-size: 1.6rem; }
.empty-state p { margin: 0 auto 24px; max-width: 42ch; color: var(--muted); }
.empty-icon { width: 68px; height: 68px; display: grid; place-items: center; margin: auto; border-radius: 20px; color: var(--green); background: var(--mint-soft); }
.empty-icon svg { width: 36px; height: 36px; }

.modal { width: min(620px, calc(100% - 28px)); max-height: calc(100vh - 36px); padding: 0; border: 0; border-radius: 24px; background: transparent; overflow: visible; }
.modal::backdrop { background: rgba(8,27,22,.58); backdrop-filter: blur(5px); }
.modal--narrow { width: min(500px, calc(100% - 28px)); }
.modal--wide { width: min(780px, calc(100% - 28px)); }
.modal-card { max-height: calc(100vh - 36px); overflow: auto; padding: clamp(24px, 5vw, 38px); border-radius: 24px; background: #fff; box-shadow: 0 30px 100px rgba(0,0,0,.25); }
.modal-card h2 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.35rem); letter-spacing: -.045em; }
.modal-card > p:not(.eyebrow):not(.form-error) { color: var(--muted); line-height: 1.6; }
.modal-card label { margin-top: 20px; }
.modal-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 8px; }
.optional { color: #98a29e; font-weight: 550; }
.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 28px; }
.success-mark { width: 62px; height: 62px; display: grid; place-items: center; margin-bottom: 24px; border-radius: 20px; color: #174b3d; background: var(--mint); }
.success-mark svg { width: 30px; height: 30px; }
.token-box { display: grid; grid-template-columns: 1fr 44px; align-items: center; gap: 10px; margin: 24px 0 14px; padding: 16px; border: 1px solid #b7d8c9; border-radius: 14px; background: #f1f9f5; }
.token-box code { overflow-wrap: anywhere; color: #14533e; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88rem; line-height: 1.65; }
.warning-note { margin: 0 0 24px; padding: 13px 15px; border-radius: 12px; color: #7c4b13; background: #fff4dc; font-size: .84rem; line-height: 1.5; }
.detail-location { margin: 6px 0 0; color: var(--muted); }
.detail-status { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 8px 0 34px; padding: 20px; border-radius: 16px; background: #f3f6f3; }
.detail-status .state-duration { display: inline-block; margin-left: 11px; color: var(--ink); }
.detail-status p { margin: 5px 0 0; color: var(--muted); font-size: .84rem; }
.history-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-top: 28px; border-top: 1px solid var(--line); }
.history-head h3 { margin: 0; }
.history-head p { margin: 5px 0 0; color: var(--muted); font-size: .84rem; }
.history-list { margin: 22px 0; }
.history-item { position: relative; display: grid; grid-template-columns: 14px 1fr auto; gap: 14px; align-items: center; padding: 12px 0; }
.history-item:not(:last-child)::after { content: ""; position: absolute; left: 6px; top: 29px; bottom: -12px; width: 1px; background: var(--line); }
.history-dot { width: 13px; height: 13px; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px currentColor; background: currentColor; }
.history-item strong { font-size: .9rem; }
.history-item time { color: var(--muted); font-size: .78rem; text-align: right; }
.history-empty { padding: 28px; border-radius: 14px; text-align: center; color: var(--muted); background: #f5f7f5; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 100; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px; color: #fff; background: var(--forest); box-shadow: var(--shadow); opacity: 0; transform: translate(-50%, 20px); pointer-events: none; transition: .25s; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
    .auth-shell { grid-template-columns: 1fr; }
    .brand-panel { min-height: 0; padding: 32px; }
    .brand-copy { margin: 58px 0 30px; }
    .brand-copy h1 { font-size: clamp(2.8rem, 12vw, 5rem); }
    .live-demo { max-width: 620px; }
    .brand-status { display: none; }
    .auth-panel { padding: 48px 24px 70px; }
    .door-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
    .live-demo { padding: 18px; border-radius: 21px; }
    .live-demo__body { gap: 16px; }
    .live-demo__door { width: 76px; height: 76px; border-radius: 22px; }
    .live-demo__door svg { width: 43px; height: 43px; }
    .live-demo__footer { align-items: flex-start; flex-direction: column; gap: 5px; }
    .topbar { height: 68px; padding: 0 18px; }
    .topbar-user span { display: none; }
    .dashboard-main { width: min(100% - 30px, 1240px); padding-top: 42px; }
    .dashboard-heading { align-items: center; }
    .dashboard-heading > div > p:last-child { max-width: 30ch; }
    .summary-grid { grid-template-columns: 1fr 1fr 1fr; gap: 7px; }
    .summary-item { padding: 13px 11px; }
    .summary-item strong { font-size: 1.3rem; }
    .door-grid { grid-template-columns: 1fr; }
    .door-card__top { align-items: flex-start; flex-direction: column; }
    .modal-card { border-radius: 20px; }
    .history-item { grid-template-columns: 14px 1fr; }
    .history-item time { grid-column: 2; text-align: left; }
    .detail-status { align-items: start; flex-direction: column; }
    .detail-status .state-duration { display: block; margin: 9px 0 0; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
