:root {
    --bg: #f3f4ef;
    --panel: #ffffff;
    --line: #d8d8d0;
    --text: #1f2a1f;
    --muted: #5b655e;
    --accent: #0f5c4b;
    --accent-soft: #d9ece6;
    --danger: #a23a2a;
    --warning: #a56d11;
    --success: #216645;
    --shadow: 0 14px 30px rgba(21, 34, 24, 0.08);
    --radius: 16px;
    --font: "Yu Gothic UI", "Meiryo UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: linear-gradient(180deg, #f7f7f2 0%, #eceee7 100%);
    color: var(--text);
    font-family: var(--font);
}

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

a:hover {
    text-decoration: underline;
}

.container {
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(247, 247, 242, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(15, 92, 75, 0.12);
}

.header-row,
.page-header,
.header-meta,
.toolbar,
.button-row,
.compact-row,
.meta-grid,
.info-grid {
    display: flex;
    gap: 16px;
    align-items: center;
}

.header-row,
.page-header {
    justify-content: space-between;
}

.header-row {
    min-height: 72px;
}

.brand {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.header-nav {
    display: flex;
    gap: 16px;
}

.header-meta {
    margin-left: auto;
}

.page-shell {
    padding: 28px 0 48px;
}

.panel,
.auth-card,
.info-card {
    background: var(--panel);
    border: 1px solid rgba(15, 92, 75, 0.08);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel,
.auth-card {
    padding: 24px;
}

.subtle-panel {
    background: #f8faf6;
    border: 1px solid var(--line);
}

.no-margin {
    margin: 0;
}

.stack-gap {
    display: grid;
    gap: 18px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

.alert {
    margin-bottom: 20px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
}

.alert-success {
    background: #e8f7ef;
    border-color: #b9e4ca;
    color: var(--success);
}

.alert-error {
    background: #fff1ef;
    border-color: #f1c2bb;
    color: var(--danger);
}

.alert-warning {
    background: #fff7e6;
    border-color: #ebd399;
    color: var(--warning);
}

.form-layout,
.form-grid,
.wide-grid,
.two-col-grid,
.compact-form {
    display: grid;
    gap: 18px;
}

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

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

.two-col-grid {
    grid-template-columns: 1.4fr 1fr;
}

.compact-form {
    grid-template-columns: 1fr;
}

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

.field span {
    font-size: 0.92rem;
    color: var(--muted);
}

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

.grow {
    flex: 1;
}

.align-end {
    align-self: end;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    background: #fcfdfb;
}

textarea {
    resize: vertical;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    border-radius: 999px;
    padding: 11px 18px;
    cursor: pointer;
    text-decoration: none;
}

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

.button-muted {
    background: #eff1eb;
}

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

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

.compact-table-wrap {
    max-height: 420px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(216, 216, 208, 0.7);
    vertical-align: top;
    text-align: left;
}

.data-table thead th {
    background: #f4f7f1;
    position: sticky;
    top: 0;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.86rem;
}

.status-unread {
    background: #f1ede6;
    color: #7e5a1a;
}

.status-disagreed {
    background: #fff0ee;
    color: var(--danger);
}

.message-body {
    padding: 20px;
    background: #f9fbf8;
    border-radius: 14px;
    border: 1px solid rgba(15, 92, 75, 0.08);
    line-height: 1.8;
}

.sub-note {
    padding: 16px;
    border-radius: 14px;
    background: #fbf9ee;
    border: 1px solid #eadfb7;
}

.attachment-list,
.attachment-stack {
    display: grid;
    gap: 16px;
    padding-left: 0;
    list-style: none;
}

.attachment-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fcfdfb;
}

.attachment-card header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.attachment-preview {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.image-preview {
    max-height: 520px;
    object-fit: contain;
}

.video-preview,
.pdf-preview {
    min-height: 360px;
}

.meta-grid,
.info-grid {
    flex-wrap: wrap;
}

.meta-grid > div,
.info-card {
    flex: 1 1 180px;
}

.meta-grid span,
.info-card span {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    margin-bottom: 8px;
}

.info-card {
    padding: 18px 20px;
}

.info-card strong {
    font-size: 1.5rem;
}

.summary-grid {
    margin: 18px 0;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
}

.pagination-link.is-active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.empty-state {
    text-align: center;
    color: var(--muted);
    padding: 32px 12px;
}

.inline-form {
    margin: 0;
}

.section-heading {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at top left, rgba(15, 92, 75, 0.16), transparent 36%),
        radial-gradient(circle at bottom right, rgba(165, 109, 17, 0.14), transparent 30%),
        linear-gradient(180deg, #f7f8f2 0%, #e7ebe3 100%);
}

.auth-wrapper {
    width: min(460px, calc(100% - 32px));
}

.auth-card-header {
    margin-bottom: 18px;
}

@media (max-width: 900px) {
    .header-row,
    .page-header,
    .toolbar,
    .header-meta,
    .button-row,
    .compact-row {
        flex-direction: column;
        align-items: stretch;
    }

    .form-grid,
    .wide-grid,
    .two-col-grid {
        grid-template-columns: 1fr;
    }

    .video-preview,
    .pdf-preview {
        min-height: 260px;
    }
}
