:root {
    --bg: #f3f4f7;
    --surface: #ffffff;
    --surface-muted: #f8f9fc;
    --surface-strong: #111111;
    --text: #111111;
    --text-soft: #7d8696;
    --line: #dde2ea;
    --line-strong: #171717;
    --blue: #0d40ff;
    --primary-dark: #1c1d21;
    --danger: #b92f2f;
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

body.theme-dark {
    --bg: #101114;
    --surface: #181b20;
    --surface-muted: #1d2128;
    --surface-strong: #ffffff;
    --text: #f4f5f7;
    --text-soft: #9ca4b0;
    --line: #2a2f38;
    --line-strong: #f1f3f6;
    --blue: #4d74ff;
    --primary-dark: #2a2c31;
    --danger: #ff6b6b;
}

::-webkit-scrollbar {
    height: 6px; /* ultra fine */
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--blue);
    border-radius: 10px;
}

::-webkit-scrollbar {
    width: 6px; /* ultra fine */
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--blue);
    border-radius: 10px;
}






body.theme-dark ::-webkit-scrollbar-thumb {
    background: white;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Manrope', sans-serif;
    color: var(--text);
    background: var(--bg);
}

body.modal-open {
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

textarea {
    resize: vertical;
}

input,
textarea,
select {
    color: var(--text);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.wordmark {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.9rem, 2vw, 2.35rem);
    font-weight: 700;
    letter-spacing: -0.06em;
}

.wordmark span {
    color: var(--blue);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 18px;
    background: var(--surface-strong);
    color: var(--surface);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.brand-text strong,
.auth-copy h1,
.page-header h1,
.workspace-title,
.empty-state h2,
.gallery-card h2,
.modal-form-head h2,
.item-gallery-header h2 {
    font-family: 'Space Grotesk', sans-serif;
}

.brand-text strong {
    font-size: 1.2rem;
}

.brand-text small,
.auth-copy p,
.page-header p,
.gallery-card p,
.empty-state p,
.auth-links span,
.kpi-card span,
.section-count,
.board-empty,
.user-chip-name,
.modal-form-head p,
.field-help,
.workspace-subcopy,
.item-gallery-note,
.item-collection-link {
    color: var(--text-soft);
}

.eyebrow,
.section-kicker,
.gallery-tag,
.mode-label,
.field span,
.kpi-card span,
.item-tag {
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.alert {
    display: grid;
    gap: 0.35rem;
    padding: 1rem 1.15rem;
    border-radius: 18px;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.alert-error {
    color: #912222;
    background: rgba(195, 32, 32, 0.08);
    border-color: rgba(195, 32, 32, 0.14);
}

.alert-success {
    color: #0e6d41;
    background: rgba(11, 138, 75, 0.08);
    border-color: rgba(11, 138, 75, 0.14);
}

.auth-page {
    background: linear-gradient(135deg, #ffffff 0%, #ffffff 60%, #edf1ff 100%);
}

.auth-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2rem;
    padding: 4rem clamp(1.5rem, 5vw, 5rem);
}

.auth-copy h1,
.page-header h1 {
    margin: 0.75rem 0;
    font-size: clamp(2.3rem, 3vw, 3.8rem);
    line-height: 0.95;
    letter-spacing: -0.05em;
}

.auth-form,
.data-form {
    display: grid;
    gap: 1.1rem;
}

.auth-form {
    padding: 2rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, 0.92);
}

.field {
    display: grid;
    gap: 0.6rem;
}

.field span {
    color: var(--text-soft);
}

.field input,
.field textarea,
.field select,
.search-field input {
    width: 100%;
    min-height: 52px;
    padding: 0.95rem 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.field textarea {
    min-height: 140px;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.search-field input:focus {
    outline: 2px solid rgba(13, 64, 255, 0.2);
    border-color: rgba(13, 64, 255, 0.6);
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 6rem;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 0.85rem;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--text-soft);
    font-weight: 700;
}

.form-message {
    margin: 0;
    font-size: 0.92rem;
}

.form-message.error {
    color: var(--danger);
}

.form-message.muted {
    color: var(--text-soft);
}

.button-primary,
.button-secondary,
.button-filter,
.button-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 1rem 1.55rem;
    border-radius: 18px;
    font-weight: 600;
    border: 1px solid transparent;
}

.button-inline {
    white-space: nowrap;
}

.button-primary {
    border-color: var(--primary-dark);
    background: var(--blue);
    color: #ffffff;
}

.button-secondary,
.button-filter {
    border-color: var(--line-strong);
    background: var(--surface);
    color: var(--text);
}

.button-secondary {
    border-width: 2px;
}

body.theme-dark .button-primary {
    border-color: #ffffff;
    background: #ffffff;
    color: #111111;
}

.button-danger {
    border-color: rgba(185, 47, 47, 0.2);
    background: rgba(185, 47, 47, 0.08);
    color: var(--danger);
}

.button-secondary:hover {
    background: #eceef2;
    border-color: black;
    color: black;
}

.button-filter:hover,
.button-filter:focus-visible {
    background: #eceef2;
    border-color: var(--line-strong);
    color: var(--text);
}
.button-danger:hover {
    background: rgba(185, 47, 47, 0.14);
}




.button-primary:disabled,
.button-secondary:disabled,
.button-danger:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.auth-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.auth-links a,
.link-button,
.inline-actions a,
.card-actions a {
    font-weight: 800;
}

.auth-showcase {
    display: grid;
    place-items: center;
    padding: clamp(2rem, 5vw, 5rem);
    background: radial-gradient(circle at 18% 20%, rgba(13, 64, 255, 0.18), transparent 26%), linear-gradient(145deg, #0e1119 0%, #1a2450 52%, #0d40ff 100%);
}

.showcase-card {
    width: min(100%, 520px);
    padding: clamp(2rem, 3vw, 2.8rem);
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(18px);
}

.showcase-card p,
.showcase-card .section-kicker,
.showcase-card .eyebrow {
    color: rgba(255, 255, 255, 0.78);
}

.showcase-card h2 {
    margin: 0.9rem 0;
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2rem, 3vw, 3rem);
    line-height: 0.98;
    letter-spacing: -0.04em;
}

.mini-kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.9rem;
    margin-top: 1.8rem;
}

.mini-kpis article {
    display: grid;
    gap: 0.3rem;
    padding: 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
}

.app-shell {
    width: 95%;
    margin: 0 auto;
    padding: 28px 28px 42px;
}

.topbar,
.topbar-left,
.topbar-tools,
.mode-toggle-wrap,
.workspace-actions,
.workspace-toolbar,
.inline-actions,
.form-actions,
.gallery-meta,
.card-actions,
.section-line,
.workspace-head,
.page-header,
.gallery-card-top {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar,
.page-header,
.workspace-head,
.section-line {
    justify-content: space-between;
}

.topbar {
    margin-bottom: 2rem;
}

.mode-toggle-wrap {
    gap: 0.8rem;
}

.mode-label,
.section-kicker,
.gallery-tag {
    color: var(--text-soft);
}

.mode-switch {
    position: relative;
    width: 48px;
    height: 30px;
    display: inline-flex;
}

.mode-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.mode-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--line);
}

.mode-slider::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--blue);
}

.mode-switch input:checked + .mode-slider::before {
    left: 22px;
}

.user-chip,
.icon-button,
.collection-pill,
.kpi-card,
.workspace-card,
.gallery-card,
.modal-panel,
.item-gallery-card,
.board-empty,
.empty-state,
.image-preview-card {
    background: var(--surface);
    border: 1px solid var(--line);
}

.user-chip {
    padding: 0.8rem 1rem;
    border-radius: 999px;
}

.icon-button {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    color: var(--text);
}

.icon-button svg {
    width: 20px;
    height: 20px;
}

.app-main {
    display: grid;
    gap: 2rem;
}

.kpi-grid,
.collection-gallery-grid,
.item-gallery-grid,
.form-grid {
    display: grid;
    gap: 1rem;
}

.kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kpi-card {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 1rem 1.15rem 1.1rem;
    border-radius: var(--radius-lg);
}

.kpi-card strong {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2rem, 3vw, 2.5rem);
    letter-spacing: -0.05em;
}

.collection-zone {
    display: grid;
    gap: 1rem;
}

.collection-strip {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 40px;
}

.collection-pill {
    min-width: 230px;
    display: grid;
    gap: 0.65rem;
    padding: 1.15rem;
    border-radius: 22px;
}

.collection-pill strong {
    font-size: 24px;
    line-height: 1.2;
}

.collection-pill span {
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.collection-pill.is-active {
    border: 2px solid var(--line-strong);
}

.workspace-card {
    padding: 1.35rem;
    border-radius: 28px;
}

.workspace-card-flat {
    padding: 1.4rem;
}

.workspace-head {
    align-items: end;
    margin-bottom: 1rem;
}

.workspace-head-top {
    align-items: flex-start;
}

.page-header {
    margin-bottom: 0;
}

.workspace-title {
    margin: 0.35rem 0 0;
    font-size: clamp(2rem, 3vw, 3rem);
    line-height: 0.95;
    letter-spacing: -0.05em;
}

.workspace-subcopy,
.page-header p,
.auth-copy p {
    margin: 0.4rem 0 0;
}

.workspace-toolbar {
    justify-content: space-between;
    margin-bottom: 1rem;
}

.search-field {
    min-width: 320px;
}

.search-field-wide {
    flex: 1;
}

.board-empty,
.empty-state {
    display: grid;
    place-items: center;
    min-height: 112px;
    padding: 1.3rem;
    border-radius: 18px;
    background: var(--surface-muted);
    text-align: center;
}

.empty-state {
    gap: 0.6rem;
    padding: 2rem;
}

.collection-gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gallery-card,
.form-card,
.item-gallery-card {
    border-radius: 24px;
}

.gallery-card {
    display: grid;
    gap: 1rem;
    padding: 1.2rem;
    background: var(--surface-muted);
}

.collection-card {
    align-content: start;
}

.mini-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.gallery-meta {
    justify-content: space-between;
    flex-wrap: wrap;
}

.item-gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.item-gallery-card {
    display: grid;
    overflow: hidden;
}

.item-gallery-media {
    aspect-ratio: 3 / 4;
    background: var(--surface-muted);
    border-bottom: 1px solid var(--line);
}

.item-gallery-media img,
.item-gallery-placeholder {
    width: 100%;
    height: 100%;
}

.item-gallery-media img {
    display: block;
    object-fit: cover;
}

.item-gallery-placeholder {
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, rgba(13, 64, 255, 0.12), rgba(13, 64, 255, 0.03));
}

.item-gallery-placeholder span {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.6rem;
    font-weight: 700;
    color: var(--blue);
}

.item-gallery-body {
    display: grid;
    gap: 1rem;
    padding: 1.1rem;
}

.item-gallery-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.item-gallery-header h2,
.gallery-card h2 {
    margin: 0;
    font-size: 1.15rem;
    line-height: 1.08;
}

.item-collection-link {
    display: inline-flex;
    margin-top: 0.3rem;
    font-size: 0.92rem;
    font-weight: 700;
}

.item-gallery-price {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    white-space: nowrap;
}

.item-tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.item-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--text-soft);
}

.item-tag-blue,
.status-pill {
    background: rgba(13, 64, 255, 0.08);
    color: var(--blue);
    border-color: rgba(13, 64, 255, 0.18);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.8rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
}

.item-gallery-note {
    margin: 0;
    min-height: 2.8em;
    line-height: 1.45;
}

.card-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
}

.card-actions-spread {
    justify-content: space-between;
}

.card-actions form,
.inline-actions form {
    margin: 0;
}

.link-button,
.inline-actions a,
.card-actions a {
    color: var(--text);
}

.link-button:hover,
.inline-actions a:hover,
.card-actions a:hover,
.item-collection-link:hover {
    color: var(--blue);
}

.danger-link {
    color: var(--danger);
}

.link-button {
    padding: 0;
    border: 0;
    background: transparent;
}

.form-card {
    max-width: 1120px;
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-full {
    grid-column: 1 / -1;
}

.field-color input {
    padding: 0.35rem;
    min-height: 56px;
}

.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    color: var(--text);
}

.checkbox-row input {
    width: 18px;
    height: 18px;
    min-height: 18px;
    padding: 0;
}

.image-preview-field {
    gap: 0.8rem;
}

.image-preview-card {
    display: grid;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    background: var(--surface-muted);
}

.image-preview-card img {
    width: 100%;
    max-width: 280px;
    height: 220px;
    object-fit: cover;
    border-radius: 16px;
    border: 1px solid var(--line);
}

.form-actions {
    justify-content: flex-end;
    margin-top: 0.6rem;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 16px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 10, 18, 0.42);
    backdrop-filter: blur(8px);
}

.modal-panel {
    position: relative;
    width: min(580px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    padding: 1rem;
    border-radius: 30px;
    overflow: auto;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    z-index: 2;
}

.modal-close:hover {
    background: var(--blue);
    border-color: var(--blue);
    color: #ffffff;
}

.modal-close span {
    font-size: 1.8rem;
    line-height: 1;
}

.modal-content {
    padding: 0.25rem 0.5rem 0.75rem;
}

.modal-form-shell {
    display: grid;
    gap: 1.25rem;
}

.modal-form-head h2 {
    margin: 0.35rem 0 0;
    font-size: clamp(1.8rem, 2vw, 2.4rem);
    line-height: 0.98;
    letter-spacing: -0.05em;
}

[hidden] {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.button-primary.is-loading,
.button-secondary.is-loading {
    opacity: 0.8;
    cursor: progress;
}

@media (max-width: 1180px) {
    .kpi-grid,
    .collection-gallery-grid,
    .item-gallery-grid,
    .form-grid {
        grid-template-columns: 1fr 1fr;
    }
}


@media (max-width: 640px) {
    .item-gallery-grid {
        grid-template-columns: 1fr;
    }
}
.item-gallery-media {
    padding: 0;
}

.item-gallery-face {
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.item-gallery-face-front,
.item-gallery-face-back {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-gallery-placeholder {
    border-radius: 0;
}
.item-gallery-header h2 {
    font-size: 1.35rem;
    line-height: 1.02;
}
.item-gallery-header h2 {
    font-size: 1.55rem;
    line-height: 0.98;
}
.wordmark-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
}


.wordmark-text {
    display: inline-flex;
    align-items: baseline;
    gap: 0.02rem;
}

.search-field {
    position: relative;
}

.search-field::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 1rem;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    background: center / contain no-repeat url('../media/search.svg');
    pointer-events: none;
    z-index: 1;
}

body.theme-dark .search-field::before {
    background-image: url('../media/search_white.svg');
}

.search-field input {
    padding-left: 3rem;
}

.icon-button-media {
    width: 20px;
    height: 20px;
    display: block;
    background: center / contain no-repeat url('../media/logout.svg');
}

body.theme-dark .icon-button-media {
    background-image: url('../media/logout_white.svg');
}
.icon-button[data-tooltip] {
    position: relative;
}

.icon-button[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    top: calc(100% + 10px);
    transform: translateX(-50%);
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
}

.icon-button[data-tooltip]::before {
    content: '';
    position: absolute;
    left: 50%;
    top: calc(100% + 4px);
    width: 10px;
    height: 10px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    transform: translateX(-50%) rotate(45deg);
    opacity: 0;
    pointer-events: none;
}

.icon-button[data-tooltip]:hover::after,
.icon-button[data-tooltip]:hover::before,
.icon-button[data-tooltip]:focus-visible::after,
.icon-button[data-tooltip]:focus-visible::before {
    opacity: 1;
}
.card-actions-icons {
    gap: 0.7rem;
}

.card-actions-icons form {
    display: contents;
}

.item-action-icon {
    position: relative;
    width: 42px;
    height: 42px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 14px;
    background: var(--primary-dark);
    color: #ffffff;
    flex: 0 0 auto;
}

.item-action-icon::before {
    content: '';
    width: 24px;
    height: 24px;
    display: block;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
}

.item-action-edit::before {
    background-image: url('../media/editWhite.svg');
}

.item-action-move::before {
    background-image: url('../media/moveWhite.svg');
}

.item-action-delete::before {
    background-image: url('../media/binWhite.svg');
}

.item-action-icon[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    top: calc(100% + 10px);
    transform: translateX(-50%);
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    z-index: 8;
}

.item-action-icon[data-tooltip]::selection {
    background: transparent;
}

.item-action-icon[data-tooltip] .tooltip {
    display: none;
}

.item-action-icon[data-tooltip]:hover::after,
.item-action-icon[data-tooltip]:focus-visible::after {
    opacity: 1;
}
.item-gallery-card {
    position: relative;
}

.card-actions-icons {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 6;
    opacity: 0;
    pointer-events: none;
}

.item-gallery-card:hover .card-actions-icons,
.item-gallery-card:focus-within .card-actions-icons {
    opacity: 1;
    pointer-events: auto;
}

.item-action-icon {
    width: 36px;
    height: 36px;
}


.card-actions-icons {
    top: 18px;
    right: 18px;
    gap: 0.45rem;
    padding: 0.45rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    opacity: 0;
}

.item-action-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--primary-dark);
}


.card-actions-icons {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.item-gallery-card[data-image-viewer-trigger="true"] {
    cursor: zoom-in;
}

.image-viewer-overlay {
    position: fixed;
    inset: 0;
    z-index: 230;
    display: grid;
    place-items: center;
    padding: 24px;
}

.image-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 10, 18, 0.88);
    backdrop-filter: blur(10px);
}

.image-viewer-stage {
    position: relative;
    z-index: 1;
    place-items: center;
    padding: 24px;
}

.image-viewer-stage img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 18px;
}

.image-viewer-frame {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 16px;
    background: rgba(17, 17, 17, 0.92);
    color: #ffffff;
}

.image-viewer-nav span {
    font-size: 2.3rem;
    line-height: 1;
}

.image-viewer-nav-prev {
    left: 20px;
}

.image-viewer-nav-next {
    right: 20px;
}

.image-viewer-meta {
    position: absolute;
    left: 20px;
    bottom: 20px;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 16px;
    background: rgba(17, 17, 17, 0.92);
    color: #ffffff;
}

.image-viewer-counter {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.8;
}

.image-viewer-label {
    font-size: 0.95rem;
    font-weight: 700;
}

.image-viewer-close {
    position: absolute;
    top: 24px;
    right: 24px;
    z-index: 2;
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 16px;
    background: rgba(17, 17, 17, 0.92);
    color: #ffffff;
}

.image-viewer-close span {
    font-size: 2rem;
    line-height: 1;
}

@media (max-width: 720px) {
    .image-viewer-overlay {
        padding: 12px;
    }

    .image-viewer-stage {
        width: calc(100vw - 24px);
        height: calc(100vh - 24px);
        padding: 12px;
    }

    .image-viewer-close {
        top: 12px;
        right: 12px;
    }
}

.image-viewer-stage {
    overflow: hidden;
}

.image-viewer-stage img {
    width: auto;
    height: 95vh;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
}

.button-filter.is-active,
.button-filter[aria-pressed="true"] {
    /*background: var(--blue);
    border-color: var(--blue);*/
    color: #ffffff;
}
.button-filter {
    border-width: 2px;
    gap: 0.7rem;
}

.button-filter-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    background-color: currentColor;
    -webkit-mask: url('../media/filter.svg') center / contain no-repeat;
    mask: url('../media/filter.svg') center / contain no-repeat;
}
.button-sort-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    background: center / contain no-repeat url('../media/sort_black.svg');
}

body.theme-dark .button-sort-icon {
    background-image: url('../media/sort_white.svg');
}

.button-filter.is-active .button-sort-icon,
.button-filter[aria-pressed="true"] .button-sort-icon {
    background-image: url('../media/sort_white.svg');
}

.filter-menu-wrap {
    position: relative;
    flex: 0 0 auto;
}

.filter-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(320px, calc(100vw - 56px));
    display: grid;
    gap: 0.75rem;
    padding: 0.8rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    z-index: 70;
}

.filter-option {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.7rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-muted);
    cursor: pointer;
}

.filter-checkbox {
    margin: 0.15rem 0 0;
    width: 18px;
    height: 18px;
    accent-color: var(--blue);
    flex: 0 0 18px;
}

.filter-option-copy {
    display: grid;
    gap: 0.2rem;
}

.filter-option-copy strong {
    font-size: 0.95rem;
    line-height: 1.2;
}

.filter-option-copy small {
    color: var(--text-soft);
    line-height: 1.35;
}
@media (max-width: 1920px) {
    .modal-panel[data-size="wide"] {
        overflow-y: auto;
        overflow-x: hidden;
    }

    .modal-panel[data-size="wide"] .modal-content {
        height: auto;
        min-height: 0;
    }

    .item-modal-shell,
    .item-modal-form,
    .item-modal-layout {
        height: auto;
        min-height: 0;
    }

    .item-modal-media-column,
    .item-modal-fields-column,
    .item-modal-fields-grid {
        overflow: visible;
    }
}

.section-line-collections {
    align-items: center;
}

.section-line-tools {
    display: inline-flex;
    align-items: center;
    gap: 0.9rem;
}

.auth-page-minimal {
    background: #ffffff;
}

.auth-shell-minimal {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
}

.auth-panel-minimal {
    width: min(100%, 420px);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 0;
    margin: 0 auto;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    align-self: center;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.65rem;
    font-weight: 700;
}


.auth-copy-minimal {
    text-align: center;
    display: grid;
    gap: 0.45rem;
}

.auth-copy-minimal h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 2.6rem);
}

.auth-copy-minimal p {
    margin: 0;
    color: var(--muted);
}

.auth-links-minimal {
    justify-content: center;
}

.auth-wordmark {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    justify-content: center;
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2rem, 4vw, 2.6rem);
    font-weight: 700;
    letter-spacing: -0.04em;
}

.auth-wordmark span {
    color: var(--blue);
}

@media (min-width: 1921px) {
    .app-shell {
        width: min(95vw, 1840px);
        padding: 24px 24px 36px;
    }

    .app-main {
        gap: 1.75rem;
    }

    .kpi-grid {
        gap: 0.9rem;
    }

    .kpi-card {
        padding: 0.95rem 1.05rem 1rem;
    }

    .collection-strip {
        gap: 0.9rem;
    }

    .collection-pill {
        min-width: 240px;
        padding: 1.05rem;
    }

    .collection-pill strong {
        font-size: 22px;
    }

    .workspace-card,
    .workspace-card-flat {
        padding: 1.25rem;
    }

    .workspace-toolbar {
        gap: 0.85rem;
    }

    .item-gallery-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 0.9rem;
    }

    .item-gallery-body {
        gap: 0.85rem;
        padding: 1rem;
    }

    .item-gallery-header h2 {
        font-size: 1.45rem;
    }
}

@media (max-width: 1920px) and (min-width: 1281px) {
    .app-shell {
        width: min(95vw, 1824px);
        padding: 24px 24px 36px;
    }

    .app-main {
        gap: 1.75rem;
    }

    .kpi-grid {
        gap: 0.9rem;
    }

    .kpi-card {
        padding: 0.95rem 1.05rem 1rem;
    }

    .collection-strip {
        gap: 0.9rem;
    }

    .collection-pill {
        min-width: 240px;
        padding: 1.05rem;
    }

    .collection-pill strong {
        font-size: 22px;
    }

    .workspace-card,
    .workspace-card-flat {
        padding: 1.25rem;
    }

    .workspace-toolbar {
        gap: 0.85rem;
    }

    .item-gallery-grid {
        gap: 0.9rem;
    }

    .item-gallery-body {
        gap: 0.85rem;
        padding: 1rem;
    }

    .item-gallery-header h2 {
        font-size: 1.45rem;
    }
}

@media (max-width: 1280px) and (min-width: 981px) {
    .app-shell {
        width: min(95vw, 1248px);
        padding: 20px 20px 32px;
    }

    .topbar {
        gap: 1rem;
    }

    .topbar-tools {
        gap: 0.7rem;
    }

    .app-main {
        gap: 1.4rem;
    }

    .kpi-grid {
        gap: 0.8rem;
    }

    .kpi-card {
        padding: 0.9rem 0.95rem 0.95rem;
    }

    .kpi-card strong {
        font-size: 2.1rem;
    }

    .collection-strip {
        gap: 0.75rem;
    }

    .collection-pill {
        min-width: 216px;
        padding: 0.95rem;
    }

    .collection-pill strong {
        font-size: 20px;
    }

    .workspace-card,
    .workspace-card-flat {
        padding: 1.1rem;
    }

    .workspace-head-top {
        gap: 1rem;
    }

    .workspace-actions {
        display: flex;
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    .workspace-toolbar {
        gap: 0.8rem;
        align-items: stretch;
    }

    .search-field {
        min-width: 0;
    }

    .filter-menu {
        width: min(300px, calc(100vw - 40px));
    }

    .item-gallery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.8rem;
    }

    .item-gallery-body {
        gap: 0.8rem;
        padding: 0.95rem;
    }

    .item-gallery-header h2 {
        font-size: 1.35rem;
    }

    .item-tag-row {
        gap: 0.45rem;
    }

    .item-tag {
        padding: 0.38rem 0.58rem;
    }
}

/* Component repair */
.collection-strip {
    padding-left: 1px;
    padding-right: 12px;
}

.collection-card-shell {
    position: relative;
    flex: 0 0 296px;
    min-width: 296px;
    z-index: 1;
}

.collection-strip > .collection-card-shell > .collection-pill {
    min-width: 100%;
    min-height: 152px;
    display: grid;
    gap: 0.55rem;
    padding: 1.4rem 1.4rem 1.35rem;
}

.item-gallery-topline {
    display: flex;
    justify-content: space-between;
}

.collection-pill-link {
    padding-right: 4.4rem;
}

.collection-pill strong {
    margin: 0;
    max-width: calc(100% - 1rem);
    font-size: 24px;
    line-height: 1.08;
}

.collection-pill span {
    font-size: 0.9rem;
    line-height: 1.15;
}

.collection-menu-wrap {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 260;
}

.collection-action-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 180px;
    display: grid;
    gap: 0.35rem;
    padding: 0.45rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    z-index: 261;
}

.item-gallery-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
}

.item-gallery-card {
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--surface);
}

.item-gallery-media {
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: var(--surface-muted);
    border-bottom: 1px solid var(--line);
}

.item-gallery-face {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.item-gallery-face-front,
.item-gallery-face-back {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-gallery-face-back {
    opacity: 0;
}

.item-gallery-card.has-back-image:hover .item-gallery-face-front {
    opacity: 0;
}

.item-gallery-card.has-back-image:hover .item-gallery-face-back {
    opacity: 1;
}

.item-gallery-placeholder {
    display: grid;
    place-items: center;
    border-radius: 0;
}

.item-gallery-body {
    display: grid;
    align-content: start;
    gap: 1rem;
    padding: 1.1rem;
}

.item-gallery-header h2 {
    margin: 0;
    font-size: 1.55rem;
    line-height: 0.98;
}

.card-actions-icons {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 6;
    display: inline-flex;
    gap: 0.45rem;
    opacity: 0;
    pointer-events: none;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.item-gallery-card:hover .card-actions-icons,
.item-gallery-card:focus-within .card-actions-icons {
    opacity: 1;
    pointer-events: auto;
}

.item-action-icon {
    position: relative;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: var(--primary-dark);
    color: #ffffff;
    flex: 0 0 auto;
}

/*$120px;$220px;
    display: block;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
}*/

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 16px;
}

.modal-panel {
    position: relative;
    width: min(580px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 30px;
    background: var(--surface);
    overflow: auto;
}

.modal-content {
    padding: 0.25rem 0.5rem 0.75rem;
}

.modal-panel[data-size="wide"] {
    width: 95vw;
    max-width: 95vw;
    height: 95vh;
    max-height: 95vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.modal-panel[data-size="wide"] .modal-content {
    height: auto;
    min-height: 0;
}

.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 210;
    display: grid;
    place-items: center;
    padding: 16px;
}

.confirm-panel {
    position: relative;
    width: min(520px, calc(100vw - 32px));
    padding: 1.4rem;
    border: 1px solid var(--line);
    border-radius: 28px;
    background: var(--surface);
}

.item-modal-shell,
.item-modal-form,
.item-modal-layout {
    height: auto;
    min-height: 0;
}

.item-modal-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(420px, 0.9fr);
    gap: 1rem;
}

.item-modal-media-column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-content: start;
    overflow: visible;
}

.item-modal-media-column .field-help {
    grid-column: 1 / -1;
}

.item-modal-fields-column,
.item-modal-fields-grid {
    overflow: visible;
}

.item-modal-fields-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.item-image-block {
    display: grid;
    gap: 0.65rem;
    align-content: start;
}

.item-image-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.item-image-dropzone {
    display: block;
    cursor: pointer;
}

.item-image-frame {
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--surface-muted);
}

.item-image-frame img,
.item-image-placeholder {
    width: 100%;
    height: 100%;
}

.item-image-frame img {
    display: block;
    object-fit: cover;
}

.item-image-placeholder {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    place-items: center;
    gap: 0.45rem;
    padding: 1rem;
    text-align: center;
}

.item-image-placeholder strong,
.item-image-placeholder span {
    display: block;
}

@media (max-width: 1280px) and (min-width: 981px) {
    .collection-strip > .collection-card-shell {
        flex-basis: 232px;
        min-width: 232px;
    }

    .collection-strip > .collection-card-shell > .collection-pill {
        min-height: 140px;
        gap: 0.45rem;
        padding: 1rem;
    }

    .collection-pill strong {
        font-size: 20px;
    }

    .item-gallery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .item-gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .item-modal-layout {
        grid-template-columns: 1fr;
    }

    .item-modal-media-column,
    .item-modal-fields-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .item-gallery-grid {
        grid-template-columns: 1fr;
    }

    .collection-strip > .collection-card-shell {
        flex-basis: 100%;
        min-width: 100%;
    }
}

/* Collection menu and popup repair */
.collection-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-soft);
    gap: 4px;
}

.collection-menu-toggle span {
    display: block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
}

.collection-menu-toggle:hover,
.collection-menu-toggle:focus-visible {
    color: var(--blue);
}

.tag-editor-input-row {
    display: flex;
    gap: 8px;
}

.collection-action-menu {
    z-index: 80;
    box-shadow: none;
}

.collection-action-link {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-muted);
    color: var(--text);
    text-align: left;
}

button.collection-action-link {
    appearance: none;
}

.collection-action-link:hover,
.collection-action-link:focus-visible {
    border-color: var(--blue);
    color: var(--blue);
}

.confirm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 10, 18, 0.42);
    backdrop-filter: blur(8px);
}

.confirm-panel {
    display: grid;
    gap: 1rem;
    z-index: 1;
}

.confirm-panel h2 {
    margin: 0;
    font-size: clamp(1.7rem, 2vw, 2.2rem);
    line-height: 1;
    letter-spacing: -0.04em;
}

.confirm-copy {
    margin: 0;
}

.confirm-actions .button-secondary,
.confirm-actions .button-danger {
    width: 100%;
    justify-content: center;
}

.confirm-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
}

.modal-panel,
.confirm-panel {
    box-shadow: none;
}

.modal-form-head p {
    margin: 0.45rem 0 0;
}

.item-modal-head,
.modal-form-head {
    display: grid;
    gap: 0.25rem;
}

.item-modal-fields-column {
    display: grid;
    align-content: start;
    gap: 1rem;
}

.item-modal-actions,
.form-actions-full {
    display: flex;
    width: 100%;
}

.button-full-width {
    width: 100%;
}


/* Collection menu stacking repair */
.collection-zone {
    overflow: visible;
}

.collection-strip {
    overflow-x: auto;
    overflow-y: visible;
}

.collection-card-shell {
    position: relative;
    overflow: visible;
}

.collection-menu-wrap {
    z-index: 400;
}

.collection-action-menu {
    z-index: 401;
}



/* Dark mode filter/sort buttons */
body.theme-dark .button-filter {
    color: #111111;
}

body.theme-dark .button-filter-icon {
    background-color: #111111;
}

body.theme-dark .button-sort-icon,
body.theme-dark .button-filter.is-active .button-sort-icon,
body.theme-dark .button-filter[aria-pressed="true"] .button-sort-icon {
    background-image: url('../media/sort_black.svg');
}

/* Light mode filter/sort buttons */
body:not(.theme-dark) .button-filter {
    color: #111111;
}

body:not(.theme-dark) .button-filter:hover,
body:not(.theme-dark) .button-filter:focus-visible {
    color: #111111;
}

body:not(.theme-dark) .button-filter-icon {
    background-color: #111111;
}

body:not(.theme-dark) .button-sort-icon,
body:not(.theme-dark) .button-filter.is-active .button-sort-icon,
body:not(.theme-dark) .button-filter[aria-pressed="true"] .button-sort-icon {
    background-image: url('../media/sort_black.svg');
}

/* Dark mode filter/sort buttons final */
body.theme-dark .button-filter {
    color: #ffffff;
}

body.theme-dark .button-filter-icon {
    background-color: #ffffff;
}

body.theme-dark .button-sort-icon,
body.theme-dark .button-filter.is-active .button-sort-icon,
body.theme-dark .button-filter[aria-pressed="true"] .button-sort-icon {
    background-image: url('../media/sort_white.svg');
}

body.theme-dark .button-filter:hover,
body.theme-dark .button-filter:focus-visible {
    color: #111111;
}

body.theme-dark .button-filter:hover .button-filter-icon,
body.theme-dark .button-filter:focus-visible .button-filter-icon {
    background-color: #111111;
}

body.theme-dark .button-filter:hover .button-sort-icon,
body.theme-dark .button-filter:focus-visible .button-sort-icon {
    background-image: url('../media/sort_black.svg');
}


/* Upload form button and tag editor repair */
.ghost-inline-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0.7rem 0.95rem;
    border: 1px solid ;
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 700;
}

.ghost-inline-button:hover,
.ghost-inline-button:focus-visible {
    border-color: var(--blue);
    background: var(--blue);
    color: #ffffff;
}

.tag-editor {
    display: grid;
    gap: 0.85rem;
    padding: 0.95rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface-muted);
}

.tag-editor-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    min-height: 20px;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 700;
}

.tag-chip-remove {
    width: 20px;
    height: 20px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-soft);
    font-size: 1rem;
    line-height: 1;
}

.tag-chip-remove:hover,
.tag-chip-remove:focus-visible {
    color: var(--blue);
}

.tag-editor-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
}

.tag-editor-button {
    min-width: 132px;
}

@media (max-width: 720px) {
    .tag-editor-input-row {
        grid-template-columns: 1fr;
    }

    .tag-editor-button {
        width: 100%;
    }
}

/* Upload photo remove button layout */
.item-image-block {
    position: relative;
}

.item-image-head {
    display: block;
}

.item-image-head .section-kicker {
    display: inline-block;
    margin-bottom: 0.65rem;
}

.item-image-head .ghost-inline-button {
    width: 100%;
    justify-content: center;
    margin-top: 0.75rem;
    border-radius: 16px;
}

/* Upload photo remove button bottom layout */
.item-image-block {
    display: grid;
    grid-template-areas:
        "kicker"
        "frame"
        "button";
    gap: 0.65rem;
}

.item-image-head {
    display: contents;
}

.item-image-head .section-kicker {
    grid-area: kicker;
    margin: 0;
}

.item-image-dropzone {
    grid-area: frame;
}

.item-image-head .ghost-inline-button {
    grid-area: button;
    width: 100%;
    margin: 0;
    justify-content: center;
    border-radius: 16px;
}






.bug-report-button {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1100001;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border: 2px solid currentColor;
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-main);
}

.bug-report-icon {
    width: 22px;
    height: 22px;
    display: block;
}

body.theme-dark .bug-report-button {
    background: var(--surface);
    color: var(--text-main);
}
.bug-report-button[data-tooltip]::after {
    top: auto;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
}

.bug-report-button[data-tooltip]::before {
    top: auto;
    bottom: calc(100% + 4px);
    border-right: 0;
    border-bottom: 0;
    border-left: 1px solid var(--line);
    border-top: 1px solid var(--line);
    transform: translateX(-50%) rotate(225deg);
}
body.theme-dark .wordmark-logo {
    content: url('../media/logo_white.svg');
}

.bug-report-button[data-tooltip] {
    position: fixed;
}

.bug-report-button[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
}

.bug-report-button[data-tooltip]::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: calc(100% + 4px);
    width: 10px;
    height: 10px;
    border-left: 1px solid var(--line);
    border-top: 1px solid var(--line);
    background: var(--surface);
    transform: translateX(-50%) rotate(225deg);
    opacity: 0;
    pointer-events: none;
}

.bug-report-button[data-tooltip]:hover::after,
.bug-report-button[data-tooltip]:hover::before,
.bug-report-button[data-tooltip]:focus-visible::after,
.bug-report-button[data-tooltip]:focus-visible::before {
    opacity: 1;
}
/* Mobile responsive overrides */
@media (max-width: 980px) {
    .app-shell {
        width: 100%;
        padding: 20px 16px 32px;
    }

    .topbar,
    .page-header,
    .workspace-head,
    .workspace-toolbar,
    .section-line {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar,
    .page-header,
    .workspace-head,
    .workspace-toolbar,
    .section-line,
    .topbar-tools,
    .workspace-actions,
    .section-line-tools {
        gap: 0.85rem;
    }

    .topbar-left {
        justify-content: center;
    }

    .wordmark-logo {
        width: clamp(148px, 34vw, 184px);
        height: auto;
    }

    .topbar-tools {
        width: 100%;
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .mode-toggle-wrap {
        width: 100%;
        justify-content: space-between;
    }

    .user-chip {
        flex: 1 1 0;
        min-width: 0;
        justify-content: center;
    }

    .user-chip-name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .page-header > div,
    .workspace-head > div {
        width: 100%;
    }

    .workspace-actions,
    .section-line-tools {
        width: 100%;
        flex-wrap: wrap;
    }

    .workspace-actions .button-inline,
    .section-line-tools > a,
    .section-line-tools > button,
    .section-line-tools > .filter-menu-wrap,
    .section-line-tools > .button-filter {
        flex: 1 1 220px;
    }

    .section-line-tools > .filter-menu-wrap,
    .section-line-tools > .filter-menu-wrap > .button-filter,
    .section-line-tools > .filter-menu-wrap > .button-secondary,
    .workspace-toolbar .search-field,
    .workspace-toolbar .section-line-tools,
    .search-field,
    .search-field-wide {
        width: 100%;
        min-width: 0;
    }

    .filter-menu {
        left: 0;
        right: auto;
        width: min(100%, calc(100vw - 32px));
    }

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

    .collection-strip {
        padding-bottom: 12px;
    }

    .collection-card-shell,
    .collection-strip > .collection-card-shell {
        flex: 0 0 clamp(240px, 82vw, 320px);
        min-width: clamp(240px, 82vw, 320px);
    }

    .collection-strip > .collection-card-shell > .collection-pill {
        min-height: 138px;
        padding: 1rem;
    }

    .collection-menu-wrap {
        top: 14px;
        right: 14px;
    }

    .workspace-title,
    .page-header h1 {
        font-size: clamp(2rem, 8vw, 2.85rem);
        line-height: 1;
    }

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

    .card-actions-icons {
        position: static;
        display: flex;
        flex-wrap: wrap;
        opacity: 1;
        pointer-events: auto;
    }

    .item-gallery-card:hover .card-actions-icons,
    .item-gallery-card:focus-within .card-actions-icons {
        opacity: 1;
        pointer-events: auto;
    }

    .item-action-icon {
        width: 40px;
        height: 40px;
    }

    .modal-overlay,
    .confirm-overlay {
        padding: 12px;
    }

    .modal-panel,
    .confirm-panel {
        width: min(100%, calc(100vw - 24px));
        padding: 0.9rem;
        border-radius: 22px;
    }

    .modal-panel[data-size="wide"] {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        height: auto;
        max-height: calc(100vh - 24px);
    }

    .modal-content {
        padding: 0.25rem 0.15rem 0.4rem;
    }

    .confirm-actions {
        grid-template-columns: 1fr;
    }

    .image-viewer-overlay {
        padding: 10px;
    }

    .image-viewer-stage {
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: calc(100vh - 20px);
        padding: 52px 12px 80px;
    }

    .image-viewer-frame {
        width: 100%;
        max-height: calc(100vh - 160px);
    }

    .image-viewer-stage img {
        width: 100%;
        height: auto;
        max-height: calc(100vh - 180px) !important;
    }

    .image-viewer-nav {
        top: auto;
        bottom: 12px;
        transform: none;
        width: 48px;
        height: 48px;
    }

    .image-viewer-nav-prev {
        left: 12px;
    }

    .image-viewer-nav-next {
        right: 12px;
    }

    .image-viewer-meta {
        left: 12px;
        right: 12px;
        bottom: 72px;
        display: grid;
        gap: 0.35rem;
    }

    .image-viewer-close {
        top: 12px;
        right: 12px;
        width: 44px;
        height: 44px;
    }

    .auth-shell-minimal {
        padding: 1.5rem 1rem;
    }

    .auth-panel-minimal {
        width: 100%;
        max-width: 420px;
        gap: 1.25rem;
    }

    .auth-wordmark {
        position: static;
        top: auto;
        left: auto;
        transform: none;
        align-self: center;
    }

    .bug-report-button {
        right: 16px;
        bottom: 16px;
        width: 48px;
        height: 48px;
    }

    .icon-button[data-tooltip]::after,
    .icon-button[data-tooltip]::before,
    .item-action-icon[data-tooltip]::after,
    .item-action-icon[data-tooltip]::before,
    .bug-report-button[data-tooltip]::after,
    .bug-report-button[data-tooltip]::before {
        display: none;
    }
}

@media (max-width: 640px) {
    .app-shell {
        padding: 16px 12px 28px;
    }

    .mode-label {
        display: none;
    }

    .button-primary,
    .button-secondary,
    .button-filter,
    .button-danger {
        width: 100%;
        padding: 0.95rem 1rem;
    }

    .button-inline {
        white-space: normal;
    }

    .workspace-card,
    .workspace-card-flat,
    .kpi-card,
    .collection-pill,
    .item-gallery-card,
    .board-empty,
    .empty-state,
    .modal-panel,
    .confirm-panel {
        border-radius: 20px;
    }

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

    .workspace-actions .button-inline,
    .section-line-tools,
    .section-line-tools > *,
    .filter-menu-wrap {
        width: 100%;
        flex: 1 1 100%;
    }

    .collection-card-shell,
    .collection-strip > .collection-card-shell {
        flex-basis: calc(100vw - 40px);
        min-width: calc(100vw - 40px);
    }

    .collection-action-menu {
        min-width: 0;
        width: min(260px, calc(100vw - 48px));
    }

    .workspace-title,
    .page-header h1,
    .auth-copy h1 {
        font-size: clamp(1.9rem, 10vw, 2.45rem);
    }

    .page-header p,
    .workspace-subcopy,
    .auth-copy p {
        font-size: 0.95rem;
    }

    .item-gallery-topline {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .item-gallery-header h2 {
        font-size: 1.3rem;
        line-height: 1.02;
    }

    .item-gallery-body {
        gap: 0.85rem;
        padding: 0.9rem;
    }

    .item-tag {
        font-size: 0.7rem;
    }

    .item-modal-fields-grid,
    .item-modal-media-column {
        gap: 0.75rem;
    }

    .tag-editor {
        padding: 0.8rem;
    }

    .modal-form-head h2 {
        font-size: clamp(1.55rem, 8vw, 2rem);
    }

    .confirm-panel h2 {
        font-size: clamp(1.45rem, 8vw, 1.9rem);
    }

    .image-viewer-meta {
        padding: 0.7rem 0.8rem;
    }

    .image-viewer-label {
        font-size: 0.85rem;
    }
}

/* Mobile object action icon color fix */
@media (max-width: 980px) {
    .item-action-icon {
        color: #ffffff;
    }

    .item-action-icon::before {
        filter: brightness(0) invert(1);
    }
}

/* Mobile object action icon asset override */
@media (max-width: 980px) {
    .item-action-icon::before {
        filter: none;
        background-position: center;
        background-repeat: no-repeat;
        background-size: 20px 20px;
    }

    .item-action-edit::before {
        background-image: url('../media/editWhite.svg') !important;
    }

    .item-action-move::before {
        background-image: url('../media/moveWhite.svg') !important;
    }

    .item-action-delete::before {
        background-image: url('../media/binWhite.svg') !important;
    }
}

/* Mobile object action icon direct background override */
@media (max-width: 980px) {
    .item-action-icon {
        background-position: center;
        background-repeat: no-repeat;
        background-size: 20px 20px;
    }

    .item-action-icon::before {
        content: none;
    }

    .item-action-edit {
        background-image: url('../media/editWhite.svg') !important;
    }

    .item-action-move {
        background-image: url('../media/moveWhite.svg') !important;
    }

    .item-action-delete {
        background-image: url('../media/binWhite.svg') !important;
    }
}

/* Mobile image viewer carousel meta layout */
@media (max-width: 980px) {
    .image-viewer-stage {
        padding-bottom: 92px;
    }

    .image-viewer-nav {
        bottom: 18px;
    }

    .image-viewer-nav-prev {
        left: 18px;
    }

    .image-viewer-nav-next {
        right: 18px;
    }

    .image-viewer-meta {
        left: 50%;
        right: auto;
        bottom: 18px;
        transform: translateX(-50%);
        display: grid;
        gap: 0.2rem;
        min-width: 112px;
        max-width: calc(100vw - 156px);
        padding: 0.8rem 0.95rem;
        text-align: left;
        white-space: nowrap;
    }
}

/* Mobile image viewer meta fixed between nav buttons */
@media (max-width: 980px) {
    .image-viewer-frame {
        position: static;
    }

    .image-viewer-meta {
        position: fixed;
        left: 50%;
        right: auto;
        bottom: 18px;
        transform: translateX(-50%);
        z-index: 4;
        display: grid;
        gap: 0.2rem;
        min-width: 112px;
        max-width: calc(100vw - 156px);
        padding: 0.8rem 0.95rem;
        text-align: left;
        white-space: nowrap;
    }
}

/* Mobile image viewer shared controls row */
.image-viewer-controls {
    display: contents;
}

@media (max-width: 980px) {
    .image-viewer-stage {
        display: grid;
        grid-template-rows: minmax(0, 1fr) auto;
        align-items: center;
        gap: 18px;
        width: 100%;
        max-width: 100%;
        padding: 52px 12px 18px;
    }

    .image-viewer-frame {
        width: 100%;
        max-height: calc(100vh - 190px);
    }

    .image-viewer-stage img {
        width: 100%;
        height: auto;
        max-height: calc(100vh - 210px) !important;
    }

    .image-viewer-controls {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 18px;
        width: 100%;
        max-width: calc(100vw - 24px);
    }

    .image-viewer-nav {
        position: static;
        top: auto;
        bottom: auto;
        left: auto;
        right: auto;
        transform: none;
        width: 48px;
        height: 48px;
        flex: 0 0 48px;
    }

    .image-viewer-meta {
        position: static;
        left: auto;
        right: auto;
        bottom: auto;
        transform: none;
        z-index: auto;
        display: grid;
        gap: 0.2rem;
        min-width: 112px;
        max-width: calc(100vw - 156px);
        padding: 0.8rem 0.95rem;
        text-align: left;
        white-space: nowrap;
    }
}

.legal-consent-block {
    display: grid;
    gap: 0.65rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(13, 64, 255, 0.04);
}

.checkbox-row-legal {
    align-items: flex-start;
}

.checkbox-row-legal input {
    margin-top: 0.2rem;
}

.checkbox-row-legal span {
    line-height: 1.6;
}

.checkbox-row-legal a {
    color: var(--blue);
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

body.theme-dark .legal-consent-block {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
}
