.app-shell {
    --app-accent: #3564d8;
    --app-ink: #17233c;
    --app-muted: #657189;
    --app-bg: #f5f7fb;
    --app-surface: #fff;
    --app-line: #c6d0df;
    --app-tint: #edf2ff;
    --app-link: #2857b8;
    --app-card-shadow: 0 5px 16px #17233c14;
    color-scheme: light;
    min-height: 100dvh;
    background: var(--app-bg);
    color: var(--app-ink);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
html[data-app-theme="dark"] .app-shell {
    color-scheme: dark;
    --app-accent: #8cafff;
    --app-ink: #e6edf8;
    --app-muted: #b0bed3;
    --app-bg: #101725;
    --app-surface: #1c2739;
    --app-line: #53647d;
    --app-tint: #263c61;
    --app-link: #a4c2ff;
    --app-card-shadow: 0 6px 20px #0005;
    --bs-body-color: #e6edf8;
    --bs-body-bg: #101725;
    --bs-secondary-color: #b0bed3;
    --bs-border-color: #53647d;
    --bs-link-color: #a4c2ff;
    --bs-link-hover-color: #c5d8ff;
}
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: calc(1rem + env(safe-area-inset-top)) max(1rem, env(safe-area-inset-left)) 1rem;
    border-bottom: 1px solid var(--app-line);
    background: var(--app-surface);
}
.app-brand { color: var(--app-ink); font-weight: 700; text-decoration: none; }
.app-session { display: flex; align-items: center; gap: .5rem; color: var(--app-muted); font-size: .8rem; }
.app-database-target { text-align: right; max-width: 24rem; }
.app-status-dot { width: .5rem; height: .5rem; border-radius: 50%; background: #288267; }
.app-content { max-width: 1120px; margin: auto; padding: 1.25rem 1rem calc(7rem + env(safe-area-inset-bottom)); }
.app-content h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); font-weight: 700; }
.app-shell .jumbotron { background: var(--app-surface); }
.app-content button, .app-content .btn { min-height: 44px; }
.app-card { background: var(--app-surface); border: 1px solid var(--app-line); border-radius: 20px; padding: 1.5rem; margin-bottom: 1rem; }
.app-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 1rem; }
.site-verification { margin-top: 1.5rem; }
.unlock-duration { padding: 1rem; margin-bottom: 1.5rem; background: var(--app-tint); border: 1px solid var(--app-line); border-radius: 16px; }
.appearance-setting label { display: block; margin-top: 1rem; margin-bottom: .5rem; font-weight: 600; }
.appearance-setting select { max-width: 240px; min-height: 44px; }
.appearance-setting p { margin: .75rem 0 0; font-size: .9rem; }
.site-editor { border: 2px solid var(--app-accent); margin-top: 1.5rem; scroll-margin-top: 1rem; }
.site-editor h2 { font-size: 1.5rem; margin-bottom: 1rem; }
.site-editor label { display: flex; flex-direction: column; gap: .35rem; font-size: .9rem; }
.site-editor button { margin: .5rem .3rem .5rem 0; }
.site-editor .text-body-secondary { font-size: .85rem; margin-top: .75rem; }
.password-editor { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 2px solid var(--app-line); }
.password-generator { background: var(--app-tint); padding: 1rem; border-radius: 12px; margin: 1rem 0; }
.password-generator summary { cursor: pointer; font-weight: 600; min-height: 44px; }
.password-generator input[type="number"] { max-width: 160px; }
.generator-options { display: flex; flex-wrap: wrap; gap: .75rem 1rem; margin: 1rem 0; }
.generator-options label { flex-direction: row; align-items: center; min-height: 44px; }
.generator-options input { width: 20px; height: 20px; }
.unlock-duration label { display: block; font-weight: 600; margin-bottom: .5rem; }
.unlock-duration select { max-width: 220px; min-height: 44px; }
.unlock-duration p { margin: .75rem 0 0; font-size: .9rem; }
.unlock-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 1rem; align-items: start; }
.unlock-method { margin: 0; border-top: 4px solid var(--app-accent, #3564d8); }
.unlock-method h3 { font-size: 1.2rem; margin-bottom: .75rem; }
.unlock-method label { display: block; margin-top: .75rem; margin-bottom: .35rem; }
.unlock-method button { margin-top: .5rem; }
.app-card-link { color: inherit; text-decoration: none; display: block; }
.app-card-link:hover { border-color: var(--app-accent); }
.app-card-icon { color: var(--app-accent); width: 32px; height: 32px; margin-bottom: 1rem; }
.app-dock-container {
    position: fixed;
    z-index: 1000;
    bottom: 0;
    left: 0;
    right: 0;
    container-type: inline-size;
    background: var(--app-surface);
    border-top: 1px solid var(--app-line);
    padding: .4rem max(.5rem, env(safe-area-inset-left)) calc(.4rem + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 24px #17233c0a;
}
.app-dock { display: flex; justify-content: center; max-width: 720px; margin: auto; }
.app-destination {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .2rem;
    min-width: 0;
    min-height: 60px;
    padding: .4rem .5rem;
    border-radius: 16px;
    color: var(--app-muted);
    font-size: .75rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    list-style: none;
}
.app-destination svg { width: 24px; height: 24px; }
.app-destination:hover, .app-destination.active, .app-more[open] > summary { color: var(--app-accent); background: var(--app-tint); }
.app-destination:focus-visible, .app-overflow-link:focus-visible { outline: 2px solid var(--app-accent); outline-offset: -2px; }
.app-more { position: relative; flex: 1; min-width: 0; }
.app-more summary::-webkit-details-marker { display: none; }
.app-overflow {
    position: absolute;
    bottom: calc(100% + 1rem);
    right: 0;
    width: min(280px, 85vw);
    max-height: min(65dvh, 480px);
    overflow-y: auto;
    padding: .75rem;
    border: 1px solid var(--app-line);
    border-radius: 20px;
    box-shadow: 0 12px 48px #17233c26;
    background: var(--app-surface);
}
.app-overflow-title { display: block; padding: .5rem .75rem; color: var(--app-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.app-overflow-link { display: flex; align-items: center; gap: .75rem; min-height: 48px; padding: .5rem .75rem; color: var(--app-ink); text-decoration: none; border-radius: 12px; }
.app-overflow-link svg { width: 22px; height: 22px; }
.app-overflow-link:hover, .app-overflow-link.active { background: var(--app-tint); color: var(--app-accent); }
.app-signout { border-top: 1px solid var(--app-line); margin-top: .5rem; padding-top: .5rem; }
.app-signout button { background: none; border: 0; color: var(--app-ink); text-align: left; width: 100%; padding: .75rem; border-radius: 12px; }
.app-signout button:hover { background: var(--app-tint); }
.app-primary.app-item-3, .app-primary.app-item-4 { display: none; }
.app-overflow-link.app-item-0, .app-overflow-link.app-item-1, .app-overflow-link.app-item-2 { display: none; }
@container (min-width: 440px) {
    .app-primary.app-item-3 { display: flex; }
    .app-overflow-link.app-item-3 { display: none; }
}
@container (min-width: 580px) {
    .app-primary.app-item-4 { display: flex; }
    .app-overflow-link.app-item-4 { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
    .app-destination { transition: color .15s, background .15s; }
}
