* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
    background: #f6f7fb;
    color: #222;
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 24px;
    background: #111827;
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand { font-weight: 800; font-size: 18px; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 8px; }
.topbar nav a, .nav-logout-form button {
    padding: 8px 12px;
    border-radius: 8px;
    color: #e5e7eb;
}
.nav-logout-form { display: inline; margin: 0; }
.nav-logout-form button { border: 0; background: transparent; font: inherit; cursor: pointer; }
.topbar nav a.active, .topbar nav a:hover, .nav-logout-form button:hover { background: #374151; color: #fff; }
.container { max-width: 1180px; margin: 24px auto; padding: 0 18px; }
.footer { text-align: center; color: #777; padding: 24px; }
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}
h1 { margin: 0; font-size: 28px; }
h2 { margin: 0 0 14px; font-size: 20px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 18px;
    box-shadow: 0 4px 18px rgba(15, 23, 42, .04);
}
.card.narrow { max-width: 680px; }
.card.highlight { background: linear-gradient(135deg, #fff, #f2f7ff); }
.grid.two { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; }
.dashboard-layout {
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    grid-template-areas:
        "today stats"
        "future future";
    gap: 18px;
}
.dashboard-today-card { grid-area: today; }
.dashboard-stats-card { grid-area: stats; }
.dashboard-future-card { grid-area: future; }
.dashboard-layout > .card { margin-bottom: 0; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    padding: 8px 14px;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    background: #fff;
    color: #111827;
    cursor: pointer;
    font-size: 14px;
}
.btn:hover { background: #f9fafb; }
.btn.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn.primary:hover { background: #1d4ed8; }
.btn.danger { color: #b91c1c; border-color: #fecaca; }
.btn.danger:hover { background: #fff1f2; }
.btn.small { min-height: 30px; padding: 5px 9px; font-size: 13px; }
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 11px 10px;
    border-bottom: 1px solid #edf0f5;
    text-align: left;
    vertical-align: middle;
}
th { background: #f9fafb; font-weight: 700; color: #374151; }
tr:hover td { background: #fcfcfd; }
.avatar {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    color: #6b7280;
    font-weight: 700;
}
.avatar.large { width: 72px; height: 72px; font-size: 24px; }
.avatar.xlarge { width: 104px; height: 104px; font-size: 34px; }
.person-link { color: #2563eb; font-weight: 700; }
.person-link:hover { text-decoration: underline; }
.person-profile { display: flex; gap: 22px; align-items: flex-start; }
.person-profile-main { flex: 1; min-width: 0; }
.person-overview-card .person-profile { display: grid; grid-template-columns: auto minmax(210px, .65fr) minmax(420px, 1.6fr); }
.person-profile-introduction {
    min-width: 0;
    padding-left: 24px;
    border-left: 1px solid #e5e7eb;
}
.person-profile-introduction h2 { margin-bottom: 12px; }
.person-profile-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.person-profile-title h2 { margin: 0; font-size: 25px; }
.person-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; margin-top: 18px; }
.person-meta div { display: grid; gap: 3px; }
.person-meta span { color: #6b7280; font-size: 13px; }
.person-content { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.today-duty { display: flex; gap: 16px; align-items: center; }
.duty-name { font-size: 24px; font-weight: 800; }
.schedule-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
    gap: 14px;
}
.schedule-person-card {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
    padding: 15px;
    border: 1px solid #e5e7eb;
    border-radius: 13px;
    background: linear-gradient(135deg, #fff, #f8faff);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.schedule-person-card:hover {
    transform: translateY(-2px);
    border-color: #bfdbfe;
    box-shadow: 0 8px 20px rgba(37, 99, 235, .10);
}
.schedule-avatar { width: 58px; height: 58px; flex: 0 0 58px; font-size: 20px; }
.schedule-card-body { flex: 1; min-width: 0; }
.schedule-card-name { font-size: 17px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schedule-card-title { color: #6b7280; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schedule-card-date { margin-top: 5px; color: #374151; font-size: 14px; font-weight: 600; }
.mentor-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}
.team-sort-bar { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 16px; }
.team-sort-bar > span { color: #6b7280; font-size: 14px; }
.team-sort-bar a {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-size: 13px;
}
.team-sort-bar a:hover { background: #f9fafb; }
.team-sort-bar a.active { border-color: #2563eb; background: #2563eb; color: #fff; }
.mentor-card {
    display: block;
    padding: 18px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: linear-gradient(135deg, #fff, #f8faff);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.mentor-card-main { display: flex; align-items: flex-start; gap: 16px; }
.team-mentor-card {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 0;
    padding: 14px;
}
.team-mentor-card .mentor-avatar {
    width: 80px;
    height: 80px;
    flex-basis: 80px;
}
.team-mentor-card .mentor-card-content {
    min-height: 0;
    justify-content: center;
}
.team-mentor-card .mentor-card-content h2 { font-size: 18px; }
.mentor-card:hover {
    transform: translateY(-2px);
    border-color: #bfdbfe;
    box-shadow: 0 8px 22px rgba(37, 99, 235, .10);
}
.mentor-avatar { width: 72px; height: 72px; flex: 0 0 72px; font-size: 25px; }
.mentor-card-content { display: flex; flex-direction: column; min-width: 0; min-height: 78px; }
.mentor-card-content h2 { margin: 0; font-size: 20px; }
.mentor-title { min-height: 20px; margin: auto 0 0; padding-top: 8px; color: #2563eb; font-weight: 700; }
.mentor-share-topic {
    display: -webkit-box;
    width: 100%;
    margin: 8px 0 0;
    overflow: hidden;
    color: #4b5563;
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.mentor-next-date, .mentor-share-count { display: flex; margin: 4px 0 0; font-size: 14px; }
.mentor-next-date { flex-wrap: nowrap; white-space: nowrap; }
.mentor-next-date span, .mentor-share-count span { color: #6b7280; }
.mentor-next-date strong, .mentor-share-count strong { color: #374151; }
.muted { color: #6b7280; font-size: 13px; }
.empty { color: #6b7280; margin: 8px 0; }
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-muted { background: #f3f4f6; color: #4b5563; }
.badge-info { background: #dbeafe; color: #1d4ed8; }
.alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
    border: 1px solid transparent;
}
.alert-success { background: #ecfdf5; border-color: #bbf7d0; color: #166534; }
.alert-error { background: #fff1f2; border-color: #fecdd3; color: #9f1239; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.form { display: grid; gap: 16px; }
.form label { display: grid; gap: 7px; font-weight: 700; }
.form label span b { color: #dc2626; }
.form input, .form select, .form textarea, .filter-form input, .inline-form select {
    width: 100%;
    min-height: 38px;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    padding: 8px 10px;
    background: #fff;
    font-size: 14px;
}
.form textarea {
    min-height: 110px;
    resize: vertical;
    font-family: inherit;
}
.person-form-card { max-width: 980px; }
.person-edit-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
}
.person-edit-form .wide-field { grid-column: 1 / -1; }
.person-edit-form textarea { min-height: 88px; }
.compact-avatar-upload { display: flex; align-items: center; gap: 12px; }
.compact-avatar-upload > div:last-child { flex: 1; min-width: 0; }
.compact-avatar-upload small { display: block; margin-top: 3px; }
.person-edit-form .form-actions { margin-top: 2px; }
.history-editor-heading { margin-bottom: 14px; }
.history-editor-heading h2, .history-editor-heading p { margin-bottom: 0; }
.history-add-form {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
    padding: 14px;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    background: #eff6ff;
}
.history-add-title > div { display: grid; gap: 3px; }
.history-add-title strong { font-size: 17px; }
.history-add-title span { color: #6b7280; font-size: 13px; }
.history-add-fields {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    align-items: stretch;
    gap: 16px;
}
.history-replay-field { grid-column: 2; }
.history-add-date-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.history-add-date-actions .btn { width: 100%; margin-top: auto; }
.history-add-form label { display: grid; gap: 6px; font-weight: 700; }
.history-add-form input, .history-add-form textarea {
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    background: #fff;
    font: inherit;
}
.schedule-replay-link { color: #2563eb; font-size: 13px; font-weight: 700; white-space: nowrap; }
.schedule-replay-link:hover { text-decoration: underline; }
.schedule-topic-replay {
    display: inline-flex;
    align-items: flex-start;
    gap: .5em;
    color: #2563eb;
    font-weight: 400;
    text-decoration: none;
}
.schedule-topic-replay:hover {
    color: #1d4ed8;
}
.schedule-topic-link-text {
    text-decoration: underline;
    text-decoration-color: #94a3b8;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}
.schedule-topic-replay:hover .schedule-topic-link-text { text-decoration-color: #1d4ed8; }
.replay-link-icon {
    flex: 0 0 auto;
    margin-top: 2px;
    color: #94a3b8;
    font-size: 13px;
    line-height: 1.4;
}
.schedule-topic-replay:hover .replay-link-icon { color: #2563eb; }
.history-add-form textarea { min-height: 110px; resize: vertical; }
.history-edit-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.history-edit-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
}
.history-edit-card:hover { border-color: #bfdbfe; }
.history-edit-select { padding-top: 2px; cursor: pointer; }
.history-edit-list input { width: 17px; height: 17px; }
.history-edit-card-content { min-width: 0; }
.history-edit-card-content strong { display: block; }
.history-edit-card-content p {
    display: -webkit-box;
    margin: 4px 0 0;
    overflow: hidden;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.45;
    white-space: normal;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}
.history-topic-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #2563eb;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.history-topic-edit:hover { border-color: #93c5fd; background: #eff6ff; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.schedule-topic-trigger {
    padding: 0;
    border: 0;
    background: transparent;
    color: #2563eb;
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}
.schedule-topic-trigger:hover { text-decoration: underline; }
.schedule-topic-cell { min-width: 180px; max-width: 360px; white-space: normal; overflow-wrap: anywhere; }
.person-schedule-records { max-width: none; }
.schedule-record-table th:first-child,
.schedule-record-table td:first-child { width: 230px; }
.schedule-record-table tr.schedule-record-future td { background: #fff7ed; }
.schedule-record-table tr.schedule-record-history td { background: #ecfdf5; }
.schedule-record-table tr.schedule-record-future:hover td { background: #ffedd5; }
.schedule-record-table tr.schedule-record-history:hover td { background: #dcfce7; }
.schedule-record-table .schedule-topic-cell {
    max-width: none;
    line-height: 1.55;
}
.schedule-record-future .schedule-topic-trigger,
.schedule-record-history .schedule-topic-trigger { color: #2563eb; }
.schedule-topic-dialog {
    width: min(560px, calc(100% - 28px));
    padding: 0;
    border: 0;
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
}
.schedule-topic-dialog::backdrop { background: rgba(15, 23, 42, .48); }
.schedule-topic-dialog form { display: grid; gap: 16px; padding: 20px; }
.schedule-topic-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.schedule-topic-dialog-head h2, .schedule-topic-dialog-head p { margin-bottom: 0; }
.schedule-topic-dialog label { display: grid; gap: 7px; font-weight: 700; }
.schedule-topic-dialog textarea,
.schedule-topic-dialog input[type="url"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    font: inherit;
}
.schedule-topic-dialog textarea { resize: vertical; }
.dialog-close { border: 0; background: transparent; color: #6b7280; font-size: 28px; cursor: pointer; }
.form small { color: #6b7280; font-weight: 400; }
.form .checkbox-label {
    grid-template-columns: auto 1fr;
    align-items: center;
}
.form .checkbox-label input { width: 18px; min-height: 18px; }
.form .checkbox-label small { grid-column: 2; }
.form-actions { display: flex; gap: 10px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.section-head h2, .section-head p { margin-bottom: 0; }
.booking-list { display: grid; gap: 10px; }
.booking-row {
    display: grid;
    gap: 10px;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 11px;
    background: #f9fafb;
}
.booking-row-main {
    display: grid;
    grid-template-columns: minmax(190px, .8fr) minmax(220px, 1fr) minmax(190px, .75fr);
    align-items: end;
    gap: 10px;
}
.booking-row-secondary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 10px;
}
.booking-row label { display: grid; gap: 6px; font-weight: 700; }
.booking-row select, .booking-row input {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    background: #fff;
}
.booking-save-actions { margin-top: 14px; }
.booking-topic-field input { min-width: 0; }
.group-management-card { padding: 0; overflow: hidden; }
.group-management-card > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px;
    cursor: pointer;
    list-style: none;
}
.group-management-card > summary::-webkit-details-marker { display: none; }
.group-management-card > summary span { font-size: 20px; font-weight: 700; }
.group-management-card > summary small { color: #6b7280; font-weight: 400; }
.group-management-card[open] > summary { border-bottom: 1px solid #e5e7eb; }
.group-management { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 14px; }
.group-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
}
.group-form input[type="text"] { min-height: 36px; padding: 7px 9px; border: 1px solid #d1d5db; border-radius: 8px; }
.group-form-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.group-form label { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.group-create-form { background: #eff6ff; border-color: #bfdbfe; }
.group-create-form input[type="text"] { border-color: #bfdbfe; }
.group-form label, .auto-group-options label { display: flex; align-items: center; gap: 6px; }
.auto-group-options { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 7px; }
.auto-group-options label { padding: 8px 11px; border: 1px solid #dbe3ee; border-radius: 999px; background: #fff; cursor: pointer; }
.auto-group-options label:has(input:checked) { border-color: #93c5fd; background: #eff6ff; color: #1d4ed8; }
.auto-group-options input { width: 16px; height: 16px; }
.form-label { display: block; font-weight: 700; }
.auto-schedule-card { padding: 16px 18px; }
.auto-schedule-form { gap: 8px; }
.auto-schedule-row { display: flex; align-items: end; gap: 14px; }
.auto-schedule-fields { display: grid; grid-template-columns: 210px 130px; gap: 10px; flex: 0 0 auto; }
.auto-schedule-fields label { display: grid; gap: 7px; font-weight: 700; }
.auto-schedule-groups { display: grid; gap: 1px; flex: 1; min-width: 0; }
.auto-schedule-groups .auto-group-options { margin-top: 5px; }
.auto-schedule-submit { min-width: 145px; flex: 0 0 auto; }
.auto-schedule-note { margin: 0; }
.booking-date-field { position: relative; }
.booking-date-trigger {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    text-align: left;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    background: #fff;
    cursor: pointer;
}
.booking-calendar {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 30;
    width: 310px;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .16);
}
.booking-calendar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.booking-calendar-head button { border: 0; background: transparent; font-size: 22px; cursor: pointer; }
.booking-calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.booking-calendar-weekday { text-align: center; color: #6b7280; font-size: 12px; }
.booking-calendar-day { min-height: 34px; border: 1px solid transparent; border-radius: 7px; font-weight: 700; }
.booking-calendar-day.available { color: #c2410c; background: #ffedd5; cursor: pointer; }
.booking-calendar-day.available:hover { background: #fed7aa; }
.booking-calendar-day.scheduled { color: #15803d; background: #dcfce7; }
.booking-calendar-day.rest { color: #6b7280; background: #e5e7eb; }
.booking-calendar-day.past { color: #9ca3af; background: #f3f4f6; }
.booking-calendar-legend { display: flex; gap: 12px; margin-top: 10px; font-size: 12px; }
.booking-calendar-legend span::before { content: ''; display: inline-block; width: 9px; height: 9px; margin-right: 4px; border-radius: 3px; }
.booking-calendar-legend .available::before { background: #fb923c; }
.booking-calendar-legend .scheduled::before { background: #4ade80; }
.booking-calendar-legend .rest::before { background: #9ca3af; }
.batch-actions { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.batch-group-form { margin-bottom: 12px; }
.batch-group-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.batch-group-actions select {
    min-width: 150px;
    min-height: 32px;
    padding: 5px 9px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
}
.person-sort-input {
    width: 76px;
    min-height: 32px;
    padding: 5px 7px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    background: #fff;
}
.person-sort-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.person-list-column-settings {
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 9px;
    background: #f9fafb;
}
.person-search-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}
.person-search-form input {
    flex: 1;
    min-width: 180px;
    min-height: 38px;
    padding: 8px 11px;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    background: #fff;
    font-size: 14px;
}
.person-list-column-settings summary { cursor: pointer; font-weight: 700; }
.person-list-column-form { display: grid; gap: 12px; margin-top: 12px; }
.person-list-column-options { display: flex; flex-wrap: wrap; gap: 8px; }
.person-list-column-options label {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 9px;
    border: 1px solid #e5e7eb;
    border-radius: 7px;
    background: #fff;
}
.select-cell { width: 42px; text-align: center; }
.select-cell input { width: 17px; height: 17px; cursor: pointer; }
.settings-tabs { display: flex; gap: 6px; margin-bottom: 18px; border-bottom: 1px solid #dbe1ea; }
.settings-tabs a { padding: 10px 18px; color: #6b7280; border-bottom: 3px solid transparent; }
.settings-tabs a.active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 700; }
.settings-hint { margin: -5px 0 16px; }
.workday-settings-card { max-width: 900px; }
.weekday-options { display: flex; flex-wrap: wrap; gap: 9px; }
.weekday-options label { display: flex; align-items: center; gap: 5px; padding: 8px 12px; border: 1px solid #e5e7eb; border-radius: 9px; }
.weekday-options input { width: 17px; min-height: 17px; }
.calendar-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.calendar-head h2, .calendar-head p { margin-bottom: 0; }
.calendar-head input { width: auto; }
.workday-calendars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.calendar-month-card { min-width: 0; padding: 14px; border: 1px solid #e5e7eb; border-radius: 12px; background: #fff; }
.calendar-month-card h3 { margin: 0 0 10px; text-align: center; font-size: 17px; }
.workday-calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }
.calendar-weekday { padding: 6px; text-align: center; color: #6b7280; font-size: 13px; font-weight: 700; }
.calendar-day { display: grid; gap: 2px; min-height: 62px; padding: 8px; border: 1px solid #dbe3ee; border-radius: 9px; background: #f8fafc; cursor: pointer; }
.calendar-day strong { font-size: 16px; }
.calendar-day span { color: #16a34a; font-size: 11px; }
.calendar-day.excluded { background: #fff1f2; border-color: #fda4af; }
.calendar-day.excluded span { color: #dc2626; }
.calendar-day.included { background: #ecfdf5; border-color: #86efac; }
.calendar-day.included span { color: #15803d; }
.schedule-calendars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.schedule-calendar-month { min-width: 0; }
.schedule-calendar-month h3 { margin: 0 0 12px; text-align: center; font-size: 18px; }
.schedule-calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.schedule-calendar-weekday { padding: 5px 2px; text-align: center; color: #6b7280; font-size: 12px; font-weight: 700; }
.schedule-calendar-day {
    min-width: 0;
    min-height: 78px;
    padding: 7px;
    border: 1px solid #e5e7eb;
    border-radius: 9px;
    background: #fff;
}
.schedule-calendar-day.blank { border-color: transparent; background: transparent; }
.schedule-calendar-day.past { background: #f8fafc; }
.schedule-calendar-day.today { border-color: #60a5fa; box-shadow: inset 0 0 0 1px #60a5fa; }
.schedule-calendar-date { margin-bottom: 5px; color: #374151; font-size: 13px; font-weight: 800; }
.schedule-calendar-day.today .schedule-calendar-date { color: #2563eb; }
.schedule-calendar-rest {
    display: block;
    margin-top: 4px;
    padding: 3px 5px;
    border-radius: 5px;
    background: #e5e7eb;
    color: #6b7280;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}
.schedule-calendar-person {
    display: block;
    margin-top: 4px;
    padding: 3px 5px;
    overflow: hidden;
    border-radius: 5px;
    background: #ffedd5;
    color: #c2410c;
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.schedule-calendar-day.past .schedule-calendar-person { background: #dcfce7; color: #15803d; }
.schedule-calendar-person:hover { background: #fed7aa; }
.history-page-head { align-items: flex-end; }
.history-page-head p { margin: 5px 0 0; }
.history-calendar-controls, .history-month-form { display: flex; align-items: center; gap: 8px; }
.history-month-form input {
    min-height: 36px;
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    background: #fff;
    font: inherit;
}
.history-calendars { display: grid; gap: 30px; }
.history-calendar-month h2 { margin-bottom: 12px; text-align: center; }
.history-calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.history-calendar-day {
    min-width: 0;
    padding: 7px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f8fafc;
    overflow: hidden;
}
.history-calendar-day.blank { border-color: transparent; background: transparent; }
.history-calendar-day.today { border-color: #60a5fa; box-shadow: inset 0 0 0 1px #60a5fa; }
.history-calendar-mentor {
    display: grid;
    grid-template-rows: auto auto;
    gap: 6px;
    min-width: 0;
    color: #374151;
}
.history-calendar-mentor:hover .history-calendar-photo { border-color: #60a5fa; }
.history-calendar-photo {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    min-height: 0;
    overflow: hidden;
    border-radius: 8px;
    background: #f1f5f9;
}
.history-calendar-photo img, .history-calendar-photo .history-avatar-placeholder {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 0;
    object-fit: contain;
    object-position: center;
}
.history-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #dcfce7;
    color: #15803d;
    font-size: 28px;
    font-weight: 800;
}
.history-calendar-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    min-width: 0;
    padding: 5px 7px;
    border: 1px solid rgba(148, 163, 184, .25);
    border-radius: 7px;
    background: rgba(255, 255, 255, .78);
    backdrop-filter: blur(3px);
}
.history-calendar-meta strong { color: #374151; font-size: 15px; }
.history-calendar-day.today .history-calendar-meta strong { color: #2563eb; }
.history-calendar-meta > span { overflow: hidden; color: #15803d; font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.history-calendar-meta > .history-mentor-name { color: #15803d; }
.history-calendar-meta > .future-mentor-name { color: #c2410c; }
.history-calendar-empty { display: grid; grid-template-rows: auto auto; gap: 6px; }
.history-calendar-empty .empty-photo { background: #f1f5f9; }
.history-calendar-empty .history-calendar-meta > span { color: #6b7280; }
.setting-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.form .setting-option {
    display: flex;
    grid-template-columns: none;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
}
.form .setting-option:hover { background: #f9fafb; }
.form .setting-option input { width: 18px; min-height: 18px; margin-top: 2px; }
.form .setting-option span { display: grid; gap: 2px; }
.form .setting-option small { display: block; }
.person-status-label-settings { padding-top: 4px; }
.person-status-label-settings h2 { margin-bottom: 4px; }
.person-status-label-settings > p { margin: 0 0 12px; }
.status-label-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.status-label-fields label { display: grid; gap: 6px; }
.avatar-thumbnail-settings { display: grid; gap: 10px; padding-top: 4px; }
.avatar-thumbnail-settings h2, .avatar-thumbnail-settings p { margin-bottom: 0; }
.avatar-thumbnail-settings label { max-width: 260px; }
.avatar-refresh-progress { display: grid; gap: 8px; margin-top: 14px; }
.avatar-refresh-track { height: 12px; overflow: hidden; border-radius: 999px; background: #e5e7eb; }
.avatar-refresh-track > div { width: 0; height: 100%; border-radius: inherit; background: #2563eb; transition: width .2s ease; }
.avatar-refresh-status { color: #6b7280; font-size: 13px; }
.backup-setting-meta { display: grid; gap: 3px; padding: 11px 13px; border: 1px solid #e5e7eb; border-radius: 9px; background: #f9fafb; }
.backup-setting-meta span { color: #6b7280; font-size: 13px; }
.backup-file-list { display: grid; gap: 9px; }
.backup-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
}
.backup-file-item > div { display: grid; gap: 3px; min-width: 0; }
.backup-file-item strong { overflow-wrap: anywhere; }
.backup-file-item span { color: #6b7280; font-size: 13px; }
.inline { display: inline; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form select { min-width: 120px; }
.nowrap { white-space: nowrap; }
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.stats-row div {
    background: #f9fafb;
    border: 1px solid #edf0f5;
    border-radius: 12px;
    padding: 14px;
    text-align: center;
}
.stats-row strong { display: block; font-size: 26px; }
.stats-row span { display: block; color: #6b7280; font-size: 13px; }
.filter-form { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.filter-form label { display: grid; gap: 6px; font-weight: 700; }
.install-box {
    max-width: 520px;
    margin: 80px auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, .08);
}
.install-box h1 { margin-bottom: 12px; }
.note { margin-top: 18px; color: #6b7280; }
code { background: #f3f4f6; padding: 2px 6px; border-radius: 5px; }

@media (max-width: 780px) {
    .topbar { align-items: flex-start; flex-direction: column; }
    .grid.two { grid-template-columns: 1fr; }
    .dashboard-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "today"
            "future"
            "stats";
    }
    .page-head { align-items: flex-start; flex-direction: column; }
    table { display: block; overflow-x: auto; white-space: nowrap; }
    .stats-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .stats-row div { padding: 10px 4px; }
    .stats-row strong { font-size: 22px; }
    .stats-row span { font-size: 11px; }
    .person-profile { flex-direction: row; gap: 14px; align-items: flex-start; }
    .person-overview-card .person-profile {
        display: grid;
        grid-template-columns: 96px minmax(0, 1fr);
        gap: 14px;
    }
    .person-profile > .avatar.xlarge {
        width: 96px;
        height: 96px;
        flex: 0 0 96px;
        border-radius: 12px;
    }
    .person-profile-title { gap: 7px; }
    .person-profile-title h2 { font-size: 22px; }
    .person-profile-main > .muted { margin: 5px 0; }
    .person-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 12px; margin-top: 10px; }
    .person-meta span { font-size: 12px; }
    .person-profile-introduction {
        grid-column: 1 / -1;
        padding: 14px 0 0;
        border-top: 1px solid #e5e7eb;
        border-left: 0;
    }
    .setting-options { grid-template-columns: 1fr; }
    .status-label-fields { grid-template-columns: 1fr; }
    .backup-file-item { align-items: flex-start; flex-direction: column; }
    .person-edit-form { grid-template-columns: 1fr; }
    .person-edit-form .wide-field { grid-column: auto; }
    .person-history-editor .section-head { flex-direction: column; }
    .history-add-fields { grid-template-columns: 1fr; gap: 12px; }
    .history-replay-field { grid-column: auto; }
    .history-add-date-actions .btn { margin-top: 0; }
    .history-add-form textarea { min-height: 92px; }
    .history-edit-card { grid-template-columns: auto minmax(0, 1fr); }
    .history-topic-edit { grid-column: 2; justify-self: start; }
    .workday-calendars { grid-template-columns: 1fr; }
    .schedule-calendars { grid-template-columns: 1fr; }
    .schedule-calendar-grid { gap: 3px; }
    .schedule-calendar-day { min-height: 62px; padding: 5px; }
    .schedule-calendar-rest,
    .schedule-calendar-person { padding: 2px 3px; font-size: 11px; }
    .history-page-head { align-items: stretch; }
    .history-calendar-controls { flex-wrap: wrap; }
    .history-month-form { order: -1; width: 100%; }
    .history-month-form input { flex: 1; min-width: 0; }
    .history-calendar-month { width: 100%; overflow: hidden; }
    .history-calendar-grid { width: 100%; min-width: 0; gap: 2px; }
    .history-calendar-day { min-width: 0; padding: 2px; border-radius: 5px; }
    .history-calendar-weekday { padding: 3px 0; font-size: 10px; }
    .history-calendar-mentor, .history-calendar-empty { gap: 3px; }
    .history-calendar-photo { width: 100%; border-radius: 4px; }
    .history-calendar-mentor,
    .history-calendar-empty {
        display: flex;
        flex-direction: column;
    }
    .history-calendar-meta {
        display: contents;
    }
    .history-calendar-meta strong {
        order: -1;
        display: block;
        padding: 2px;
        border-radius: 3px;
        background: rgba(255, 255, 255, .78);
        font-size: 10px;
        line-height: 1.2;
        text-align: center;
    }
    .history-calendar-photo { order: 0; }
    .history-calendar-meta > span {
        order: 1;
        display: block;
        min-height: 15px;
        padding: 2px 1px;
        border-radius: 3px;
        background: rgba(255, 255, 255, .78);
        font-size: 9px;
        line-height: 1.2;
        text-align: center;
    }
    .history-avatar-placeholder { font-size: 15px; }
    .person-schedule-records { padding: 16px; }
    .person-schedule-records h2 { margin-bottom: 12px; }
    .schedule-record-table,
    .schedule-record-table tbody {
        display: grid;
        width: 100%;
        gap: 10px;
        overflow: visible;
        white-space: normal;
    }
    .schedule-record-table thead { display: none; }
    .schedule-record-table tr {
        display: grid;
        gap: 8px;
        padding: 12px;
        border: 1px solid #e5e7eb;
        border-radius: 10px;
    }
    .schedule-record-table tr.schedule-record-future { border-color: #fed7aa; background: #fff7ed; }
    .schedule-record-table tr.schedule-record-history { border-color: #bbf7d0; background: #ecfdf5; }
    .schedule-record-table tr.schedule-record-future td,
    .schedule-record-table tr.schedule-record-history td,
    .schedule-record-table tr:hover td { background: transparent; }
    .schedule-record-table td,
    .schedule-record-table th:first-child,
    .schedule-record-table td:first-child {
        display: grid;
        width: auto;
        max-width: none;
        padding: 0;
        border: 0;
    }
    .schedule-record-table td::before {
        content: attr(data-label);
        margin-bottom: 3px;
        color: #6b7280;
        font-size: 11px;
        font-weight: 700;
    }
    .schedule-record-table td:first-child {
        padding-bottom: 8px;
        border-bottom: 1px solid rgba(148, 163, 184, .25);
    }
    .schedule-topic-cell { min-width: 0; line-height: 1.55; overflow-wrap: anywhere; }
    .schedule-topic-replay { display: inline-flex; max-width: 100%; }
    .booking-row { grid-template-columns: 1fr; }
    .booking-row-main { grid-template-columns: 1fr; }
    .booking-row-secondary { grid-template-columns: 1fr auto; }
    .booking-row .booking-remove { justify-self: start; }
    .group-management-card > summary { align-items: flex-start; flex-direction: column; }
    .group-management { grid-template-columns: 1fr; }
    .auto-schedule-row { align-items: stretch; flex-direction: column; }
    .auto-schedule-fields { grid-template-columns: 1fr 1fr; width: 100%; }
    .auto-schedule-submit { width: 100%; }
    .person-search-form { flex-wrap: wrap; }
    .person-search-form input { flex-basis: 100%; }
}
.admin-name {
    display: inline-block;
    margin-left: 10px;
    padding-left: 10px;
    border-left: 1px solid rgba(255,255,255,.25);
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 500;
}
.login-box {
    max-width: 420px;
    margin: 80px auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, .08);
}
.login-box h1 { margin-bottom: 6px; }
.btn.full { width: 100%; }
