:root {
    --bg: #efe8dc;
    --paper: rgba(255, 252, 246, 0.88);
    --paper-strong: #fffdf9;
    --ink: #1f2730;
    --muted: #67707c;
    --line: #ddd4c6;
    --accent: #ca6331;
    --accent-soft: #f4ddcf;
    --accent-dark: #a34f28;
    --success: #1d7a4a;
    --warning: #9b6400;
    --error: #aa3d3d;
    --info: #335f92;
    --topbar: #1f2836;
    --topbar-soft: #283244;
    --shadow: 0 24px 60px rgba(38, 28, 18, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "IBM Plex Sans", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(202, 99, 49, 0.18), transparent 30%),
        radial-gradient(circle at top right, rgba(51, 95, 146, 0.12), transparent 24%),
        linear-gradient(180deg, #f7f3eb 0%, #eee6d9 100%);
}

button,
input,
select {
    font: inherit;
}

.app-shell {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 22px;
    background: linear-gradient(180deg, rgba(31, 40, 54, 0.97), rgba(40, 50, 68, 0.96));
    color: #f6efe5;
    backdrop-filter: blur(16px);
    box-shadow: 0 12px 28px rgba(20, 25, 35, 0.18);
}

.topbar-brand,
.topbar-user {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    background: linear-gradient(135deg, #d86d3a, #f4c8ae);
    color: #1f2836;
    font-family: "Space Grotesk", sans-serif;
    font-size: 1rem;
    font-weight: 700;
    flex: none;
}

.topbar h1,
.panel-head h2,
.editor-title h2,
.slot-header h3,
.result-title,
.quarantine-head h3 {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
    letter-spacing: -0.03em;
}

.topbar h1 {
    font-size: 1.38rem;
}

.topbar p {
    margin: 2px 0 0;
    color: rgba(246, 239, 229, 0.72);
    font-size: 0.88rem;
}

.topbar-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    flex: 1;
}

.nav-item,
.ghost-button,
.primary-button,
.secondary-button,
.preview-button {
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.16s ease, opacity 0.16s ease, box-shadow 0.16s ease;
}

.nav-item {
    padding: 9px 14px;
    background: rgba(255, 255, 255, 0.07);
    color: #f6efe5;
}

.nav-item.is-active {
    background: linear-gradient(135deg, rgba(216, 110, 58, 0.95), rgba(247, 198, 168, 0.92));
    color: #1f2836;
    box-shadow: 0 12px 24px rgba(216, 110, 58, 0.2);
}

.user-card {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
    white-space: nowrap;
}

.user-role {
    display: inline-flex;
    margin-bottom: 0;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 0.68rem;
    text-transform: uppercase;
}

.main-content {
    padding: 24px 28px 36px;
}

.flash {
    margin-bottom: 16px;
    padding: 14px 18px;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.flash.hidden,
.hidden {
    display: none !important;
}

.flash.success,
.status-banner.success,
.badge.ok {
    background: rgba(29, 122, 74, 0.12);
    color: var(--success);
}

.flash.warning,
.status-banner.warning,
.badge.warn {
    background: rgba(155, 100, 0, 0.12);
    color: var(--warning);
}

.flash.error,
.badge.danger {
    background: rgba(170, 61, 61, 0.12);
    color: var(--error);
}

.flash.info,
.status-banner.info {
    background: rgba(51, 95, 146, 0.12);
    color: var(--info);
}

.status-banner.info {
    display: none;
}

.view {
    display: none;
}

.view.is-active {
    display: block;
}

.panel,
.login-panel {
    background: var(--paper);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 30px;
    padding: 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.login-panel {
    max-width: 540px;
    margin: 8vh auto 0;
}

.panel-head {
    margin-bottom: 22px;
}

.panel-head.inline {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 600px);
    gap: 18px;
    align-items: end;
}

.editor-screen-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.view[data-view="editor"].is-active .panel {
    padding: 18px 20px;
}

.view[data-view="editor"].is-active .panel-head {
    margin-bottom: 12px;
}

.view[data-view="editor"].is-active .panel-head h2 {
    margin: 4px 0 2px;
    font-size: 1.68rem;
}

.view[data-view="editor"].is-active .panel-head p {
    margin: 0;
}

.panel-head h2 {
    margin: 8px 0 6px;
    font-size: 2rem;
}

.eyebrow {
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.15em;
    color: var(--accent);
    font-weight: 700;
}

.search-form,
.stack-form {
    display: grid;
    gap: 12px;
}

.search-form {
    grid-template-columns: minmax(0, 1fr) 170px auto;
    align-items: center;
}

input,
select {
    width: 100%;
    padding: 13px 15px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--paper-strong);
    color: var(--ink);
}

label span {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.primary-button {
    padding: 13px 18px;
    background: linear-gradient(135deg, var(--accent), #df8760);
    color: #fff;
    box-shadow: 0 14px 24px rgba(202, 99, 49, 0.2);
}

.secondary-button {
    padding: 10px 14px;
    background: rgba(202, 99, 49, 0.11);
    color: var(--accent-dark);
}

.ghost-button {
    padding: 11px 15px;
    background: rgba(31, 39, 48, 0.06);
    color: var(--ink);
}

.preview-button {
    padding: 8px 10px;
    background: #cfe9d5;
    color: #215235;
    font-size: 0.8rem;
    box-shadow: 0 10px 18px rgba(84, 154, 102, 0.16);
}

.danger-text {
    color: var(--error);
}

.nav-item:hover,
.ghost-button:hover,
.primary-button:hover,
.secondary-button:hover,
.preview-button:hover {
    transform: translateY(-1px);
}

.primary-button[disabled],
.secondary-button[disabled],
.ghost-button[disabled],
.preview-button[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.result-strip {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding: 6px 2px 14px;
    margin-bottom: 20px;
    scrollbar-width: thin;
}

.search-context-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 20px;
    background: rgba(31, 39, 48, 0.05);
    border: 1px solid rgba(221, 212, 198, 0.86);
}

.search-context-copy {
    display: grid;
    gap: 4px;
}

.result-strip.empty-state {
    min-height: 170px;
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--muted);
}

.result-card {
    flex: 0 0 146px;
    display: grid;
    gap: 8px;
    padding: 10px;
    border-radius: 22px;
    background: var(--paper-strong);
    border: 1px solid rgba(221, 212, 198, 0.9);
    box-shadow: 0 12px 28px rgba(33, 27, 23, 0.05);
}

.result-strip.has-selection .result-card:not(.is-active) {
    opacity: 0.52;
    filter: saturate(0.62);
}

.result-card.is-active {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(202, 99, 49, 0.16), 0 16px 30px rgba(202, 99, 49, 0.16);
}

.result-card.is-active .result-poster {
    box-shadow: 0 0 0 3px rgba(202, 99, 49, 0.18);
}

.result-poster {
    aspect-ratio: 2 / 3;
    overflow: hidden;
    border-radius: 14px;
    background: #ddd4c6;
}

.result-poster img,
.editor-poster img,
.image-thumb img,
.lightbox-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-meta {
    display: grid;
    gap: 6px;
}

.result-title {
    font-size: 0.94rem;
    line-height: 1.08;
}

.small-copy,
.muted,
.meta-line,
.overview,
.tiny,
.lightbox-caption,
.quarantine-head p {
    color: var(--muted);
}

.result-meta .pill {
    font-size: 0.72rem;
}

.result-card .ghost-button,
.result-card .primary-button {
    padding: 10px 12px;
    font-size: 0.84rem;
}

.editor-panel {
    padding: 22px;
    border-radius: 28px;
    background: var(--paper-strong);
    border: 1px solid rgba(221, 212, 198, 0.9);
}

.editor-panel.empty-state {
    min-height: 320px;
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--muted);
}

.editor-empty-state {
    display: grid;
    gap: 12px;
    justify-items: center;
    max-width: 520px;
}

.editor-empty-state h3,
.editor-empty-state p {
    margin: 0;
}

.editor-hero {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.editor-poster {
    aspect-ratio: 2 / 3;
    overflow: hidden;
    border-radius: 18px;
    background: #ddd4c6;
}

.editor-title {
    display: grid;
    gap: 10px;
}

.pill,
.badge,
.flag-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 600;
    background: rgba(31, 39, 48, 0.07);
}

.pill.accent {
    background: var(--accent-soft);
    color: var(--accent-dark);
}

.pill.soft {
    background: rgba(51, 95, 146, 0.08);
    color: var(--info);
}

.selection-toolbar {
    display: flex;
    justify-content: flex-start;
    gap: 16px;
    align-items: center;
    margin: 20px 0 18px;
    padding: 16px 18px;
    border-radius: 20px;
    background: rgba(31, 39, 48, 0.04);
}

.view[data-view="editor"].is-active .selection-toolbar {
    margin: 10px 0 12px;
    padding: 10px 12px;
    border-radius: 16px;
}

.toolbar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.selection-toolbar .preview-button {
    padding: 13px 18px;
    border-radius: 14px;
}

.status-banner {
    padding: 13px 15px;
    border-radius: 16px;
}

.history-pending-block,
.history-table-block {
    display: grid;
    gap: 14px;
}

.history-layout {
    display: grid;
    gap: 18px;
}

.history-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.history-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.history-filter {
    display: inline-flex;
    align-items: center;
    padding: 8px 13px;
    border: 1px solid rgba(221, 212, 198, 0.92);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--ink);
    font: inherit;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.history-filter:hover {
    transform: translateY(-1px);
}

.history-filter.is-active {
    border-color: rgba(202, 99, 49, 0.5);
    background: rgba(202, 99, 49, 0.12);
    color: var(--accent-dark);
}

.history-tab {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid rgba(221, 212, 198, 0.92);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--ink-strong);
    font: inherit;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.history-tab:hover {
    transform: translateY(-1px);
}

.history-tab.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.history-tab-count {
    min-width: 24px;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(31, 39, 48, 0.08);
    font-size: 0.78rem;
    line-height: 1;
    text-align: center;
}

.history-tab.is-active .history-tab-count {
    background: rgba(255, 255, 255, 0.2);
}

.history-tab-panel {
    display: grid;
    gap: 14px;
}

.history-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.history-action-badge,
.history-type-badge,
.history-detail-tag {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 0.74rem;
    line-height: 1.1;
}

.history-action-badge {
    font-weight: 600;
}

.history-type-badge,
.history-detail-tag--slot {
    background: rgba(31, 39, 48, 0.07);
    color: var(--ink);
}

.history-action-badge--direct {
    background: rgba(29, 122, 74, 0.12);
    color: var(--success);
}

.history-action-badge--success,
.history-detail-tag--success {
    background: rgba(29, 122, 74, 0.12);
    color: var(--success);
}

.history-action-badge--warning,
.history-detail-tag--warning,
.history-detail-tag--pending {
    background: rgba(155, 100, 0, 0.12);
    color: var(--warning);
}

.history-action-badge--danger,
.history-detail-tag--danger {
    background: rgba(170, 61, 61, 0.12);
    color: var(--error);
}

.history-action-badge--neutral,
.history-detail-tag--neutral {
    background: rgba(31, 39, 48, 0.08);
    color: var(--muted);
}

.history-detail-tag--info {
    background: rgba(51, 95, 146, 0.12);
    color: var(--info);
}

.history-empty-state {
    padding: 18px 20px;
    border: 1px dashed rgba(221, 212, 198, 0.92);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.55);
    color: var(--ink-soft);
}

.history-table-block {
    margin-top: 22px;
}

.compact-head {
    margin-bottom: 0;
}

.compact-head h3 {
    margin: 6px 0 0;
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}

.editor-groups {
    display: grid;
    gap: 16px;
}

.view[data-view="editor"].is-active .editor-groups {
    gap: 10px;
}

.group-tabs,
.slot-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.group-tabs {
    overflow-x: auto;
    padding: 3px 0 4px;
    scrollbar-width: thin;
}

.group-tab,
.slot-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(221, 212, 198, 0.92);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--ink);
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.group-tab {
    padding: 12px 14px;
}

.slot-tab {
    padding: 10px 12px;
}

.group-tab:hover,
.slot-tab:hover {
    transform: translateY(-1px);
}

.group-tab.is-active,
.slot-tab.is-active {
    border-color: var(--accent);
    background: linear-gradient(135deg, rgba(202, 99, 49, 0.12), rgba(244, 221, 207, 0.92));
    box-shadow: 0 10px 20px rgba(202, 99, 49, 0.08);
}

.group-tab-title {
    font-weight: 700;
}

.group-tab-meta {
    font-size: 0.74rem;
    color: var(--muted);
}

.group-panel {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 14px;
    padding: 16px;
    height: 455px;
    border: 1px solid rgba(221, 212, 198, 0.9);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.58);
    overflow: hidden;
}

.view[data-view="editor"].is-active .group-panel {
    height: clamp(330px, calc(100vh - 300px), 455px);
    gap: 10px;
    padding: 12px;
}

.group-block {
    border: 1px solid rgba(221, 212, 198, 0.9);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.55);
    overflow: hidden;
}

.group-block summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    cursor: pointer;
    list-style: none;
}

.group-block summary::-webkit-details-marker {
    display: none;
}

.group-content {
    display: grid;
    gap: 14px;
    padding: 0 16px 16px;
}

.slot-block {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 10px;
    min-height: 0;
}

.slot-header {
    display: flex;
    justify-content: flex-start;
    align-items: end;
    gap: 12px;
}

.slot-header h3 {
    font-size: 1.02rem;
}

.slot-strip {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 2px 28px;
    scrollbar-width: thin;
}

.image-card {
    display: grid;
    gap: 6px;
    padding: 8px;
    border-radius: 16px;
    border: 1px solid rgba(221, 212, 198, 0.95);
    background: #fff;
    min-width: 0;
    overflow: hidden;
    align-content: start;
}

.image-card--portrait {
    flex: 0 0 146px;
    width: 146px;
    min-width: 146px;
    max-width: 146px;
}

.image-card--landscape {
    flex: 0 0 300px;
    width: 300px;
    min-width: 300px;
    max-width: 300px;
}

.image-card--logo {
    flex: 0 0 206px;
    width: 206px;
    min-width: 206px;
    max-width: 206px;
}

.image-card.is-selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(202, 99, 49, 0.16);
}

.image-card.is-disabled {
    opacity: 0.45;
    filter: grayscale(1);
}

.image-thumb {
    display: block;
    flex: none;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: #ddd4c6;
    padding: 0;
    border: 0;
    width: 100%;
    cursor: zoom-in;
}

.image-card--portrait .image-thumb--portrait {
    display: block;
    width: 100%;
    height: 195px;
    margin: 0;
    overflow: hidden;
    aspect-ratio: auto;
}

.image-thumb--landscape {
    aspect-ratio: 16 / 9;
}

.image-thumb--logo {
    aspect-ratio: 3 / 1;
    background: #f6f0e6;
}

.image-card--portrait .image-thumb--portrait img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    max-height: none;
    margin: 0;
    object-fit: cover !important;
    object-position: center top !important;
}

.flag-badge {
    padding: 4px 7px;
    background: rgba(51, 95, 146, 0.1);
    color: var(--info);
    font-size: 0.7rem;
}

.card-footer {
    display: grid;
    gap: 0;
    padding: 4px 7px;
    border-radius: 10px;
    background: rgba(31, 39, 48, 0.05);
    min-height: 42px;
    text-align: center;
}

#search-results .card-footer {
    min-height: 0;
}

.footer-line {
    display: block;
    height: 13px;
    overflow: hidden;
    white-space: normal;
    text-overflow: ellipsis;
    font-size: 0.68rem;
    line-height: 1.1;
    color: #54606d;
    word-break: break-word;
}

.footer-line--top,
.footer-line--bottom {
    display: block;
}

.selected-owner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
    width: fit-content;
    max-width: 100%;
    padding: 3px 9px;
    border-radius: 999px;
    background: #dbeaf8;
    color: #2f628f;
    font-size: 0.72rem;
    min-height: 1rem;
    text-align: center;
    line-height: 1.15;
    cursor: help;
}

.selected-owner.is-mine {
    background: #d9efd8;
    color: #2d6b3b;
}

.selected-owner.is-pending {
    background: #eadcf8;
    color: #6f4ea0;
}

.selected-owner.is-empty {
    visibility: hidden;
    background: transparent;
    padding: 0;
}

.select-image-button {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 9px 10px;
    font-size: 0.69rem;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.select-image-button[disabled] {
    cursor: not-allowed;
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 14px 12px;
    border-bottom: 1px solid rgba(221, 212, 198, 0.86);
    text-align: left;
    vertical-align: top;
}

.data-table td .tiny {
    display: block;
    margin-top: 4px;
    font-size: 0.78rem;
}

.quarantine-list {
    display: grid;
    gap: 16px;
}

.quarantine-media-tabs,
.quarantine-pane-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.quarantine-media-tabs {
    margin-bottom: 14px;
}

.quarantine-media-tab,
.quarantine-pane-tab {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid rgba(221, 212, 198, 0.92);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--ink);
    font: inherit;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.quarantine-pane-tab {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
}

.quarantine-media-tab:hover,
.quarantine-pane-tab:hover {
    transform: translateY(-1px);
}

.quarantine-media-tab.is-active,
.quarantine-pane-tab.is-active {
    border-color: rgba(202, 99, 49, 0.56);
    background: rgba(202, 99, 49, 0.12);
}

.quarantine-media-tab-title {
    font-weight: 700;
}

.quarantine-media-tab-meta {
    font-size: 0.74rem;
    color: var(--muted);
}

.quarantine-card {
    padding: 20px;
    border-radius: 24px;
    background: var(--paper-strong);
    border: 1px solid rgba(221, 212, 198, 0.9);
}

.quarantine-group {
    padding: 20px;
    border-radius: 24px;
    background: var(--paper-strong);
    border: 1px solid rgba(221, 212, 198, 0.9);
}

.quarantine-compare {
    display: grid;
    gap: 18px;
    margin-top: 14px;
}

.quarantine-pane {
    display: grid;
    gap: 14px;
    margin-top: 14px;
}

.quarantine-baseline,
.quarantine-proposal {
    display: grid;
    gap: 12px;
    padding: 16px;
    border-radius: 20px;
    background: rgba(31, 39, 48, 0.03);
    border: 1px solid rgba(221, 212, 198, 0.72);
}

.quarantine-proposals {
    display: grid;
    gap: 14px;
}

.proposal-head {
    align-items: start;
}

.quarantine-selection-strip {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
}

.quarantine-selection-strip .image-card {
    gap: 8px;
}

.quarantine-image-card .compare-image-label {
    min-height: 32px;
    display: flex;
    align-items: center;
}

.quarantine-image-card .selected-owner {
    justify-self: center;
}

.compare-image-card {
    flex: 0 0 170px;
    display: grid;
    gap: 8px;
}

.compare-image-card[data-slot="landscape"] {
    flex-basis: 280px;
}

.compare-image-card[data-slot="logo"] {
    flex-basis: 220px;
}

.compare-image-label {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--ink);
}

.quarantine-head,
.quarantine-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.meta-stack {
    display: grid;
    gap: 4px;
    color: var(--muted);
}

.empty-state,
.loader-card,
.empty-gallery {
    display: grid;
    place-items: center;
    text-align: center;
    min-height: 120px;
    color: var(--muted);
}

.empty-gallery {
    min-width: 280px;
    padding: 12px;
    border: 1px dashed var(--line);
    border-radius: 16px;
    background: rgba(31, 39, 48, 0.03);
}

.no-image {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: var(--muted);
    background: linear-gradient(135deg, rgba(221, 212, 198, 0.9), rgba(246, 240, 230, 0.92));
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 40;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 21, 31, 0.78);
    backdrop-filter: blur(6px);
}

.lightbox-dialog {
    position: relative;
    z-index: 1;
    width: min(92vw, 1180px);
    margin: 5vh auto 0;
    padding: 18px;
    border-radius: 26px;
    background: rgba(255, 252, 246, 0.98);
    box-shadow: 0 24px 70px rgba(16, 21, 31, 0.32);
}

.lightbox-toolbar,
.lightbox-meta-row,
.lightbox-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.lightbox-nav,
.lightbox-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border: 0;
    border-radius: 14px;
    background: rgba(31, 39, 48, 0.08);
    cursor: pointer;
}

.lightbox-toolbar .lightbox-close {
    margin-left: auto;
    width: 42px;
    height: 42px;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
}

.button-with-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.button-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.lightbox-meta-row {
    margin-top: 12px;
}

.lightbox-nav[disabled] {
    opacity: 0.38;
    cursor: default;
}

.lightbox-media {
    margin-top: 14px;
    max-height: 72vh;
    overflow: hidden;
    border-radius: 18px;
    background: #e6dfd4;
}

.lightbox-media img {
    object-fit: contain;
    max-height: 72vh;
}

.lightbox-caption {
    font-size: 0.92rem;
}

.lightbox-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
    text-align: center;
}

.lightbox-owner {
    color: var(--muted);
    font-size: 0.9rem;
}

.lightbox-actions {
    justify-content: flex-end;
    margin-top: 14px;
}

.preview-dialog {
    position: relative;
    z-index: 1;
    width: min(92vw, 1120px);
    margin: 6vh auto 0;
    padding: 18px;
    border-radius: 26px;
    background: rgba(255, 252, 246, 0.98);
    box-shadow: 0 24px 70px rgba(16, 21, 31, 0.32);
}

.preview-head {
    display: grid;
    gap: 4px;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(92px, 118px));
    justify-content: start;
    gap: 10px;
    margin-top: 16px;
    max-height: 72vh;
    overflow: auto;
    padding-right: 4px;
}

.preview-actions {
    margin-top: 16px;
}

.preview-change-card {
    display: grid;
    gap: 6px;
    padding: 8px;
    border-radius: 14px;
    border: 1px solid rgba(221, 212, 198, 0.92);
    background: #fff;
}

.preview-change-media {
    overflow: hidden;
    border-radius: 10px;
    background: #ddd4c6;
}

.preview-change-media--portrait {
    aspect-ratio: 2 / 3;
}

.preview-change-media--landscape {
    aspect-ratio: 16 / 9;
}

.preview-change-media--logo {
    aspect-ratio: 3 / 1;
    background: #f6f0e6;
}

.preview-change-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.preview-empty {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    min-height: 64px;
    color: var(--muted);
    font-size: 0.72rem;
    background: linear-gradient(135deg, rgba(221, 212, 198, 0.9), rgba(246, 240, 230, 0.96));
}

.preview-change-body {
    display: grid;
    gap: 2px;
}

.preview-change-label {
    font-size: 0.72rem;
    line-height: 1.2;
    font-weight: 600;
}

.preview-change-state,
.muted {
    color: var(--muted);
    font-size: 0.7rem;
    line-height: 1.15;
}

code {
    padding: 2px 6px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
}

@media (max-width: 1200px) {
    .panel-head.inline {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    .topbar {
        position: static;
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-nav,
    .topbar-user {
        justify-content: space-between;
    }

    .search-form {
        grid-template-columns: 1fr;
    }

    .search-context-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .group-tabs,
    .slot-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .group-panel {
        height: auto;
        min-height: 455px;
    }
}

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

    .panel,
    .login-panel,
    .editor-panel {
        padding: 18px;
    }

    .result-card {
        flex-basis: 124px;
    }

    .image-card {
        flex-basis: 124px;
    }

    .image-card[data-slot="landscape"] {
        flex-basis: 240px;
    }

    .image-card[data-slot="logo"] {
        flex-basis: 180px;
    }
}
