:root {
    color-scheme: light;
    --bg: #f5f6f8;
    --surface: #ffffff;
    --border: #d9dde4;
    --text: #17202a;
    --muted: #5f6b7a;
    --primary: #146c5f;
    --primary-dark: #0f5147;
    --accent: #b6422c;
    --alert-bg: #fff3f0;
    --alert-border: #e5a093;
}

* {
    box-sizing: border-box;
}

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

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.app-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    color: var(--text);
    font-size: 20px;
    font-weight: 700;
}

.nav {
    display: flex;
    gap: 16px;
    font-size: 14px;
}

.page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 28px 20px 56px;
}

.section {
    display: grid;
    gap: 18px;
}

.section-heading,
.panel-heading,
.actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

h1,
h2 {
    margin: 0;
    line-height: 1.3;
}

h1 {
    font-size: 28px;
}

h2 {
    font-size: 18px;
}

.form,
.panel,
.notice,
.alert,
.disclaimer,
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}

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

.form {
    display: grid;
    gap: 16px;
}

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

label {
    display: grid;
    gap: 6px;
    font-weight: 600;
}

label span {
    color: var(--text);
}

label b {
    color: var(--accent);
    font-size: 12px;
}

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

textarea {
    resize: vertical;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: 6px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

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

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

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

.button.secondary {
    color: var(--text);
    background: #eef1f4;
    border-color: var(--border);
}

.button.compact {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 14px;
}

.button:disabled {
    cursor: wait;
    opacity: .7;
}

.disclaimer,
.notice {
    padding: 12px 14px;
    color: var(--muted);
}

.alert {
    padding: 12px 14px;
    background: var(--alert-bg);
    border-color: var(--alert-border);
    color: #7a2a1d;
}

.alert p {
    margin: 0;
}

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

.meta-grid div {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
}

.meta-grid span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.meta-grid strong {
    display: block;
    overflow-wrap: anywhere;
}

.prewrap {
    margin-top: 10px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

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

th {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

tr:last-child td {
    border-bottom: 0;
}

@media (max-width: 720px) {
    .header-inner,
    .section-heading,
    .panel-heading,
    .actions {
        align-items: stretch;
        flex-direction: column;
    }

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

    h1 {
        font-size: 24px;
    }

    .button {
        width: 100%;
    }
}
