:root {
    color: #262422;
    background: #f7f5f0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

* {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
}

a {
    color: inherit;
}

input {
    font: inherit;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 32px;
    padding: 28px 22px;
    color: #f8f3e8;
    background: #243b36;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    font-weight: 800;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    color: #17231f;
    font-size: 13px;
    background: #d9c891;
    border-radius: 8px;
}

.sidebar nav {
    display: grid;
    gap: 8px;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 12px;
    color: #ede7d9;
    text-decoration: none;
    border-radius: 8px;
}

.sidebar nav a.active,
.sidebar nav a:hover {
    color: #17231f;
    background: #d9c891;
}

.privacy-note {
    display: grid;
    gap: 6px;
    margin-top: auto;
    padding: 14px;
    font-size: 14px;
    line-height: 1.4;
    color: #efe8d8;
    background: rgb(255 255 255 / 10%);
    border: 1px solid rgb(255 255 255 / 18%);
    border-radius: 8px;
}

.content {
    display: grid;
    gap: 24px;
    align-content: start;
    padding: 32px;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.kicker {
    margin: 0 0 8px;
    color: #7b5d35;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin: 0;
}

h1 {
    max-width: 760px;
    font-size: 42px;
    line-height: 1.08;
}

h2 {
    font-size: 18px;
}

h3 {
    font-size: 16px;
}

.primary-button,
.section-heading a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 14px;
    white-space: nowrap;
    text-decoration: none;
    border-radius: 8px;
}

.primary-button {
    color: #ffffff;
    background: #b64632;
}

.search-row {
    display: grid;
    grid-template-columns: minmax(90px, auto) 1fr;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 0 16px;
    background: #ffffff;
    border: 1px solid #e2ddd2;
    border-radius: 8px;
}

.search-row label {
    color: #625d55;
    font-weight: 700;
}

.search-row input {
    width: 100%;
    color: #262422;
    border: 0;
    outline: 0;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.summary-grid div {
    display: grid;
    gap: 4px;
    padding: 18px;
    background: #ffffff;
    border: 1px solid #e2ddd2;
    border-radius: 8px;
}

.summary-grid strong {
    font-size: 28px;
}

.summary-grid span {
    color: #706b61;
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 24px;
    align-items: start;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.section-heading a {
    color: #243b36;
    background: #ebe5d6;
}

.cards {
    display: grid;
    gap: 14px;
}

.photo-card {
    display: grid;
    grid-template-columns: 160px 1fr;
    min-height: 154px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e2ddd2;
    border-radius: 8px;
}

.photo-placeholder {
    display: grid;
    place-items: center;
    color: #f5ead0;
    background: linear-gradient(135deg, rgb(36 59 54 / 92%), rgb(182 70 50 / 72%)), #243b36;
}

.photo-placeholder span {
    font-size: 28px;
    font-weight: 800;
}

.photo-body {
    display: grid;
    gap: 14px;
    padding: 18px;
}

.photo-body p {
    color: #625d55;
    line-height: 1.45;
}

.photo-body div > p {
    margin-top: 5px;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chips span {
    padding: 5px 8px;
    color: #243b36;
    background: #edf0e8;
    border-radius: 8px;
}

.people-panel {
    display: grid;
    gap: 12px;
}

.person-row {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #e2ddd2;
    border-radius: 8px;
}

.avatar {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    color: #243b36;
    font-weight: 800;
    background: #edf0e8;
    border-radius: 50%;
}

.person-row p,
.person-row span {
    color: #706b61;
    font-size: 14px;
}

.memory-box {
    display: grid;
    gap: 10px;
    margin-top: 12px;
    padding: 18px;
    color: #17231f;
    background: #d9c891;
    border-radius: 8px;
}

.memory-box p {
    line-height: 1.45;
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        gap: 18px;
    }

    .sidebar nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .privacy-note {
        margin-top: 0;
    }

    .workspace-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .content {
        padding: 22px 16px;
    }

    .topbar {
        display: grid;
    }

    h1 {
        font-size: 34px;
    }

    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .photo-card {
        grid-template-columns: 1fr;
    }

    .photo-placeholder {
        min-height: 150px;
    }

    .search-row {
        grid-template-columns: 1fr;
        padding: 12px 16px;
    }

    .sidebar nav {
        grid-template-columns: 1fr;
    }
}

/* Funkční archiv */
button,select,textarea {font:inherit}
button {cursor:pointer;border:0}
button:disabled {opacity:.6;cursor:wait}
.brand {text-decoration:none}
h1 {font-size:34px;line-height:1.18}
.content {min-width:0}
.panel {background:#fff;border:1px solid #e2ddd2;border-radius:12px;padding:24px}
.stack {display:grid;gap:18px;align-content:start}
.narrow {width:100%;max-width:780px}
label {display:grid;gap:7px;font-weight:600;font-size:14px}
input:not([type=checkbox]),select,textarea {width:100%;min-width:0;padding:11px 12px;background:#fff;color:#262422;border:1px solid #cfcabd;border-radius:7px}
textarea {resize:vertical;line-height:1.5}
:focus-visible {outline:3px solid #b68d44;outline-offset:3px}
.muted {color:#706b61;font-size:14px;line-height:1.6}
.secondary,.danger,.subtle {display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:10px 14px;border-radius:7px;text-decoration:none;min-height:42px}
.secondary {background:#ebe5d6;color:#243b36}
.danger {background:#faece7;color:#992f1d}
.subtle {background:#ffffff18;color:inherit;width:100%}
.primary-button {padding:12px 16px;font-weight:600}
.alert {padding:15px 18px;border-radius:8px;line-height:1.5}
.success {background:#e5efe5;color:#254528;border:1px solid #aec8ac}
.error {background:#fff0eb;color:#8d301d;border:1px solid #e8b7a7}
.summary-grid {grid-template-columns:repeat(3,minmax(0,1fr));max-width:780px}
.filter-bar {display:flex;align-items:end;flex-wrap:wrap;gap:12px}
.filter-bar label:first-child {flex:2;min-width:220px}
.filter-bar label {flex:1;min-width:155px}
.filter-bar>a {align-self:center}
.gallery {display:grid;grid-template-columns:repeat(auto-fill,minmax(235px,1fr));gap:22px}
.gallery-card {display:block;overflow:hidden;border:1px solid #e2ddd2;border-radius:10px;background:white;text-decoration:none;transition:box-shadow .15s}
.gallery-card:hover {box-shadow:0 6px 20px #243b3618}
.gallery-card img {display:block;width:100%;height:220px;object-fit:cover;background:#ece8dd}
.gallery-card>div {padding:18px}
.gallery-card p {margin-top:8px;font-size:14px;color:#706b61}
.gallery-card h2 {overflow-wrap:anywhere}
.empty {display:grid;gap:16px;justify-items:center;text-align:center;padding:60px 25px;line-height:1.6}
.upload-zone {padding:35px 22px;border:2px dashed #b9c2b2;border-radius:10px;background:#f8faf5;gap:16px}
.upload-zone span {font-size:13px;color:#706b61}
.collection-grid {display:grid;gap:16px;align-content:start}
.collection {display:grid;gap:13px}
.collection h2>a {text-decoration:none}
.actions {display:flex;gap:16px;align-items:center;flex-wrap:wrap}
.detail-grid {display:grid;grid-template-columns:minmax(0,1.5fr) minmax(280px,1fr);gap:24px;align-items:start}
.photo-stage {display:flex;align-items:center;justify-content:center;background:#e6e2d8;border-radius:12px;overflow:hidden;min-height:260px}
.photo-stage img {max-width:100%;max-height:75vh;object-fit:contain}
fieldset {border:1px solid #e2ddd2;padding:14px;border-radius:7px;display:grid;gap:10px;max-height:250px;overflow:auto}
legend {font-weight:700;padding:0 6px}
.check {display:flex;align-items:center;gap:10px;font-weight:400}
.check input {width:18px;height:18px;accent-color:#243b36}
.comment {display:grid;gap:8px;padding-bottom:16px;border-bottom:1px solid #eee8df;line-height:1.6;overflow-wrap:anywhere}
.comment-heading {font-size:14px;color:#706b61}
.comment-heading strong {color:#292824}
.comment-heading time {font:inherit;color:inherit}
.member {display:flex;justify-content:space-between;gap:16px;align-items:center;padding:12px 0;border-bottom:1px solid #eee8df}
.member span {color:#706b61;font-size:14px}
.chips a {padding:8px;background:#edf0e8;border-radius:6px}
.back {display:block;margin-bottom:12px;color:#706b61;font-size:14px;text-decoration:none}
.pagination {display:flex;align-items:center;gap:20px;justify-content:center}
.auth-shell {min-height:100vh;display:grid;grid-template-columns:1fr 1fr;gap:60px;align-items:center;padding:60px max(32px,8vw)}
.auth-intro {display:grid;gap:32px;max-width:550px}
.auth-intro h1 {font-size:48px;line-height:1.15}
.auth-intro>p {font-size:18px;line-height:1.7;color:#706b61}
.auth-card {display:grid;gap:24px;width:100%;max-width:460px;justify-self:center;padding:36px}
.auth-card h2 {font-size:25px}
.auth-card>p:last-child {font-size:14px}
@media(max-width:1100px) {.detail-grid{grid-template-columns:1fr}.auth-shell{gap:30px;padding:40px}.auth-intro h1{font-size:38px}}
@media(max-width:980px) {.sidebar{padding:18px 22px}.sidebar nav{grid-template-columns:repeat(4,1fr)}.privacy-note{display:flex;align-items:center;flex-wrap:wrap;padding:10px 14px}.privacy-note form{margin-left:auto}.privacy-note span{font-size:13px}.content{padding:24px}.auth-shell{grid-template-columns:1fr;gap:30px}.auth-intro{justify-self:center;width:100%;max-width:460px}.auth-intro h1{font-size:32px}.auth-intro>p{display:none}.auth-card{padding:26px}}
@media(max-width:600px) {.sidebar nav{gap:3px}.sidebar nav a{padding:8px;font-size:14px}.content{padding:20px 14px}.panel{padding:20px}.summary-grid strong{font-size:24px}.summary-grid div{padding:14px}.filter-bar label{flex-basis:100%}.filter-bar button{width:100%}.auth-shell{padding:30px 18px}.gallery{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.gallery-card img{height:150px}.gallery-card>div{padding:12px}.gallery-card h2{font-size:15px}.gallery-card p{font-size:12px}.member{flex-wrap:wrap}h1{font-size:29px}}

/* Značky patří k rozměrům obrázku, nikoli k volnému prostoru kolem něj. */
[hidden] {display:none!important}
.tag-image {position:relative;max-width:100%;line-height:0}
.photo-stage .tag-image>img {display:block;max-width:100%;height:auto;max-height:75vh;width:auto}
.person-pin {position:absolute;transform:translate(-50%,-50%);width:30px;height:30px;display:grid;place-items:center;padding:0;border:2px solid white;border-radius:50%;background:#243b36;color:white;font-size:13px;font-weight:800;line-height:1;box-shadow:0 1px 5px #0009;z-index:1}
.person-pin.is-selected {background:#b64632;outline:4px solid #f7d77a;z-index:2}
.pending-pin {background:#b64632;pointer-events:none}
.tag-image.is-tagging {cursor:crosshair}
.tag-image.is-tagging .person-pin {pointer-events:none}
.tag-legend {display:grid;gap:10px}
.tag-row {display:flex;gap:10px;align-items:center;justify-content:space-between;flex-wrap:wrap}
.tag-row>[aria-pressed=true] {background:#243b36;color:white;box-shadow:0 0 0 2px #d9c891}
.tag-row .secondary {white-space:normal;text-align:left;overflow-wrap:normal;word-break:normal;hyphens:none}
.tag-editor {border-top:1px solid #e2ddd2;padding-top:18px}

.tag-image.is-clickable {cursor:crosshair}
.person-picker {width:min(460px,calc(100vw - 32px));max-height:85dvh;overflow:auto;border:1px solid #e2ddd2;border-radius:16px;padding:24px;color:#262422;background:#fff;box-shadow:0 20px 80px #0004}
.person-picker::backdrop {background:#17231f99}
.person-picker>h2,.person-picker>p,.person-picker>label {margin-bottom:18px}
.person-choices {display:grid;gap:8px;max-height:40dvh;overflow:auto}
.person-choices button {justify-content:flex-start;text-align:left;overflow-wrap:normal;word-break:normal;hyphens:none}

.pin-name {display:none}
[data-tag-display=names] .person-pin:not(.pending-pin) {width:12px;height:12px}
[data-tag-display=names] .pin-number {display:none}
[data-tag-display=hidden] [data-person-pin] {display:none}
.person-choices .is-suggestion {background:#243b36;color:white;box-shadow:inset 0 0 0 2px #d9c891}

.photo-stage[data-tag-frame] {position:relative}
.person-connectors {position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:2;overflow:visible}
.person-connectors path {fill:none;stroke:#fff;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke;filter:drop-shadow(0 0 1px #000) drop-shadow(0 1px 1px #0009)}
.person-connectors path.is-selected {stroke:#ffe6a3;stroke-width:2.2}
.person-side-label {position:absolute;right:8px;transform:translateY(-50%);width:102px;max-height:48px;padding:5px 7px;border:1px solid #c9d2c8;border-radius:6px;background:#f9faf5;color:#243b36;font-size:12px;line-height:18px;font-weight:600;text-align:left;overflow:hidden;overflow-wrap:normal;word-break:normal;hyphens:none;z-index:3;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.person-side-label.on-left {right:auto;left:8px;text-align:right}
.person-side-label[aria-pressed=true] {background:#b64632;color:white;border-color:#b64632}
[data-tag-frame]:not([data-tag-display=names])>.person-connectors,
[data-tag-frame]:not([data-tag-display=names])>.person-side-label {display:none}

.photo-stage[data-tag-frame] {padding:5px 0}
.person-side-label {background:rgb(249 250 245 / 90%);box-shadow:0 1px 4px #0003}

.tag-image.can-enlarge {cursor:zoom-in}
.tag-image.is-tagging {cursor:crosshair}
.photo-stage.is-tagging .person-side-label {pointer-events:none}
[data-tag-mode][aria-pressed=true] {background:#243b36;color:white;box-shadow:0 0 0 2px #d9c891}
.photo-lightbox {width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;margin:0;padding:12px;border:0;border-radius:0;background:#17231f;color:#fff}
.photo-lightbox[open] {display:flex;flex-direction:column}
.photo-lightbox::backdrop {background:#000c}
.lightbox-header {display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:12px}
.lightbox-header h2 {overflow-wrap:anywhere;flex:1;min-width:0;font-size:18px}
.lightbox-header button {flex-shrink:0}
.lightbox-viewport {flex:1;min-height:0;overflow:auto}
.lightbox-viewport>img {display:block;width:100%;height:100%;max-width:none;max-height:none;object-fit:contain}
.lightbox-viewport.is-zoomed>img {width:200%;height:200%;object-position:left top}
@media(max-width:600px) {.lightbox-header {flex-wrap:wrap;gap:8px}.lightbox-header h2 {flex-basis:100%}}
body.photo-modal-open {overflow:hidden}

.detail-grid.is-viewing {grid-template-columns:minmax(0,1fr)}
.photo-albums {margin:10px 0}
.photo-context {margin-top:8px}
.photo-story {line-height:1.7;overflow-wrap:anywhere}
.tag-status:empty {display:none}

.person-choices button {display:block}
.person-choice-years {font-weight:400;opacity:.8}

.photo-navigation {display:grid;grid-template-columns:30px minmax(0,1fr) 30px;gap:6px;align-items:stretch}
.photo-navigation>.scan-viewport {grid-column:2;grid-row:1;min-width:0}
.photo-nav-arrow {grid-row:1;display:flex;align-items:center;justify-content:center;align-self:center;min-height:100px;border-radius:9px;background:#243b3609;color:#243b3699;text-decoration:none;font-size:36px;transition:background .15s,color .15s}
.photo-nav-previous {grid-column:1}
.photo-nav-next {grid-column:3}
.photo-nav-arrow:hover,.photo-nav-arrow:focus-visible {background:#243b361c;color:#243b36}
.photo-nav-arrow:focus-visible {outline:2px solid #536d62;outline-offset:2px}
@media(max-width:600px) {.photo-navigation {grid-template-columns:24px minmax(0,1fr) 24px;gap:3px}.photo-nav-arrow {font-size:30px;min-height:80px}}

.scan-viewport {min-width:0;border-radius:12px;background:#e6e2d8}
.scan-viewport.has-scan-zoom {overflow:auto;overscroll-behavior:contain;scrollbar-width:thin}
.has-scan-zoom>.photo-stage {min-height:0;max-width:none;border-radius:0;overflow:hidden}
.has-scan-zoom .tag-image {max-width:none;flex:none}
.has-scan-zoom .tag-image>img {max-width:none;max-height:none}
.lightbox-viewport {padding:5px}

.comment-edit summary {cursor:pointer;color:#706b61;font-size:14px;width:fit-content}
.comment-edit[open] summary {margin-bottom:12px}
