:root {
    --ink: #151933;
    --muted: #68708d;
    --primary: #6559e8;
    --primary-dark: #4d43ca;
    --mint: #3dd9c5;
    --surface: rgba(255, 255, 255, .93);
    --line: #e4e6f1;
    --danger: #c73f55;
    --success: #137f6e;
    --shadow: 0 30px 80px rgba(25, 29, 71, .20);
    --radius: 28px;
    --app-height: 100dvh;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    min-height: var(--app-height);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 12% 8%, rgba(129,116,255,.38), transparent 32%),
        radial-gradient(circle at 88% 88%, rgba(61,217,197,.30), transparent 34%),
        linear-gradient(145deg, #151833 0%, #252a57 48%, #17243a 100%);
}
body::before, body::after {
    content: "";
    position: fixed;
    border-radius: 999px;
    filter: blur(4px);
    pointer-events: none;
    opacity: .6;
}
body::before { width: 220px; height: 220px; background: #7267ee; left: -80px; bottom: 10%; }
body::after { width: 180px; height: 180px; background: #34cdb9; right: -70px; top: 7%; }

a { color: var(--primary-dark); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

.auth-shell, .page-shell {
    position: relative;
    z-index: 1;
    min-height: var(--app-height);
    display: grid;
    place-items: center;
    padding: clamp(14px, 3vw, 38px);
}

.phone-card {
    width: min(100%, 470px);
    min-height: min(820px, calc(var(--app-height) - 28px));
    background: var(--surface);
    border: 1px solid rgba(255,255,255,.55);
    border-radius: 38px;
    box-shadow: var(--shadow);
    overflow: hidden;
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
}

.landing-page { overflow: hidden; }
.landing-page .auth-shell { height: var(--app-height); min-height: 0; overflow: hidden; }
.landing-page .landing-card { height: min(820px, calc(var(--app-height) - clamp(28px, 6vw, 76px))); min-height: 0; }

.landing-card { padding: 28px 26px 24px; }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 850; letter-spacing: -.02em; }
.brand-mark {
    width: 42px; height: 42px; border-radius: 14px;
    display: grid; place-items: center; color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--mint));
    box-shadow: 0 10px 25px rgba(98,87,233,.32);
}
.status-pill {
    padding: 7px 11px; border-radius: 999px; color: #137466;
    background: #dffaf5; font-size: 12px; font-weight: 800;
}
.hero-copy { text-align: center; padding-top: 20px; }
.eyebrow { margin: 0 0 8px; color: var(--primary); text-transform: uppercase; letter-spacing: .16em; font-size: 12px; font-weight: 900; }
h1, h2, h3 { letter-spacing: -.035em; }
.hero-copy h1 { margin: 0; font-size: clamp(36px, 9vw, 56px); line-height: .98; }
.hero-copy p { color: var(--muted); line-height: 1.55; margin: 15px auto 0; max-width: 360px; }
.hero-art { margin: 12px auto 2px; width: min(100%, 410px); }
.trust-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 18px; }
.trust-item { padding: 10px 6px; border-radius: 15px; text-align: center; color: #555e7c; background: #f4f5fb; font-size: 11px; font-weight: 800; }
.welcome-back { margin: 6px 0 14px; text-align: center; color: #4d5674; font-size: 14px; }
.action-stack { margin-top: auto; display: grid; gap: 11px; }
.btn {
    border: 0; border-radius: 15px; min-height: 52px; padding: 13px 18px;
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    text-decoration: none; font-weight: 850; transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn-primary { color: #fff; background: linear-gradient(135deg, var(--primary), #7669f1); box-shadow: 0 13px 27px rgba(98,87,233,.28); }
.btn-primary:hover { box-shadow: 0 17px 32px rgba(98,87,233,.36); }
.btn-secondary { color: var(--ink); background: #eef0f8; border: 1px solid #e0e3ef; }
.btn-danger { color: white; background: var(--danger); }
.btn-ghost { color: var(--primary-dark); background: transparent; }
.subtle-link { text-align: center; margin-top: 4px; font-size: 13px; }
.privacy-note { color: #8a90a6; text-align: center; font-size: 11px; line-height: 1.5; margin: 16px 10px 0; }

.auth-form-page { overflow: hidden; }
.auth-form-page .auth-shell { height: var(--app-height); min-height: 0; overflow: hidden; }
.form-card { height: min(860px, calc(var(--app-height) - 28px)); min-height: 0; }
.form-header {
    position: sticky; top: 0; z-index: 10; padding: 20px 22px 16px;
    background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px);
}
.back-link { display: inline-flex; align-items: center; gap: 6px; color: #555e7b; text-decoration: none; font-weight: 750; font-size: 14px; }
.form-header h1 { margin: 12px 0 4px; font-size: 30px; }
.form-header p { margin: 0; color: var(--muted); font-size: 14px; }
.form-scroll { flex: 1; padding: 18px 22px 110px; overflow-y: auto; overscroll-behavior: contain; scroll-padding: 140px 0 180px; }
.form-actions {
    position: sticky; bottom: 0; z-index: 10; padding: 14px 22px calc(14px + env(safe-area-inset-bottom));
    display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px;
    background: rgba(255,255,255,.96); border-top: 1px solid var(--line); backdrop-filter: blur(16px);
}
.form-actions.one { grid-template-columns: 1fr; }
.field-grid { display: grid; gap: 15px; }
.field-grid.two { grid-template-columns: 1fr 1fr; }
.field { display: grid; gap: 7px; }
.field label { font-size: 13px; color: #3e4664; font-weight: 800; }
.field small { color: #858ca3; line-height: 1.4; }
.input-wrap { position: relative; }
.input, select, textarea {
    width: 100%; border: 1px solid #dfe2ed; background: #f9faff; color: var(--ink);
    border-radius: 14px; padding: 14px 14px; outline: none; font-size: 16px;
    transition: border-color .18s, box-shadow .18s, background .18s;
}
textarea { min-height: 105px; resize: vertical; }
.input:focus, select:focus, textarea:focus { border-color: var(--primary); background: white; box-shadow: 0 0 0 4px rgba(98,87,233,.13); }
.password-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--primary-dark); padding: 8px; font-weight: 800; }
.input.has-toggle { padding-right: 70px; }
.checkbox-row { display: flex; align-items: flex-start; gap: 10px; color: #555e7b; font-size: 14px; }
.checkbox-row input { width: 20px; height: 20px; accent-color: var(--primary); flex: 0 0 auto; }
.form-divider { display: flex; align-items: center; gap: 12px; color: #9096aa; font-size: 12px; margin: 20px 0; }
.form-divider::before, .form-divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.alert { border-radius: 14px; padding: 12px 14px; margin: 0 0 14px; line-height: 1.45; font-size: 14px; }
.alert-error { background: #fff0f2; color: #9f2940; border: 1px solid #ffd3da; }
.alert-success { background: #e8faf5; color: #106d5f; border: 1px solid #bdeee4; }
.alert-info { background: #eef1ff; color: #4a4e9c; border: 1px solid #d9dcff; }
.error-list { margin: 0; padding-left: 20px; }

.step-progress { margin-top: 14px; }
.progress-meta { display: flex; justify-content: space-between; gap: 10px; color: #6d7591; font-size: 12px; font-weight: 800; }
.progress-track { height: 7px; background: #ebedf5; border-radius: 999px; overflow: hidden; margin-top: 8px; }
.progress-bar { height: 100%; width: 33.333%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--mint)); transition: width .25s ease; }
.form-step h2 { margin: 2px 0 5px; font-size: 22px; }
.form-step > p { margin: 0 0 18px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.form-step[hidden] { display: none !important; }
.registration-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.registration-actions [data-step-submit] { grid-column: 1 / -1; }
.avatar-preview { width: 82px; height: 82px; border-radius: 22px; object-fit: cover; background: #eff1f8; border: 1px solid var(--line); }

.dashboard-card { width: min(100%, 980px); background: rgba(255,255,255,.95); border-radius: 30px; box-shadow: var(--shadow); padding: clamp(20px, 4vw, 38px); }
.dashboard-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.dashboard-top h1 { margin: 0; }
.dashboard-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 26px; }
.info-card { border: 1px solid var(--line); border-radius: 20px; padding: 20px; background: #fafbff; }
.info-card h3 { margin: 0 0 8px; }
.info-card p { color: var(--muted); line-height: 1.5; }
.admin-table { width: 100%; border-collapse: collapse; margin-top: 18px; font-size: 14px; }
.admin-table th, .admin-table td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; }
.admin-table th { color: #555e7b; }
.table-wrap { overflow-x: auto; }

@media (max-width: 720px) {
    .auth-shell, .page-shell { padding: 0; place-items: stretch; }
    .phone-card { width: 100%; min-height: var(--app-height); border-radius: 0; }
    .form-card { height: var(--app-height); min-height: 0; }
    .landing-card { padding: 22px 20px calc(18px + env(safe-area-inset-bottom)); }
    .hero-copy h1 { font-size: 44px; }
    .hero-art { width: min(100%, 360px); margin-top: 4px; }
    .field-grid.two { grid-template-columns: 1fr; }
    .dashboard-card { min-height: var(--app-height); border-radius: 0; }
    .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-height: 720px) {
    .hero-art { width: 260px; }
    .hero-copy { padding-top: 8px; }
    .hero-copy p { margin-top: 8px; }
    .trust-row { margin: 4px 0 10px; }
}

.form-card > form { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.form-scroll { min-height: 0; }
.bio-field { margin-top: 15px; }
.inline-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.section-gap { margin-top: 18px; }
.admin-link { margin-top: 22px; }
.profile-summary { display: flex; align-items: center; gap: 20px; margin: 24px 0; padding: 20px; border: 1px solid var(--line); border-radius: 22px; background: #fafbff; }
.profile-summary h2, .profile-summary p { margin: 4px 0; }
.profile-avatar { width: 112px; height: 112px; border-radius: 28px; object-fit: cover; border: 1px solid var(--line); background: #eef0f8; }
.profile-avatar.placeholder { display: grid; place-items: center; font-size: 44px; }
.profile-section { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.profile-section > p { color: var(--muted); line-height: 1.55; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-top: 18px; }
.avatar-card { border: 1px solid var(--line); border-radius: 18px; padding: 12px; background: #fafbff; }
.avatar-card.is-hidden img { opacity: .35; filter: grayscale(1); }
.avatar-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 13px; }
.avatar-card small { display: block; margin: 8px 0; color: var(--muted); font-weight: 800; }
.avatar-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.avatar-actions form, .avatar-actions .btn { width: 100%; }
.btn-small { min-height: 38px; padding: 8px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.compact-input { max-width: 420px; }
.danger-zone { margin-top: 30px; padding: 22px; border: 1px solid #ffd3da; border-radius: 20px; background: #fff7f8; }
.danger-zone h2 { color: var(--danger); }
.danger-zone p { color: #76505a; line-height: 1.55; }
.danger-action { display: inline-block; }
.btn-danger-compact { min-height: 38px; width: auto; padding: 8px 13px; font-size: 13px; }
.download-list { display: grid; gap: 14px; margin-top: 24px; }

@media (max-width: 720px) {
    .profile-summary { align-items: flex-start; }
    .profile-avatar { width: 88px; height: 88px; border-radius: 22px; }
}

/* Authenticated photo workspace */
.user-page-shell {
    place-items: start center;
    height: var(--app-height);
    min-height: 0;
    overflow: hidden;
    background: linear-gradient(150deg, #f8f8f1 0%, #f2f3fb 54%, #edf8f6 100%);
}
.user-app {
    width: min(100%, 1024px);
    height: calc(var(--app-height) - clamp(28px, 6vw, 76px));
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(101, 89, 232, .12);
    border-radius: 34px;
    background: rgba(255, 255, 255, .93);
    box-shadow: 0 24px 70px rgba(42, 43, 79, .14);
}
.user-header {
    position: relative;
    z-index: 20;
    min-height: 116px;
    display: grid;
    grid-template-columns: 72px 1fr auto auto;
    align-items: center;
    gap: 18px;
    padding: 18px 24px;
    border-bottom: 1px solid #eaebf4;
    background: rgba(255, 255, 255, .96);
}
.menu-button {
    width: 62px;
    height: 62px;
    display: grid;
    place-content: center;
    gap: 6px;
    border: 0;
    border-radius: 21px;
    background: #f0effd;
}
.menu-button span { width: 27px; height: 3px; border-radius: 999px; background: var(--primary-dark); }
.user-greeting { display: grid; line-height: 1.05; }
.user-greeting small { color: var(--muted); font-size: 15px; font-weight: 700; }
.user-greeting strong { max-width: 500px; overflow: hidden; text-overflow: ellipsis; font-size: clamp(26px, 4vw, 39px); letter-spacing: -.045em; }
.header-profile { min-width: 76px; display: grid; justify-items: center; gap: 5px; color: var(--primary-dark); text-decoration: none; font-weight: 850; }
.header-profile img, .header-avatar-placeholder { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; border: 3px solid #efeffa; }
.header-avatar-placeholder { display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--primary), var(--mint)); }
.header-profile small { max-width: 100px; overflow: hidden; text-overflow: ellipsis; }
.user-content { padding: clamp(22px, 4vw, 44px); }
.user-app > .user-content { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }

.reset-complete { min-height: 360px; display: grid; align-content: center; justify-items: center; gap: 12px; text-align: center; }
.reset-complete h2, .reset-complete p { margin: 0; }
.reset-complete p { color: var(--muted); line-height: 1.55; }
.reset-complete .btn { min-width: min(100%, 260px); margin-top: 12px; }
.success-mark { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--success); font-size: 38px; font-weight: 900; }
.verification-form { align-content: center; }
.verification-icon { width: 82px; height: 82px; display: grid; place-items: center; margin: 8px auto; border-radius: 26px; color: var(--primary-dark); background: #eeecff; font-size: 38px; }
.verification-code { text-align: center; letter-spacing: .42em; font-size: 30px; font-weight: 900; }

.menu-backdrop { position: fixed; z-index: 89; inset: 0; background: rgba(20, 22, 48, .44); backdrop-filter: blur(3px); }
.user-menu {
    position: fixed;
    z-index: 90;
    top: 0;
    left: 0;
    width: min(88vw, 370px);
    height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 22px;
    background: #fff;
    box-shadow: 20px 0 55px rgba(18, 20, 51, .24);
    transform: translateX(-105%);
    transition: transform .24s ease;
}
.menu-is-open { overflow: hidden; }
.menu-is-open .user-menu { transform: translateX(0); }
.user-menu-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 5px 24px; border-bottom: 1px solid var(--line); }
.user-menu-heading div { display: grid; gap: 3px; }
.user-menu-heading small { color: var(--muted); }
.user-menu-heading strong { font-size: 19px; }
.user-menu-heading button { width: 42px; height: 42px; border: 0; border-radius: 14px; color: var(--ink); background: #f0f1f7; font-size: 28px; }
.user-menu nav { display: grid; gap: 5px; padding: 18px 0; }
.user-menu nav a, .menu-logout { min-height: 50px; display: flex; align-items: center; gap: 14px; border: 0; border-radius: 14px; padding: 12px 14px; color: var(--ink); background: transparent; text-decoration: none; font-weight: 750; }
.user-menu nav a:hover, .menu-logout:hover { background: #f1f0fd; color: var(--primary-dark); }
.user-menu nav span, .menu-logout span { width: 24px; color: var(--primary); font-size: 20px; text-align: center; }
.user-menu form { margin-top: auto; border-top: 1px solid var(--line); padding-top: 14px; }
.menu-logout { width: 100%; color: var(--danger); }

.dashboard-hero {
    min-height: 310px;
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(230px, .6fr);
    align-items: center;
    gap: 24px;
    overflow: hidden;
    padding: clamp(26px, 5vw, 54px);
    border-radius: 30px;
    color: #fff;
    background: linear-gradient(135deg, #25234c, #6156dc 62%, #43cfc0);
}
.dashboard-hero .eyebrow { color: #bdf7ef; }
.dashboard-hero h1 { max-width: 560px; margin: 0; font-size: clamp(42px, 7vw, 68px); line-height: .95; }
.dashboard-hero p:not(.eyebrow) { max-width: 580px; color: #e8e8fb; line-height: 1.55; }
.dashboard-hero .btn { margin-top: 10px; color: var(--primary-dark); background: #fff; box-shadow: none; }
.backup-orbit { position: relative; width: 220px; height: 220px; margin: auto; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; }
.backup-orbit::before, .backup-orbit::after { content: ""; position: absolute; inset: 28px; border: 1px dashed rgba(255,255,255,.35); border-radius: 50%; }
.backup-orbit::after { inset: 70px; background: rgba(255,255,255,.17); }
.backup-orbit span { position: absolute; z-index: 1; width: 58px; height: 58px; display: grid; place-items: center; border-radius: 19px; color: var(--primary-dark); background: white; font-size: 28px; box-shadow: 0 12px 30px rgba(18,20,51,.2); }
.backup-orbit span:nth-child(1) { left: -9px; top: 77px; }
.backup-orbit span:nth-child(2) { left: 82px; top: 82px; color: #fff; background: #302d67; }
.backup-orbit span:nth-child(3) { right: -8px; top: 28px; }
.stat-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 18px 0 34px; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--line); }
.stat-strip div { display: grid; gap: 3px; padding: 20px; text-align: center; background: #fff; }
.stat-strip strong { color: var(--primary-dark); font-size: 25px; }
.stat-strip span { color: var(--muted); font-size: 13px; font-weight: 750; }
.content-section { margin-top: 34px; }
.content-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 15px; }
.content-title h2 { margin: 0; font-size: 25px; }
.content-title > span { min-width: 32px; padding: 5px 9px; border-radius: 999px; color: var(--primary-dark); background: #efeffb; text-align: center; font-size: 12px; font-weight: 850; }
.content-title a { font-size: 14px; font-weight: 800; }
.quick-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.quick-card { min-height: 150px; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 5px; padding: 20px; border: 1px solid var(--line); border-radius: 22px; color: var(--ink); background: #fafbff; text-decoration: none; transition: transform .18s ease, box-shadow .18s ease; }
.quick-card:hover { transform: translateY(-3px); box-shadow: 0 14px 28px rgba(37, 38, 83, .11); }
.quick-card > span { width: 46px; height: 46px; display: grid; place-items: center; margin-bottom: auto; border-radius: 15px; color: var(--primary-dark); background: #e9e7ff; font-size: 25px; }
.quick-card strong { font-size: 18px; }
.quick-card small { color: var(--muted); line-height: 1.35; }
.folder-quick > span { color: #946111; background: #fff1ce; }
.ftp-quick > span { color: #087267; background: #dcf7f1; }
.profile-quick > span { color: #16796c; background: #dff8f3; }
.app-quick > span { color: #a12f4a; background: #ffe4ea; }
.recent-photo-row { display: grid; grid-template-columns: repeat(6, minmax(100px, 1fr)); gap: 10px; }
.recent-photo-row a { min-width: 0; color: var(--ink); text-decoration: none; }
.recent-photo-row img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 15px; background: #eef0f7; }
.recent-photo-row span { display: block; overflow: hidden; margin-top: 7px; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.recent-empty, .empty-gallery { border: 1px dashed #d8dbe9; border-radius: 20px; padding: 28px; color: var(--muted); background: #fafbfe; text-align: center; }
.recent-empty > span, .empty-gallery > span { color: var(--primary); font-size: 44px; }
.recent-empty p { margin: 8px 0; }

.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.section-heading h1 { margin: 0; font-size: clamp(38px, 6vw, 58px); }
.section-heading p:not(.eyebrow) { max-width: 620px; color: var(--muted); line-height: 1.55; }
.gallery-location { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; overflow-wrap: anywhere; margin: 0 0 20px; padding: 9px 13px; border-radius: 999px; color: #515977; background: #f0f1f7; font-size: 13px; font-weight: 750; }
.folder-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.folder-card { min-width: 0; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); background: #fafbff; text-decoration: none; }
.folder-icon { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 15px; color: #9c6710; background: #fff0c6; font-size: 27px; }
.folder-card strong, .folder-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-card small { margin-top: 4px; color: var(--muted); }
.photo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.photo-card { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); background: #fff; text-decoration: none; }
.photo-card img { width: 100%; aspect-ratio: 1; object-fit: cover; background: #eef0f7; }
.photo-card > span { display: grid; gap: 3px; padding: 11px; }
.photo-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.photo-card small { color: var(--muted); font-size: 11px; }
.empty-gallery { padding: clamp(40px, 9vw, 90px) 25px; }
.empty-gallery h2 { margin: 10px 0 4px; }
.empty-gallery p { max-width: 470px; margin: 0 auto 22px; line-height: 1.55; }

.timeline-content { padding: clamp(18px, 3vw, 30px); }
.gallery-heading { margin-bottom: 16px; }
.gallery-heading h1 { font-size: clamp(34px, 5vw, 52px); }
.timeline-album-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 13px; }
.timeline-album { min-width: 0; display: grid; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 20px; color: var(--ink); background: #fafbff; text-decoration: none; }
.album-preview-stack { position: relative; height: clamp(110px, 15vw, 154px); display: block; }
.album-preview-stack img { position: absolute; width: 76%; height: 86%; left: 12%; top: 7%; object-fit: cover; border: 4px solid #fff; border-radius: 17px; box-shadow: 0 9px 22px rgba(27,29,66,.18); }
.album-preview-stack img:nth-child(1) { transform: rotate(-7deg) translate(-7px, 3px); }
.album-preview-stack img:nth-child(2) { transform: rotate(7deg) translate(7px, 2px); }
.album-preview-stack img:nth-child(3) { transform: rotate(0); }
.album-empty { height: 100%; display: grid; place-items: center; border-radius: 17px; color: #9da3b8; background: #eceef5; font-size: 42px; }
.album-label { display: grid; min-width: 0; }
.album-label strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
.album-label small { margin-top: 3px; color: var(--muted); }
.timeline-photo-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-rows: clamp(64px, calc((100dvh - 300px) / 8), 135px); gap: 6px; }
.timeline-photo { min-width: 0; overflow: hidden; border-radius: 8px; background: #eceef4; }
.timeline-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .18s ease; }
.timeline-photo:hover img { transform: scale(1.035); }
.gallery-pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; }
.gallery-pagination span { color: var(--muted); font-size: 13px; font-weight: 800; }

.profile-content { max-width: 850px; margin: auto; }
.profile-identity { display: grid; justify-items: center; padding: 24px 0 34px; text-align: center; }
.profile-avatar-large { width: 190px; height: 190px; border: 7px solid #fff; border-radius: 50%; object-fit: cover; background: #f0f1f7; box-shadow: 0 15px 35px rgba(33,35,74,.16); }
.profile-avatar-large.placeholder { display: grid; place-items: center; color: #9ca2b7; font-size: 70px; }
.avatar-profile-form { display: grid; justify-items: center; gap: 12px; }
.profile-avatar-picker { position: relative; display: block; width: 190px; height: 190px; border-radius: 50%; cursor: pointer; overflow: hidden; box-shadow: 0 15px 35px rgba(33,35,74,.16); }
.profile-avatar-picker.is-disabled { cursor: not-allowed; opacity: .7; }
.profile-avatar-picker .profile-avatar-large { width: 100%; height: 100%; border: 7px solid #fff; box-shadow: none; }
.avatar-change-overlay { position: absolute; inset: auto 13px 13px; min-height: 42px; display: grid; place-items: center; border-radius: 999px; color: #fff; background: rgba(28, 28, 57, .82); backdrop-filter: blur(7px); font-size: 13px; font-weight: 900; }
.avatar-save-button { min-height: 44px; }
.profile-identity h2 { margin: 18px 0 0; font-size: 30px; }
.profile-identity > p { margin: 4px 0 13px; color: var(--muted); }
.profile-identity > small { max-width: 520px; color: var(--muted); line-height: 1.5; }
.change-photo-button { padding: 8px 14px; color: var(--primary-dark); cursor: pointer; font-weight: 850; }
.avatar-upload-form { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 6px 0 11px; flex-wrap: wrap; }
.avatar-upload-form input { max-width: 310px; }
.avatar-upload-form .btn { min-height: 44px; padding: 9px 14px; }
.profile-details { display: grid; grid-template-columns: 1fr 1fr; margin: 0; border-top: 1px solid var(--line); }
.profile-details div { min-width: 0; padding: 20px 12px; border-bottom: 1px solid var(--line); }
.profile-details dt { margin-bottom: 7px; color: var(--primary-dark); text-transform: uppercase; letter-spacing: .05em; font-size: 12px; font-weight: 900; }
.profile-details dd { margin: 0; overflow-wrap: anywhere; font-size: 20px; }
.status-chip { display: inline-flex; padding: 5px 10px; border-radius: 999px; font-size: 14px; font-weight: 850; }
.status-active { color: #11695e; background: #dcf8f2; }
.status-inactive, .status-suspended { color: #9d2e46; background: #ffe6eb; }
.download-panel { padding: 24px; border: 1px solid #dedcf9; border-radius: 22px; background: #f7f6ff; }
.download-panel h2 { margin: 0; }
.download-panel .btn { width: 100%; margin-top: 10px; }
.security-content { max-width: 850px; margin: auto; }
.security-panel { margin-top: 20px; padding: clamp(20px, 4vw, 30px); border: 1px solid var(--line); border-radius: 24px; background: #fafbff; }
.security-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.security-panel-heading h2 { margin: 0; }
.security-panel-heading p { margin: 6px 0 0; color: var(--muted); line-height: 1.5; }
.security-toggle { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px; border: 1px solid #dedff0; border-radius: 17px; background: #fff; }
.security-toggle span { display: grid; gap: 4px; }
.security-toggle small { color: var(--muted); line-height: 1.4; }
.security-toggle input { width: 52px; height: 28px; flex: 0 0 auto; accent-color: var(--primary); }

.avatar-mini-grid { display: grid; grid-template-columns: repeat(5, minmax(82px, 1fr)); gap: 12px; align-items: start; }
.avatar-mini-card { min-width: 0; display: grid; justify-items: center; gap: 7px; padding: 9px 5px; border: 1px solid var(--line); border-radius: 16px; background: #fafbff; }
.avatar-mini-card > img { width: 75px; height: 75px; border-radius: 50%; object-fit: cover; }
.avatar-mini-card.is-hidden > img { opacity: .45; filter: grayscale(1); }
.avatar-mini-card.is-empty { min-height: 132px; align-content: center; color: #a3a7ba; border-style: dashed; }
.avatar-mini-card.is-empty > span { width: 75px; height: 75px; display: grid; place-items: center; border-radius: 50%; background: #eff0f6; font-size: 30px; }
.avatar-mini-actions { width: 100%; display: grid; gap: 4px; }
.avatar-mini-actions form { margin: 0; }
.avatar-mini-actions button { width: 100%; border: 0; border-radius: 8px; padding: 5px 3px; color: var(--primary-dark); background: #eceafd; font-size: 10px; font-weight: 850; }
.avatar-mini-actions button.remove { color: #a52d46; background: #ffe8ed; }

.avatar-editor-open { overflow: hidden; }
.avatar-editor-modal { position: fixed; z-index: 120; inset: 0; display: grid; place-items: center; padding: 18px; }
.avatar-editor-modal[hidden] { display: none; }
.avatar-editor-backdrop { position: absolute; inset: 0; border: 0; background: rgba(17, 19, 45, .7); backdrop-filter: blur(6px); }
.avatar-editor-dialog { position: relative; width: min(100%, 620px); max-height: calc(100dvh - 36px); overflow-y: auto; padding: 22px; border-radius: 28px; background: #fff; box-shadow: 0 30px 80px rgba(9, 11, 35, .35); }
.avatar-editor-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.avatar-editor-header h2 { margin: 0; font-size: 28px; }
.avatar-editor-header > button { width: 42px; height: 42px; border: 0; border-radius: 13px; background: #eff0f6; font-size: 28px; }
.avatar-existing-strip { margin: 16px 0; padding: 12px; border-radius: 17px; background: #f6f7fb; }
.avatar-existing-strip > strong { display: block; margin-bottom: 9px; font-size: 13px; }
.avatar-slot-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.avatar-slot { aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; border-radius: 13px; background: #e8eaf2; }
.avatar-slot img { width: 100%; height: 100%; object-fit: cover; }
.avatar-slot.is-empty { color: #a0a5b7; border: 1px dashed #cbd0df; background: transparent; font-size: 24px; }
.avatar-crop-stage { position: relative; width: min(100%, 440px); margin: auto; overflow: hidden; border-radius: 24px; background: #11142c; touch-action: none; }
.avatar-crop-stage canvas { width: 100%; height: auto; display: block; cursor: grab; touch-action: none; }
.avatar-crop-stage canvas:active { cursor: grabbing; }
.avatar-circle-guide { position: absolute; inset: 18px; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1000px rgba(8, 10, 30, .52); pointer-events: none; }
.avatar-crop-stage > p { position: absolute; z-index: 2; left: 20px; right: 20px; bottom: 18px; margin: 0; color: #fff; text-align: center; text-shadow: 0 2px 8px #000; font-size: 12px; pointer-events: none; }
.avatar-zoom-control { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; margin: 15px auto 0; max-width: 440px; color: #505873; font-size: 13px; font-weight: 850; }
.avatar-zoom-control input { width: 100%; accent-color: var(--primary); }
.avatar-editor-error { min-height: 20px; margin: 8px 0 0; color: var(--danger); text-align: center; font-size: 13px; }
.avatar-editor-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 10px; }

.app-download-open { overflow: hidden; }
.app-download-modal { position: fixed; z-index: 115; inset: 0; display: grid; place-items: center; padding: 18px; }
.app-download-modal[hidden] { display: none; }
.app-download-backdrop { position: absolute; inset: 0; border: 0; background: rgba(16,18,43,.68); backdrop-filter: blur(6px); }
.app-download-dialog { position: relative; width: min(100%, 470px); display: grid; gap: 12px; padding: 30px; border-radius: 28px; background: #fff; box-shadow: 0 30px 80px rgba(9,11,35,.35); text-align: center; }
.app-download-dialog h2, .app-download-dialog p { margin: 0; }
.app-download-dialog > p:not(.eyebrow) { color: var(--muted); line-height: 1.55; }
.app-download-dialog form, .app-download-dialog form .btn { width: 100%; }
.app-download-dialog > small { color: var(--muted); line-height: 1.45; }
.app-download-close { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border: 0; border-radius: 13px; background: #eff0f6; font-size: 27px; }
.app-download-icon { width: 74px; height: 74px; display: grid; place-items: center; margin: 0 auto; border-radius: 24px; color: #fff; background: linear-gradient(135deg,var(--primary),var(--mint)); font-size: 36px; font-weight: 900; }

.header-logout { margin-left: 4px; }
.header-logout button { min-height: 40px; border: 1px solid #ffd3da; border-radius: 13px; padding: 8px 12px; color: var(--danger); background: #fff7f8; font-weight: 800; cursor: pointer; }
.header-logout button:hover { background: #ffecef; }
.ftp-details { display: grid; gap: 14px; margin-top: 22px; }
.ftp-detail-card { padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: #fafbff; }
.ftp-detail-card dt { margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.ftp-detail-card dd { margin: 0; overflow-wrap: anywhere; font-weight: 800; }

.admin-shell { width: min(100%, 1180px); min-height: var(--app-height); margin: 0 auto; padding: 24px; }
.user-app > .admin-shell { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.admin-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.admin-header h1 { margin: 2px 0; }
.admin-header p { margin: 0; color: var(--muted); }
.admin-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 20px 0; }
.admin-stat { padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.admin-stat strong { display: block; margin-bottom: 5px; font-size: 24px; }
.admin-stat span { color: var(--muted); font-size: 13px; }
.admin-panel { padding: 20px; border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: 0 12px 32px rgba(30, 34, 70, .08); }
.admin-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.admin-toolbar form { display: flex; gap: 8px; width: min(100%, 440px); }
.admin-toolbar .input { min-height: 42px; }
.admin-user-table { min-width: 880px; }
.admin-user-cell { display: flex; align-items: center; gap: 10px; }
.admin-user-cell small { display: block; color: var(--muted); }
.admin-avatar { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; border-radius: 10px; object-fit: cover; color: #fff; background: var(--primary); font-size: 12px; font-weight: 900; }
.admin-state { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-size: 12px; font-weight: 800; }
.admin-state::before { width: 9px; height: 9px; border-radius: 3px; background: #d92d20; content: ''; }
.admin-state.is-active::before, .admin-state.is-admin::before { background: #12a36d; }
.admin-edit-link { display: inline-flex; min-height: 34px; align-items: center; padding: 6px 11px; border-radius: 10px; color: #fff; background: var(--primary); text-decoration: none; font-size: 12px; font-weight: 850; }
.admin-profile-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .7fr); gap: 18px; }
.admin-profile-identity { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.admin-profile-identity h2 { margin: 0; }
.admin-profile-identity .admin-avatar { width: 52px; height: 52px; flex-basis: 52px; border-radius: 16px; font-size: 18px; }
.admin-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.admin-form-grid .field.full { grid-column: 1 / -1; }
.read-only-value { display: flex; align-items: center; background: #f4f5f9; }
.activity-filters { display: flex; flex-wrap: wrap; gap: 7px; margin: 16px 0; }
.activity-filters a { padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; font-size: 12px; font-weight: 800; }
.activity-filters a.is-current { color: #fff; border-color: var(--primary); background: var(--primary); }
.activity-section { scroll-margin-top: 18px; }
.activity-section:focus { outline: none; }
.activity-chart { display: grid; grid-template-columns: repeat(auto-fit, minmax(30px, 1fr)); align-items: end; gap: 6px; min-height: 190px; padding: 18px 10px 8px; border: 1px solid var(--line); border-radius: 16px; overflow-x: auto; }
.activity-chart.is-five-minute { grid-template-columns: repeat(288, minmax(0, 1fr)); gap: 0; overflow-x: hidden; }
.activity-column { min-width: 26px; display: flex; min-height: 150px; flex-direction: column; justify-content: end; align-items: center; gap: 6px; }
.activity-column strong { font-size: 10px; }
.activity-bar { width: min(100%, 28px); height: 130px; color: var(--primary); overflow: visible; }
.activity-bar rect { fill: currentColor; }
.activity-column small { max-width: 48px; color: var(--muted); font-size: 9px; white-space: nowrap; transform: rotate(-35deg); transform-origin: center; }
.activity-chart.is-five-minute .activity-column { position: relative; min-width: 0; gap: 0; padding-bottom: 34px; }
.activity-chart.is-five-minute .activity-column strong,
.activity-chart.is-five-minute .activity-column small { display: none; }
.activity-chart.is-five-minute .activity-bar { width: 3px; max-width: 100%; }
.activity-chart.is-five-minute .activity-column:nth-child(12n + 1) small,
.activity-chart.is-five-minute .activity-column:nth-child(12n + 7) small { position: absolute; display: block; left: 50%; max-width: none; transform: translateX(-50%); }
.activity-chart.is-five-minute .activity-column:nth-child(12n + 1) small { bottom: 16px; }
.activity-chart.is-five-minute .activity-column:nth-child(12n + 7) small { bottom: 2px; }
.admin-note { color: var(--muted); font-size: 13px; line-height: 1.5; }

@media (max-width: 800px) {
    .activity-chart.is-five-minute .activity-column:nth-child(12n + 7) small { display: none; }
    .quick-grid { grid-template-columns: repeat(2, 1fr); }
    .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .recent-photo-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .timeline-album-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-profile-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .user-page-shell { padding: 0; }
    .user-app { height: var(--app-height); min-height: 0; border: 0; border-radius: 0; }
    .user-header { min-height: 96px; grid-template-columns: 58px 1fr auto; gap: 10px; padding: 14px 12px; }
    .menu-button { width: 52px; height: 52px; border-radius: 18px; }
    .menu-button span { width: 24px; }
    .user-greeting strong { font-size: clamp(23px, 7vw, 31px); }
    .user-greeting small { font-size: 12px; }
    .header-profile img, .header-avatar-placeholder { width: 50px; height: 50px; }
    .header-profile small { display: none; }
    .header-profile { min-width: 50px; }
    .user-greeting { display: none; }
    .header-logout { margin-left: 0; }
    .header-logout button { min-height: 38px; padding-inline: 9px; font-size: 12px; }
    .user-content { padding: 20px 16px calc(32px + env(safe-area-inset-bottom)); }
    .dashboard-hero { min-height: 360px; grid-template-columns: 1fr; padding: 28px 24px; }
    .dashboard-hero h1 { font-size: 47px; }
    .backup-orbit { position: absolute; width: 170px; height: 170px; right: -55px; margin-top: 170px; opacity: .45; }
    .dashboard-hero > div:first-child { position: relative; z-index: 2; }
    .stat-strip div { padding: 16px 8px; }
    .stat-strip strong { font-size: 20px; }
    .quick-card { min-height: 136px; padding: 16px; }
    .folder-grid { grid-template-columns: 1fr; }
    .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .timeline-photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: clamp(82px, calc((100dvh - 280px) / 8), 145px); }
    .timeline-album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .album-preview-stack { height: 125px; }
    .section-heading { align-items: flex-end; }
    .section-heading h1 { font-size: 42px; }
    .section-heading .btn { min-height: 44px; padding: 9px 12px; }
    .profile-details { grid-template-columns: 1fr; }
    .profile-avatar-large { width: 160px; height: 160px; }
    .profile-avatar-picker { width: 160px; height: 160px; }
    .avatar-mini-grid { grid-template-columns: repeat(5, minmax(58px, 1fr)); gap: 5px; }
    .avatar-mini-card { padding: 6px 2px; border-radius: 12px; }
    .avatar-mini-card > img, .avatar-mini-card.is-empty > span { width: min(75px, 13vw); height: min(75px, 13vw); }
    .avatar-mini-card.is-empty { min-height: 112px; }
    .avatar-mini-actions button { font-size: 9px; }
    .avatar-editor-modal { padding: 0; align-items: stretch; }
    .avatar-editor-dialog { width: 100%; max-height: 100dvh; border-radius: 0; padding: 17px; }
    .admin-shell { padding: 12px; }
    .admin-header, .admin-toolbar { align-items: stretch; flex-direction: column; }
    .admin-toolbar form { width: 100%; }
    .admin-form-grid { grid-template-columns: 1fr; }
    .admin-form-grid .field.full { grid-column: auto; }
}

@media (max-height: 760px) {
    .landing-card { padding-top: 16px; padding-bottom: 14px; }
    .landing-page .hero-copy { padding-top: 6px; }
    .landing-page .hero-copy h1 { font-size: 34px; }
    .landing-page .hero-copy p { margin-top: 6px; font-size: 13px; line-height: 1.35; }
    .landing-page .hero-art { width: 210px; margin: 0 auto; }
    .landing-page .trust-row { margin: 2px 0 7px; }
    .landing-page .btn { min-height: 44px; padding: 9px 14px; }
    .landing-page .action-stack { gap: 7px; }
    .landing-page .privacy-note { margin-top: 7px; font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .user-menu, .quick-card { transition: none; }
}

/* Shared application chrome and deliberate administrator edit mode. */
.site-footer { width: min(100%, 1180px); display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 auto; padding: 18px 24px 26px; color: #69708c; font-size: 12px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 14px; }
.site-footer a { color: inherit; font-weight: 800; text-decoration: none; }
.site-footer a:hover { color: var(--primary); }
.public-app-header { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 22px; border-bottom: 1px solid var(--line); background: #fff; }
.public-app-header > a { color: var(--ink); font-size: 18px; font-weight: 900; text-decoration: none; }
.public-app-header nav { display: flex; gap: 8px; }
.public-app-header nav a { padding: 9px 12px; border-radius: 10px; color: var(--primary); background: #eef0ff; font-size: 12px; font-weight: 850; text-decoration: none; }
.admin-static-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.admin-static-details > div { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fafbff; }
.admin-static-details dt { color: var(--muted); font-size: 11px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.admin-static-details dd { margin: 5px 0 0; overflow-wrap: anywhere; font-weight: 800; }
.admin-edit-dialog { width: min(calc(100% - 24px), 720px); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 24px; color: var(--ink); background: #fff; box-shadow: 0 32px 90px rgba(10, 15, 45, .36); }
.admin-edit-dialog::backdrop { background: rgba(13, 17, 43, .7); backdrop-filter: blur(3px); }
.admin-edit-form { display: grid; gap: 18px; padding: 24px; overflow-y: auto; }
.dialog-close { width: 38px; height: 38px; border: 0; border-radius: 50%; color: var(--ink); background: #eff1f7; font-size: 24px; cursor: pointer; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
@media (max-width: 680px) {
    .site-footer { align-items: flex-start; flex-direction: column; padding-inline: 16px; }
    .public-app-header { padding: 12px; }
    .admin-static-details { grid-template-columns: 1fr; }
    .admin-edit-form { padding: 18px; }
}

/* Date Taken gallery: six columns, six visible rows and incremental loading. */
.gallery-total { flex: 0 0 auto; padding: 9px 12px; border-radius: 999px; color: #087267; background: #dcf7f1; font-size: 12px; font-weight: 850; }
.gallery-page { height: var(--app-height); overflow: hidden; }
.gallery-page .site-footer { display: none; }
.gallery-page .user-page-shell { height: var(--app-height); min-height: 0; overflow: hidden; }
.gallery-page .user-app > .timeline-content { display: flex; flex-direction: column; overflow: hidden; padding-block: 10px 8px; }
.gallery-page .gallery-heading { flex: 0 0 auto; align-items: center; margin-bottom: 8px; }
.gallery-page .gallery-heading h4 { margin: 0; font-size: clamp(16px, 2vw, 22px); line-height: 1.1; }
.gallery-page .gallery-total { padding: 5px 9px; font-size: 10px; }
.gallery-page .gallery-workspace {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
}
.gallery-page .gallery-timeline-scroll { height: 100%; min-height: 0; overflow-y: auto; }
.gallery-workspace { position: relative; min-height: 0; padding-right: 52px; }
.gallery-timeline-scroll { height: min(68dvh, 760px); min-height: 420px; overflow-y: auto; overscroll-behavior: contain; padding: 0 10px 18px 0; scrollbar-gutter: stable; scroll-behavior: smooth; }
.gallery-year { scroll-margin-top: 12px; }
.gallery-year > header { position: sticky; z-index: 3; top: 0; display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; padding: 10px 12px; border-radius: 14px; color: #fff; background: linear-gradient(120deg, #242958, var(--primary)); box-shadow: 0 8px 20px rgba(34, 40, 91, .18); }
.gallery-year > header h2, .gallery-year > header span, .gallery-month h3, .gallery-day h4 { margin: 0; }
.gallery-year > header h2 { font-size: 22px; }
.gallery-year > header span { font-size: 11px; font-weight: 800; }
.gallery-month { margin: 0 0 20px; }
.gallery-month > h3 { margin: 0 0 9px; color: var(--ink); font-size: 18px; }
.gallery-day { margin: 0 0 15px; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: #fafbff; }
.gallery-day-heading { display: flex; align-items: center; justify-content: space-between; margin: 0 0 8px; }
.gallery-day-heading h4 { font-size: 13px; }
.gallery-day-heading span { min-width: 26px; padding: 3px 7px; border-radius: 999px; color: var(--muted); background: #eceef6; font-size: 10px; font-weight: 850; text-align: center; }
.gallery-photo-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.gallery-photo-card { aspect-ratio: 1; min-width: 0; overflow: hidden; padding: 0; border: 0; border-radius: 8px; background: #eceef4; cursor: zoom-in; }
.gallery-photo-card[hidden] { display: none; }
.gallery-photo-card img { width: 100%; height: 100%; display: block; object-fit: contain; transition: filter .18s ease; }
.gallery-photo-card:hover img, .gallery-photo-card:focus-visible img { filter: saturate(1.08); }
.gallery-load-status { margin: 14px 0 0; color: var(--muted); font-size: 11px; font-weight: 750; text-align: center; }
.gallery-year-rail { position: absolute; z-index: 4; top: 0; right: 0; bottom: 0; width: 46px; display: flex; flex-direction: column; justify-content: space-around; gap: 5px; padding: 8px 0; pointer-events: none; }
.gallery-year-rail button { display: grid; grid-template-columns: 12px 1fr; align-items: center; gap: 3px; padding: 3px 0; border: 0; color: var(--muted); background: transparent; font-size: 9px; font-weight: 900; cursor: pointer; pointer-events: auto; }
.gallery-year-rail button span { width: 12px; height: 2px; border-radius: 3px; background: var(--primary); }
.photo-viewer { width: min(calc(100% - 20px), 1080px); height: min(calc(100dvh - 20px), 900px); padding: 0; border: 0; border-radius: 24px; color: #fff; background: #111426; box-shadow: 0 35px 100px rgba(0, 0, 0, .6); }
.photo-viewer::backdrop { background: rgba(4, 6, 16, .9); backdrop-filter: blur(4px); }
.photo-viewer[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.photo-viewer-toolbar, .photo-viewer-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
.photo-viewer-toolbar > div { min-width: 0; display: grid; }
.photo-viewer-toolbar strong, .photo-viewer-toolbar small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-viewer-toolbar small { color: #aeb4d3; }
.photo-viewer-toolbar button { width: 40px; height: 40px; flex: 0 0 auto; border: 0; border-radius: 50%; color: #fff; background: #2d324d; font-size: 25px; cursor: pointer; }
.photo-viewer-stage img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.photo-viewer-stage img { width: 100%; height: 100%; max-width: none; max-height: none; display: block; object-fit: contain; }
.photo-viewer-actions { justify-content: center; }
@media (max-width: 720px) {
    .timeline-content { padding-inline: 10px; }
    .gallery-page .user-app > .timeline-content { padding-block: 7px 5px; }
    .gallery-page .gallery-heading { margin-bottom: 6px; }
    .gallery-page .gallery-heading h4 { font-size: 16px; }
    .gallery-workspace { padding-right: 35px; }
    .gallery-timeline-scroll { height: calc(var(--app-height) - 245px); min-height: 320px; padding-right: 4px; }
    .gallery-photo-grid { gap: 3px; }
    .gallery-photo-card { border-radius: 4px; }
    .gallery-day { padding: 7px; }
    .gallery-year-rail { width: 32px; }
    .gallery-year-rail button { grid-template-columns: 8px 1fr; font-size: 7px; }
    .gallery-year-rail button span { width: 8px; }
    .photo-viewer { width: 100%; height: 100dvh; max-height: none; border-radius: 0; }
}

/* One-page folder gallery: Years -> Months -> Days -> Photos. */
.gallery-browser-page { height: var(--app-height); overflow: hidden; }
.gallery-browser-page .site-footer { display: none; }
.gallery-browser-page .user-page-shell { height: var(--app-height); min-height: 0; overflow: hidden; }
.gallery-browser-page .user-app > .photo-browser-content { min-height: 0; display: flex; flex-direction: column; overflow: hidden; padding: 10px clamp(10px, 2vw, 22px) 8px; }
.photo-browser-heading { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 8px; }
.photo-browser-heading h4 { margin: 0; font-size: clamp(16px, 2vw, 22px); line-height: 1.1; }
.photo-browser-heading p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.photo-browser-heading .gallery-total { padding: 5px 9px; font-size: 10px; }
.photo-browser { min-height: 0; flex: 1 1 auto; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #f8f9fd; }
.photo-browser-toolbar { min-height: 45px; flex: 0 0 auto; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 7px 10px; border-bottom: 1px solid var(--line); background: #fff; }
.photo-browser-toolbar > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.photo-browser-back { min-height: 30px; padding: 5px 9px; border: 0; border-radius: 9px; color: var(--primary); background: #eceeff; font-size: 11px; font-weight: 850; cursor: pointer; }
.photo-browser-crumbs { min-width: 0; display: flex; align-items: center; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.photo-browser-crumbs::-webkit-scrollbar { display: none; }
.photo-browser-crumbs button { flex: 0 0 auto; padding: 4px 7px; border: 0; border-radius: 8px; color: #525a79; background: #f1f2f7; font-size: 10px; font-weight: 800; cursor: pointer; }
.photo-browser-crumbs button:disabled { color: #fff; background: var(--primary); cursor: default; }
.photo-browser-scroll { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 12px; scrollbar-gutter: stable; }
.photo-browser-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; }
.photo-browser[data-view="months"] .photo-browser-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.photo-browser-grid.is-day-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.photo-folder-tile { min-width: 0; min-height: 150px; display: flex; flex-direction: column; align-items: stretch; justify-content: space-between; gap: 7px; overflow: hidden; padding: 10px; border: 1px solid #dfe2ee; border-radius: 17px; color: var(--ink); background: #fff; box-shadow: 0 8px 20px rgba(36, 42, 91, .07); text-decoration: none; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.photo-folder-tile:not(.is-empty):hover, .photo-folder-tile:not(.is-empty):focus-visible { transform: translateY(-2px); border-color: #b9bdf2; box-shadow: 0 13px 28px rgba(36, 42, 91, .14); }
.photo-folder-tile.is-empty { cursor: default; box-shadow: none; }
.folder-photo-fan { position: relative; width: 126px; max-width: 100%; height: 91px; align-self: center; display: block; }
.folder-fan-photo { position: absolute; top: 7px; left: calc(50% - 38px); width: 75px; height: 75px; display: block; object-fit: contain; border: 3px solid #fff; border-radius: 13px; background: #eef0f6; box-shadow: 0 8px 16px rgba(20, 25, 63, .22); }
.folder-fan-photo-1 { z-index: 1; transform: translateX(-19px) rotate(-9deg); }
.folder-fan-photo-2 { z-index: 3; transform: translateY(-3px); }
.folder-fan-photo-3 { z-index: 2; transform: translateX(19px) rotate(9deg); }
.folder-photo-fan.has-1 .folder-fan-photo-1 { transform: none; }
.folder-photo-fan.has-2 .folder-fan-photo-1 { transform: translateX(-11px) rotate(-7deg); }
.folder-photo-fan.has-2 .folder-fan-photo-2 { transform: translateX(11px) rotate(7deg); }
.empty-folder-icon { min-height: 91px; display: grid; place-items: center; color: #e2a20b; font-size: 66px; line-height: 1; filter: drop-shadow(0 8px 8px rgba(135, 92, 0, .14)); }
.photo-folder-details { min-width: 0; display: block; padding-top: 7px; border-top: 1px solid #eff0f5; text-align: center; }
.photo-folder-details strong, .photo-folder-details small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-folder-details strong { font-size: 13px; }
.photo-folder-details small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.photo-browser-grid.is-day-grid .photo-folder-tile { min-height: 112px; padding: 6px; border-radius: 12px; }
.photo-browser-grid.is-day-grid .folder-photo-fan { width: 82px; height: 62px; }
.photo-browser-grid.is-day-grid .folder-fan-photo { top: 5px; left: calc(50% - 27px); width: 54px; height: 54px; border-width: 2px; border-radius: 9px; }
.photo-browser-grid.is-day-grid .folder-fan-photo-1 { transform: translateX(-12px) rotate(-9deg); }
.photo-browser-grid.is-day-grid .folder-fan-photo-2 { transform: translateY(-2px); }
.photo-browser-grid.is-day-grid .folder-fan-photo-3 { transform: translateX(12px) rotate(9deg); }
.photo-browser-grid.is-day-grid .folder-photo-fan.has-1 .folder-fan-photo-1 { transform: none; }
.photo-browser-grid.is-day-grid .empty-folder-icon { min-height: 62px; font-size: 44px; }
.photo-browser-grid.is-day-grid .photo-folder-details { padding-top: 4px; }
.photo-browser-grid.is-day-grid .photo-folder-details strong { font-size: 10px; }
.photo-browser-grid.is-day-grid .photo-folder-details small { font-size: 8px; }
.photo-browser-grid.is-photo-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.folder-gallery-photo { min-width: 0; aspect-ratio: 1; overflow: hidden; padding: 0; border: 0; border-radius: 8px; background: #eceef4; cursor: zoom-in; }
.folder-gallery-photo img { width: 100%; height: 100%; display: block; object-fit: contain; }
.folder-gallery-photo:hover img, .folder-gallery-photo:focus-visible img { filter: saturate(1.08); }
.photo-browser-empty { min-height: 220px; display: grid; place-items: center; align-content: center; color: var(--muted); text-align: center; }
.photo-browser-empty span { color: #e2a20b; font-size: 70px; }
.photo-browser-empty h3 { margin: 4px 0 0; }
.photo-browser-status { margin: 12px 0 0; color: var(--muted); font-size: 10px; font-weight: 750; text-align: center; }
.photo-browser.is-loading .photo-browser-scroll { opacity: .64; }

@media (max-width: 820px) {
    .photo-browser[data-view="months"] .photo-browser-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .photo-browser-grid.is-day-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .gallery-browser-page .user-app > .photo-browser-content { padding: 7px 7px 5px; }
    .photo-browser-heading p { display: none; }
    .photo-browser-toolbar { grid-template-columns: auto minmax(0, 1fr); }
    .photo-browser-toolbar > strong { display: none; }
    .photo-browser-scroll { padding: 7px; }
    .photo-browser-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
    .photo-browser[data-view="months"] .photo-browser-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .photo-browser-grid.is-day-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
    .photo-folder-tile { min-height: 132px; padding: 7px; border-radius: 13px; }
    .folder-photo-fan { height: 78px; }
    .folder-fan-photo { width: 64px; height: 64px; left: calc(50% - 32px); }
    .photo-browser-grid.is-day-grid .photo-folder-tile { min-height: 95px; }
    .photo-browser-grid.is-day-grid .folder-photo-fan { height: 50px; }
    .photo-browser-grid.is-day-grid .folder-fan-photo { width: 43px; height: 43px; left: calc(50% - 22px); }
    .photo-browser-grid.is-day-grid .empty-folder-icon { min-height: 50px; font-size: 37px; }
    .photo-browser-grid.is-photo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; }
    .folder-gallery-photo { border-radius: 5px; }
}
