:root {
    color-scheme: light;
    --bg: #eef3f7;
    --panel: #ffffff;
    --text: #162233;
    --muted: #627084;
    --line: #d3dce8;
    --primary: #123f6d;
    --primary-dark: #0b2d4e;
    --primary-soft: #e9f1f8;
    --accent: #e7f5ee;
    --accent-strong: #1f7a56;
    --danger: #b42318;
    --gold: #b68a32;
}

* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background:
        linear-gradient(180deg, #123f6d 0, #123f6d 176px, var(--bg) 176px),
        var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.6;
}

a { color: var(--primary); }

ruby rt {
    font-size: 0.58em;
    font-weight: 500;
    line-height: 1;
}

.page {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 52px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
    color: #ffffff;
}

.brand {
    margin: 0;
    font-size: 24px;
    font-weight: 750;
    letter-spacing: 0;
}

.topbar .muted { color: #d8e5f1; }

.topbar button {
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 8px 18px rgb(0 0 0 / 12%);
}

.topbar button:hover {
    background: #f4f8fb;
    color: var(--primary-dark);
}

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

.quick-links {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin: 0 0 18px;
    padding: 10px;
    border: 1px solid rgb(255 255 255 / 24%);
    border-radius: 8px;
    background: rgb(255 255 255 / 94%);
    box-shadow: 0 10px 24px rgb(13 35 61 / 14%);
    scrollbar-width: none;
}

.quick-links::-webkit-scrollbar {
    display: none;
}

.quick-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 82px;
    border: 1px solid #c9d6e2;
    border-radius: 999px;
    background: #ffffff;
    color: var(--primary-dark);
    padding: 8px 12px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
}

.quick-links a:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.panel[id] {
    scroll-margin-top: 78px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: 0 12px 28px rgb(24 44 70 / 8%);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 16px;
    font-size: 18px;
    color: var(--primary-dark);
    line-height: 1.35;
}

.section-title::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 22px;
    border-radius: 4px;
    background: var(--gold);
    flex: 0 0 auto;
}

.inline-title {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px;
}

.warning-note {
    color: var(--danger);
    font-size: 14px;
    font-weight: 700;
}

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

.metric {
    border: 1px solid #d9e3ec;
    border-radius: 8px;
    padding: 15px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
}

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

.metric strong {
    display: block;
    margin-top: 4px;
    font-size: 22px;
    color: var(--primary-dark);
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
    background: #ffffff;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 11px 10px;
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
}

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

tbody tr:nth-child(even) { background: #fbfdff; }

th {
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 650;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(180deg, rgb(18 63 109 / 94%) 0%, rgb(18 63 109 / 84%) 42%, var(--bg) 42%),
        var(--bg);
}

.login-card {
    width: min(420px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 18px 42px rgb(13 35 61 / 16%);
}

.login-card .brand {
    color: var(--primary-dark);
    padding-bottom: 12px;
    border-bottom: 3px solid var(--gold);
    margin-bottom: 12px;
}

label {
    display: block;
    margin: 14px 0 6px;
    font-weight: 650;
    color: var(--primary-dark);
}

input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px;
    font: inherit;
    background: #ffffff;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgb(18 63 109 / 12%);
    outline: none;
}

select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px;
    font: inherit;
    background: #fff;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 6px;
    background: var(--primary);
    color: white;
    padding: 11px 16px;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
    text-decoration: none;
}

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

.error {
    border: 1px solid #f5c2bd;
    background: #fff4f2;
    color: var(--danger);
    padding: 10px 12px;
    border-radius: 6px;
    margin: 14px 0;
}

.exam-block + .exam-block { margin-top: 22px; }

.month-block {
    border-top: 1px solid var(--line);
    padding-top: 18px;
    margin-top: 20px;
}

.month-block:first-of-type {
    border-top: 0;
    padding-top: 0;
    margin-top: 0;
}

.month-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 10px;
}

.month-heading h3 {
    margin: 0;
    font-size: 16px;
    color: var(--primary-dark);
}

.month-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
}

.month-summary span {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f8fbfd;
    padding: 2px 9px;
    white-space: nowrap;
}

.compact-table {
    min-width: 560px;
}

.badge {
    display: inline-flex;
    border-radius: 999px;
    background: var(--accent);
    padding: 2px 9px;
    color: var(--accent-strong);
    font-size: 13px;
    font-weight: 650;
}

.monthly-credit-mobile {
    display: none;
}

@media (max-width: 760px) {
    /*body {
        background:
            linear-gradient(180deg, #123f6d 0, #123f6d 140px, var(--bg) 140px),
            var(--bg);
    }*/

    .page {
        width: min(100% - 20px, 520px);
        padding: 14px 0 86px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        margin-bottom: 14px;
    }

    .quick-links {
        margin: 0 -2px 12px;
        padding: 8px;
    }

    .quick-links a {
        min-width: 76px;
        padding: 8px 11px;
        font-size: 14px;
    }

    .panel[id] {
        scroll-margin-top: 72px;
    }

    .brand {
        font-size: 21px;
        line-height: 1.3;
    }

    .topbar form:not(.logout-form),
    .topbar form:not(.logout-form) button {
        width: 100%;
    }

    .logout-form {
        position: fixed;
        right: 10px;
        bottom: 10px;
        z-index: 40;
        margin: 0;
    }

    .topbar .logout-form button {
        width: auto;
        border-radius: 999px;
        background: var(--primary);
        color: #ffffff;
        padding: 10px 15px;
        box-shadow: 0 10px 24px rgb(13 35 61 / 24%);
    }

    .topbar .logout-form button:hover {
        background: var(--primary-dark);
        color: #ffffff;
    }

    .section-title {
        font-size: 17px;
    }

    .metric {
        padding: 12px;
    }

    .metric strong {
        font-size: 19px;
    }

    .month-heading { flex-direction: column; }

    .month-summary { justify-content: flex-start; }

    .monthly-credit-desktop {
        display: none;
    }

    .monthly-credit-mobile {
        display: block;
    }

    .summary-grid { grid-template-columns: 1fr; }

    .panel {
        padding: 15px;
        margin-bottom: 12px;
        box-shadow: 0 8px 20px rgb(24 44 70 / 7%);
    }

    .table-wrap {
        overflow-x: visible;
        border: 0;
    }

    table,
    .compact-table {
        min-width: 0;
    }

    thead {
        display: none;
    }

    tbody,
    tr,
    td {
        display: block;
        width: 100%;
    }

    tr {
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #ffffff;
        padding: 8px 10px;
        margin-bottom: 10px;
        box-shadow: 0 4px 12px rgb(24 44 70 / 5%);
    }

    td {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        border-bottom: 1px solid #edf1f7;
        padding: 7px 0;
        white-space: normal;
        text-align: right;
    }

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

    td::before {
        content: attr(data-label);
        color: var(--muted);
        font-weight: 650;
        text-align: left;
        flex: 0 0 42%;
    }

    td:not([data-label]) {
        display: block;
        text-align: left;
    }

    td:not([data-label])::before {
        content: "";
        display: none;
    }

    td[data-label="教科"] {
        display: block;
        text-align: left;
        font-weight: 700;
    }

    td[data-label="教科"]::before {
        display: block;
        margin-bottom: 2px;
        font-size: 12px;
        font-weight: 650;
    }

    .login-shell {
        align-items: start;
        place-items: start center;
        padding: 16px 10px;
    }

    .login-card {
        padding: 22px 18px;
    }

    .login-card button {
        width: 100%;
    }
}

/*amano*/
/*header*/
.page-header{
    margin: 0;
    background: #fff;
    display: flex;
    justify-content: space-between;
}
.page-header p{
    font-size: 12px;
    color:#627084;
    padding: 20px 20px 0 0;
}

.topbar{
    width: 100vw!important;
    margin-left: calc(-50vw + 50%)!important;
    margin-right: calc(-50vw + 50%)!important;
    padding: 10px;
}

.page-header h1{
    margin: 0;
    padding: 10px 0 0 20px!important;
}

.page-header img{
    width: 100px;
}

.topbar{
    background: var(--primary);
}

#tuition-section strong{
    text-align: right;
}
/*入金金額*/
#tuition-section .metric:nth-child(2) strong{
    color: var(--accent-strong);
}
#tuition-section .metric:nth-child(2){
    background:linear-gradient(180deg, #ffffff 0%, var(--accent) 100%);
}
/*未払い*/
#tuition-section .metric:nth-child(3) strong{
    color: var(--danger)
}
#tuition-section .metric:nth-child(3){
    background:linear-gradient(180deg, #ffffff 0%, #ffe3e1 100%);
}
.section-title{
    align-items: flex-end;
}
.section-title-3{
    width: 100%;
   background:#beccda;
   border-radius: 20px;
   padding: 5px 20px;
}

/*取得単位について*/
#credit-section .metric:nth-child(2) strong{
    color: var(--accent-strong);
}
#credit-section .metric:nth-child(2){
    background:linear-gradient(180deg, #ffffff 0%, var(--accent) 100%);
}

#credit-section .metric:nth-child(3) strong{
    color: var(--danger)
}
#credit-section .metric:nth-child(3){
    background:linear-gradient(180deg, #ffffff 0%, #ffe3e1 100%);
}

#credit-section strong{
    text-align: right;
}

/* Compatibility fixes for current app requirements */
body {
    overflow-x: hidden;
}

@media (max-width: 760px) {
    .page {
        width: calc(100vw - 20px);
        max-width: 520px;
    }

    .quick-links {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: clamp(3px, 1.3vw, 7px);
        overflow-x: visible;
        margin: 0 0 12px;
        padding: clamp(5px, 1.8vw, 8px);
    }

    .quick-links a {
        min-width: 0;
        min-height: 42px;
        padding: 7px clamp(2px, 1.6vw, 8px);
        font-size: clamp(10px, 2.9vw, 14px);
        line-height: 1.08;
        white-space: normal;
        word-break: keep-all;
    }

    .quick-links rt {
        font-size: 0.55em;
    }

    .metric strong {
        overflow-wrap: anywhere;
    }
}
