:root {
  --bg: #f4f1eb;
  --surface: #fffdf9;
  --surface-strong: #ffffff;
  --ink: #241f18;
  --muted: #7a7165;
  --line: #e6dfd3;
  --gold: #a77b25;
  --gold-soft: #f5ead2;
  --green: #24745a;
  --green-soft: #e4f2ec;
  --orange: #b85d21;
  --orange-soft: #fae9dd;
  --red: #ad3f45;
  --red-soft: #f8e4e5;
  --brown: #6d421f;
  --brown-dark: #3f2c22;
  --shadow: 0 18px 50px rgba(44, 34, 21, 0.08);
}

* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; }
body.drawer-open { overflow: hidden; overscroll-behavior: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.role-hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 5px; color: var(--gold); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }

.login-shell { min-height: 100vh; padding: 0 34px; overflow: hidden; background: radial-gradient(circle at 8% 12%, rgba(255,237,207,.9) 0, transparent 32%), radial-gradient(circle at 92% 78%, rgba(203,157,100,.18) 0, transparent 33%), linear-gradient(145deg, #f4eadc, #fbf8f3 58%, #efe1d1); }
.login-public-page { width: min(1240px, 100%); min-height: 100vh; margin: auto; display: flex; flex-direction: column; }
.login-public-header { min-height: 92px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(112,76,43,.14); }
.login-public-brand { display: flex; align-items: center; gap: 12px; }
.login-public-brand strong, .login-public-brand span { display: block; }
.login-public-brand strong { font-size: 18px; letter-spacing: .06em; }
.login-public-brand span { color: var(--muted); font-size: 12px; letter-spacing: .09em; }
.entity-brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: #2e211a; color: #f6dfb5; font: 700 20px/1 Georgia, "Songti SC", serif; }
.login-platform-badge { padding: 7px 14px; border: 1px solid rgba(129,80,31,.18); border-radius: 999px; color: #81501f; background: rgba(255,253,249,.48); font-size: 12px; }
.login-public-hero { flex: 1; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(360px, .72fr); gap: 84px; align-items: center; padding: 54px 0 48px; }
.login-hero-copy { max-width: 690px; }
.login-hero-copy h1 { margin: 10px 0 22px; font: 700 clamp(44px, 5vw, 68px)/1.12 Georgia, "Songti SC", serif; letter-spacing: -.025em; }
.login-hero-copy h1 em { color: #a15239; font-style: normal; }
.login-hero-lead { max-width: 625px; margin: 0 0 30px; color: #69564a; font-size: 18px; line-height: 1.85; }
.login-value-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.login-value-list > div { min-height: 130px; padding: 17px; border: 1px solid rgba(129,80,31,.13); border-radius: 16px; background: rgba(255,253,249,.5); }
.login-value-list b { display: block; margin-bottom: 12px; color: #a86f32; font: 700 13px/1 Georgia, serif; letter-spacing: .14em; }
.login-value-list strong, .login-value-list span { display: block; }
.login-value-list strong { margin-bottom: 4px; color: #3d2b20; font-size: 14px; }
.login-value-list span { color: var(--muted); font-size: 12px; line-height: 1.65; }
.login-founder-sign { display: flex; align-items: center; gap: 12px; margin-top: 24px; }
.login-founder-sign img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; object-position: 70% 24%; border: 2px solid rgba(255,255,255,.85); box-shadow: 0 5px 16px rgba(65,39,19,.12); }
.login-founder-sign strong, .login-founder-sign span { display: block; }
.login-founder-sign strong { font-size: 13px; }
.login-founder-sign span { color: var(--muted); font-size: 11px; }
.login-card { width: 100%; padding: 38px; border: 1px solid rgba(168,111,50,.2); border-radius: 28px; background: rgba(255,253,249,.9); box-shadow: 0 22px 60px rgba(82,55,32,.12); backdrop-filter: blur(18px); }
.login-card-head { display: flex; align-items: center; gap: 13px; }
.login-card-head h2 { margin: 0; font-size: 25px; }
.login-symbol { width: 48px; height: 48px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 15px; background: #2e211a; color: #f6dfb5; font-size: 19px; }
.login-card > .muted { margin: 12px 0 0; font-size: 13px; }
.login-form-fields { display: grid; gap: 16px; margin-top: 26px; }
.login-card label { display: grid; gap: 7px; color: #5c4a3e; font-size: 13px; font-weight: 700; }
.login-card label small { color: var(--muted); font-weight: 500; }
.login-field { display: grid; gap: 7px; }
.login-field > label { display: block; }
.login-card input { height: 48px; padding: 0 13px; border-radius: 12px; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 72px; }
.password-toggle { position: absolute; top: 50%; right: 8px; min-width: 52px; padding: 7px 9px; border-radius: 8px; background: #f3ece3; color: #765431; font-size: 12px; transform: translateY(-50%); }
.password-toggle:hover, .password-toggle:focus-visible { background: #eadbc8; outline: none; box-shadow: 0 0 0 2px rgba(168,111,50,.14); }
.login-card .primary { min-height: 50px; margin-top: 2px; border-radius: 11px; background: #2e211a; color: #fff7e9; }
.login-card .message { margin: 12px 0 0; }
.login-learner-entry { display: block; width: fit-content; margin: -4px auto 10px; color: #81501f; font-size: 12px; font-weight: 800; text-decoration: none; }
.login-help { margin: 4px 0 0; color: #9a8a7f; font-size: 11px; text-align: center; }
.login-public-footer { min-height: 68px; display: flex; justify-content: center; align-items: center; gap: 18px; border-top: 1px solid rgba(112,76,43,.14); color: #79665a; font-size: 12px; letter-spacing: .05em; }
.login-public-footer i { width: 3px; height: 3px; border-radius: 50%; background: #b99167; }

input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-strong); color: var(--ink); outline: none; transition: .2s; }
input, select { height: 42px; padding: 0 12px; }
textarea { padding: 12px; resize: vertical; line-height: 1.65; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(167,123,37,.12); }

button { border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 750; }
.primary { background: var(--ink); color: white; }
.primary:hover { background: #44392d; }
.ghost { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.ghost:hover { border-color: #cbbda8; }
.danger { color: var(--red); }
.full { width: 100%; }
.small { padding: 8px 12px; font-size: 13px; }
.message { min-height: 22px; margin: 12px 0 0; color: var(--red); font-size: 13px; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 28px; border-bottom: 1px solid var(--line); background: rgba(244,241,235,.92); backdrop-filter: blur(16px); }
.topbar h1 { margin: 0; font-size: 23px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.user-chip { display: inline-flex; align-items: center; min-height: 34px; padding: 7px 11px; border-radius: 9px; background: var(--gold-soft); color: #77581b; font-size: 12px; font-weight: 800; }
main { width: min(1480px, calc(100% - 40px)); margin: 24px auto 70px; }

.access-scope { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 14px; padding: 18px 20px; border: 1px solid #d8c39a; border-radius: 16px; background: linear-gradient(135deg, #fffaf0, #f3e6cb); box-shadow: 0 8px 25px rgba(90,62,27,.05); }
.access-scope h2 { margin: 0 0 5px; font-size: 18px; }
.access-scope p { margin: 0; color: var(--muted); line-height: 1.6; }
.access-capabilities { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.access-capabilities span { padding: 7px 10px; border: 1px solid #d8c39a; border-radius: 999px; background: rgba(255,255,255,.72); color: #76551f; font-size: 12px; font-weight: 800; white-space: nowrap; }

.slot-panel { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 14px; padding: 18px 20px; border: 1px solid #d9c08c; border-radius: 14px; background: #fff8e9; }
.slot-panel h2 { margin: 0 0 5px; font-size: 18px; }
.slot-panel p { margin: 0; }
.slot-form { display: grid; grid-template-columns: minmax(180px, 260px) auto; gap: 9px; }

.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 12px; }
.stat-card { min-height: 108px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 8px 25px rgba(44,34,21,.04); }
.stat-card span { color: var(--muted); font-size: 13px; }
.stat-card strong { display: block; margin-top: 8px; font-size: 29px; }
.stat-card.attention { background: var(--orange-soft); border-color: #edc9ae; }
.stat-card.success { background: var(--green-soft); border-color: #bcded0; }

.tabs { display: flex; gap: 7px; margin: 24px 0 12px; padding: 5px; overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.tab { flex: 0 0 auto; background: transparent; color: var(--muted); }
.tab.active { background: var(--ink); color: white; }
.toolbar { display: grid; grid-template-columns: minmax(240px, 1fr) 190px 180px 180px; gap: 10px; margin-bottom: 12px; }
.bulk-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding: 12px 15px; border-radius: 12px; background: var(--gold-soft); }
.bulk-bar select { width: 220px; }

.panel { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 8px 25px rgba(44,34,21,.035); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 18px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1050px; }
th { position: sticky; top: 0; z-index: 1; padding: 11px 12px; background: #f8f4ed; color: var(--muted); font-size: 12px; text-align: left; white-space: nowrap; }
td { padding: 12px; border-top: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
tr:hover td { background: #fffaf1; }
.student-name { font-weight: 800; }
.student-meta { margin-top: 3px; color: var(--muted); font-size: 11px; }
.student-row { cursor: pointer; }
.student-open { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; width: 100%; min-width: 185px; padding: 7px 9px; border: 1px solid #decda9; border-radius: 8px; background: #fffaf1; color: var(--ink); text-align: left; }
.student-open .student-name, .student-open .student-meta { grid-column: 1; }
.student-open span { grid-column: 2; grid-row: 1 / span 2; color: var(--gold); font-size: 12px; font-weight: 800; white-space: nowrap; }
.student-open:hover, .student-open:focus-visible { border-color: var(--gold); background: var(--gold-soft); outline: none; box-shadow: 0 0 0 3px rgba(185,132,35,.16); }
.row-actions { display: flex; gap: 7px; }
.row-check { width: 18px; height: 18px; }
.rank-number { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--gold-soft); font-weight: 850; }
.rank-number.top { background: var(--gold); color: white; }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 999px; background: #eee9e0; color: #655c50; font-size: 11px; font-weight: 800; white-space: nowrap; }
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.orange { background: var(--orange-soft); color: var(--orange); }
.tag.red { background: var(--red-soft); color: var(--red); }
.progress-mini { width: 110px; height: 7px; overflow: hidden; border-radius: 999px; background: #e9e3d9; }
.progress-mini i { display: block; height: 100%; border-radius: inherit; background: var(--gold); }

.assignment-layout { display: grid; grid-template-columns: 340px minmax(0,1fr); gap: 14px; }
.member-form { display: grid; gap: 9px; padding: 16px; }
.quota-field { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.member-form-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.member-cards { display: grid; gap: 9px; padding: 0 16px 16px; }
.member-card { padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.member-card-head { display: flex; justify-content: space-between; gap: 10px; }
.member-card p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.member-card-actions { display: flex; align-items: center; gap: 7px; }
.role-label { display: inline-flex; margin-top: 8px; padding: 4px 8px; border-radius: 7px; background: #f3eee5; color: #695f52; font-size: 11px; font-weight: 800; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(32,25,17,.32); }
.drawer { position: fixed; inset: 0; z-index: 50; width: 100vw; height: 100dvh; display: flex; flex-direction: column; background: var(--surface); box-shadow: -24px 0 70px rgba(32,25,17,.2); transform: translateX(102%); transition: transform .25s ease; }
.drawer.open { transform: translateX(0); }
.drawer-head { position: relative; z-index: 12; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px max(22px, calc((100vw - 1440px) / 2)); border-bottom: 1px solid var(--line); background: rgba(255,253,249,.98); box-shadow: 0 8px 24px rgba(44,34,21,.06); }
.drawer-head h2 { margin: 0; }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border-radius: 50%; background: #eee8df; font-size: 25px; }
.drawer-content { flex: 1; min-height: 0; padding: 22px max(22px, calc((100vw - 1440px) / 2)) 80px; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: auto; -webkit-overflow-scrolling: touch; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: min(1440px, 100%); margin: 0 auto; }
.detail-card { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.detail-card.wide { grid-column: 1 / -1; }
.detail-card h3 { margin: 0 0 10px; font-size: 15px; }
.profile-list { display: grid; gap: 0; }
.profile-row { display: grid; grid-template-columns: 128px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.profile-row:last-child { border-bottom: 0; }
.profile-row dt { color: var(--muted); font-size: 12px; }
.profile-row dd { margin: 0; white-space: pre-wrap; line-height: 1.65; }
.content-block { margin: 9px 0; padding: 12px; border-radius: 10px; background: #f8f4ed; white-space: pre-wrap; line-height: 1.65; max-height: 360px; overflow: auto; }
.content-block.large { max-height: 640px; }
#drawerScript { max-height: none; overflow: visible; }
.script-workspace { padding: 22px; }
.script-workspace-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.script-workspace-title h3 { margin-bottom: 0; font-size: 20px; }
.script-tabs { position: sticky; top: -1px; z-index: 8; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin: 0 0 12px; padding: 8px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,253,249,.97); box-shadow: 0 8px 18px rgba(90,62,27,.08); backdrop-filter: blur(10px); }
.script-tab { --tab-color: #4c3024; display: grid; grid-template-columns: 31px minmax(0, 1fr); align-items: center; gap: 7px; min-height: 62px; padding: 8px 10px; border: 1px solid #bda28f; border-radius: 9px; background: linear-gradient(145deg, #f4ece5, #e6d7ca); color: #4c3024; text-align: left; box-shadow: 0 4px 10px rgba(74,45,32,.08); }
.script-tab.script-section-tab-two { --tab-color: #684936; border-color: #c9ad98; background: linear-gradient(145deg, #f7f0ea, #eadccf); color: #684936; }
.script-tab.script-section-tab-three { --tab-color: #84634c; border-color: #d2baa6; background: linear-gradient(145deg, #fbf6f1, #eee3d9); color: #76543f; }
.script-tab.active { border-color: #4a2d22; background: linear-gradient(145deg, #3d241b, #6b4632); color: #fff8ef; box-shadow: 0 7px 15px rgba(61,36,27,.2); }
.script-tab:hover { transform: translateY(-1px); }
.script-section-number { display: grid; place-items: center; width: 29px; height: 29px; border: 1px solid currentColor; border-radius: 50%; background: rgba(255,255,255,.78); color: var(--tab-color); font-size: 15px; font-weight: 900; }
.script-tab.active .script-section-number { border-color: #eed4ad; background: #f7e4c4; color: #4b2e22; }
.script-tab > span:last-child { display: block; min-width: 0; }
.script-tab strong { display: block; color: currentColor; font-size: 13px; line-height: 1.35; }
.script-tab small { display: block; margin-top: 3px; color: currentColor; font-size: 10px; line-height: 1.3; opacity: .78; }
.script-meta { margin: 4px 2px 12px; color: var(--muted); font-size: 13px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 10px; }
.manual-editor { margin: 20px 0 0; padding: 18px; border: 1px solid #d7bd98; border-radius: 14px; background: linear-gradient(145deg, #fffaf1, #f8eddd); }
.manual-editor-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.manual-editor-head h3 { margin: 0; font-size: 18px; }
.manual-editor-head > span { color: var(--muted); font-size: 12px; }
.manual-editor textarea { width: 100%; min-height: calc(100dvh - 220px); max-height: none; margin: 0; padding: 24px 28px; border-color: #d8c8b2; border-radius: 12px; background: #fff; font-family: inherit; font-size: 16px; line-height: 1.95; resize: vertical; }
.manual-editor .editor-actions { position: sticky; bottom: 10px; z-index: 5; justify-content: flex-end; padding: 10px; border-radius: 12px; background: rgba(255,250,241,.94); box-shadow: 0 8px 24px rgba(61,36,27,.12); backdrop-filter: blur(10px); }
.ai-adjust-panel { margin-top: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.ai-adjust-panel > h3 { font-size: 17px; }
.generated-output { display: grid; gap: 12px; min-height: 260px; margin: 0; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: #fffdf9; color: var(--brown-dark); font-size: 15px; line-height: 1.78; word-break: break-word; box-shadow: 0 2px 12px rgba(168,135,91,.08); }
.generated-output h3, .generated-output h4, .generated-output p, .generated-output ol { margin: 0; }
.generated-output h3 { display: flex; align-items: center; gap: 12px; width: 100%; border-radius: 10px; background: linear-gradient(135deg, #5c3d2e 0%, #a8875b 100%); color: #fff; padding: 12px 20px; font-size: 17px; line-height: 1.35; box-shadow: 0 10px 22px rgba(168,135,91,.18); }
.generated-output .output-icon { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; background: #fff8ea; color: var(--brown); font-size: 18px; font-weight: 900; }
.generated-output .output-title { min-width: 0; font-weight: 900; }
.generated-output h4 { margin-top: 4px; border-left: 4px solid var(--gold); border-radius: 8px; background: #fff5e6; padding: 10px 12px; color: var(--brown); font-size: 16px; line-height: 1.45; }
.generated-output p { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 12px 14px; box-shadow: 0 6px 18px rgba(32,35,31,.04); }
.generated-output .script-line { display: grid; grid-template-columns: minmax(92px, .26fr) 1fr; gap: 10px; border-left: 4px solid var(--gold); }
.generated-output strong { color: var(--brown); }
.output-list { display: grid; gap: 10px; list-style: none; counter-reset: output; padding-left: 0; }
.output-list li { position: relative; min-height: 46px; display: grid; align-items: center; border: 1px solid #d9c6aa; border-radius: 10px; background: linear-gradient(180deg, #fffdfa, #fff8ef); padding: 10px 12px 10px 52px; box-shadow: 0 8px 22px rgba(109,66,31,.08); }
.output-list li::before { counter-increment: output; content: counter(output); position: absolute; left: 12px; top: 10px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg, var(--gold), #d5b26f); color: #fff; font-size: 13px; font-weight: 800; box-shadow: 0 6px 14px rgba(109,66,31,.18); }
.permission-note { margin: 10px 0 0; padding: 10px 12px; border-radius: 9px; background: var(--gold-soft); color: #72551e; font-size: 12px; line-height: 1.6; }
.detail-assignment { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.ai-library-shell { display: grid; gap: 14px; }
.ai-library-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 24px; border: 1px solid #d8c39a; border-radius: 18px; background: linear-gradient(135deg, #34251d, #6b4a35); color: #fff9ef; box-shadow: 0 16px 38px rgba(61,36,27,.16); }
.ai-library-hero h2 { margin: 3px 0 8px; font-size: 25px; }
.ai-library-hero p { max-width: 780px; margin: 0; color: #eadbc9; line-height: 1.7; }
.ai-version { flex: 0 0 auto; padding: 8px 11px; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; color: #ffe9bd; font-size: 12px; font-weight: 800; }
.ai-principles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ai-principle { min-height: 96px; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: #fffdf9; color: #5f5145; font-size: 13px; line-height: 1.65; }
.ai-library-section { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.ai-library-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.ai-library-section-head h3 { margin: 2px 0 0; font-size: 18px; }
.knowledge-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; padding: 16px; }
.knowledge-card { padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: #fffdf9; }
.knowledge-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.knowledge-card h4 { margin: 0; font-size: 14px; }
.knowledge-card p { margin: 9px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.instruction-list { display: grid; gap: 9px; padding: 16px; }
.instruction-item { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fffdf9; }
.instruction-item summary { display: grid; grid-template-columns: minmax(170px, .35fr) 1fr auto; align-items: center; gap: 14px; padding: 15px 16px; cursor: pointer; list-style: none; }
.instruction-item summary::-webkit-details-marker { display: none; }
.instruction-item summary::after { content: '＋'; color: var(--gold); font-size: 20px; font-weight: 900; }
.instruction-item[open] summary::after { content: '−'; }
.instruction-item summary strong { font-size: 14px; }
.instruction-item summary span { color: var(--muted); font-size: 12px; }
.instruction-item pre, .ai-context-pre { max-height: 620px; margin: 0; padding: 18px; overflow: auto; border-top: 1px solid var(--line); background: #2d2823; color: #f5eadc; font: 12px/1.75 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.ai-context-card { border-color: #d8bd91; background: linear-gradient(145deg, #fffdf9, #fff7e9); }
.ai-context-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.ai-context-head h3 { margin-bottom: 4px; }
.ai-context-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 13px 0; }
.ai-context-stat { padding: 10px; border: 1px solid #dfcba9; border-radius: 10px; background: rgba(255,255,255,.74); text-align: center; }
.ai-context-stat strong, .ai-context-stat span { display: block; }
.ai-context-stat strong { color: #60421f; font-size: 19px; }
.ai-context-stat span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.ai-feed-list { display: grid; gap: 8px; }
.ai-feed-item { overflow: hidden; border: 1px solid #e1d5c3; border-radius: 10px; background: #fff; }
.ai-feed-item summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 13px; cursor: pointer; font-size: 13px; font-weight: 800; }
.ai-feed-item .content-block { margin: 0; border-radius: 0; border-top: 1px solid var(--line); }
.ai-context-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.empty { padding: 40px 20px; color: var(--muted); text-align: center; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 100; max-width: 360px; padding: 13px 16px; border-radius: 12px; background: var(--ink); color: white; box-shadow: var(--shadow); }

@media (max-width: 1050px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .assignment-layout { grid-template-columns: 1fr; }
  .slot-panel { align-items: stretch; flex-direction: column; }
  .access-scope { align-items: flex-start; flex-direction: column; }
  .access-capabilities { justify-content: flex-start; }
  .login-public-hero { grid-template-columns: 1fr; gap: 36px; }
  .login-public-header { min-height: 78px; }
  .login-hero-copy { max-width: none; }
  .login-card { max-width: 560px; }
  .ai-principles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .knowledge-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .login-shell { padding: 0 18px; overflow: visible; }
  .login-public-header { min-height: 70px; }
  .login-platform-badge { display: none; }
  .login-public-hero { padding: 36px 0 30px; }
  .login-hero-copy h1 { font-size: 39px; }
  .login-hero-lead { font-size: 15px; }
  .login-value-list { grid-template-columns: 1fr; }
  .login-value-list > div { min-height: auto; }
  .login-founder-sign { align-items: flex-start; }
  .login-card { padding: 28px 22px; }
  .login-public-footer { flex-wrap: wrap; gap: 10px; padding: 17px 0; }
  .topbar { align-items: flex-start; padding: 14px 16px; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
  #lastUpdated { display: none; }
  main { width: min(100% - 20px, 1480px); margin-top: 14px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .toolbar { grid-template-columns: 1fr; }
  .bulk-bar { align-items: stretch; flex-direction: column; }
  .bulk-bar select { width: 100%; }
  .slot-form { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-card.wide { grid-column: auto; }
  .profile-row { grid-template-columns: 1fr; gap: 5px; }
  .detail-assignment { grid-template-columns: 1fr; }
  .drawer-head { padding: 13px 16px; }
  .drawer-content { padding: 14px 10px 60px; }
  .script-workspace { padding: 14px 10px; }
  .script-workspace-title, .manual-editor-head { align-items: flex-start; flex-direction: column; }
  .script-tabs { gap: 4px; padding: 5px; }
  .script-tab { grid-template-columns: 24px minmax(0, 1fr); gap: 5px; min-height: 56px; padding: 6px 5px; }
  .script-section-number { width: 23px; height: 23px; font-size: 12px; }
  .script-tab strong { font-size: 11px; }
  .script-tab small { display: none; }
  .generated-output { padding: 12px; }
  .generated-output .script-line { grid-template-columns: 1fr; }
  .manual-editor { padding: 12px 8px; }
  .manual-editor textarea { min-height: calc(100dvh - 170px); padding: 18px 14px; font-size: 15px; }
  .ai-library-hero, .ai-context-head { flex-direction: column; }
  .ai-principles, .knowledge-grid { grid-template-columns: 1fr; }
  .ai-context-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .instruction-item summary { grid-template-columns: 1fr auto; }
  .instruction-item summary span { grid-column: 1 / -1; }
}
