:root { color-scheme: light; font-family: system-ui, sans-serif; color: #183f37; background: #f5f3eb; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 95% 5%, #dbe6d8 0, transparent 60%); }
main { width: min(100% - 3rem, 64rem); margin: auto; padding: 3rem 0; }
.brand { font-size: 1.35rem; font-weight: 750; display: flex; gap: .6rem; align-items: center; margin-bottom: 6rem; }
.brand-mark { font-size: 2rem; color: #497b61; }
.eyebrow { font-size: .75rem; font-weight: 650; letter-spacing: .18em; }
h1 { font-size: clamp(2.8rem, 8vw, 6rem); line-height: 1.06; letter-spacing: -.055em; margin: 1.3rem 0; font-weight: 650; }
.intro { max-width: 35rem; font-size: 1.15rem; line-height: 1.7; color: #476058; }
.notice { display: flex; align-items: center; gap: .8rem; width: fit-content; margin-top: 3rem; padding: 1rem 1.3rem; border: 1px solid #b6c7b5; border-radius: .8rem; font-size: .9rem; line-height: 1.6; }
.dot { flex-shrink: 0; width: .5rem; height: .5rem; background: #497b61; border-radius: 50%; }
footer { padding: 1.5rem; text-align: center; color: #52685d; font-size: .8rem; }
@media (max-width: 40rem) { .brand { margin-bottom: 4rem; } .notice { padding: 1rem; } }

[hidden] { display: none !important; }
.auth { margin-top: 2rem; max-width: 40rem; overflow-wrap: anywhere; }
.auth h2 { font-size: 1.1rem; margin-top: 2rem; }
button { font: inherit; font-weight: 600; background: #183f37; color: white; border: 0; border-radius: .6rem; min-height: 48px; padding: .8rem 1.2rem; cursor: pointer; }
button:focus-visible { outline: 3px solid #497b61; outline-offset: 4px; }
button:disabled { opacity: .6; cursor: wait; }

#workspace { margin-top: 3rem; }
.section-heading, .actions, .management-row { display: flex; align-items: center; flex-wrap: wrap; gap: .7rem; }
.section-heading { justify-content: space-between; }
.library-layout { display: grid; grid-template-columns: minmax(10rem, 1fr) minmax(0, 3fr); gap: 1.5rem; }
.album-list { display: flex; flex-direction: column; gap: .5rem; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: .8rem; }
.field { display: flex; flex-direction: column; gap: .4rem; margin: .7rem 0; }
.field:has(input[type=checkbox]) { flex-direction: row-reverse; justify-content: flex-end; align-items: center; }
input, select { font: inherit; color: inherit; padding: .7rem; border: 1px solid #8ca598; border-radius: .4rem; min-width: 0; max-width: 100%; background: white; }
input[type=checkbox] { width: 1.2rem; height: 1.2rem; flex-shrink: 0; }
input:focus-visible, select:focus-visible { outline: 3px solid #497b61; outline-offset: 2px; }
input[readonly] { background: #eef0e9; }
.secondary { background: #e1e9de; color: #183f37; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 1rem; }
.photo-card, .editor, .preview-banner { border: 1px solid #b6c7b5; border-radius: .8rem; padding: 1rem; margin: 1rem 0; overflow-wrap: anywhere; }
.photo-card img { width: 100%; height: auto; display: block; margin-top: .8rem; border-radius: .4rem; }
.photo-card button { margin: .3rem; }
.management { border-top: 1px solid #b6c7b5; margin-top: 2rem; padding-top: 1rem; }
.management-row { padding: .8rem 0; border-bottom: 1px solid #d5ddce; overflow-wrap: anywhere; }
.management-row span { flex: 1 1 16rem; }
.editor { background: #fffdf6; scroll-margin-top: 1rem; }
.editor form { max-width: 50rem; }
fieldset { border: 1px solid #b6c7b5; border-radius: .5rem; padding: 1rem; margin: 1rem 0; min-width: 0; }
.grant-row { border-bottom: 1px solid #d5ddce; padding: .7rem 0; }
.preview-banner { background: #fff0cf; border-color: #ab873b; }
.portal-message { color: #81370d; overflow-wrap: anywhere; }
.location-map { width: 100%; background: #dce8ee; border: 1px solid #8ca598; border-radius: .5rem; }
.location-map circle { fill: #183f37; }
.location-map text { fill: white; font: 14px system-ui; }
@media (max-width: 45rem) { .library-layout { grid-template-columns: 1fr; } main { width: min(100% - 2rem, 64rem); } .brand { margin-bottom: 2rem; } h1 { font-size: 2.8rem; } }

body:has(#workspace:not([hidden])) main > h1,
body:has(#workspace:not([hidden])) main > .eyebrow,
body:has(#workspace:not([hidden])) main > .intro { display: none; }
body:has(#workspace:not([hidden])) .brand { margin-bottom: 1rem; }
body:has(#workspace:not([hidden])) main { margin-top: 0; }

.photo-thumbnail { position: relative; min-height: 3rem; padding-top: 2.5rem; }
.album-count { position: absolute; top: .3rem; right: .3rem; z-index: 1; display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; height: 2rem; padding: 0 .4rem; border-radius: 999px; background: #244c35; color: #fff; border: 2px solid #fff; font-weight: 700; font-variant-numeric: tabular-nums; box-shadow: 0 1px 4px #0003; }

.sync-settings { display: grid; gap: .8rem; max-width: 40rem; }
.sync-settings label { display: grid; gap: .3rem; }
.sync-folder { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin: .5rem 0; }

.sync-selection { position: sticky; bottom: 0; z-index: 3; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .75rem; background: #fff; border: 1px solid #cbd5e1; box-shadow: 0 -2px 8px #0001; padding-bottom: max(.75rem, env(safe-area-inset-bottom)); }
.sync-selection button { min-height: 44px; }
.rejected-photos { margin-top: 1rem; padding-top: 1rem; border-top: 2px dashed #94a3b8; }
@media (max-width: 600px) { .sync-selection { font-size: .85rem; } .sync-selection button { flex: 1 1 40%; padding: .5rem; } }

.portal-nav, .date-browser { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.portal-nav { padding-bottom: .75rem; border-bottom: 1px solid #b6c7b5; }
.portal-nav [aria-current=page] { box-shadow: 0 3px 0 #497b61; }
.library-layout.full-width { grid-template-columns: minmax(0, 1fr); }
.date-browser p { flex-basis: 100%; }
.photo-thumbnail { padding-top: 0; }
.preview-trigger { display: block; width: 100%; min-height: 8rem; padding: .25rem; margin: 0 !important; }
.preview-trigger img { width: 100%; height: 12rem; object-fit: cover; margin: 0; }
.photo-lightbox { width: min(96vw, 80rem); max-width: 96vw; max-height: 94svh; padding: 1rem; border: 0; border-radius: .8rem; background: #162b26; color: white; text-align: center; }
.photo-lightbox::backdrop { background: #000c; }
.photo-lightbox img { display: block; width: 100%; height: min(70svh, 60rem); object-fit: contain; margin: .5rem auto; cursor: zoom-out; }
.photo-lightbox p { margin: .5rem; }
@media (max-width: 45rem) { .portal-nav button { flex: 1 1 auto; } .filters .field { flex: 1 1 8rem; } }

.draft-bar { position: sticky; top: .5rem; z-index: 4; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .8rem; background: #fff0cf; border: 1px solid #ab873b; border-radius: .6rem; }
.folder-status { padding: .75rem; margin: .5rem 0; border: 1px solid #b6c7b5; border-radius: .5rem; overflow-wrap: anywhere; }
.sync-status { border-top: 1px solid #b6c7b5; margin-top: 1rem; }
.watched-folders .sync-folder > span { flex: 1 1 14rem; overflow-wrap: anywhere; }

.action-feedback:not(:empty), .form-error { padding: .8rem 1rem; border: 1px solid #668273; border-radius: .5rem; background: #eef6f0; overflow-wrap: anywhere; }
.action-feedback.is-error { border-color: #a52c27; background: #fff0ed; color: #7a1e19; }
.action-feedback:focus, .form-error:focus { outline: 2px solid currentColor; outline-offset: 2px; }
.folder-chooser { min-width: 0; margin: 1rem 0; border: 1px solid #b6c7b5; border-radius: .6rem; }
.folder-tree { border-top: 1px solid #b6c7b5; margin-top: 1rem; padding-top: .8rem; }
.folder-tree summary { cursor: pointer; font-weight: 600; }

.suggestion-card { margin: 1rem 0; padding: 1rem; border: 1px solid var(--border, #ccd5df); border-radius: .75rem; }
.suggestion-card .photo-grid { max-height: 26rem; overflow: auto; }
.filters fieldset { min-width: 0; max-width: 100%; }

.import-log-panel { margin-top: 1.5rem; border-top: 1px solid #b6c7b5; padding-top: 1rem; }
.import-log-panel summary { cursor: pointer; font-weight: 700; }
.import-log-window { max-height: 24rem; overflow: auto; overflow-wrap: anywhere; background: #f3f6f2; border: 1px solid #b6c7b5; border-radius: .5rem; padding: .5rem; margin: .5rem 0; }
.import-log-window p { padding: .4rem; margin: 0; border-bottom: 1px solid #dde4dc; font-size: .85rem; }
.import-log-error { color: #7a1e19; background: #fff0ed; }

.preview-frame { position: relative; }
.preview-expand { position: absolute; top: .35rem; left: .35rem; z-index: 1; width: 2.5rem; height: 2.5rem; padding: 0; margin: 0 !important; border-radius: 50%; font-size: 1.6rem; line-height: 1; box-shadow: 0 1px 5px #0006; }
.import-photo-grid .photo-card { transition: border-color .1s, background-color .1s; }
.import-photo-grid .photo-card.is-selected { border: 2px solid #245e49; background: #e4f3e9; box-shadow: 0 0 0 2px #245e4922; }
.import-photo-grid .preview-trigger { user-select: none; touch-action: manipulation; }
.import-photo-grid .preview-trigger[aria-pressed=true] { outline: 3px solid #245e49; outline-offset: -3px; }
.import-pagination { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .75rem 0; }
.import-pagination span { flex: 1 1 10rem; text-align: center; }
.import-panel .sync-selection { top: 0; bottom: auto; }
@media (max-width: 600px) { .import-panel .sync-selection { position: static; } .import-pagination button { flex: 1 1 auto; } }
.import-photo-grid .photo-card h4 { margin: .6rem 0 .3rem; }
.import-photo-grid .photo-card > p { margin: .3rem 0; font-size: .9rem; }
.import-photo-grid details { font-size: .85rem; }
.import-photo-grid details summary { cursor: pointer; }
