:root {
    --bg: #f6f2ea;
    --panel: #fffdf8;
    --ink: #181716;
    --muted: #6d675f;
    --line: #ddd5c8;
    --primary: #16615b;
    --primary-dark: #104844;
    --accent: #c24f2f;
    --warn: #9b6415;
    --danger: #a51f2f;
    --shadow: 0 14px 34px rgba(31, 28, 22, .12);
    --app-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--app-font);
    font-size: 16px;
    line-height: 1.45;
}

a {
    color: inherit;
}

button,
input,
textarea,
select {
    font: inherit;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px clamp(14px, 3vw, 34px);
    background: rgba(255, 253, 248, .94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    text-decoration: none;
    font-weight: 800;
}

.brand > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--ink);
    color: #fff;
    font-size: 14px;
    overflow: hidden;
}

.brand-mark img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 44px;
    max-width: min(180px, 34vw);
    height: 48px;
    padding: 4px;
    border-radius: 8px;
    background: transparent;
    overflow: hidden;
}

.brand-logo img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: contain;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.nav-link,
.button,
.primary,
.danger,
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    text-decoration: none;
    font-weight: 750;
    cursor: pointer;
    white-space: nowrap;
}

.nav-link.active,
.primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.primary:hover {
    background: var(--primary-dark);
}

.danger {
    border-color: rgba(165, 31, 47, .28);
    color: var(--danger);
}

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

.mini {
    min-height: 38px;
    padding: 8px 12px;
}

.big {
    min-height: 58px;
    padding: 14px 22px;
    font-size: 18px;
}

.icon-button {
    width: 44px;
    padding: 0;
    font-size: 22px;
}

.shell {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 24px clamp(14px, 3vw, 34px) 52px;
}

.auth-shell {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-panel,
.panel,
.item-card,
.look-card,
.row-item,
.task-row,
.shoot-mode {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.auth-panel {
    width: min(460px, 100%);
    padding: 28px;
}

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

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

h1 {
    margin-bottom: 6px;
    font-size: clamp(30px, 4vw, 48px);
    line-height: 1.05;
}

h2 {
    margin-bottom: 14px;
    font-size: 22px;
}

h3 {
    margin-bottom: 4px;
    font-size: 18px;
}

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

.flash {
    margin: 0 0 16px;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    font-weight: 700;
}

.flash.ok {
    border-color: rgba(22, 97, 91, .28);
    color: var(--primary);
}

.flash.error {
    border-color: rgba(165, 31, 47, .28);
    color: var(--danger);
}

.flash.warning {
    border-color: rgba(155, 100, 21, .32);
    color: var(--warn);
}

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

.dash-tile {
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--panel);
    text-decoration: none;
    box-shadow: var(--shadow);
}

.dash-tile span {
    color: var(--muted);
    font-weight: 800;
}

.dash-tile strong {
    font-size: 42px;
    line-height: 1;
}

.dash-tile.accent {
    background: #1d1b18;
    color: #fff;
    border-color: #1d1b18;
}

.dash-tile.accent span {
    color: rgba(255, 255, 255, .72);
}

.dash-tile.wide {
    grid-column: span 2;
    background: #e9f3ef;
}

.split {
    display: grid;
    grid-template-columns: minmax(280px, 360px) 1fr;
    gap: 18px;
    align-items: start;
}

.split.compact {
    grid-template-columns: minmax(280px, 420px) 1fr;
}

.panel {
    padding: 20px;
}

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

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

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    padding: 12px 13px;
}

input:focus,
textarea:focus,
select:focus {
    outline: 3px solid rgba(22, 97, 91, .18);
    border-color: var(--primary);
}

.library-grid,
.look-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
}

.item-card {
    overflow: hidden;
}

.item-body {
    padding: 14px;
}

.thumb {
    aspect-ratio: 1 / 1;
    width: 100%;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: #ede6da;
    border-radius: 8px;
}

.item-card > .thumb {
    border-radius: 8px 8px 0 0;
}

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

.thumb.small {
    width: 130px;
}

.thumb.tiny {
    width: 64px;
    min-width: 64px;
    border-radius: 7px;
}

.placeholder span {
    font-size: 42px;
    font-weight: 900;
}

.actions,
.task-actions,
.mode-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.inline {
    display: inline-flex;
}

.list-panel {
    display: grid;
    gap: 10px;
}

.row-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
}

.row-item p {
    margin-bottom: 0;
}

.empty {
    padding: 18px;
    color: var(--muted);
    background: rgba(255, 255, 255, .62);
    border: 1px dashed var(--line);
    border-radius: 8px;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    overflow-x: auto;
}

.tabs a {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    text-decoration: none;
    font-weight: 800;
}

.tabs a.active {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

.look-card {
    overflow: hidden;
}

.look-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
    padding: 10px;
    background: #efe8dc;
}

.look-content {
    padding: 16px;
}

.note {
    padding: 12px;
    border-left: 4px solid var(--primary);
    background: #eef5f2;
    color: var(--ink);
}

.look-form {
    display: block;
}

.field-group {
    display: grid;
    gap: 10px;
}

.choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 10px;
}

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

.choice {
    position: relative;
    display: grid;
    gap: 9px;
    min-height: 58px;
    align-content: center;
    padding: 12px;
    border: 2px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
}

.choice input {
    position: absolute;
    inset: 10px auto auto 10px;
    width: 22px;
    height: 22px;
}

.choice span:not(.thumb) {
    padding-left: 30px;
    font-weight: 850;
}

.choice:has(input:checked) {
    border-color: var(--primary);
    background: #eef7f4;
}

.image-choice-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.image-choice .thumb {
    border: 1px solid var(--line);
}

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

.task-list {
    display: grid;
    gap: 10px;
}

.task-row {
    display: grid;
    grid-template-columns: 76px minmax(70px, auto) minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    min-height: 88px;
}

.task-row.done {
    opacity: .64;
}

.task-row.dragging {
    opacity: .42;
    outline: 3px solid rgba(22, 97, 91, .18);
}

.task-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.drag-handle {
    display: grid;
    place-items: center;
    width: 24px;
    height: 42px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 18px;
    font-weight: 900;
    cursor: grab;
    user-select: none;
}

.drag-handle:active {
    cursor: grabbing;
}

.task-number {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: var(--ink);
    color: #fff;
    font-weight: 900;
}

.mini-images {
    display: flex;
    gap: 6px;
    max-width: 148px;
    overflow: hidden;
}

.task-main {
    min-width: 0;
}

.task-actions {
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.task-main h3,
.task-main p {
    margin-bottom: 0;
}

.shoot-mode {
    padding: clamp(16px, 3vw, 28px);
}

.mode-top,
.mode-info {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.mode-top {
    margin-bottom: 16px;
    color: var(--muted);
    font-weight: 850;
}

.mode-bg {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    padding: 8px 14px;
    margin-bottom: 18px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-weight: 900;
}

.mode-fighter {
    margin: -4px 0 14px;
    color: var(--ink);
    font-size: 22px;
    font-weight: 900;
}

.mode-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.mode-images figure {
    margin: 0;
}

figcaption {
    margin-top: 8px;
    font-weight: 850;
    text-align: center;
}

.mode-info {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 22px;
}

.mode-info section {
    padding: 14px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--line);
}

.mode-info p {
    margin-bottom: 0;
    color: var(--ink);
    font-weight: 750;
}

.mode-actions {
    justify-content: space-between;
}

.fighter-link-row {
    align-items: flex-start;
}

.fighter-link-main {
    display: grid;
    gap: 8px;
    min-width: min(520px, 100%);
}

.fighter-link-main input {
    font-size: 14px;
}

.public-shell {
    width: min(920px, 100%);
}

.fighter-public {
    display: grid;
    gap: 18px;
    padding: clamp(18px, 4vw, 32px);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.fighter-kicker {
    margin-bottom: -8px;
    color: var(--primary);
    font-weight: 900;
    text-transform: uppercase;
}

.fighter-instruction {
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #eef7f4;
}

.fighter-instruction h2,
.fighter-instruction p {
    margin-bottom: 0;
}

.fighter-instruction p {
    color: var(--ink);
    font-size: 20px;
    font-weight: 750;
}

.muted-box {
    background: #fff;
}

.upcoming-list {
    display: grid;
    gap: 8px;
}

.upcoming-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.ui-layout {
    display: grid;
    grid-template-columns: minmax(300px, 520px) 1fr;
    gap: 18px;
    align-items: start;
}

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

.color-field {
    display: grid;
    grid-template-columns: 1fr 48px;
    grid-template-areas:
        "label color"
        "code color";
    gap: 2px 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.color-field span {
    grid-area: label;
    color: var(--ink);
}

.color-field input {
    grid-area: color;
    width: 48px;
    height: 48px;
    padding: 3px;
    cursor: pointer;
}

.color-field code {
    grid-area: code;
    color: var(--muted);
    font-size: 13px;
}

.logo-current {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.preview-logo {
    flex: 0 0 auto;
    max-width: 220px;
}

.checkline {
    display: flex;
    grid-template-columns: none;
    align-items: center;
    gap: 8px;
    color: var(--ink);
}

.checkline input {
    width: 20px;
    height: 20px;
}

.reset-form {
    margin-top: 12px;
}

.ui-preview {
    position: sticky;
    top: 86px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.preview-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .5);
}

.preview-body {
    padding: 18px;
}

.preview-square {
    aspect-ratio: 1 / 1;
    width: min(260px, 100%);
    margin: 14px 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(135deg, transparent 48%, var(--accent) 49%, var(--accent) 51%, transparent 52%),
        var(--bg);
}

@media (max-width: 900px) {
    .topbar,
    .page-head,
    .row-item,
    .planning-head {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-grid,
    .split,
    .split.compact,
    .mode-info,
    .ui-layout {
        grid-template-columns: 1fr;
    }

    .ui-preview {
        position: static;
    }

    .dash-tile.wide {
        grid-column: auto;
    }

    .task-row {
        grid-template-columns: 76px minmax(64px, auto) minmax(0, 1fr);
    }

    .task-actions {
        grid-column: 1 / -1;
        max-width: none;
    }

    .task-actions {
        justify-content: flex-end;
    }

    .task-actions > * {
        flex: 0 0 auto;
    }
}

@media (max-width: 560px) {
    .shell {
        padding-inline: 10px;
    }

    h1 {
        font-size: 34px;
    }

    .choice-grid.two,
    .choice-grid,
    .color-grid {
        grid-template-columns: 1fr;
    }

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

    .mode-actions .inline,
    .mode-actions button,
    .mode-actions a {
        width: 100%;
    }
}
