body {
    margin: 0;
    font-family: "Noto Sans CJK JP", "IPAGothic", "Hiragino Sans", "Yu Gothic", sans-serif;
    background: #f4f6f8;
    color: #1f2933;
}

a {
    color: #0b5cad;
    text-decoration: none;
}

.site-header {
    background: #12344d;
    color: #fff;
    padding: 16px 24px;
}

.site-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.site-header a {
    color: #fff;
}

.site-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.site-user {
    color: #d9e2ec;
    font-size: 0.95rem;
}

.site-nav {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.site-nav-group {
    display: grid;
    gap: 6px;
    min-width: 150px;
}

.site-nav-heading {
    color: #bcccdc;
    font-size: 0.78rem;
    font-weight: 700;
}

.site-nav-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.site-nav-links a {
    font-size: 0.93rem;
    white-space: nowrap;
}

.site-nav-subgroup {
    align-items: center;
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
}

.site-nav-subheading {
    color: #d9e2ec;
    font-size: 0.82rem;
    font-weight: 700;
}

.inline-form {
    margin: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.page-header {
    margin-bottom: 20px;
}

.card {
    background: #fff;
    border: 1px solid #d9e2ec;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.grid-form p {
    display: grid;
    gap: 8px;
}

.grid-form .helptext {
    color: #486581;
    font-size: 0.9rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    border: 1px solid #d9e2ec;
    padding: 8px;
    vertical-align: top;
}

button,
.button-link {
    display: inline-block;
    background: #0b5cad;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
}

.secondary-content-link {
    background: #fff;
    color: #0b5cad;
    border: 1px solid #9fb3c8;
}

.secondary-button {
    background: #fff;
    color: #0b5cad;
    border: 1px solid #9fb3c8;
}

.site-header .secondary-button,
.header-link {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.45);
}

.secondary-note {
    color: #486581;
}

.command-snippet {
    background: #1f2933;
    border-radius: 6px;
    color: #f8fafc;
    overflow-x: auto;
    padding: 12px;
}

.inline-actions {
    display: grid;
    gap: 8px;
}

.messages {
    list-style: none;
    padding: 0;
}

.message {
    background: #d9f2e3;
    border: 1px solid #9ad1af;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 12px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: #fff;
    border: 1px solid #d9e2ec;
    border-radius: 8px;
    padding: 16px;
}

.manual-header {
    background: #fff;
    border: 1px solid #d9e2ec;
    border-radius: 8px;
    padding: 24px;
}

.manual-header h2 {
    margin-top: 0;
}

.section-eyebrow {
    color: #486581;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    margin: 0 0 8px;
    text-transform: uppercase;
}

.manual-flow {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 18px 0 0;
    padding: 0;
}

.manual-flow li {
    background: #eef4ff;
    border: 1px solid #bcccdc;
    border-radius: 999px;
    color: #243b53;
    padding: 6px 10px;
}

.manual-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.manual-card {
    background: #fff;
    border: 1px solid #d9e2ec;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: space-between;
    padding: 18px;
}

.manual-card h3 {
    margin: 4px 0 8px;
}

.manual-card-meta {
    color: #627d98;
    font-size: 0.85rem;
    margin: 0;
}

.manual-detail-header {
    margin-bottom: 16px;
}

.manual-meta-list {
    display: grid;
    gap: 10px;
    margin: 16px 0;
}

.manual-meta-list div {
    display: grid;
    gap: 4px;
}

.manual-meta-list dt {
    color: #486581;
    font-weight: 700;
}

.manual-meta-list dd {
    margin: 0;
}

.manual-section {
    background: #fff;
    border: 1px solid #d9e2ec;
    border-radius: 8px;
    margin-bottom: 16px;
    padding: 20px;
}

.manual-section h3 {
    margin-top: 0;
}

.manual-callout {
    border-left: 4px solid #0b5cad;
}

.manual-callout p:last-child,
.manual-callout ul:last-child,
.manual-section p:last-child,
.manual-section ul:last-child {
    margin-bottom: 0;
}

.manual-callout-check {
    background: #f0f7ff;
    border-color: #3d7cc9;
}

.manual-callout-point {
    background: #edf7ed;
    border-color: #4b9b69;
}

.manual-callout-caution {
    background: #fff8e5;
    border-color: #d99a2b;
}

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

.case-item {
    border-top: 1px solid #d9e2ec;
    padding-top: 12px;
}

.case-item:first-child {
    border-top: 0;
    padding-top: 0;
}

.case-item h4 {
    margin: 0 0 8px;
}

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

.manual-example-table th {
    background: #f0f4f8;
}

.related-screen-list {
    display: grid;
    gap: 10px;
    list-style: none;
    padding: 0;
}

.related-screen-list li {
    display: grid;
    gap: 4px;
}

.related-screen-list span {
    color: #486581;
}

.compact-list {
    display: grid;
    gap: 4px;
    margin: 0;
    padding-left: 18px;
}

.form-control {
    width: 100%;
    padding: 8px;
    border: 1px solid #bcccdc;
    border-radius: 6px;
    box-sizing: border-box;
}

.page-help-card {
    background: #eef4ff;
    border-color: #bcccdc;
}

.page-help-list {
    display: grid;
    gap: 12px;
    margin: 0;
}

.page-help-item {
    display: grid;
    gap: 4px;
}

.page-help-item dt {
    font-weight: 700;
}

.page-help-item dd {
    margin: 0;
    color: #334e68;
}

.auth-card {
    max-width: 520px;
    margin: 0 auto;
}

.form-errors,
.field-error-list {
    color: #9b1c1c;
}

.field-error-list {
    margin: 8px 0 0;
    padding-left: 20px;
}

.daily-action-card {
    border-left: 4px solid #0b5cad;
}

.daily-action-list,
.detail-list,
.preview-list {
    display: grid;
    gap: 10px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.summary-grid div {
    background: #f8fafc;
    border: 1px solid #d9e2ec;
    border-radius: 6px;
    padding: 12px;
}

.summary-grid dt {
    color: #486581;
    font-weight: 700;
}

.summary-grid dd {
    margin: 4px 0 0;
}

.quick-entry-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
    gap: 20px;
    align-items: start;
}

.quick-entry-preview {
    position: sticky;
    top: 16px;
}

.totals-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 12px 0;
}

.totals-strip span {
    background: #f0f4f8;
    border: 1px solid #d9e2ec;
    border-radius: 6px;
    padding: 8px 10px;
}

.warning-text {
    color: #9b1c1c;
    font-weight: 700;
}

.detail-section {
    margin-top: 20px;
}

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

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

.bulk-entry-table {
    min-width: 1500px;
}

.bulk-entry-table th,
.bulk-entry-table td {
    min-width: 120px;
    vertical-align: top;
}

.bulk-entry-table th:nth-child(4),
.bulk-entry-table td:nth-child(4) {
    min-width: 220px;
}

.bulk-entry-table th:last-child,
.bulk-entry-table td:last-child {
    min-width: 160px;
}

.bulk-entry-table .errorlist {
    color: #9b1c1c;
    margin: 6px 0 0;
    padding-left: 18px;
}

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

.statement-start-card {
    display: grid;
    align-content: start;
    gap: 10px;
    border-top: 4px solid #0b5cad;
}

.statement-start-card h3,
.statement-start-card p {
    margin: 0;
}

.statement-start-icon {
    color: #0b5cad;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.statement-primary-action {
    justify-self: start;
    margin-top: 8px;
    padding: 12px 16px;
    font-weight: 700;
}

.statement-resume-card {
    background: #eef8ff;
    border-left: 4px solid #0b5cad;
}

.statement-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    list-style-position: inside;
    padding: 0;
}

.statement-steps li {
    display: grid;
    gap: 5px;
    background: #f8fafc;
    border: 1px solid #d9e2ec;
    border-radius: 8px;
    padding: 14px;
}

.statement-steps span,
.recommendation-text,
.tax-reason {
    color: #486581;
    font-size: 0.88rem;
}

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

.statement-new-source {
    border-top: 1px solid #d9e2ec;
    margin-top: 18px;
    padding-top: 12px;
}

.field-block {
    display: grid;
    align-content: start;
    gap: 7px;
}

.field-block > label,
.field-label {
    font-weight: 700;
}

.helptext {
    color: #486581;
    font-size: 0.9rem;
}

.statement-paste-area {
    min-height: 240px;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 1rem;
    line-height: 1.55;
}

.statement-format-help {
    background: #f8fafc;
    border: 1px solid #d9e2ec;
    border-radius: 8px;
    margin-top: 14px;
    padding: 12px;
}

.statement-format-help summary {
    color: #0b5cad;
    cursor: pointer;
    font-weight: 700;
}

.statement-format-help pre {
    overflow-x: auto;
    white-space: pre-wrap;
}

.statement-submit-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    background: #eef4ff;
    border: 1px solid #bcccdc;
    border-radius: 8px;
    margin-top: 18px;
    padding: 14px;
}

.statement-submit-bar button {
    flex: 0 0 auto;
    font-size: 1rem;
    font-weight: 700;
    padding: 12px 18px;
}

.statement-progress-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    border-left: 4px solid #0b5cad;
}

.statement-progress-card h3,
.statement-progress-card p {
    margin: 0 0 6px;
}

.statement-review-list {
    display: grid;
    gap: 14px;
}

.statement-review-row {
    display: grid;
    grid-template-columns: minmax(210px, 0.65fr) minmax(210px, 0.55fr) minmax(360px, 1.4fr);
    gap: 16px;
    align-items: start;
    margin-bottom: 0;
}

.statement-line-summary {
    display: grid;
    gap: 6px;
}

.statement-amount {
    font-size: 1.08rem;
    font-weight: 700;
}

.statement-choice-block {
    display: grid;
    gap: 8px;
}

.statement-choice-block ul,
.statement-import-form #id_scope {
    display: flex;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.statement-choice-block label,
.statement-import-form #id_scope label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 2px solid #9fb3c8;
    border-radius: 8px;
    cursor: pointer;
    padding: 10px 12px;
    font-weight: 700;
}

.statement-choice-block label:has(input:checked),
.statement-import-form #id_scope label:has(input:checked) {
    background: #e3f2fd;
    border-color: #0b5cad;
    color: #063d74;
}

.statement-business-fields {
    grid-column: 3;
}

.statement-review-row > .field-block {
    grid-column: 1 / -1;
}

.statement-sticky-submit {
    position: sticky;
    bottom: 12px;
    z-index: 5;
    box-shadow: 0 5px 20px rgba(18, 52, 77, 0.18);
}

.statement-complete-card {
    background: #edf8f1;
    border-left: 4px solid #2f855a;
}

@media (max-width: 860px) {
    .quick-entry-layout {
        grid-template-columns: 1fr;
    }

    .quick-entry-preview {
        position: static;
    }

    .statement-start-grid,
    .statement-steps,
    .statement-form-grid,
    .statement-business-fields,
    .statement-review-row {
        grid-template-columns: 1fr;
    }

    .statement-business-fields,
    .statement-review-row > .field-block {
        grid-column: 1;
    }

    .statement-submit-bar,
    .statement-progress-card {
        align-items: stretch;
        flex-direction: column;
    }

    .statement-submit-bar button {
        width: 100%;
    }
}
