[hidden] { display: none !important; }
:root {
    --bg: #f6f8f7;
    --card: #ffffff;
    --ink: #1b2a24;
    --muted: #5c6b76;
    --line: #d5e3db;
    --brand: #0e5c43;
    --brand-2: #187454;
    --shadow: 0 10px 30px rgba(27, 42, 36, 0.06);
    --radius: 16px;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--bg);
}
button, input, select { font: inherit; color: inherit; }
.top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-end;
    padding: 28px 24px 8px;
    max-width: 1120px;
    margin: 0 auto;
}
.eyebrow { margin: 0; font-weight: 800; letter-spacing: 0.04em; color: var(--brand); text-transform: uppercase; font-size: 0.78rem; }
h1 { margin: 4px 0; font-size: 1.8rem; }
.muted { color: var(--muted); }
.account { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.main-tabs, .panel { max-width: 1120px; margin: 0 auto; padding: 0 24px 28px; }
.main-tabs { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 12px; }
.main-tabs button, .set-tabs button, .pill, .chip, .btn {
    border: 1px solid var(--line);
    background: var(--card);
    border-radius: 999px;
    padding: 8px 14px;
    cursor: pointer;
    font-weight: 700;
}
.main-tabs button.is-on, .set-tabs button.is-on, .pill.is-on, .chip.is-on, .btn.primary {
    background: var(--brand);
    border-color: var(--brand);
    color: white;
}
.btn.ghost { background: transparent; }
.btn.danger { background: #b42318; border-color: #b42318; color: white; }
.btn, a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.tools, .pills, .chips, .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tools { margin: 12px 0; }
.search, select, textarea, input:not([type]), input[type="text"], input[type="url"], input[type="password"] {
    border: 1.5px solid #d5e3db;
    border-radius: 10px;
    padding: 10px 14px;
    min-height: 42px;
    background: white;
    width: 100%;
}
textarea { height: auto; min-height: 96px; }
.search:focus, select:focus, textarea:focus, input:not([type]):focus, input[type="text"]:focus, input[type="url"]:focus, input[type="password"]:focus {
    outline: none;
    border-color: #0e5c43;
    box-shadow: 0 0 0 3px rgba(14, 92, 67, 0.12);
}
.search { max-width: 320px; }
.subjects {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin: 14px 0;
}
.subject {
    text-align: left;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
    cursor: pointer;
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 10px;
    align-items: center;
}
.subject.is-on { border-color: var(--brand); outline: 2px solid rgba(15, 118, 110, 0.2); }
.subject strong { display: block; }
.subject span { color: var(--muted); font-size: 0.86rem; }
.icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; }
.icon svg { width: 24px; height: 24px; stroke: white; fill: none; stroke-width: 1.8; }
.list { display: grid; gap: 10px; }
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
}
.sheet {
    background: var(--card);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
    padding: 16px;
}
.card h3 { margin: 0 0 6px; }
.meta { margin: 0; color: var(--muted); font-size: 0.92rem; }
.modal {
    position: fixed;
    inset: 0;
    background: rgba(18, 24, 32, 0.46);
    display: grid;
    place-items: center;
    padding: 18px;
    z-index: 5;
}
.modal[hidden] { display: none; }
.sheet { width: min(440px, 100%); display: grid; gap: 10px; }
.sheet-wide { width: min(920px, 100%); max-height: min(92vh, 900px); overflow: auto; }
.sheet-settings {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    overflow: hidden;
}
.sheet-head, .sheet-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    flex: 0 0 auto;
}
.sheet-head { border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 1.15rem; }
.sheet-foot { border-top: 1px solid var(--line); justify-content: flex-end; }
.sheet-body {
    padding: 16px 18px 8px;
    overflow-y: auto;
    max-height: min(72vh, calc(92vh - 150px));
    scrollbar-width: thin;
    scrollbar-color: #c9d7d0 transparent;
}
.sheet-body::-webkit-scrollbar { width: 8px; }
.sheet-body::-webkit-scrollbar-thumb { background: #c9d7d0; border-radius: 8px; }
.icon-close {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #f6f8f7;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
}
.set-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    margin-bottom: 14px;
    background: #eef2f0;
    border-radius: 12px;
}
.set-tabs button {
    border: 0;
    background: transparent;
    border-radius: 9px;
    color: var(--ink);
    box-shadow: none;
}
.set-tabs button.is-on {
    background: #0e5c43;
    border-color: #0e5c43;
    color: white;
}
.stack { display: grid; gap: 10px; }
[data-set-panel]:not([hidden]) { display: grid; }
.member-row, .member-card {
    display: grid;
    gap: 10px;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #d5e3db;
    border-radius: 14px;
    background: white;
}
.member-main, .member-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.member-name { flex: 1 1 220px; font-weight: 700; }
.member-name input, .member-row input { width: 100%; }
.user-badge {
    font-family: Consolas, "Courier New", monospace;
    background: #eef2f0;
    border-radius: 999px;
    padding: 4px 10px;
    font-weight: 700;
}
.state-badge { border-radius: 999px; padding: 4px 10px; font-weight: 800; font-size: 0.82rem; }
.state-ok { background: #e5f6ee; color: #0e5c43; }
.state-wait { background: #fff4df; color: #9a6700; }
.state-lock { background: #fde8e6; color: #b42318; }
.member-actions .btn { padding: 6px 10px; font-size: 0.86rem; }
.page-copy { white-space: pre-wrap; margin: 8px 0 0; }
.foot { max-width: 1120px; margin: 0 auto; padding: 0 24px 32px; color: var(--muted); }
.sheet label, .split label { display: grid; gap: 4px; font-weight: 700; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
iframe { width: 100%; height: min(62vh, 560px); border: 1px solid var(--line); border-radius: 12px; background: white; }
.error { color: #b42318; min-height: 1.2em; margin: 0; }
.toast {
    position: fixed;
    bottom: 16px;
    right: 16px;
    background: #14332f;
    color: white;
    padding: 10px 14px;
    border-radius: 12px;
    opacity: 0;
    pointer-events: none;
}
.toast.show { opacity: 1; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: white; border-radius: 12px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.school-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; margin-bottom: 8px; }
@media (max-width: 800px) {
    .top, .split, .school-row { display: grid; grid-template-columns: 1fr; }
    .top { align-items: start; }
    h1 { font-size: 1.45rem; }
    .account { justify-content: flex-start; }
}
