:root {
    color-scheme: light;
    --ink: #20251f;
    --muted: #777c73;
    --paper: #f6f4ef;
    --line: #e8e5dc;
    --green: #59745b;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { overflow-x: clip; }
body { margin: 0; overflow-x: clip; background: var(--paper); color: var(--ink); }
.shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }
.topbar { height: 78px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; font-family: Georgia, serif; font-size: 23px; letter-spacing: -.7px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--green); font-size: 18px; }
.account { display: flex; align-items: center; justify-content: end; gap: 10px; min-width: 0; }
.login-form, .account-session { display: flex; align-items: center; gap: 8px; }
.login-form input { width: min(220px, 34vw); padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: white; font: inherit; font-size: 13px; }
.login-form button, .button-secondary { padding: 9px 12px; border: 0; border-radius: 7px; color: white; background: var(--green); font: inherit; font-size: 13px; cursor: pointer; }
.button-secondary { color: var(--ink); background: #e8e5dc; }
.account-session { display: flex; align-items: center; }
.menu-button { display: grid; width: 42px; height: 42px; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: #fffefa; cursor: pointer; transition: background-color .2s ease, border-color .2s ease; }
.menu-button:hover, .menu-button[aria-expanded="true"] { border-color: #c4cebd; background: #e9eee5; }
.menu-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.account-message { max-width: 220px; color: var(--muted); font-size: 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.live { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #7eaa72; box-shadow: 0 0 0 4px #7eaa7220; }
main { padding: 0 0 80px; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 42px; }
.eyebrow { margin: 0 0 12px; color: var(--green); font-size: 11px; font-weight: 700; letter-spacing: .17em; text-transform: uppercase; }
h1 { margin: 0; font: 400 clamp(36px, 5vw, 54px)/1.04 Georgia, "Times New Roman", serif; letter-spacing: -1.8px; }
.subhead { margin: 14px 0 0; color: var(--muted); font-size: 15px; }
.count { flex: none; color: var(--muted); font-size: 13px; }
#feed { display: grid; gap: 42px; min-width: 0; }
.moment { min-width: 0; max-width: 100%; }
.moment-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 17px; }
.moment-date { font: 400 21px Georgia, serif; }
.moment-count { color: var(--muted); font-size: 12px; }
.moment-rule { height: 1px; flex: 1; background: var(--line); }
.moment-actions, .photo-actions { display: flex; align-items: center; gap: 7px; }
.moment-actions:empty { display: none; }
.rail { --photo-width: min(340px, 78vw); display: flex; width: 100%; min-width: 0; max-width: 100%; gap: 18px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-inline: contain; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 0 max(0px, calc((100% - var(--photo-width)) / 2)); }
.rail::-webkit-scrollbar { display: none; }
.rail--single { overflow-x: hidden; scrollbar-width: none; padding-bottom: 0; }
.rail--single::-webkit-scrollbar { display: none; }
.photo { position: relative; flex: 0 0 var(--photo-width); overflow: hidden; min-height: 120px; align-self: center; border-radius: 10px; background: #e4e2d9; scroll-snap-align: center; box-shadow: 0 8px 24px #302b1b12; }
.action-button { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: #fff; cursor: pointer; transition: transform .18s ease, background-color .18s ease; }
.action-button:hover { transform: translateY(-1px); background: #f0eee8; }
.action-button:disabled { opacity: .6; cursor: wait; }
.action-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.photo-actions { position: absolute; top: 12px; right: 12px; z-index: 1; }
.photo-actions .action-button { color: white; background: #161912a8; border-color: #ffffff45; backdrop-filter: blur(10px); }
.photo-actions .action-button:hover { background: #161912d9; }
.photo-delete { color: #ffe5df !important; }
.rail-indicators { display: flex; justify-content: center; gap: 8px; margin-top: 13px; }
.rail-indicator { width: 8px; height: 8px; flex: 0 0 8px; padding: 0; border: 0; border-radius: 50%; background: #c9c7bd; cursor: pointer; transition: background-color .2s ease, transform .2s ease; }
.rail-indicator.is-active { background: var(--green); transform: scale(1.2); }
.rail-indicator:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.photo img { display: block; width: 100%; height: auto; transition: transform .45s ease; }
.photo:hover img { transform: scale(1.035); }
.photo-time { position: absolute; right: 12px; bottom: 12px; padding: 7px 10px; border: 1px solid #ffffff45; border-radius: 20px; color: white; background: #16191280; backdrop-filter: blur(10px); font-size: 11px; }
.empty { padding: 70px 24px; border: 1px dashed #d8d5cc; border-radius: 14px; text-align: center; }
.empty-icon { margin-bottom: 14px; font-size: 30px; }
.empty h2 { margin: 0; font: 400 26px Georgia, serif; }
.empty p { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.error { color: #9d4035; }
.devices-backdrop { position: fixed; inset: 0; z-index: 20; width: 100%; height: 100%; padding: 0; border: 0; background: #191d1880; cursor: default; backdrop-filter: blur(2px); }
.devices-panel { position: fixed; inset: 0 0 0 auto; z-index: 21; display: flex; width: min(420px, 90vw); flex-direction: column; padding: 28px 22px 20px; border-left: 1px solid var(--line); background: #fffefa; box-shadow: -18px 0 48px #181d1826; transform: translateX(0); animation: pane-enter .24s ease-out; }
.devices-panel[hidden] { display: none; }
.menu-open { overflow: hidden; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-heading .eyebrow { display: block; margin: 0 0 5px; }
.panel-heading h2 { margin: 0; font: 400 27px Georgia, serif; }
.pane-close { display: grid; width: 38px; height: 38px; place-items: center; padding: 0 0 3px; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: white; font: 300 27px/1 system-ui, sans-serif; cursor: pointer; }
.pane-account { margin: -6px 0 20px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.admin-menu-link { display: block; margin: -5px 0 18px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #f6f4ef; font-size: 14px; font-weight: 650; text-decoration: none; }
.admin-menu-link:hover { border-color: #b9c8b7; background: #e9eee5; }
.device-list { display: grid; align-content: start; gap: 10px; flex: 1; overflow-y: auto; }
.device-card { display: flex; min-width: 0; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); text-align: left; font: inherit; cursor: pointer; transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease; }
.device-card:hover { transform: translateY(-2px); border-color: #b9c8b7; box-shadow: 0 8px 20px #302b1b12; }
.device-card > img, .device-no-image { display: grid; width: 68px; height: 68px; flex: 0 0 68px; place-items: center; border-radius: 9px; background: #e9e7de; object-fit: cover; }
.device-no-image { color: var(--green); font-size: 25px; }
.device-card-info { display: grid; min-width: 0; flex: 1; gap: 4px; }
.device-card-info strong, .device-card-info span, .device-card-info small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-card-info strong { font-size: 14px; }
.device-card-info span { color: var(--green); font-size: 12px; font-weight: 650; }
.device-card-info small, .devices-empty, .history-message { color: var(--muted); font-size: 12px; }
.device-arrow { color: var(--muted); font-size: 24px; }
.pane-footer { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); }
.logout-button { width: 100%; padding: 12px 14px; border: 0; border-radius: 9px; color: white; background: #303b31; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: background-color .2s ease; }
.logout-button:hover { background: #202820; }
.logout-button[hidden] { display: none; }
.admin-brand { color: var(--ink); text-decoration: none; }
.admin-page { padding: 48px 0 80px; }
.admin-intro { margin-bottom: 22px; }
.admin-intro h1 { font-size: clamp(36px, 5vw, 48px); }
.admin-message { min-height: 1.5em; color: var(--muted); font-size: 14px; }
.admin-device-list { display: grid; gap: 14px; }
.admin-device-card { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: #fffefa; }
.admin-device-identity { display: flex; align-items: center; gap: 16px; }
.admin-device-image { display: block; width: 112px; height: 112px; flex: 0 0 112px; border-radius: 10px; background: #e9e7de; object-fit: cover; }
.admin-device-image-empty { display: grid; place-items: center; color: var(--green); font-size: 28px; }
.admin-device-summary { min-width: 0; flex: 1; }
.admin-device-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.admin-device-heading h2 { margin: 0; font: 400 22px Georgia, serif; overflow-wrap: anywhere; }
.admin-device-code { color: var(--green); font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.admin-device-details { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.admin-device-card h3 { margin: 18px 0 6px; font-size: 13px; }
.admin-device-users { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 0; list-style: none; }
.admin-device-users li { padding: 6px 9px; border-radius: 20px; background: #e9eee5; font-size: 12px; overflow-wrap: anywhere; }
.admin-device-users .admin-no-users { color: var(--muted); background: #f0eee8; }
.admin-device-form { display: flex; gap: 8px; margin-top: 18px; }
.admin-device-form select { min-width: 0; flex: 1; padding: 10px 11px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--ink); font: inherit; font-size: 13px; }
.admin-device-form button { padding: 10px 14px; border: 0; border-radius: 7px; color: white; background: var(--green); font: inherit; font-size: 13px; cursor: pointer; }
.admin-device-form button:disabled { opacity: .55; cursor: not-allowed; }
.session-list { display: grid; gap: 12px; }
.session-card { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: #fffefa; }
.admin-page > .session-card + .session-card { margin-top: 12px; }
.session-actions { display: flex; flex: none; align-items: center; gap: 8px; }
.session-details { min-width: 0; }
.session-details h2 { margin: 0 0 9px; font: 400 20px Georgia, serif; }
.session-details p { margin: 4px 0; color: var(--muted); font-size: 13px; }
.session-close { flex: none; padding: 10px 13px; border: 1px solid #e3c7c1; border-radius: 7px; color: #8b3e32; background: #fff8f6; font: inherit; font-size: 13px; cursor: pointer; }
#device-settings-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px 18px; margin-top: 16px; }
#device-settings-form label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 650; }
#device-settings-form input, #device-settings-form select { width: 100%; box-sizing: border-box; padding: 10px 11px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--ink); font: inherit; font-size: 13px; font-weight: 400; }
#device-settings-form button, #device-settings-form .admin-message { grid-column: 1 / -1; justify-self: start; margin: 0; }
.session-close:hover { background: #f9e9e5; }
.session-close:disabled { opacity: .55; cursor: wait; }
.session-current { flex: none; padding: 7px 10px; border-radius: 20px; color: var(--green); background: #e9eee5; font-size: 12px; font-weight: 650; }
.session-push, .session-push-off { flex: none; padding: 8px 10px; border: 1px solid var(--line); border-radius: 20px; color: var(--ink); background: white; font: inherit; font-size: 12px; cursor: pointer; }
.session-push:hover { border-color: #b9c8b7; background: #e9eee5; }
.session-push-off { color: var(--muted); cursor: default; }
.session-push:disabled { opacity: .55; cursor: wait; }
@keyframes pane-enter { from { transform: translateX(24px); opacity: .7; } to { transform: translateX(0); opacity: 1; } }
.history-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.history-chart { min-width: 0; padding: 14px 12px 8px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.admin-page > .history-chart { margin-bottom: 14px; }
.history-chart h2, .history-chart h3 { margin: 0 0 8px; font: 400 17px Georgia, serif; }
.history-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-axis { stroke: var(--line); stroke-width: 1; }
.chart-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; opacity: .7; }
.chart-label { fill: var(--muted); font-family: inherit; font-size: 15px; }
.chart-summary { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.chart-summary strong { font-size: 24px; font-weight: 600; }
.chart-readout { margin: 4px 0 6px; min-height: 1.4em; font-size: 14px; color: var(--muted); }
.chart-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { stroke: white; stroke-width: 2; }
footer { padding: 20px 0 32px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
@media (max-width: 600px) {
    .shell { width: min(calc(100% - 28px), 1120px); }
    .topbar { height: 66px; }
    .account { gap: 5px; }
    .account-message { position: absolute; top: 68px; right: 14px; }
    .login-form { gap: 4px; }
    .login-form input { width: min(150px, 39vw); padding: 8px; font-size: 12px; }
    .login-form button, .button-secondary { padding: 8px 9px; font-size: 12px; }
    .intro { display: block; margin-bottom: 32px; }
    .count { display: block; margin-top: 18px; }
    #feed { gap: 32px; }
    .moment-heading { gap: 8px; }
    .moment-date { font-size: 18px; }
    .moment-actions, .photo-actions { gap: 5px; }
    .action-button { width: 32px; height: 32px; flex-basis: 32px; }
    .devices-panel { padding: 22px 16px 14px; }
    .panel-heading { align-items: flex-start; }
    .panel-heading h2 { font-size: 23px; }
    .history-charts { grid-template-columns: minmax(0, 1fr); }
    .session-card { align-items: flex-start; flex-direction: column; gap: 12px; padding: 15px; }
    .session-actions { flex-wrap: wrap; }
}
