:root {
    color-scheme: light;
    font-family: "DM Sans", "Inter", "Segoe UI", Arial, Helvetica, sans-serif;
    --ink: #1c1510;
    --muted: #746b63;
    --paper: #fffaf3;
    --line: #ded2c3;
    --surface: #f1ece6;
    --night: #2a2520;
    --night-soft: #312b26;
    --accent: #8c6a3f;
    --accent-strong: #7b5d37;
    --accent-soft: #eadfce;
    --blue-mark: #172d44;
    --danger: #b42318;
    --success: #16794c;
    background: var(--surface);
    color: var(--ink);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--surface);
}

a {
    color: var(--accent-strong);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.login-page {
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(135deg, rgba(140, 106, 63, 0.08), transparent 42%),
        var(--surface);
}

.login-box {
    width: min(420px, 100%);
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    box-shadow: 0 22px 58px rgba(28, 21, 16, 0.13);
}

.login-logo {
    display: block;
    width: 96px;
    height: 96px;
    object-fit: contain;
    margin: 0 auto 18px;
}

.login-box h1 {
    margin: 0 0 6px;
    color: var(--ink);
    font-size: 24px;
    line-height: 1.15;
    text-align: center;
}

.login-kicker {
    margin: 0 0 24px;
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

.app-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
    padding: 24px 18px;
    color: #f2ede6;
    background:
        linear-gradient(180deg, rgba(140, 106, 63, 0.18), transparent 190px),
        var(--night);
    box-shadow: 10px 0 34px rgba(28, 21, 16, 0.22);
}

.brand {
    display: grid;
    gap: 8px;
    padding: 0 8px 24px;
    border-bottom: 1px solid rgba(242, 237, 230, 0.14);
    text-align: center;
}

.brand-logo {
    width: 96px;
    height: 96px;
    object-fit: contain;
    margin: 0 auto 8px;
    padding: 10px;
    border: 1px solid rgba(140, 106, 63, 0.34);
    border-radius: 8px;
    background: #f1ece6;
}

.brand strong {
    color: #f2ede6;
    font-size: 15px;
}

.brand span {
    color: rgba(242, 237, 230, 0.68);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.side-nav {
    display: grid;
    align-content: start;
    gap: 10px;
    padding-top: 20px;
}

.side-nav a {
    display: block;
    padding: 12px;
    border-radius: 6px;
    color: rgba(242, 237, 230, 0.84);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.nav-group {
    display: grid;
    gap: 3px;
}

.nav-heading {
    padding: 10px 12px 4px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.nav-group a {
    margin-left: 10px;
    padding: 8px 12px;
    border-left: 2px solid rgba(242, 237, 230, 0.12);
    border-radius: 0 6px 6px 0;
    color: rgba(242, 237, 230, 0.72);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

.side-nav a:hover,
.side-nav a.active {
    color: #f2ede6;
    background: rgba(140, 106, 63, 0.18);
    text-decoration: none;
}

.nav-group a.active {
    border-left-color: var(--accent);
}

.sidebar-user {
    display: grid;
    gap: 8px;
    padding: 16px 8px 0;
    border-top: 1px solid rgba(242, 237, 230, 0.14);
    font-size: 14px;
}

.sidebar-user span {
    font-weight: 800;
}

.sidebar-user a {
    color: rgba(242, 237, 230, 0.76);
}

.content {
    min-width: 0;
    padding: 30px 36px 56px;
}

.content-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.content-head h1 {
    margin: 0 0 6px;
    color: var(--ink);
    font-size: 28px;
    line-height: 1.15;
}

.content-head p {
    margin: 0;
    color: var(--muted);
}

.panel,
.stat,
.login-box {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
}

.panel {
    padding: 22px;
    box-shadow: 0 14px 34px rgba(28, 21, 16, 0.07);
}

.compact-panel {
    padding: 14px 16px;
}

.panel + .panel,
.grid + .panel {
    margin-top: 18px;
}

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

.stat {
    padding: 18px;
}

.stat span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.stat strong {
    display: block;
    margin-top: 8px;
    color: var(--ink);
    font-size: 30px;
}

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

form {
    display: grid;
    gap: 14px;
}

.filter-bar {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 12px;
}

.filter-bar label {
    min-width: min(360px, 100%);
}

.inline-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d8cab9;
    border-radius: 6px;
    background: #fffdf8;
    color: var(--ink);
    font: inherit;
}

input,
select {
    min-height: 42px;
}

textarea {
    min-height: 96px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(140, 106, 63, 0.22);
    border-color: var(--accent);
}

.check-row {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--ink);
}

.check-row input {
    width: 18px;
    min-height: 18px;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 0;
    border-radius: 6px;
    background: var(--night);
    color: #f2ede6;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.button.secondary,
button.secondary {
    background: var(--accent-soft);
    color: #4f3b22;
}

button:hover,
.button:hover {
    text-decoration: none;
    filter: brightness(1.05);
}

.alert {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 6px;
    font-weight: 700;
}

.alert.error {
    background: #ffe9e7;
    color: var(--danger);
}

.alert.success {
    background: #e8f7ef;
    color: var(--success);
}

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #efe5d5;
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 800;
}

.badge.off {
    background: #f3e1df;
    color: var(--danger);
}

.muted {
    color: var(--muted);
}

.logo-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px dashed #d8cab9;
    border-radius: 8px;
    background: #fffdf8;
}

.logo-preview img,
.table-logo {
    display: block;
    width: 58px;
    height: 58px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    object-fit: contain;
}

.garment-image-col {
    width: 150px;
}

.garment-name-col {
    width: 260px;
}

.garment-actions-col {
    width: 160px;
}

.garment-thumb {
    width: 128px;
    height: 128px;
    background: #fffdf8;
}

.garment-summary {
    max-width: 260px;
}

.garment-summary p {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.45;
}

.table-actions {
    display: grid;
    gap: 8px;
    align-items: start;
}

.table-button {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 13px;
    line-height: 1.1;
    white-space: nowrap;
}

.pagination {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.pagination span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.button.disabled {
    opacity: 0.45;
    pointer-events: none;
}

.logo-preview span {
    color: var(--muted);
    font-size: 13px;
}

.subsection-head {
    display: grid;
    gap: 4px;
    padding-top: 8px;
}

.subsection-head h3 {
    margin: 0;
    color: var(--ink);
    font-size: 18px;
}

.subsection-head p {
    margin: 0;
    color: var(--muted);
}

.contact-list {
    display: grid;
    gap: 12px;
}

.contact-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1.1fr 0.9fr;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf8;
}

.artisan-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 210px;
}

.domain-input {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-width: 260px;
}

.domain-input span {
    color: var(--muted);
    font-weight: 800;
}

code {
    padding: 3px 6px;
    border-radius: 5px;
    background: #efe5d5;
    color: var(--accent-strong);
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.image-card {
    display: grid;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf8;
}

.image-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    object-fit: cover;
}

.image-card strong,
.image-card span {
    display: block;
}

.image-card span,
.image-card p {
    color: var(--muted);
    font-size: 13px;
}

.image-card p {
    margin: 8px 0 0;
}

.image-archive-table {
    min-width: 980px;
}

.image-row-title {
    width: 230px;
}

.image-row-title strong,
.image-row-title span {
    display: block;
}

.image-row-title span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.image-strip {
    display: flex;
    gap: 12px;
    max-width: calc(100vw - 620px);
    overflow-x: auto;
    padding: 2px 0 8px;
}

.strip-image-card {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 8px;
    flex: 0 0 150px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf8;
}

.strip-image-card img {
    width: 132px;
    height: 100px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    object-fit: cover;
}

.strip-image-card strong {
    display: block;
    min-height: 34px;
    font-size: 12px;
    line-height: 1.35;
}

.strip-image-card .badge {
    margin: 4px 0 8px;
}

.strip-image-card .table-button {
    width: 100%;
}

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

    .sidebar {
        position: relative;
        min-height: auto;
    }

    .content {
        padding: 24px 18px 42px;
    }

    .grid,
    .form-grid,
    .contact-row,
    .domain-input {
        grid-template-columns: 1fr;
    }

    .image-strip {
        max-width: 100%;
    }
}
