:root {
    --bg: #f4f5f2;
    --panel: #ffffff;
    --text: #171717;
    --muted: #5f6368;
    --line: #d7d9d2;
    --accent: #1f6f68;
    --accent-strong: #164e49;
    --danger: #9f1239;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

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

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem clamp(1rem, 3vw, 2rem);
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
}

.brand {
    color: var(--text);
    font-weight: 750;
    text-decoration: none;
}

.app-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    align-items: center;
    color: var(--muted);
    font-size: 0.95rem;
}

.app-nav form {
    margin: 0;
}

.page-shell {
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.5rem 0 3rem;
}

.page-heading {
    margin-bottom: 1.25rem;
}

.page-heading.with-actions,
.list-toolbar,
.item-card-header,
.button-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
}

.button-row {
    justify-content: flex-start;
    flex-wrap: wrap;
}

.eyebrow {
    margin: 0 0 0.25rem;
    color: var(--accent-strong);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    overflow-wrap: anywhere;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 1.05;
}

h2 {
    margin: 0 0 0.85rem;
    font-size: 1.2rem;
}

h3 {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
}

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

.preserve-lines {
    white-space: pre-line;
}

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

.panel,
.auth-panel {
    padding: clamp(1rem, 3vw, 1.5rem);
    margin-bottom: 1.25rem;
}

.auth-panel {
    width: min(420px, 100%);
    margin: 8vh auto 0;
}

.split-panel {
    display: grid;
    gap: 1.5rem;
}

.card-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

.item-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}

.item-card.is-archived {
    border-style: dashed;
    opacity: 0.78;
}

.status-pill {
    display: inline-block;
    margin-top: 0.25rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.1rem 0.55rem;
    color: var(--muted);
    font-size: 0.8rem;
}

.stack {
    display: grid;
    gap: 1rem;
}

.stack.compact {
    margin-top: 1rem;
}

label {
    display: grid;
    gap: 0.35rem;
    color: #2c2f30;
    font-weight: 650;
}

.checkbox-label {
    display: flex;
    gap: 0.55rem;
    align-items: center;
}

.checkbox-label input {
    width: auto;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid #bec3bd;
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font: inherit;
    padding: 0.72rem 0.8rem;
}

textarea {
    resize: vertical;
}

button,
.primary-button,
.secondary-button,
.danger-button {
    display: inline-flex;
    min-height: 2.7rem;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 0.62rem 0.95rem;
    color: inherit;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.primary-button {
    background: var(--accent);
    color: #fff;
}

.secondary-button {
    border-color: var(--line);
    background: #fff;
    color: var(--accent-strong);
}

.danger-button {
    border-color: #f2becd;
    background: #fff;
    color: var(--danger);
}

.link-button {
    min-height: 0;
    border: 0;
    background: transparent;
    color: var(--accent-strong);
    padding: 0;
}

.alert {
    border: 1px solid #f2becd;
    border-radius: 6px;
    background: #fff5f8;
    color: var(--danger);
    padding: 0.8rem 1rem;
}

.success {
    border: 1px solid #b9dbc5;
    border-radius: 6px;
    background: #f0fbf3;
    color: #14532d;
    padding: 0.8rem 1rem;
}

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

.search-form {
    display: grid;
    gap: 1rem;
}

.admin-table-wrap {
    overflow-x: auto;
    margin-bottom: 1.25rem;
}

.admin-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    background: #ffffff;
}

.admin-table th,
.admin-table td {
    border: 1px solid var(--line);
    padding: 0.75rem;
    text-align: left;
    vertical-align: top;
}

.admin-table th {
    background: #f8f9f6;
}

.admin-actions {
    display: grid;
    gap: 0.5rem;
}

.admin-actions form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.audit-list {
    display: grid;
    gap: 0.7rem;
}

.audit-list article {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.75rem;
}

.audit-list pre {
    overflow: auto;
    white-space: pre-wrap;
}

details {
    border-top: 1px solid var(--line);
    padding-top: 0.7rem;
}

summary {
    cursor: pointer;
    font-weight: 750;
}

@media (min-width: 760px) {
    .split-panel {
        grid-template-columns: 1.2fr 0.8fr;
    }
}
