:root {
    --ks-ink: #1c1917;
    --ks-muted: #57534e;
    --ks-line: #d6d3d1;
    --ks-paper: #fffdf8;
    --ks-page: #f3f0ea;
    --ks-green: #145c3e;
    --ks-green-soft: #e7f3ec;
    --ks-notice: #ecfdf3;
}

* { box-sizing: border-box; }

body.ks-body {
    margin: 0;
    color: var(--ks-ink);
    background: var(--ks-page);
    font-family: "Yu Gothic UI", "Yu Gothic", "Hiragino Sans", "Noto Sans JP", sans-serif;
    line-height: 1.6;
}

.ks-top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: end;
    padding: 20px 28px 16px;
    background: var(--ks-green);
    color: #f7fbf8;
}

.ks-top-side {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ks-logout {
    font: inherit;
    color: #f7fbf8;
    background: transparent;
    border: 1px solid rgba(247, 251, 248, 0.55);
    border-radius: 999px;
    padding: 6px 14px;
    cursor: pointer;
}

.ks-logout:hover {
    background: rgba(255, 255, 255, 0.12);
}

.ks-login-body {
    margin: 0;
    min-height: 100vh;
    color: var(--ks-ink);
    background: #e7e1d6;
    font-family: "Yu Gothic UI", "Yu Gothic", "Hiragino Sans", "Noto Sans JP", sans-serif;
}

.ks-login {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(280px, 1.05fr) minmax(320px, 0.95fr);
}

.ks-login-hero {
    position: relative;
    padding: 64px 56px;
    color: #f6f3ea;
    background:
        radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.08), transparent 28%),
        linear-gradient(165deg, #0e3d2a 0%, #145c3e 48%, #1d7a52 100%);
    overflow: hidden;
}

.ks-login-hero::after {
    content: "";
    position: absolute;
    right: -80px;
    bottom: -90px;
    width: 280px;
    height: 280px;
    border: 18px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
}

.ks-login-kicker {
    margin: 0 0 28px;
    letter-spacing: 0.18em;
    font-size: 0.78rem;
}

.ks-login-hero h1 {
    margin: 0;
    font-size: clamp(2.2rem, 4vw, 3.4rem);
    line-height: 1.25;
    letter-spacing: 0.06em;
}

.ks-login-lead {
    max-width: 28em;
    margin: 22px 0 0;
    color: rgba(246, 243, 234, 0.86);
}

.ks-login-steps {
    margin: 36px 0 0;
    padding: 0;
    list-style: none;
    counter-reset: ks-step;
}

.ks-login-steps li {
    counter-increment: ks-step;
    margin: 0 0 12px;
    padding-left: 2.4em;
    position: relative;
}

.ks-login-steps li::before {
    content: counter(ks-step);
    position: absolute;
    left: 0;
    top: 0;
    width: 1.7em;
    height: 1.7em;
    border: 1px solid rgba(246, 243, 234, 0.45);
    border-radius: 50%;
    text-align: center;
    line-height: 1.7em;
    font-size: 0.82rem;
}

.ks-login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
}

.ks-login-card {
    width: min(420px, 100%);
    padding: 36px 32px 32px;
    background: var(--ks-paper);
    border: 1px solid #e4ddd2;
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(40, 32, 22, 0.08);
}

.ks-login-mark {
    display: inline-block;
    margin: 0 0 14px;
    padding: 4px 10px;
    color: var(--ks-green);
    border: 1px solid #9dccb4;
    border-radius: 999px;
    font-size: 0.78rem;
    letter-spacing: 0.12em;
}

.ks-login-card h2 {
    margin: 0;
    font-size: 1.7rem;
}

.ks-login-note {
    margin: 8px 0 18px;
    color: var(--ks-muted);
}

.ks-login-error {
    margin: 0 0 14px;
    padding: 10px 12px;
    color: #7f1d1d;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
}

.ks-login-form {
    display: grid;
    gap: 14px;
}

.ks-login-form input {
    width: 100%;
}

.ks-login-form button {
    margin-top: 6px;
    padding: 12px 16px;
    font: inherit;
    font-weight: 700;
    color: #fff;
    background: var(--ks-green);
    border: 1px solid var(--ks-green);
    border-radius: 12px;
    cursor: pointer;
}

.ks-login-form button:hover {
    background: #0f4a32;
}

.ks-login-form input:focus,
.ks-logout:focus-visible,
.ks-login-form button:focus-visible {
    outline: none;
    border-color: var(--ks-green);
    box-shadow: none;
}

.ks-top h1 {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.ks-kicker,
.ks-year {
    margin: 0;
    font-size: 0.85rem;
}

.ks-layout {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 14px;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 12px 16px 28px;
}

.ks-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ks-nav-link {
    display: block;
    padding: 10px 12px;
    white-space: nowrap;
    color: var(--ks-ink);
    text-decoration: none;
    background: #fff;
    border: 1px solid var(--ks-line);
    border-radius: 10px;
}

.ks-nav-link.is-current {
    background: var(--ks-green-soft);
    border-color: #9dccb4;
    font-weight: 700;
}

.ks-reset button,
.ks-actions button {
    font: inherit;
    cursor: pointer;
    color: var(--ks-green);
    background: #fff;
    border: 1px solid #9dccb4;
    border-radius: 10px;
    padding: 8px 14px;
}

.ks-actions button {
    background: var(--ks-green);
    color: #fff;
    border-color: var(--ks-green);
}

.ks-actions button + button {
    margin-left: 8px;
    color: var(--ks-green);
    background: #fff;
}

.ks-main { min-width: 0; }

.ks-paper,
.ks-summary {
    background: var(--ks-paper);
    border: 1px solid var(--ks-line);
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 16px;
}

.ks-form-no {
    margin: 0;
    color: var(--ks-muted);
    font-size: 0.82rem;
}

h2 { margin: 0 0 12px; font-size: 1.35rem; }
h3 { margin: 0 0 12px; font-size: 1.05rem; }

.ks-notice,
.ks-demo-note {
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 10px;
}

.ks-notice {
    background: var(--ks-notice);
    border: 1px solid #b7e4c7;
}

.ks-demo-note {
    background: #fff;
    border: 1px solid var(--ks-line);
    color: var(--ks-muted);
    font-size: 0.9rem;
}

.ks-grid {
    display: grid;
    grid-template-columns: repeat(2, max-content);
    gap: 6px 28px;
    align-items: center;
    justify-content: start;
}

.ks-grid > label {
    display: grid;
    grid-template-columns: 16em 8.4em;
    align-items: center;
    column-gap: 8px;
}

.ks-grid > label.ks-span,
.ks-grid > label:has(textarea),
.ks-grid > label:has(input.ks-wide),
.ks-grid > label:not(:has(input.ks-amount)):not(:has(input.ks-cell-text)) {
    grid-column: 1 / -1;
    grid-template-columns: 16em minmax(16em, 28em);
}

.ks-span { grid-column: 1 / -1; }

label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.86rem;
    color: var(--ks-muted);
}

textarea,
select,
input[type="text"],
input:not([type="checkbox"]):not([type="hidden"]):not([type="submit"]),
.ks-amount,
.ks-narrow {
    color: var(--ks-ink);
    background: #fff;
    border: 1px solid var(--ks-line);
    border-radius: 6px;
    padding: 3px 8px;
    font: inherit;
    font-size: 0.92rem;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
}

.ks-amount,
.ks-narrow {
    width: 8.4em;
    text-align: right;
}

.ks-narrow { width: 5.2em; }

.ks-grid input.ks-amount,
.ks-grid input.ks-cell-text {
    width: 8.4em;
    text-align: right;
}

.ks-grid input.ks-wide,
.ks-grid textarea,
.ks-grid > label:not(:has(input.ks-amount)):not(:has(input.ks-cell-text)) input {
    width: 100%;
    text-align: left;
    font-variant-numeric: normal;
}

textarea:focus,
select:focus,
input:focus,
button:focus-visible,
.ks-nav-link:focus-visible {
    outline: none;
    border-color: var(--ks-green);
    box-shadow: none;
}

.ks-lead { margin: 16px 0; }

.ks-facts {
    display: grid;
    gap: 8px;
    margin: 0;
}

.ks-facts div {
    display: grid;
    grid-template-columns: 11em 1fr;
    gap: 8px;
    padding: 8px 0;
    border-top: 1px solid var(--ks-line);
}

.ks-facts dt { color: var(--ks-muted); }
.ks-facts dd { margin: 0; }
.ks-facts strong { font-size: 1.4rem; letter-spacing: 0.03em; }
.ks-facts span { margin-left: 8px; color: var(--ks-muted); font-size: 0.85rem; }

.ks-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.ks-table th,
.ks-table td {
    border: 1px solid var(--ks-line);
    padding: 3px 6px;
    vertical-align: middle;
    background: #fff;
}

.ks-table th { white-space: nowrap; }

.ks-table thead th,
.ks-group th {
    background: #f6f3ee;
    text-align: left;
}

.ks-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ks-scroll { overflow-x: auto; }
.ks-money-table { width: max-content; max-width: none; }
.ks-money-table th,
.ks-money-table td { white-space: nowrap; }
.ks-money-table thead th { text-align: center; }
.ks-money-table tbody th { text-align: left; }
.ks-money-table td { text-align: right; }
.ks-money-table input.ks-amount {
    width: 7.4em;
    padding: 2px 6px;
    font-size: 0.86rem;
}

input.ks-yen,
.ks-grid input.ks-yen,
.ks-money-table input.ks-yen {
    width: 10.2em;
}

.ks-grid > label:has(input.ks-yen) {
    grid-template-columns: 16em 10.2em;
}
.ks-grant { font-size: 1.05rem; }
.ks-grant strong { font-size: 1.5rem; }
.ks-help, .ks-rates { color: var(--ks-muted); font-size: 0.9rem; }
.ks-sub td { color: var(--ks-muted); background: #fafaf9; }
.ks-checks { list-style: none; padding: 0; margin: 0; }
.ks-checks li { padding: 4px 0; }
.ks-checks label { flex-direction: row; align-items: center; gap: 8px; color: var(--ks-ink); }
.ks-checks input { width: auto; }

.ks-print {
    font: inherit;
    color: var(--ks-green);
    background: #fff;
    border: 1px solid #fff;
    border-radius: 999px;
    padding: 6px 14px;
    cursor: pointer;
}

.ks-gate-body {
    margin: 0;
    min-height: 100vh;
    color: var(--ks-ink);
    background:
        radial-gradient(circle at 80% 0%, rgba(20, 92, 62, 0.08), transparent 32%),
        #efeae2;
    font-family: "Yu Gothic UI", "Yu Gothic", "Hiragino Sans", "Noto Sans JP", sans-serif;
}

.ks-gate-top {
    padding: 36px 24px 8px;
    text-align: center;
}

.ks-gate-top p {
    margin: 0;
    color: var(--ks-green);
    letter-spacing: 0.16em;
    font-size: 0.78rem;
}

.ks-gate-top h1 {
    margin: 8px 0 0;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    letter-spacing: 0.06em;
}

.ks-gate {
    display: grid;
    grid-template-columns: repeat(2, minmax(280px, 420px));
    justify-content: center;
    gap: 22px;
    padding: 28px 20px 48px;
}

.ks-door {
    padding: 28px 26px 24px;
    background: var(--ks-paper);
    border: 1px solid #e4ddd2;
    border-radius: 18px;
    box-shadow: 0 16px 36px rgba(40, 32, 22, 0.06);
}

.ks-door-city {
    background: #f7fbf8;
}

.ks-door-label {
    display: inline-block;
    margin: 0 0 10px;
    padding: 3px 10px;
    color: var(--ks-green);
    border: 1px solid #9dccb4;
    border-radius: 999px;
    letter-spacing: 0.12em;
    font-size: 0.75rem;
}

.ks-door h2 {
    margin: 0 0 8px;
    font-size: 1.45rem;
}

.ks-door > p {
    min-height: 3.2em;
    margin: 0 0 8px;
    color: var(--ks-muted);
}

.ks-menu-wrap {
    max-width: 980px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}

.ks-years {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 16px;
}

.ks-year-btn {
    flex: 1 1 0;
    min-width: 7.4em;
    padding: 10px 12px;
    color: var(--ks-ink);
    background: #fff;
    border: 1px solid var(--ks-line);
    border-radius: 999px;
    text-align: center;
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.ks-year-btn:hover {
    color: var(--ks-green);
    background: var(--ks-green-soft);
    border-color: #9dccb4;
}

.ks-year-btn.is-current,
.ks-year-btn.is-current:hover {
    color: #f7fbf8;
    background: var(--ks-green);
    border-color: var(--ks-green);
}

.ks-year-btn:focus,
.ks-year-btn:focus-visible {
    outline: none;
    box-shadow: none;
}

.ks-menu {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.ks-menu-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 132px;
    padding: 22px 24px;
    color: #f7fbf8;
    background: var(--ks-green);
    border: 1px solid var(--ks-green);
    border-radius: 16px;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.ks-menu-btn:hover {
    background: #0f4a32;
}

.ks-menu-btn.is-preparing {
    color: var(--ks-ink);
    background: #fff;
    border-color: var(--ks-line);
    font-weight: 600;
}

.ks-menu-btn.is-preparing span {
    display: inline-block;
    margin-top: 8px;
    color: var(--ks-muted);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.08em;
}

.ks-menu-btn:focus-visible,
.ks-back:focus-visible {
    outline: none;
    border-color: var(--ks-green);
    box-shadow: none;
}

.ks-preparing h2 { margin-top: 8px; }

.ks-back {
    display: inline-block;
    padding: 8px 14px;
    color: #fff;
    background: var(--ks-green);
    border: 1px solid var(--ks-green);
    border-radius: 10px;
    text-decoration: none;
}

.ks-city {
    max-width: 920px;
    margin: 0 auto;
    padding: 20px;
}

.ks-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 14px;
}

.ks-switch a {
    padding: 6px 12px;
    color: var(--ks-ink);
    background: #fff;
    border: 1px solid var(--ks-line);
    border-radius: 999px;
    text-decoration: none;
    white-space: nowrap;
    font-size: 0.86rem;
    font-weight: 700;
}

.ks-switch a:hover {
    color: var(--ks-green);
    background: var(--ks-green-soft);
    border-color: #9dccb4;
}

.ks-switch a.is-current,
.ks-switch a.is-current:hover {
    color: #f7fbf8;
    background: var(--ks-green);
    border-color: var(--ks-green);
}

.ks-switch a:focus,
.ks-switch a:focus-visible {
    outline: none;
    box-shadow: none;
}

textarea {
    min-height: 3.2em;
    resize: vertical;
}

.ks-table input.ks-cell-text {
    width: 8em;
    text-align: left;
    font-variant-numeric: normal;
}

.ks-table input.ks-wide {
    width: 18em;
    max-width: 100%;
    text-align: left;
    font-variant-numeric: normal;
}

.ks-mark-select {
    width: 5.6em;
    text-align: center;
}

.ks-money-table select {
    width: 7.2em;
    padding: 2px 4px;
    font-size: 0.86rem;
}

.ks-cell-text,
.ks-wide {
    text-align: left;
}

.ks-flag {
    width: 1.1em;
    height: 1.1em;
    accent-color: var(--ks-green);
}

.ks-help {
    margin: 0 0 12px;
    color: var(--ks-muted);
    font-size: 0.9rem;
}

@media print {
    .ks-top, .ks-demo-note, .ks-print, .ks-logout { display: none !important; }
    body.ks-body { background: #fff; }
    .ks-city { padding: 0; max-width: none; }
    .ks-paper { border: none; }
}

@media (max-width: 800px) {
    .ks-layout { grid-template-columns: 1fr; padding: 12px; }
    .ks-nav { flex-direction: row; flex-wrap: wrap; }
    .ks-grid, .ks-facts div { grid-template-columns: 1fr; }
    .ks-grid > label,
    .ks-grid > label.ks-span,
    .ks-grid > label:has(textarea),
    .ks-grid > label:has(input.ks-wide),
    .ks-grid > label:not(:has(input.ks-amount)):not(:has(input.ks-cell-text)) {
        grid-template-columns: minmax(0, 1fr) 8.4em;
    }
    .ks-grid > label:has(input.ks-yen) {
        grid-template-columns: minmax(0, 1fr) 10.2em;
    }
    .ks-top, .ks-top-side { flex-direction: column; align-items: start; }
    .ks-gate, .ks-menu { grid-template-columns: 1fr; }
    .ks-login { grid-template-columns: 1fr; }
    .ks-login-hero { padding: 36px 24px 28px; }
    .ks-login-hero::after { display: none; }
}
