/* ------------------------------------------------------------- theme tokens */

:root {
    --bg: #f4f2ee;
    --bg-2: #ffffff;
    --bg-3: #eceae4;
    --text: #22212b;
    --muted: #6d6a7c;
    --border: #dedbd2;
    --accent: #5b4dff;
    --accent-hover: #4a3ce6;
    --accent-soft: #eceaff;
    --danger: #dc2626;
    --ok-bg: #e7f6ec;
    --ok-text: #166534;
    --err-bg: #fdecec;
    --err-text: #991b1b;
    --shadow: 0 1px 3px rgba(20, 18, 40, .08), 0 6px 24px rgba(20, 18, 40, .06);
    --radius: 14px;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #15141b;
        --bg-2: #1e1d27;
        --bg-3: #26242f;
        --text: #eceaf4;
        --muted: #9a97a8;
        --border: #34323f;
        --accent: #8578ff;
        --accent-hover: #9b90ff;
        --accent-soft: #2a2740;
        --danger: #f87171;
        --ok-bg: #16301f;
        --ok-text: #86efac;
        --err-bg: #391c1c;
        --err-text: #fca5a5;
        --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 6px 24px rgba(0, 0, 0, .3);
    }
}

:root[data-theme="dark"] {
    --bg: #15141b;
    --bg-2: #1e1d27;
    --bg-3: #26242f;
    --text: #eceaf4;
    --muted: #9a97a8;
    --border: #34323f;
    --accent: #8578ff;
    --accent-hover: #9b90ff;
    --accent-soft: #2a2740;
    --danger: #f87171;
    --ok-bg: #16301f;
    --ok-text: #86efac;
    --err-bg: #391c1c;
    --err-text: #fca5a5;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 6px 24px rgba(0, 0, 0, .3);
}

/* ------------------------------------------------------------------- basics */

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1 { font-size: 1.7rem; margin: 0 0 .6rem; line-height: 1.25; }
h2 { font-size: 1.2rem; margin: 0 0 .8rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 .5rem; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ------------------------------------------------------------------- topbar */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .8rem 1.2rem;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    font-size: 1.05rem;
}

.brand-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.brand-dash { color: var(--muted); font-weight: 500; }

.topnav { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.topnav a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: .95rem; }
.topnav a:hover { color: var(--text); }

.theme-toggle {
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: .3rem .6rem;
    cursor: pointer;
    font-size: .95rem;
    line-height: 1;
}

.tt-dark { display: none; }
[data-theme="dark"] .tt-dark { display: inline; }
[data-theme="dark"] .tt-light { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .tt-dark { display: inline; }
    :root:not([data-theme="light"]) .tt-light { display: none; }
}

/* ------------------------------------------------------------------- layout */

.wrap {
    width: 100%;
    max-width: 1060px;
    margin: 0 auto;
    padding: 1.6rem 1.2rem 3rem;
    flex: 1;
}

.narrow { max-width: 640px; margin: 0 auto; }

.footer {
    text-align: center;
    color: var(--muted);
    font-size: .85rem;
    padding: 1.2rem;
    border-top: 1px solid var(--border);
}

.card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.4rem 1.5rem;
    margin-bottom: 1.2rem;
}

/* --------------------------------------------------------------------- hero */

.hero { text-align: center; padding: 3rem 0 1rem; }
.hero h1 { font-size: 2.2rem; }
.hero-sub { color: var(--muted); font-size: 1.1rem; margin: 0 0 2rem; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-bottom: 2.2rem; }
.hero .notice { max-width: 560px; margin: 0 auto; text-align: left; }

.notice {
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
    font-size: .95rem;
}

.inline-notice { margin-bottom: 1.2rem; }

/* ------------------------------------------------------------------ buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    background: var(--bg-3);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .55rem 1.1rem;
    font-size: .95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}

.btn:hover { border-color: var(--accent); }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-ghost { background: transparent; }

.btn-big { padding: .8rem 1.6rem; font-size: 1.05rem; }
.btn-small { padding: .3rem .7rem; font-size: .85rem; }

.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

/* -------------------------------------------------------------------- forms */

label { display: block; font-weight: 600; font-size: .92rem; margin: 1rem 0 .35rem; }

input[type="text"], input[type="password"], input[type="email"], input[type="url"],
input[type="number"], input[type="date"], textarea, select {
    width: 100%;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .6rem .75rem;
    font-size: 1rem;
    font-family: inherit;
}

input:focus, textarea:focus, select:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    border-color: var(--accent);
}

textarea { resize: vertical; }

input[type="color"] {
    width: 46px; height: 34px; padding: 2px;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg); cursor: pointer;
}

fieldset { border: none; margin: 1rem 0 0; padding: 0; }
legend { font-weight: 600; font-size: .92rem; margin-bottom: .35rem; padding: 0; }

.radio-row { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.radio, .check {
    display: flex; align-items: center; gap: .45rem;
    font-weight: 500; margin: .35rem 0; cursor: pointer;
}
.radio input, .check input { width: auto; margin: 0; }

.hint { color: var(--muted); font-size: .85rem; margin: .25rem 0 .5rem; }

.form-actions { display: flex; gap: .8rem; align-items: center; margin-top: 1.4rem; flex-wrap: wrap; }
.form-actions.center { justify-content: center; }

.field-row { display: flex; gap: 1rem; }
.field-row > div { flex: 1; }
.field-row .small-field { flex: 0 0 110px; }
.align-end { display: flex; align-items: flex-end; }
.test-row { margin-top: .5rem; }
.divider { border: none; border-top: 1px solid var(--border); margin: 1.4rem 0; }

.plain-list { margin: 0; padding-left: 1.2rem; }

/* ------------------------------------------------------------------- alerts */

.alert {
    border-radius: 10px;
    padding: .8rem 1rem;
    margin: 1rem 0;
    font-size: .95rem;
}

.alert-ok { background: var(--ok-bg); color: var(--ok-text); }
.alert-error { background: var(--err-bg); color: var(--err-text); }

/* ----------------------------------------------------------- success + code */

.success-card { text-align: center; }
.success-icon { font-size: 2.6rem; margin-bottom: .4rem; }

.code-display {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: .35em;
    padding: .6rem 0 .6rem .35em;
    margin: .6rem auto 1rem;
    background: var(--accent-soft);
    border-radius: var(--radius);
    max-width: 380px;
}

.code-input {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 1.6rem;
    letter-spacing: .3em;
    text-align: center;
}

/* ------------------------------------------------------------------- badges */

.badge {
    display: inline-block;
    background: var(--badge, #94a3b8);
    color: #fff;
    font-size: .78rem;
    font-weight: 700;
    padding: .2rem .6rem;
    border-radius: 999px;
    white-space: nowrap;
    text-shadow: 0 1px 1px rgba(0,0,0,.25);
}

.badge-big { font-size: .95rem; padding: .35rem .9rem; }

/* --------------------------------------------------------------- status page */

.status-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }

.queue-box {
    display: flex; align-items: center; gap: 1rem;
    background: var(--accent-soft);
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
    margin: 1.1rem 0;
}

.queue-num {
    font-size: 1.9rem; font-weight: 800; color: var(--accent);
    min-width: 2.4rem; text-align: center;
}

.meta-grid { display: flex; gap: 2.5rem; flex-wrap: wrap; margin-top: 1rem; }
.meta-label { display: block; color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* ----------------------------------------------------------------- timeline */

.timeline { list-style: none; margin: 0; padding: 0; }

.timeline li {
    position: relative;
    padding: 0 0 1.4rem 1.9rem;
    border-left: 2px solid var(--border);
    margin-left: .55rem;
}

.timeline li:last-child { border-left-color: transparent; padding-bottom: .2rem; }

.tl-dot {
    position: absolute;
    left: -8px; top: 2px;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--badge, #94a3b8);
    border: 3px solid var(--bg-2);
}

.tl-head { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.tl-date { color: var(--muted); font-size: .85rem; }
.tl-body p { margin: .5rem 0 0; }

.tl-img {
    display: block;
    max-width: 320px;
    max-height: 240px;
    width: auto;
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-top: .6rem;
}

.file-link { display: inline-block; margin-top: .4rem; }

/* ----------------------------------------------------------------- uploader */

.uploader .drop {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    flex-wrap: wrap;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 1.4rem 1rem;
    text-align: center;
    color: var(--muted);
    transition: border-color .15s ease, background .15s ease;
}

.uploader .drop.drag { border-color: var(--accent); background: var(--accent-soft); }

.uplist { list-style: none; margin: .6rem 0 0; padding: 0; }

.uplist li {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: .7rem;
    padding: .45rem .2rem;
    border-bottom: 1px solid var(--border);
    font-size: .9rem;
}

.up-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-status { color: var(--muted); font-size: .82rem; white-space: nowrap; }

.up-bar {
    width: 90px; height: 6px;
    background: var(--bg-3);
    border-radius: 999px;
    overflow: hidden;
}

.up-fill { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s ease; }

.up-done .up-fill { background: #22c55e; width: 100% !important; }
.up-error .up-status { color: var(--danger); }

.up-remove {
    background: none; border: none; color: var(--muted);
    cursor: pointer; font-size: .95rem; padding: .2rem .4rem;
}
.up-remove:hover { color: var(--danger); }

/* --------------------------------------------------------------------- dash */

.page-head {
    display: flex; justify-content: space-between; align-items: center;
    gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem;
}
.page-head h1 { margin: 0; }

.filters { display: flex; gap: .5rem; }

.chip {
    padding: .3rem .9rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--muted);
    text-decoration: none;
    font-size: .88rem;
    font-weight: 600;
}
.chip-on { background: var(--accent); border-color: var(--accent); color: #fff; }

.table-card { padding: .4rem .6rem; overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th { text-align: left; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; padding: .6rem .6rem; border-bottom: 1px solid var(--border); }
td { padding: .55rem .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }

.priority-form { display: flex; gap: .35rem; align-items: center; margin: 0; }
.priority-form input[type="number"] { width: 74px; }
.priority-input { padding: .35rem .5rem; }

.detail-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 800px) { .detail-grid { grid-template-columns: 1fr; } }

.dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; margin: 0; }
.dl dt { color: var(--muted); font-size: .88rem; font-weight: 600; }
.dl dd { margin: 0; }

.request-text {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .9rem 1rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.file-grid { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; }

.thumb img {
    width: 110px; height: 110px; object-fit: cover;
    border-radius: 10px; border: 1px solid var(--border);
    display: block;
}

.danger-zone { margin-top: 1.6rem; padding-top: 1rem; border-top: 1px dashed var(--border); }

/* ----------------------------------------------------------- featured image */

.thumb-wrap { display: flex; flex-direction: column; align-items: center; gap: .35rem; }
.thumb-wrap.is-featured .thumb img { outline: 3px solid var(--accent); outline-offset: -3px; }
.thumb-action { margin: 0; }

.featured-tag { color: var(--accent); font-size: .8rem; font-weight: 700; }

.featured-preview {
    display: block;
    width: 100%;
    max-height: 260px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-bottom: .8rem;
}

.thumb-cell { width: 54px; }

.row-thumb {
    width: 44px; height: 44px; object-fit: cover;
    border-radius: 8px; border: 1px solid var(--border);
    display: block;
}

.status-table input[type="text"] { min-width: 140px; }
.order-input { width: 70px; }
.center-cell { text-align: center; }
.new-row td { background: var(--bg); }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.2rem; align-items: start; }

/* ------------------------------------------------------- request card view */

.filter-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 .3rem; }

.req-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.1rem;
}

.req-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: transform .12s ease, border-color .12s ease;
}

.req-card:hover { transform: translateY(-2px); border-color: var(--accent); }

.req-card-img {
    position: relative;
    aspect-ratio: 4 / 3;
    background: var(--bg-3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.req-card-img img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}

.req-card-placeholder { font-size: 2.6rem; opacity: .45; }

.req-card-priority {
    position: absolute;
    top: .5rem; left: .5rem;
    background: var(--accent);
    color: #fff;
    font-size: .8rem;
    font-weight: 800;
    padding: .15rem .55rem;
    border-radius: 999px;
    box-shadow: 0 1px 4px rgba(0,0,0,.35);
}

.req-card-body { padding: .75rem .9rem .9rem; }

.req-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    margin-bottom: .3rem;
}

.req-card-top .mono { color: var(--muted); font-size: .85rem; }

.req-card-name {
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.req-card-meta { color: var(--muted); font-size: .82rem; margin-top: .2rem; }

/* ------------------------------------------------------------------- mobile */

@media (max-width: 560px) {
    .hero h1 { font-size: 1.7rem; }
    .code-display { font-size: 2.2rem; }
    .field-row { flex-direction: column; gap: 0; }
    .field-row .small-field { flex: 1; }
}
