:root {
    --bg: #f0ede6;
    --surface: rgba(255, 252, 247, 0.94);
    --surface-strong: #fffdf9;
    --surface-muted: #f4efe6;
    --text: #1d2525;
    --muted: #5e6a6f;
    --accent: #146c63;
    --accent-strong: #0c4f49;
    --accent-soft: #dcebe7;
    --secondary: #b76f2f;
    --secondary-soft: #f2dfcc;
    --border: #d7d0c3;
    --danger: #a23030;
    --danger-soft: #f6dddd;
    --success: #2e6d46;
    --success-soft: #dff1e4;
    --warning: #9f6523;
    --warning-soft: #f8ebd7;
    --shadow: 0 22px 55px rgba(22, 34, 34, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(20, 108, 99, 0.18), transparent 28%),
        radial-gradient(circle at bottom right, rgba(183, 111, 47, 0.16), transparent 26%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(240, 237, 230, 0.82)),
        var(--bg);
}

img {
    display: block;
    max-width: 100%;
}

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

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

pre,
code {
    font-family: "Courier New", monospace;
}

.page-shell {
    width: min(1280px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 28px 0 52px;
}

.stack,
.stack-tight {
    display: grid;
}

.stack {
    gap: 20px;
}

.stack-tight {
    gap: 12px;
}

.layout {
    display: grid;
    gap: 22px;
}

.layout-2 {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.app-layout {
    grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
    align-items: start;
}

.hero,
.panel,
.stat-card,
.fab-card {
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.hero {
    padding: 30px 32px;
}

.hero-wide {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.95fr);
    gap: 24px;
    align-items: start;
}

.hero-side {
    align-self: stretch;
}

.hero-auth-form {
    display: block;
}

.panel {
    padding: 24px;
}

.summary-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    margin: 22px 0;
}

.stat-card {
    padding: 18px 20px;
    display: grid;
    gap: 8px;
    background:
        linear-gradient(135deg, rgba(20, 108, 99, 0.08), transparent),
        var(--surface);
}

.stat-card strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.8rem, 4vw, 2.4rem);
}

.stat-label {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    font-weight: 700;
}

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

.hero-copy,
.muted,
.field small,
.link-note {
    color: var(--muted);
}

.eyebrow {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--secondary);
}

h1,
h2,
h3 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.1;
}

h1 {
    font-size: clamp(2.2rem, 5vw, 3.3rem);
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.15rem;
}

p,
ul,
ol,
dl {
    margin: 0;
}

.button-row,
.debug-tools,
.view-toggle,
.action-links,
.inline-code-list,
.suggestion-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.button,
button.button,
.button-like,
.suggestion-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: linear-gradient(135deg, var(--accent), #2b8b7f);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.button:hover,
.button-like:hover,
.suggestion-chip:hover,
.button:focus-visible,
.button-like:focus-visible,
.suggestion-chip:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(20, 108, 99, 0.2);
}

.button.ghost,
button.button.ghost,
.button-like {
    background: var(--surface-strong);
    color: var(--accent-strong);
    border-color: var(--border);
    box-shadow: none;
}

.button.danger,
button.button.danger {
    background: linear-gradient(135deg, #a23030, #c44b4b);
    color: #fff;
}

.button-small {
    min-height: 38px;
    padding: 0 14px;
    font-size: 0.95rem;
}

.button-square {
    min-width: 42px;
    padding: 0;
}

.flash {
    margin: 0 0 18px;
    padding: 15px 18px;
    border-radius: 16px;
    border: 1px solid transparent;
    font-weight: 700;
}

.flash-success {
    background: var(--success-soft);
    border-color: #bfd9c7;
    color: var(--success);
}

.flash-error {
    background: var(--danger-soft);
    border-color: #e9c3c3;
    color: var(--danger);
}

.flash-info,
.notice.info {
    background: #e6f2ef;
    border-color: #c4ddd5;
    color: var(--text);
}

.notice {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid transparent;
}

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

.field {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.field span {
    font-weight: 700;
}

.field-wide {
    grid-column: 1 / -1;
}

input[type="text"],
input[type="search"],
input[type="number"],
input[type="file"],
select,
textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid #cfc7ba;
    border-radius: 16px;
    background: var(--surface-strong);
    color: var(--text);
}

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

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(20, 108, 99, 0.16);
    border-color: var(--accent);
}

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

.process-row {
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
}

.suggestion-chip {
    min-height: 34px;
    padding: 0 14px;
    background: var(--secondary-soft);
    color: #6b461f;
    border-color: #e1c1a2;
    box-shadow: none;
}

.link-list {
    list-style: none;
    padding: 0;
    display: grid;
    gap: 12px;
}

.link-list li {
    margin: 0;
}

.link-list a {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 15px 16px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--surface-strong);
    color: var(--accent-strong);
    text-decoration: none;
    font-weight: 700;
}

.link-list a:hover,
.link-list a:focus-visible {
    border-color: #b7d4ce;
    box-shadow: 0 10px 22px rgba(20, 108, 99, 0.14);
}

.tag-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag-list li,
.pill,
.inline-code-list span {
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-weight: 700;
}

.tag-list.compact li {
    padding: 7px 10px;
    font-size: 0.92rem;
}

.pill-category-laser {
    background: #e6f4ef;
    color: #1c5b47;
}

.pill-category-cnc {
    background: #e7edf6;
    color: #274d76;
}

.pill-category-print3d {
    background: #f5eadf;
    color: #8b5223;
}

.pill-status-draft {
    background: #ece6d9;
    color: #70562d;
}

.pill-status-ready {
    background: #dff0e5;
    color: #2c6b42;
}

.pill-status-fabricated {
    background: #e1eef3;
    color: #2a5a76;
}

.pill-status-archived {
    background: #efe7ef;
    color: #66506a;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 14px;
}

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

.facts div {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.facts dt {
    font-weight: 700;
}

.facts dd {
    margin: 0;
    text-align: right;
}

.compact-facts div {
    padding-bottom: 8px;
}

.card-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.fab-card {
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 252, 247, 0.98));
}

.card-media {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, rgba(20, 108, 99, 0.1), rgba(183, 111, 47, 0.08));
    overflow: hidden;
}

.card-media img,
.detail-thumbnail img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: auto;
    object-fit: contain;
    object-position: center;
}

.media-placeholder {
    width: 100%;
    height: 100%;
    min-height: 180px;
    display: grid;
    place-items: center;
    gap: 8px;
    padding: 22px;
    text-align: center;
    background:
        linear-gradient(135deg, rgba(20, 108, 99, 0.14), rgba(183, 111, 47, 0.12)),
        repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2) 8px, transparent 8px, transparent 16px);
}

.media-placeholder span {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2rem;
    font-weight: 700;
}

.detail-placeholder {
    min-height: 280px;
}

.detail-thumbnail {
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 20px;
    aspect-ratio: 16 / 10;
    background: var(--surface-muted);
}

.card-body {
    padding: 18px;
}

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

.result-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface-strong);
    border-radius: 18px;
    overflow: hidden;
}

.result-table th,
.result-table td {
    padding: 12px 14px;
    border: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.result-table th {
    background: var(--surface-muted);
}

.sortable-link {
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.sortable-link:hover,
.sortable-link:focus-visible {
    color: var(--accent);
}

.action-links a {
    font-weight: 700;
    text-decoration: none;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pagination a {
    display: inline-flex;
    min-width: 40px;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-strong);
    color: var(--accent-strong);
    text-decoration: none;
    font-weight: 700;
}

.pagination a.current {
    background: linear-gradient(135deg, var(--accent), #2b8b7f);
    color: #fff;
    border-color: transparent;
}

.empty-state {
    padding: 34px 24px;
    border-radius: 20px;
    border: 1px dashed #cdbfa8;
    background: var(--surface-muted);
    text-align: center;
}

.status-ok {
    color: var(--success);
    font-weight: 700;
}

.status-error {
    color: var(--danger);
    font-weight: 700;
}

.status-readonly {
    color: var(--warning);
    font-weight: 700;
}

.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-weight: 700;
}

.checkbox-row input {
    margin: 0;
}

.debug-json-wrap {
    margin-bottom: 20px;
}

.debug-json-output {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 520px;
    height: min(62vh, 720px);
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-strong);
    color: var(--text);
    font: 0.92rem/1.5 monospace;
    resize: vertical;
}

ul.info-list {
    margin: 0;
    padding-left: 20px;
}

ul.info-list li + li {
    margin-top: 8px;
}

pre {
    margin: 0;
    padding: 14px;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #f8f3e9;
}

code {
    word-break: break-word;
}

@media (max-width: 980px) {
    .hero-wide,
    .app-layout,
    .form-grid,
    .filters-grid {
        grid-template-columns: 1fr;
    }

    .field-wide {
        grid-column: auto;
    }
}

@media (max-width: 720px) {
    .page-shell {
        width: min(100vw - 20px, 1280px);
        padding: 18px 0 34px;
    }

    .hero,
    .panel,
    .stat-card,
    .fab-card {
        border-radius: 20px;
    }

    .hero,
    .panel {
        padding: 20px;
    }

    .panel-head,
    .facts div,
    .button-row {
        flex-direction: column;
        align-items: stretch;
    }

    .facts dd {
        text-align: left;
    }

    .process-row {
        grid-template-columns: 1fr;
    }

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