:root {
    color-scheme: light;
    --bg: #faf8f5;
    --surface: rgba(250, 248, 245, 0.94);
    --surface-strong: #fffdfb;
    --ink: #1a1a1a;
    --muted: #556257;
    --line: rgba(26, 26, 26, 0.1);
    --brand: #b11226;
    --brand-strong: #8f0d1e;
    --accent: #647c67;
    --success: #647c67;
    --danger: #b11226;
    --shadow: 0 20px 60px rgba(26, 26, 26, 0.1);
    --radius: 24px;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 15px;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    line-height: 1.45;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(177, 18, 38, 0.12), transparent 34%),
        radial-gradient(circle at top right, rgba(100, 124, 103, 0.16), transparent 30%),
        linear-gradient(180deg, #fcfbf9 0%, var(--bg) 100%);
}

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

.app-shell {
    width: min(1180px, calc(100% - 24px));
    margin: 0 auto;
    padding: 24px 0 48px;
}

.app-header,
.panel,
.dialog-card {
    background: var(--surface);
    backdrop-filter: blur(14px);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.app-header {
    display: grid;
    gap: 20px;
    padding: 28px;
    border-radius: var(--radius);
}

.brand-block {
    display: grid;
    gap: 16px;
}

.brand-media {
    width: min(100%, 135px);
    max-width: 100%;
}

.brand-fallback {
    width: 100%;
    border-radius: 18px;
}

.brand-logo {
    display: block;
    width: 100%;
    max-height: 72px;
    object-fit: contain;
    object-position: left center;
    padding-left: 4px;
    background: transparent;
    border: 0;
}

.brand-fallback {
    min-height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand), var(--brand-strong));
    color: #fff;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

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

.eyebrow {
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.76rem;
    color: var(--accent);
    font-weight: 700;
}

h1,
h2,
h3,
h4,
p {
    margin: 0;
}

h1,
h2,
h3,
h4,
.eyebrow {
    font-family: "Oswald", "Arial Narrow", Arial, sans-serif;
    letter-spacing: 0.01em;
}

h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1;
}

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

.lede {
    max-width: 66ch;
    margin-top: 8px;
    font-size: 0.96rem;
}

.toolbar {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
}

.toolbar-group {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
}

.button,
.icon-button {
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.18s ease, background-color 0.18s ease, opacity 0.18s ease;
}

.button:hover,
.icon-button:hover {
    transform: translateY(-1px);
}

.button {
    padding: 0.78rem 1rem;
    font-weight: 700;
    white-space: nowrap;
    font-size: 0.95rem;
}

.button-primary {
    background: linear-gradient(135deg, var(--brand), var(--brand-strong));
    color: #fff;
}

.button-secondary {
    background: rgba(100, 124, 103, 0.1);
    color: var(--ink);
    border: 1px solid rgba(100, 124, 103, 0.22);
}

.file-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.button-add {
    min-width: 48px;
    padding-left: 0;
    padding-right: 0;
    font-size: 1.2rem;
    line-height: 1;
}

.is-hidden {
    display: none !important;
}

.button-link {
    text-decoration: none;
}

.layout {
    display: grid;
    gap: 18px;
    margin-top: 18px;
}

.panel {
    border-radius: var(--radius);
    padding: 24px;
}

.checkbox-line {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    color: var(--muted);
}

.checkbox-line a {
    color: var(--brand);
}

.panel-highlight {
    background: linear-gradient(160deg, rgba(250, 248, 245, 0.98), rgba(240, 245, 240, 0.9));
}

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

.stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    gap: 12px;
}

.stat {
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px 14px;
}

.stat-label {
    display: block;
    font-size: 0.74rem;
    color: var(--muted);
}

.notice {
    margin-top: 18px;
    padding: 16px 18px;
    border-radius: 18px;
    background: rgba(100, 124, 103, 0.08);
    border: 1px solid rgba(100, 124, 103, 0.18);
}

.instructions-list {
    margin: 16px 0 0;
    padding-left: 1.25rem;
    display: grid;
    gap: 10px;
    color: var(--ink);
    font-size: 0.95rem;
}

.panel-toggle {
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.panel-toggle:hover .panel-header {
    background: rgba(100, 124, 103, 0.06);
    border-radius: 18px;
}

.panel-toggle-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(100, 124, 103, 0.14);
    color: var(--accent);
    font-size: 1.4rem;
    font-weight: 700;
    flex: 0 0 auto;
}

.panel-collapsible {
    margin-top: 4px;
}

.empty-state {
    margin-top: 16px;
    padding: 22px;
    border: 1px dashed rgba(100, 124, 103, 0.28);
    border-radius: 18px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.55);
}

.entries {
    display: grid;
    gap: 16px;
    margin-top: 16px;
}

.entry-card {
    background: var(--surface-strong);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 10px;
}

.entry-summary {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border: 0;
    border-radius: 18px;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.entry-summary:hover {
    background: rgba(100, 124, 103, 0.08);
}

.entry-summary-copy {
    min-width: 0;
}

.entry-summary-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(100, 124, 103, 0.14);
    color: var(--accent);
    font-size: 1.4rem;
    font-weight: 700;
}

.entry-top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
    margin-bottom: 16px;
}

.entry-kicker,
.entry-meta {
    color: var(--muted);
    font-size: 0.84rem;
}

.entry-updated {
    color: var(--muted);
    font-size: 0.78rem;
}

.entry-title {
    font-size: 1.35rem;
    margin: 6px 0;
}

.entry-summary .entry-title {
    margin: 0 0 6px;
    font-size: 1.1rem;
}

.entry-summary .entry-meta {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.entry-details {
    padding: 6px 10px 10px;
}

.entry-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(100, 124, 103, 0.14);
    color: var(--accent);
    font-weight: 700;
}

.icon-button {
    min-width: 42px;
    min-height: 42px;
    padding: 0 14px;
    background: rgba(26, 26, 26, 0.06);
    color: var(--ink);
}

.icon-button.danger {
    background: rgba(177, 18, 38, 0.12);
    color: var(--danger);
}

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

.detail-section {
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(250, 248, 245, 0.92);
    padding: 16px;
}

.detail-section h4 {
    margin-bottom: 10px;
}

.detail-section dl {
    display: grid;
    gap: 8px;
    margin: 0;
}

.detail-section dt {
    font-size: 0.74rem;
    text-transform: uppercase;
    color: var(--brand);
    letter-spacing: 0.08em;
}

.detail-section dd {
    margin: 2px 0 0;
    color: var(--ink);
}

.entry-notes {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.dialog {
    width: min(1100px, calc(100% - 20px));
    border: none;
    padding: 0;
    background: transparent;
}

.dialog::backdrop {
    background: rgba(34, 24, 21, 0.55);
    backdrop-filter: blur(4px);
}

.dialog-card {
    border-radius: 28px;
    overflow: hidden;
}

.dialog-header,
.dialog-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 22px 24px;
}

.dialog-header {
    background: linear-gradient(135deg, rgba(177, 18, 38, 0.95), rgba(143, 13, 30, 0.95));
    color: white;
}

.dialog-body {
    display: grid;
    gap: 16px;
    padding: 24px;
    max-height: min(72vh, 900px);
    overflow: auto;
}

.form-block {
    background: rgba(255, 252, 248, 0.88);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 18px;
}

.form-block h3 {
    margin-bottom: 14px;
}

.form-grid {
    display: grid;
    gap: 12px;
}

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

.field {
    display: grid;
    gap: 8px;
}

.field span,
.field legend {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
}

.field-hint {
    font-size: 0.74rem;
    color: var(--muted);
}

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid rgba(26, 26, 26, 0.12);
    background: #fff;
    border-radius: 14px;
    padding: 0.9rem 1rem;
    color: var(--ink);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: 2px solid rgba(177, 18, 38, 0.14);
    border-color: rgba(177, 18, 38, 0.32);
}

.field output {
    color: var(--accent);
    font-weight: 700;
    min-height: 1.4rem;
}

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

.chips-field {
    border: 0;
    padding: 0;
    margin: 0;
}

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

.chips label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.9);
}

.chips input {
    accent-color: var(--brand);
}

.toast {
    position: fixed;
    right: 16px;
    bottom: 16px;
    max-width: min(420px, calc(100% - 32px));
    padding: 14px 16px;
    border-radius: 16px;
    color: white;
    background: rgba(100, 124, 103, 0.96);
    box-shadow: var(--shadow);
    z-index: 1000;
}

.toast.error {
    background: rgba(177, 18, 38, 0.96);
}

@media (max-width: 860px) {
    .panel-header,
    .entry-top,
    .dialog-header,
    .dialog-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .entry-grid,
    .two-columns,
    .stats {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .app-shell {
        width: min(100%, calc(100% - 12px));
        padding-top: 12px;
    }

    .app-header,
    .panel,
    .dialog-body,
    .dialog-header,
    .dialog-footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .brand-block {
        text-align: center;
    }

    .brand-media {
        width: 100%;
    }

    .brand-logo {
        max-height: 38px;
        object-position: center;
        padding-left: 0;
    }

    .toolbar {
        justify-content: center;
        gap: 6px;
        flex-wrap: wrap;
    }

    .toolbar-group {
        width: 100%;
        justify-content: center;
    }

    .toolbar .button {
        padding: 0.72rem 0.82rem;
        font-size: 0.88rem;
    }

    .button-add {
        min-width: 44px;
    }
}
