:root {
    --primary: #3d8a6e;
    --primary-light: #e8f5f0;
    --primary-dark: #2d6b54;
    --accent-light: #fff0ec;
    --warn-light: #fff8ec;
    --red: #e05555;
    --red-light: #fff0f0;
    --bg: oldlace;
    --card: #ffffff;
    --text: #1e2a22;
    --text-mid: #5a6e63;
    --text-light: #9db0a6;
    --border: #e2ece8;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 4px 20px rgba(61,138,110,0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Noto Sans JP', 'Helvetica Neue', Arial, 'Hiragino Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

main {
    background: #fff;
}

/* =============================
   ログイン画面
============================= */
.login-wrap {
    max-width: 400px;
    margin: 100px auto;
    background: var(--card);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.login-wrap h1 {
    font-size: 1.2rem;
    text-align: center;
    margin-bottom: 24px;
    color: var(--primary);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 4px;
    color: #555;
}

.form-group input:not([type="checkbox"]) {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group input:not([type="checkbox"]):focus {
    outline: none;
    border-color: var(--primary);
}

button[type="submit"] {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 8px;
}

button[type="submit"]:hover {
    background: var(--primary-dark);
}

.error {
    background: #fdecea;
    color: #c0392b;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* =============================
   管理者ヘッダー（サイト名のみ）
============================= */
.site-header {
    background: var(--primary);
    color: #fff;
    padding: 12px 24px 3px;
}

.site-header h1 {
    font-size: 1.1rem;
    color: #fff;
    font-weight: bold;
    letter-spacing: 0.05em;
}

h2.page-title {
    text-align: center;
    font-size: 2rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 31px;
}

h3.section-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    margin: 51px 0px 24px 0px;
    text-align: center;
}

h3.section-title:first-of-type {
    margin-top: 0;
}

h4.subsection-title {
    font-size: 1rem;
    font-weight: bold;
    color: #555;
    margin: 12px 0 8px;
    padding-left: 8px;
    border-left: 3px solid var(--primary);
}

/* =============================
   保護者ヘッダー（スティッキー）
============================= */
.proxy-banner {
    background: #fff3e0;
    border-bottom: 2px solid #e67e22;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
}

.proxy-banner a {
    margin-left: auto;
    color: #e67e22;
    font-weight: bold;
    text-decoration: none;
    border: 1px solid #e67e22;
    padding: 3px 10px;
    border-radius: 4px;
}

.header {
    background: var(--primary);
    padding: 10px 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.header-top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: nowrap;
}

.header-left { display: flex; flex-direction: column; min-width: 0; }
.header-app-name { font-size: 13px; color: rgba(255,255,255,0.9); letter-spacing: 0.05em; font-weight: 500; }
.header-user { font-size: 16px; font-weight: 700; color: #fff; font-family: 'Zen Kaku Gothic New', sans-serif; }
.header-grade { font-size: 12px; color: rgba(255,255,255,0.8); margin-top: 1px; }
.header-uid { font-size: 11px; color: rgba(255,255,255,0.6); margin-left: 14px; }
.header-right { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.btn-header {
    font-size: 12px;
    font-family: 'Noto Sans JP', sans-serif;
    padding: 6px 14px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
}

.btn-hd-mypage { background: rgba(255,255,255,0.2); color: #fff; padding-top: 12px; padding-bottom: 12px; }
.btn-hd-logout { background: #fff; color: var(--primary); padding-top: 12px; padding-bottom: 12px; }
button.btn-hd-sibling { padding: 6px 14px; width: auto; margin-top: 0; }

.sibling-dropdown { position: relative; }

.sibling-dropdown-menu {
    display: none !important;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    min-width: 140px;
    z-index: 200;
    overflow: hidden;
}

.sibling-dropdown-menu.open { display: block !important; }

.sibling-dropdown-menu form { display: block; margin: 0; }

.sibling-dropdown-menu button {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 1px solid #f0f0f0;
    text-align: left;
    cursor: pointer;
    color: #333;
    font-size: 0.9rem;
    font-family: inherit;
}

.sibling-dropdown-menu form:last-child button { border-bottom: none; }

.sibling-dropdown-menu button:hover { background: #f5faf8; }
.btn-hd-sibling small { font-size: 0.75em; }

/* =============================
   ユーザー情報バー（管理者ナビ）
============================= */
.user-bar {
    background: var(--primary);
    border-bottom: 1px solid var(--primary-dark);
    padding: 0 24px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.88rem;
    color: rgba(255,255,255,0.9);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
}

.user-bar .user-name {
    font-weight: bold;
    color: #fff;
}

.user-bar .user-meta {
    color: rgba(255,255,255,0.7);
    margin-left: 8px;
}

/* ハンバーガーボタン（デスクトップでは非表示） */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    margin-left: auto;
}

.nav-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.user-bar a.logout-link {
    color: #fff;
    text-decoration: none;
    font-size: 0.85rem;
    border: 1px solid rgba(255,255,255,0.5);
    padding: 4px 10px;
    border-radius: 4px;
}

.user-bar a.logout-link:hover {
    background: rgba(255,255,255,0.15);
}

.user-bar-links {
    display: flex;
    gap: 12px;
    align-items: center;
}

.mypage-link {
    color: #fff;
    text-decoration: none;
    font-size: 0.85rem;
    border: 1px solid rgba(255,255,255,0.4);
    padding: 4px 10px;
    border-radius: 4px;
}

.mypage-link:hover {
    background: rgba(255,255,255,0.15);
}

.mypage-link.admin-only {
    background: #1a6eb5;
    background: rgba(255, 255, 255, 0.3); /* 50%透過の白 */
}
.mypage-link.admin-only:hover {
    background: #1558a0;
}

/* =============================
   管理者ナビ：モバイル対応
============================= */
@media (max-width: 768px) {
    .user-bar {
        padding: 10px 16px;
        gap: 0;
    }

    .nav-hamburger {
        display: flex;
    }

    .user-bar-links {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        width: 100%;
        border-top: 1px solid rgba(255,255,255,0.2);
        margin-top: 8px;
        padding-top: 4px;
        padding-bottom: 4px;
    }

    .user-bar-links.open {
        display: flex;
    }

    .user-bar-links .mypage-link,
    .user-bar-links a.logout-link {
        padding: 11px 4px;
        border: none;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        border-radius: 0;
        display: block;
        font-size: 0.95rem;
    }

    .user-bar-links .mypage-link:hover,
    .user-bar-links a.logout-link:hover {
        background: rgba(255,255,255,0.1);
        padding-left: 8px;
    }

    .user-bar-links a:last-child {
        border-bottom: none;
    }
}

/* =============================
   メインコンテンツ
============================= */
.main-wrap {
    max-width: 800px;
    margin: 32px auto;
    padding: 0 24px;
}

/* 保護者ダッシュボード用メイン */
.main {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px 16px 40px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.page-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 6px;
}

.note {
    font-size: 0.85rem;
    color: #777;
    margin-bottom: 20px;
    padding: 10px 14px;
    background: #fff8e1;
    border-left: 4px solid #f0c040;
    border-radius: 4px;
}

/* =============================
   カード
============================= */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: fadeUp 0.4s ease both;
    border:1px solid #cccccc;
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.10s; }
.card:nth-child(3) { animation-delay: 0.15s; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.card-header {
    padding: 0px 10px 0px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
}

.icon-green  { background: rgba(255,255,255,0); }
.icon-orange { background: rgba(255,255,255,0); }
.icon-blue   { background: rgba(255,255,255,0);}

.card-header.bg-green  { background: mediumseagreen; }
.card-header.bg-orange { background: sandybrown; }
.card-header.bg-blue   { background: cornflowerblue; }

.card-title {
    font-size: 16px; font-weight: 700;
    font-family: 'Zen Kaku Gothic New', sans-serif;
    color: var(--text);
}

.card-body { padding: 16px 20px; }

/* =============================
   アラート
============================= */
.alert {
    background: var(--warn-light);
    border: 1px solid #f5d88a;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 13px;
    color: #7a5500;
    line-height: 1.6;
    margin-bottom: 14px;
}

.alert a { color: var(--primary-dark); font-weight: 700; text-decoration: none; }

/* =============================
   アクションボタン（保護者ダッシュボード）
============================= */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.btn-primary {
    background: var(--primary); color: #fff;
    border: none; border-radius: var(--radius-sm);
    padding: 13px 10px; font-size: 14px; font-weight: 700;
    font-family: 'Noto Sans JP', sans-serif;
    cursor: pointer; text-decoration: none;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    transition: background 0.15s, transform 0.1s;
}

.btn-primary:active { transform: scale(0.97); background: var(--primary-dark); }

.btn-secondary {
    background: var(--primary-light); color: var(--primary-dark);
    border: none; border-radius: var(--radius-sm);
    padding: 13px 10px; font-size: 14px; font-weight: 700;
    font-family: 'Noto Sans JP', sans-serif;
    cursor: pointer; text-decoration: none;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    transition: background 0.15s, transform 0.1s;
}

.btn-secondary:active { transform: scale(0.97); background: #d0ede5; }

/* =============================
   セクションラベル
============================= */
.section-label {
    font-size: 12px; font-weight: 700;
    color: var(--text-light);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

/* =============================
   欠席リスト（保護者ダッシュボード）
============================= */
.absence-list { display: flex; flex-direction: column; gap: 8px; }

.absence-item {
    display: flex; align-items: center;
    background: #f7f8fa;
    border-radius: var(--radius-sm);
    padding: 12px 14px; gap: 12px;
}

.absence-date { font-size: 14px; font-weight: 700; color: var(--text); min-width: 90px; }
.absence-reason { font-size: 13px; color: var(--text-mid); flex: 1; }

.btn-edit {
    font-size: 12px; font-family: 'Noto Sans JP', sans-serif;
    padding: 5px 12px; border-radius: 6px;
    border: 1px solid var(--primary); background: #fff;
    color: var(--primary); cursor: pointer; font-weight: 500;
    white-space: nowrap; text-decoration: none;
    transition: background 0.15s;
    display: inline-block;
}

.btn-edit:active { background: var(--primary-light); }

/* =============================
   提出ステータス（保護者ダッシュボード）
============================= */
.submit-status {
    display: flex; align-items: center; gap: 10px;
    border-radius: var(--radius-sm);
    padding: 14px 16px; margin-bottom: 14px;
}

.submit-status.is-submitted  { background: #edfaf4; border: 1px solid #a8e6cc; }
.submit-status.not-submitted { background: var(--warn-light); border: 1px solid #f5d88a; }

.status-icon { font-size: 22px; line-height: 1; }
.status-text { flex: 1; }
.status-label-ok   { font-size: 14px; font-weight: 700; color: #1a7a4a; }
.status-label-warn { font-size: 14px; font-weight: 700; color: #7a5500; }
.status-date { font-size: 12px; color: var(--text-mid); margin-top: 2px; }

.parent-footer {
    text-align: center;
    padding: 24px 16px 32px;
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.8;
}

.parent-footer a {
    color: var(--text-light);
    text-decoration: none;
}

.today-status-bar {
    text-align: center;
    font-size: 1.2rem;
    color: var(--text-mid);
    padding: 10px 16px 4px;
}

/* =============================
   タブ（保護者マイページ）
============================= */
.tab-bar {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin: 12px 0 0;
}

.tab-btn {
    flex: 1;
    padding: 12px 8px;
    text-align: center;
    font-size: 0.95rem;
    font-weight: bold;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    color: var(--text-mid);
    transition: color 0.15s, border-color 0.15s;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-btn:not(.active):hover {
    color: var(--text);
    background: var(--primary-light);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.status-outside {
    background: #f5f5f5; border: 1px solid #ddd;
    border-radius: var(--radius-sm); padding: 14px 16px;
    font-size: 13px; color: var(--text-mid); margin-bottom: 14px;
}

.btn-resubmit {
    font-size: 13px; font-family: 'Noto Sans JP', sans-serif;
    padding: 8px 16px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: #fff;
    color: var(--text-mid); cursor: pointer; font-weight: 500;
    white-space: nowrap; text-decoration: none; display: inline-block;
    transition: background 0.15s;
}

.btn-submit {
    font-size: 13px; font-family: 'Noto Sans JP', sans-serif;
    padding: 8px 16px; border-radius: var(--radius-sm);
    border: none; background: var(--primary); color: #fff;
    cursor: pointer; font-weight: 700;
    white-space: nowrap; text-decoration: none; display: inline-block;
}

/* =============================
   月ラベル
============================= */
.month-label {
    font-size: 18px; font-weight: 700;
    font-family: 'Zen Kaku Gothic New', sans-serif;
    color: var(--text); margin-bottom: 12px;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}

.month-label + .month-label { margin-top: 28px; }

/* =============================
   カレンダーテーブル（保護者ダッシュボード用）
============================= */
.calendar-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 4px;
    font-size: 13px;
}

.calendar-table thead th {
    font-size: 11px; font-weight: 700;
    color: var(--text-light);
    padding: 4px 8px 8px;
    text-align: center;
    letter-spacing: 0.05em;
}

.calendar-table tbody tr { background: #f7f8fa; }
.calendar-table tbody tr.weekend-sat td { background: #eef2ff; color: #3355cc; }
.calendar-table tbody tr.weekend-sun td { background: var(--red-light); color: var(--red); }

.calendar-table td {
    padding: 9px 8px;
    text-align: center;
}

.calendar-table td:first-child { border-radius: 8px 0 0 8px; font-weight: 700; }
.calendar-table td:last-child  { border-radius: 0 8px 8px 0; }

/* =============================
   ステータス表示
============================= */
.status {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.status.submitted     { background: #e8f5e9; color: #2e7d32; }
.status.not-submitted { background: #fff8e1; color: #f57f17; }
.status.outside       { background: #f5f5f5; color: #777; }

/* =============================
   標準お迎え時間
============================= */
.default-time-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--primary-light);
    padding: 14px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.default-time-wrap > div {
    display: flex;
    align-items: center;
    gap: 12px;
}

.default-time-wrap label {
    font-size: 0.9rem;
    font-weight: bold;
    color: #333;
    white-space: nowrap;
}

.default-time-wrap select {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
}

.btn-apply {
    padding: 8px 16px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
}

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

.btn-apply.btn-apply-off {
    background: #9e9e9e;
}

.btn-apply.btn-apply-off:hover {
    background: #757575;
}

/* =============================
   出欠テーブル
============================= */
.attendance-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
}

.attendance-table th,
.attendance-table td {
    border: 1px solid #ddd;
    padding: 10px 12px;
    text-align: left;
}

.attendance-table th {
    background: var(--primary);
    color: #fff;
    font-size: 0.9rem;
}

.attendance-table tr.sat td {
    background: #e8f4fc;
    color: #1a6eb5;
}

.attendance-table tr.sun td {
    background: #fdecea;
    color: #c0392b;
}

.no-input {
    color: #ccc;
    font-size: 0.9rem;
}

.time-select {
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* =============================
   ボタン・アクション
============================= */
.form-actions {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-top: 8px;
}

.btn {
    display: inline-block;
    padding: 10px 24px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.95rem;
    cursor: pointer;
}

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

.btn-cancel {
    color: #777;
    font-size: 0.9rem;
    text-decoration: none;
}

.btn-cancel:hover {
    text-decoration: underline;
}

/* =============================
   欠席フォーム
============================= */
.absence-form {
    background: var(--card);
    padding: 24px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 32px;
}

.absence-form .form-group {
    margin-bottom: 20px;
}

.absence-form label {
    display: block;
    font-size: 0.88rem;
    font-weight: bold;
    color: #555;
    margin-bottom: 6px;
}

.absence-form select,
.absence-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
}

.absence-form select:focus,
.absence-form textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.checkbox-date-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-date-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: normal;
    background: #fff;
    transition: background 0.15s;
}

.checkbox-date-item:has(input:checked) {
    background: #e8f5f0;
    border-color: var(--primary);
}

.checkbox-date-item.already-absent,
.checkbox-date-item.already-absent:has(input:checked) {
    background: #fff;
    border-color: #ddd;
}

.checkbox-date-item.already-absent .date-label {
    color: #e07800;
}

.checkbox-date-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.badge-submitted {
    margin-left: auto;
    font-size: 0.75rem;
    color: #e07800;
    background: #fff3d6;
    border: 1px solid #e07800;
    border-radius: 4px;
    padding: 1px 6px;
}

.section-title {
    font-size: 1rem;
    font-weight: bold;
    color: #555;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid #ddd;
}

/* =============================
   ダッシュボードセクション
============================= */
.dashboard-date {
    font-size: 1rem;
    font-weight: bold;
    color: var(--text-mid);
    margin: -12px 0 20px;
}

.dashboard-section {
    background: var(--card);
    padding: 24px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

/* =============================
   バッジ
============================= */
.badge {
    display: inline-block; padding: 3px 10px;
    border-radius: 20px; font-size: 12px; font-weight: 700;
    white-space: nowrap;
}

/* 新スタイルバッジ（保護者ダッシュボード用） */
.badge-attend       { background: #dcf5eb; color: #1a7a4a; padding: 2px 8px; border-radius: 20px; font-size: 0.8rem; font-weight: 700; }
.badge-absent       { background: #fdecea; color: #c0392b; padding: 2px 8px; border-radius: 20px; font-size: 0.8rem; font-weight: 700; }
.badge-reply        { background: #fff3cd; color: #b45309; padding: 2px 8px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; margin-left: 6px; }
.badge-absent-done  { background: #ffe8e8; color: #cc3333; }
.badge-facility-off { background: #fff0e0; color: #cc6600; }
.badge-holiday      { background: var(--border); color: var(--text-light); }
.badge-none         { background: #f5f5f5; color: #999; padding: 2px 8px; border-radius: 20px; font-size: 0.8rem; }
.badge-unconfirmed  { background: #fff8e1; color: #f57f17; padding: 2px 8px; border-radius: 20px; font-size: 0.8rem; }

/* Lunch badges */
.badge-lunch    { background: #e8f5e9; color: #2e7d32; font-size: 11px; padding: 2px 7px; border-radius: 10px; }
.badge-no-lunch { background: #f5f5f5; color: #aaa;    font-size: 11px; padding: 2px 7px; border-radius: 10px; }

/* =============================
   学校形態バッジ
============================= */
.school-type-badge {
    display: inline-block;
    font-size: 0.72rem;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 4px;
    vertical-align: middle;
}

.badge-long_holiday    { background: #e3f2fd; color: #1a6eb5; }
.badge-half_day        { background: #fff3e0; color: #e67e22; }
.badge-half_day_1f     { background: #fef6e0; color: #b45309; }
.badge-facility_closed { background: #fce4ec; color: #c0392b; }

/* ミニ形態バッジ（保護者ダッシュボード） */
.type-badge {
    display: inline-block; font-size: 10px; font-weight: 700;
    padding: 1px 5px; border-radius: 4px; margin-left: 3px;
    vertical-align: middle;
}

.type-long_holiday    { background: #e3f2fd; color: #1a6eb5; }
.type-half_day        { background: #fff3e0; color: #e67e22; }
.type-half_day_1f     { background: #fef6e0; color: #b45309; }

/* =============================
   管理者：サマリバー
============================= */
.summary-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--card);
    padding: 14px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.summary-item {
    font-size: 0.95rem;
    color: #333;
}

/* =============================
   フィルタバー
============================= */
.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 6px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
    text-decoration: none;
    color: #555;
    background: var(--card);
}

.filter-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.filter-btn:hover {
    background: var(--primary-light);
}

/* =============================
   小さいボタン
============================= */
.btn-small {
    display: inline-block;
    padding: 4px 10px;
    background: var(--primary);
    color: #fff;
    border-radius: 4px;
    font-size: 0.8rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

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

.btn-small.btn-danger { background: #c0392b; }
.btn-small.btn-danger:hover { background: #962d22; }

.btn-date-nav {
    display: inline-block;
    padding: 3px 8px;
    background: none;
    color: var(--text-light);
    font-size: 0.82rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    cursor: pointer;
}
.btn-date-nav:hover { background: var(--bg); color: var(--text-mid); }

/* 出席予定提出状況 サマリー行 */
.submission-summary-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}
.submission-summary-row:hover { background: var(--primary-light); }
.submission-label {
    font-weight: bold;
    min-width: 120px;
}
.submission-count {
    font-size: 0.9rem;
    color: var(--text-mid);
}
.submission-toggle-icon {
    margin-left: auto;
    color: var(--text-light);
    font-size: 0.8rem;
}
.submission-detail {
    border-bottom: 1px solid var(--border);
}

/* =============================
   ソートリンク
============================= */
.sort-link {
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
}

.sort-link:hover {
    text-decoration: underline;
}

/* =============================
   出席・欠席行の色分け
============================= */
.row-attend td,
.row-absent td,
.row-no-report td {
    background: var(--card);
}

.table-attend th { background: #2e7d32; }
.table-absent th { background: #c0392b; }
.table-unconfirmed th { background: #777777; }

/* =============================
   クラス別文字色
============================= */
.class-1f td, .class-2f td { color: var(--text); }

/* =============================
   クラス別欠席サマリ
============================= */
.class-summary-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.class-summary-item {
    background: var(--card);
    padding: 10px 16px;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    display: flex;
    gap: 12px;
    align-items: baseline;
}

.class-summary-label {
    font-weight: bold;
    font-size: 0.9rem;
    white-space: nowrap;
}

.class-summary-names { font-size: 0.9rem; }

.class-summary-item.class-1f .class-summary-label,
.class-summary-item.class-1f .class-summary-names { color: var(--class-1f-bg); }

.class-summary-item.class-2f .class-summary-label,
.class-summary-item.class-2f .class-summary-names { color: var(--class-2f-bg); }

/* 危険ボタン */
.btn-danger { background: #c0392b; color: #fff; }
.btn-danger:hover { background: #a93226; }

/* 月次集計テーブル */
.stat-cell {
    padding: 6px 12px !important;
    line-height: 1.6;
}

.stat-attend { color: #2e7d32; font-weight: bold; font-size: 1.5rem; }
.stat-absent { color: #c0392b; font-weight: bold; font-size: 1.5rem; }
.stat-unsubmitted { color: #f57f17; font-weight: normal; }
.stat-lunch { color: #2e7d32; font-weight: bold; }

.monthly-table th,
.monthly-table td { width: 1%; }

.monthly-table .col-total { background: #f5f5f5; }

.detail-row td {
    background: var(--card);
    padding: 10px 16px;
}

/* =============================
   給食チェックボックス
============================= */
.lunch-check {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 6px;
    font-size: 0.85rem;
    color: #2e7d32;
}

.lunch-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.weekday { background: var(--card); }

/* =============================
   管理者：出席集計テーブル
============================= */
.att-table {
    border-collapse: collapse;
    font-size: 0.78rem;
    width: 100%;
    margin-bottom: 32px;
}

.att-table th, .att-table td {
    border: 1px solid #ccc;
    padding: 3px 5px;
    text-align: center;
    white-space: nowrap;
}

.att-table th.name-col,
.att-table td.name-col {
    text-align: left;
    min-width: 80px;
}

.att-table thead th { background: #f0f0f0; }
.att-table tbody tr:nth-child(even) { background: #f5f7fa; }
.att-table tbody tr:nth-child(odd)  { background: #ffffff; }

.col-summary-attend { background: #dceefb; }
.col-summary-absent { background: #fde8e8; }
.col-summary-snack  { background: #fff8e1; }
.col-summary-lunch  { background: #e8f5e9; }

.class-title-1f {
    background: var(--class-1f-bg);
    color: var(--class-1f-text);
    font-size: 1rem;
    font-weight: bold;
    padding: 6px 10px;
    margin: 0 0 6px 0;
    border-radius: 4px 4px 0 0;
}

.class-title-2f {
    background: var(--class-2f-bg);
    color: var(--class-2f-text);
    font-size: 1rem;
    font-weight: bold;
    padding: 6px 10px;
    margin: 0 0 6px 0;
    border-radius: 4px 4px 0 0;
}

.col-sat           { background: #e8e8e8 !important; color: #1a6eb5; font-weight: bold; }
.cell-attend       { background: #e8f5e9; color: #2e7d32; font-weight: bold; }
.cell-absent       { background: #ffebee; color: #c62828; }
.cell-abs-contact  { background: #fff3e0; color: #e65100; font-weight: bold; }
.cell-none         { color: #ccc; }
.snack-mark        { color: #f57f17; font-size: 1em; }
.abs-admin-badge   { display:inline-block; font-size:0.62em; background:#e65100; color:#fff; border-radius:2px; padding:0 2px; margin-left:2px; vertical-align:super; font-weight:bold; }
.abs-reason        { display:block; font-size:0.65em; color:#e65100; line-height:1.2; }
.lunch-mark        { color: #2e7d32; font-size: 1em; }
.school-type-mark  { font-size: 0.68em; display: block; color: #888; }
.row-total         { background: #f5f5f5; font-weight: bold; }
.row-snack         { background: #fff8e1; }
.col-snack         { background: #fff8e1; }
.row-lunch         { background: #e8f5e9; }
.col-lunch         { background: #f0f0f0; }

.print-btn {
    display: inline-block;
    padding: 6px 16px;
    background: #555;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    margin-left: 12px;
}

.print-title { display: none; }

@media print {
    @page { size: A4 landscape; margin: 10mm; }
    .site-header, .user-bar, .no-print { display: none !important; }
    body { font-size: 9px; }
    .main-wrap { max-width: 100% !important; padding: 0 !important; }
    .print-title { display: block !important; font-size: 13px; font-weight: bold; margin-bottom: 8px; }
    .att-table { font-size: 0.65rem; margin-bottom: 16px; }
    .att-table th, .att-table td { padding: 2px 3px; }
    .class-section { page-break-inside: avoid; }
    .pickup-time { display: none; }
    .cell-attend { background: #fff !important; }
}

/* =============================
   管理者：カレンダーグリッド
============================= */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 16px;
}

.calendar-month {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.calendar-month-title {
    background: var(--primary);
    color: #fff;
    padding: 8px 12px;
    font-weight: bold;
    font-size: 0.95rem;
}

.calendar-month table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.calendar-month td, .calendar-month th {
    padding: 5px 8px;
    border-bottom: 1px solid #eee;
    text-align: center;
}

.calendar-month th {
    background: #f5f5f5;
    font-weight: normal;
    color: #555;
}

.calendar-month td:last-child { text-align: left; }

.calendar-month select {
    font-size: 0.82rem;
    padding: 2px 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
}

.type-normal          { color: #333; }
.type-long_holiday    { color: #1a6eb5; font-weight: bold; }
.type-half_day        { color: #e67e22; font-weight: bold; }
.type-half_day_1f     { color: #b45309; font-weight: bold; }
.type-facility_closed { color: #c0392b; font-weight: bold; }

.row-weekday { background: var(--card); }
.row-sun     { background: #fff5f5; }
.row-sat     { background: #f0f5ff; }
.row-holiday { background: #fff5f5; }

/* =============================
   管理者：モーダル
============================= */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal-box {
    background: var(--card);
    border-radius: 8px;
    padding: 24px;
    width: 420px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-box h3 { margin: 0 0 16px; font-size: 1rem; }
.modal-box .form-group { margin-bottom: 12px; }
.modal-box label { display: block; font-size: 0.82rem; color: #555; margin-bottom: 3px; }
.modal-box input, .modal-box select {
    width: 100%; padding: 6px 8px; border: 1px solid #ccc;
    border-radius: 4px; font-size: 0.9rem; box-sizing: border-box;
}
.modal-box .form-actions { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }
.child-only { display: none; }

/* =============================
   管理者：メッセージ
============================= */
.badge-unread {
    background: #c0392b;
    color: #fff;
    font-size: 0.72rem;
    padding: 1px 7px;
    border-radius: 10px;
    margin-left: 6px;
}

.msg-body-row { display: none; }
.msg-body-row.open { display: table-row; }

.msg-body-cell {
    background: #fffff8;
    padding: 12px 20px;
    text-align: left;
    white-space: pre-wrap;
    font-size: 0.9rem;
    color: #444;
    border-top: none;
}

.row-unread td { font-weight: bold; }

/* ===== 操作ログ ===== */
.log-row td { padding: 6px 10px; font-size: 0.88rem; }
.log-danger  { background: #fff0f0; }
.log-danger td { color: #c0392b; }
.log-warn    { background: #fff8e1; }
.log-auth    { background: #f0f8ff; }
.log-checkin { background: #f0fff4; }
.log-submit  { background: #fafafa; }
.log-default {}

.log-action-badge {
    display: inline-block;
    font-size: 0.78rem;
    padding: 2px 7px;
    border-radius: 4px;
    background: #e8ecf0;
    color: #444;
    white-space: nowrap;
}
.log-action-login         { background: #e3f2fd; color: #1a6eb5; }
.log-action-logout        { background: #f3e5f5; color: #6a1b9a; }
.log-action-login_failed  { background: #ffebee; color: #c0392b; font-weight: bold; }
.log-action-absence_delete,
.log-action-absence_bulk_delete { background: #ffebee; color: #c0392b; }
.log-action-checkin       { background: #e8f5e9; color: #2e7d32; }
.log-action-checkout      { background: #fff3e0; color: #e65100; }
.log-action-checkin_cancel { background: #fce4ec; color: #880e4f; }
.log-action-user_add      { background: #e8f5e9; color: #2e7d32; }
.log-action-user_edit     { background: #fff8e1; color: #f57f17; }
.log-action-user_delete   { background: #ffebee; color: #c0392b; }

.toggle-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: underline;
    padding: 0;
}

/* =============================
   管理者：ユーザー管理バッジ
============================= */
.badge-usage {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 3px;
}
.badge-annual {
    background: #e3f2fd;
    color: #1a6eb5;
}

#childTable th,
#otherTable th                { text-align: center; }
#childTable td:nth-child(3),
#childTable td:nth-child(4),
#childTable td:nth-child(5)   { text-align: center; }
#otherTable td                { text-align: center; }

th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable::after { content: ' ↕'; color: #bbb; font-size: 0.8em; }
th.sortable[data-sort="asc"]::after  { content: ' ↑'; color: var(--primary); }
th.sortable[data-sort="desc"]::after { content: ' ↓'; color: var(--primary); }

/* =============================
   管理者：利用児童数統計
============================= */
.stats-table {
    border-collapse: collapse;
    font-size: 0.85rem;
    margin: 0 auto 32px;
}

.stats-table th, .stats-table td {
    border: 1px solid #ccc;
    padding: 6px 14px;
    text-align: center;
}

.stats-table thead th {
    background: #f0f0f0;
    font-weight: bold;
}

.stats-table td.label-col {
    text-align: left;
    font-weight: bold;
    background: #f8f8f8;
}

.stats-table tr.total-row td {
    background: #f0f0f0;
    font-weight: bold;
}

.highlight { background: #e8f5e9; font-weight: bold; }

.attendance-table tbody tr.row-link:hover {
    filter: brightness(0.93);
}

/* =============================
   クラスダッシュボード
============================= */
.class-dashboard-header {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 28px;
    padding: 21px 0 0 0;
}

.class-dashboard-date {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text);
}

.class-dashboard-tabs {
    display: flex;
    gap: 8px;
}

.class-tab {
    display: inline-block;
    padding: 8px 28px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    background: var(--card);
    color: var(--text-mid);
    font-weight: bold;
    font-size: 1rem;
    text-decoration: none;
    transition: opacity 0.15s;
}

.class-tab.active {
    border-color: transparent;
}

.class-tab:not(.active):hover {
    background: var(--primary-light);
}

.class-dashboard-summary {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.cd-summary-item {
    font-size: 1rem;
    font-weight: bold;
    padding: 6px 16px;
    border-radius: 20px;
}

.cd-summary-item.arriving {
    background: #e8f5e9;
    color: #2e7d32;
}

.cd-summary-item.present {
    background: #e53935;
    color: #fff;
}

.cd-summary-item.left {
    background: #1976d2;
    color: #fff;
}

.cd-summary-item.absent {
    background: #eeeeee;
    color: #757575;
}

.cd-summary-item.unconfirmed {
    background: #9e9e9e;
    color: #fff;
}

.class-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.child-card {
    border-radius: var(--radius-sm);
    padding: 24px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 1.05rem;
    font-weight: bold;
    min-height: 80px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.child-card-arriving {
    background: #fff;
    color: #2e7d32;
    border: 2px solid #a5d6a7;
}

.child-card-present {
    background: #e53935;
    color: #fff;
}

.child-card-left {
    background: #1976d2;
    color: #fff;
}

.child-card-absent {
    background: #bdbdbd;
    color: #fff;
}

.child-card-absent.usage-long-holiday {
    background: #eeeeee;
    color: #9e9e9e;
}

.child-card-unconfirmed {
    background: #9e9e9e;
}

.child-card.clickable {
    cursor: pointer;
    user-select: none;
}

.child-card.clickable:active {
    filter: brightness(0.88);
}

/* チェックインモーダル */
.cd-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.cd-modal {
    background: #fff;
    border-radius: var(--radius);
    padding: 36px 32px 28px;
    width: min(90vw, 360px);
    text-align: center;
    box-shadow: 0 8px 40px rgba(0,0,0,0.25);
}

.cd-modal-name {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text);
    margin-bottom: 6px;
}

.cd-modal-meta {
    font-size: 0.9rem;
    color: var(--text-mid);
    margin-bottom: 28px;
}

.cd-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (max-width: 600px) {
    .class-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
