@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700;800;900&family=Oswald:wght@500;600;700&display=swap');

:root {
  --lime: #94ef22;
  --lime-strong: #6fca09;
  --ink: #101611;
  --muted: #6d786f;
  --paper: #f3f6f1;
  --card: #ffffff;
  --line: #dfe6dc;
  --sidebar: #07110b;
  --danger: #c03a3a;
  font-family: Geist, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { min-height: 100vh; margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
img { display: block; max-width: 100%; }

/* Acesso e instalação */
.auth-page {
  min-height: 100vh;
  padding: 28px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 15% 15%, #8feb2528, transparent 28%), linear-gradient(145deg, #050806, #101a0d);
  color: #fff;
}
.login-shell {
  width: min(1050px, 100%);
  min-height: 640px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  overflow: hidden;
  border: 1px solid #ffffff18;
  border-radius: 26px;
  background: #0a0e0b;
  box-shadow: 0 45px 120px #000b;
}
.login-brand { padding: 46px; display: flex; flex-direction: column; justify-content: space-between; background: radial-gradient(circle at 100% 0, #78b91d38, transparent 32%), #090d0a; }
.login-brand > img { width: 260px; }
.eyebrow, .login-brand p { margin: 0 0 10px; color: var(--lime); font-size: 10px; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.login-brand h1 { margin: 0; font: 600 clamp(56px, 7vw, 86px)/.9 Oswald, sans-serif; text-transform: uppercase; }
.login-brand h1 em { color: var(--lime); font-style: normal; }
.login-brand > div > span { display: block; margin-top: 22px; color: #aeb7ac; }
.login-brand footer { color: #758074; font-size: 12px; }
.login-brand footer b { color: #fff; }
.login-card, .install-card { background: #f7f8f4; color: var(--ink); }
.login-card { padding: 64px 54px; display: flex; flex-direction: column; justify-content: center; }
.login-card h2, .install-card h1 { margin: 0 0 10px; font: 600 40px/1 Oswald, sans-serif; text-transform: uppercase; }
.login-card > p:not(.eyebrow), .install-card > p:not(.eyebrow) { color: var(--muted); line-height: 1.65; }
.login-card form, .install-card form { display: grid; gap: 16px; margin-top: 24px; }
.login-card label, .install-card label { display: flex; flex-direction: column; gap: 7px; color: #505a51; font-size: 12px; font-weight: 750; }
.login-card input, .install-card input {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid #cfd6cc; border-radius: 10px; background: #fff; outline: 0;
}
.login-card input:focus, .install-card input:focus { border-color: var(--lime-strong); box-shadow: 0 0 0 4px #8ee51d18; }
.main-button { min-height: 52px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: 10px; background: var(--lime); color: #10150d; font-weight: 900; cursor: pointer; }
.login-card > small { margin-top: 18px; color: #8b9288; }
.login-card > small a { color: #5e9d0b; font-weight: 800; }
.install-card { width: min(900px, 100%); padding: 42px; border-radius: 22px; box-shadow: 0 40px 110px #000a; }
.install-card > img { width: 230px; margin-bottom: 32px; padding: 8px 12px; border-radius: 8px; background: #0b100c; }
.install-card fieldset { padding: 22px; border: 1px solid #d5d8d1; border-radius: 12px; }
.install-card legend { padding: 0 9px; font-weight: 850; }

/* Acesso administrativo: identidade separada da sala de aula */
.admin-auth-page {
  min-height: 100vh; margin: 0; padding: 28px; display: grid; place-items: center;
  background:
    linear-gradient(115deg, #ffffff08 1px, transparent 1px) 0 0 / 54px 54px,
    radial-gradient(circle at 15% 20%, #8bea1d20, transparent 26%),
    radial-gradient(circle at 88% 84%, #3f711519, transparent 28%), #050a07;
  color: #fff;
}
.admin-login-shell {
  width: min(980px, 100%); min-height: 610px; display: grid; grid-template-columns: .9fr 1.1fr;
  overflow: hidden; border: 1px solid #ffffff18; border-radius: 26px; background: #0a100c;
  box-shadow: 0 42px 130px #000b;
}
.admin-login-brand {
  padding: 40px; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(155deg, #0b160e, #061008 70%);
}
.admin-login-brand::after {
  content: ""; width: 260px; height: 260px; position: absolute; right: -145px; bottom: -120px;
  border: 1px solid #98ef283b; border-radius: 50%; box-shadow: 0 0 0 45px #8beb1910, 0 0 0 90px #8beb1908;
}
.admin-login-brand > a { width: 220px; position: relative; z-index: 1; }
.admin-login-brand > div { position: relative; z-index: 1; }
.admin-login-icon { width: 48px; height: 48px; margin-bottom: 25px; display: grid; place-items: center; border: 1px solid #a0f1323d; border-radius: 14px; background: #94ef2214; color: var(--lime); font-size: 18px; }
.admin-login-brand p { margin: 0 0 10px; color: var(--lime); font-size: 9px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.admin-login-brand h1 { margin: 0; font-size: clamp(44px, 5vw, 62px); line-height: .94; letter-spacing: -.055em; text-transform: uppercase; }
.student-login-brand h1 { max-width: 100%; font: 650 clamp(40px, 3.2vw, 52px)/.94 Oswald, sans-serif; letter-spacing: -.025em; }
.student-login-brand h1 em { color: var(--lime); font-style: normal; }
.admin-login-brand > div > span:last-child { max-width: 330px; margin-top: 20px; display: block; color: #91a094; font-size: 12px; line-height: 1.65; }
.admin-login-brand > small { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; color: #68766b; font-size: 9px; }
.admin-login-brand > small i { color: var(--lime); }
.admin-login-card { padding: 58px 60px; display: flex; flex-direction: column; justify-content: center; background: #f7f9f5; color: var(--ink); }
.admin-login-heading h2 { margin: 0; font-size: 38px; line-height: 1; letter-spacing: -.045em; }
.admin-login-heading > p:last-child { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.admin-login-card .form-error { margin: 22px 0 0; }
.admin-login-card .admin-login-notice { margin: 22px 0 0; }
.admin-login-card form { margin-top: 25px; display: grid; gap: 15px; }
.admin-login-card label { display: flex; flex-direction: column; gap: 7px; color: #4f5a51; font-size: 11px; font-weight: 750; }
.admin-login-card label small { color: #8a938a; font-size: 9px; font-weight: 500; line-height: 1.45; }
.admin-login-card input { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid #d0d9ce; border-radius: 10px; background: #fff; outline: 0; }
.admin-login-card input:focus { border-color: var(--lime-strong); box-shadow: 0 0 0 4px #8ee51d18; }
.admin-login-card .main-button { margin-top: 4px; }
.admin-login-footer { margin-top: 22px; padding-top: 18px; display: flex; justify-content: space-between; gap: 15px; border-top: 1px solid #dfe5db; color: #89928a; font-size: 10px; }
.admin-login-footer a { color: #508f0c; font-weight: 800; }

/* Estrutura do CMS */
.admin-page { background: radial-gradient(circle at 80% -10%, #9cf12b12, transparent 28%), var(--paper); color: var(--ink); }
.admin-sidebar {
  width: 252px; height: 100dvh; padding: 23px 18px; position: fixed; inset: 0 auto 0 0; z-index: 40;
  display: flex; flex-direction: column; overflow-y: auto; background: linear-gradient(180deg, #061009, #0b160f 55%, #08110b); color: #fff;
}
.admin-logo { width: 178px; height: 58px; margin: 0 8px; }
.admin-logo img { width: 100%; height: 100%; object-fit: contain; }
.admin-label { margin: 21px 8px 15px; padding-top: 18px; display: flex; flex-direction: column; gap: 4px; border-top: 1px solid #ffffff12; }
.admin-label small { color: var(--lime); font-size: 9px; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.admin-label strong { color: #87958a; font-size: 11px; font-weight: 600; }
.admin-sidebar nav { display: grid; gap: 5px; }
.admin-sidebar nav a { min-height: 48px; padding: 0 11px; display: flex; align-items: center; gap: 11px; border: 1px solid transparent; border-radius: 12px; color: #93a096; font-size: 12px; font-weight: 700; transition: .18s ease; }
.admin-sidebar nav a:hover { transform: translateX(2px); border-color: #b4ff3f17; background: #ffffff08; color: #fff; }
.admin-sidebar nav a.active { border-color: #a6f43425; background: linear-gradient(90deg, #8eea1c20, #8eea1c0a); color: #fff; box-shadow: inset 3px 0 0 var(--lime); }
.nav-icon { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 9px; background: #ffffff08; color: #738078; font-size: 13px; }
.admin-sidebar nav a:hover .nav-icon, .admin-sidebar nav a.active .nav-icon { background: #93ed221b; color: var(--lime); }
.nav-label { min-width: 0; }
.admin-sidebar footer { margin-top: auto; padding: 17px 8px 0; display: grid; gap: 8px; border-top: 1px solid #ffffff12; color: #758178; font-size: 10px; line-height: 1.45; }
.admin-sidebar footer a { width: max-content; color: #a0ef3d; font-weight: 700; }
.sidebar-close, .sidebar-backdrop { display: none; }
.admin-shell { min-height: 100vh; margin-left: 252px; }
.admin-topbar {
  height: 72px; padding: 0 36px; position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 18px;
  border-bottom: 1px solid var(--line); background: #fbfcf9e8; backdrop-filter: blur(16px);
}
.admin-topbar > div { min-width: 0; display: flex; flex-direction: column; }
.admin-topbar small { color: #849087; font-size: 8px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.admin-topbar strong { margin-top: 3px; font-size: 15px; font-weight: 750; }
.admin-topbar button { min-height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #465047; font-size: 12px; font-weight: 700; cursor: pointer; }
.menu-toggle { display: none; }
.admin-content { width: 100%; max-width: 1540px; margin: 0 auto; padding: 31px 38px 54px; }
.admin-flash, .form-error, .form-success { margin: 0 0 18px; padding: 13px 15px; border-radius: 10px; font-size: 12px; }
.admin-flash, .form-success { border: 1px solid #74b71f44; background: #8ce52117; color: #4e7b13; }
.form-error { border: 1px solid #d3565640; background: #d3565614; color: #a12828; }

/* Cabeçalhos e botões */
.page-heading, .editor-heading { margin-bottom: 24px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.page-heading h1, .editor-heading h1 { margin: 0; font-size: clamp(29px, 2.5vw, 38px); line-height: 1.08; font-weight: 850; letter-spacing: -.045em; }
.page-heading p, .editor-heading p { max-width: 720px; margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.admin-button { min-height: 42px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 11px; background: linear-gradient(135deg, #9af225, #78dc0c); box-shadow: 0 7px 18px #72c9141f; color: #13200f; font-size: 11px; font-weight: 850; cursor: pointer; transition: .18s ease; }
.admin-button:hover { transform: translateY(-1px); box-shadow: 0 10px 24px #72c91430; }
.admin-button.secondary { border: 1px solid var(--line); background: #fff; box-shadow: none; color: #465047; }
.admin-button.secondary:hover { border-color: #bbd5a1; background: #fbfff8; }
.danger-button { min-height: 42px; padding: 0 16px; border: 1px solid #d85a5a; border-radius: 10px; background: #fff5f5; color: #a52e2e; font-size: 11px; font-weight: 850; cursor: pointer; }

/* Cartões e métricas */
.admin-panel { padding: 22px; border: 1px solid var(--line); border-radius: 17px; background: var(--card); box-shadow: 0 8px 28px #17201908; }
.admin-panel h2 { margin: 0 0 17px; font-size: 18px; font-weight: 800; letter-spacing: -.025em; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.dashboard-metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.metric-card { min-height: 138px; padding: 20px; position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: linear-gradient(145deg, #fff, #fbfdf9); box-shadow: 0 8px 26px #17201908; }
.metric-card::after { content: ""; width: 7px; height: 7px; position: absolute; top: 21px; right: 20px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 6px #89e81a16; }
.metric-card span { display: block; padding-right: 24px; color: #67736a; font-size: 9px; font-weight: 800; letter-spacing: .105em; text-transform: uppercase; }
.metric-card strong { display: block; margin-top: 20px; font-size: 38px; line-height: 1; font-weight: 850; letter-spacing: -.055em; }
.metric-card small { display: block; margin-top: 9px; color: #8a958c; font-size: 10px; line-height: 1.45; }
.metric-title { max-width: 90%; font-size: 17px !important; line-height: 1.18 !important; letter-spacing: -.025em !important; }
.material-metrics { margin-bottom: 16px; }
.admin-grid { margin-top: 16px; display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; }
.recent-panel { margin-top: 16px; }
.panel-heading, .table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.panel-heading { margin-bottom: 20px; }
.panel-heading h2 { margin-bottom: 5px; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.panel-link { margin-top: 16px; display: inline-flex; color: #5ba700; font-size: 10px; font-weight: 850; }
.settings-note { margin-top: 24px; padding: 18px; border: 1px solid #e1e8de; border-radius: 12px; background: #f7faf5; color: #697166; }
.settings-note strong { color: #232923; }
.settings-note p { margin: 7px 0 0; font-size: 12px; line-height: 1.55; }

/* Tabelas e listas */
.data-table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.data-table th, .data-table td { padding: 13px 12px; border-bottom: 1px solid #e8ece6; text-align: left; vertical-align: middle; }
.data-table th { color: #89938b; font-size: 8px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.data-table tbody tr:hover { background: #f8fbf6; }
.data-table tr:last-child td { border-bottom: 0; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.inline-actions a, .inline-actions button { min-height: 34px; padding: 0 11px; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: #566159; font-size: 9px; font-weight: 750; cursor: pointer; }
.inline-actions a:hover, .inline-actions button:hover { border-color: #abd47f; background: #f8fff1; color: #315d05; }
.inline-actions form { margin: 0; }
.status { padding: 6px 9px; display: inline-flex; border-radius: 99px; background: #e8ede4; color: #64705f; font-size: 8px; font-weight: 850; }
.status.active, .status.done { background: #70cf1420; color: #4d9600; }
.status.blocked { background: #d94e4e17; color: #b13131; }
.bar { width: 110px; height: 7px; overflow: hidden; border-radius: 99px; background: #e7ece5; }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--lime-strong), #9ef12e); }
.table-toolbar { margin-bottom: 18px; }
.table-toolbar form { display: flex; gap: 8px; }
.table-toolbar input { width: min(360px, 48vw); min-height: 42px; padding: 0 13px; border: 1px solid #d0d8ce; border-radius: 10px; background: #fff; outline: 0; }
.table-toolbar > span { color: #798176; font-size: 11px; }
.pagination { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 7px; }
.pagination a { padding: 9px 12px; border: 1px solid #d3d8ce; border-radius: 8px; background: #fff; font-size: 11px; }
.pagination a.active { background: #111611; color: #fff; }
.empty-state { padding: 30px; color: #778075; text-align: center; }
.module-block { margin-bottom: 16px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 5px 18px #17201906; }
.module-block summary { padding: 17px 19px; display: flex; align-items: center; justify-content: space-between; gap: 14px; cursor: pointer; list-style: none; }
.module-block summary::-webkit-details-marker { display: none; }
.module-block summary b { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.module-lessons { padding: 0 18px 18px; }

/* Formulários em páginas completas */
.editor-page { width: 100%; max-width: 1240px; margin: 0 auto; }
.editor-back { margin: 0 0 19px; display: inline-flex; align-items: center; gap: 8px; color: #59655b; font-size: 11px; font-weight: 800; }
.editor-back:hover { color: #4d9100; }
.editor-heading { align-items: flex-end; }
.editor-heading .eyebrow { margin-bottom: 7px; }
.admin-editor { max-width: 920px; margin: 0 auto; padding: 26px; }
.admin-editor.is-wide { max-width: 1160px; }
.admin-editor.compact-editor { max-width: 700px; }
.admin-form { display: grid; gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.form-grid .wide { grid-column: 1 / -1; }
.material-form .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.material-form .form-grid .span-two { grid-column: span 2; }
.material-form .form-grid .wide { grid-column: 1 / -1; }
.admin-form label { min-width: 0; display: flex; flex-direction: column; gap: 7px; color: #4e5951; font-size: 11px; font-weight: 750; }
.admin-form label > small, label small { color: #8b948b; font-size: 9px; font-weight: 500; line-height: 1.45; }
.admin-form input:not([type="checkbox"]):not([type="radio"]), .admin-form select, .admin-form textarea {
  width: 100%; min-height: 46px; padding: 11px 13px; border: 1px solid #d9e1d6; border-radius: 10px; background: #fff; color: var(--ink); outline: 0;
}
.admin-form textarea { min-height: 108px; resize: vertical; line-height: 1.5; }
.admin-form input:focus, .admin-form select:focus, .admin-form textarea:focus, .table-toolbar input:focus { border-color: #7acb22; box-shadow: 0 0 0 4px #8ee51d16; }
.admin-form input[type="file"] { padding: 10px !important; background: #f6f8f4 !important; }
.editor-actions { padding-top: 4px; display: flex; flex-wrap: wrap; gap: 9px; border-top: 1px solid #edf0ea; }
.switch-field {
  min-height: 70px; padding: 13px 15px; display: flex !important; align-items: center; justify-content: space-between; flex-direction: row !important;
  gap: 16px !important; border: 1px solid var(--line); border-radius: 11px; background: #f8faf6;
}
.switch-field > span:not(.switch-control) { min-width: 0; display: grid; gap: 4px; order: 1; }
.switch-field strong, .switch-field b { color: #273027; font-size: 11px; }
.switch-field input { width: 1px; height: 1px; position: absolute; opacity: 0; pointer-events: none; }
.switch-control { width: 44px; height: 24px; flex: 0 0 44px; position: relative; order: 2; border-radius: 999px; background: #ccd4ca; box-shadow: inset 0 0 0 1px #bec8bb; transition: .18s; }
.switch-control::after { content: ""; width: 18px; height: 18px; position: absolute; top: 3px; left: 3px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px #0003; transition: .18s; }
.switch-field input:checked + .switch-control { background: var(--lime-strong); box-shadow: inset 0 0 0 1px #5aad00; }
.switch-field input:checked + .switch-control::after { transform: translateX(20px); }
.switch-field input:focus-visible + .switch-control { outline: 3px solid #8ee51d35; outline-offset: 2px; }
.simple-check { width: max-content; display: flex !important; align-items: center; flex-direction: row !important; gap: 8px !important; color: #586159 !important; }
.simple-check input { width: 17px; height: 17px; margin: 0; accent-color: var(--lime-strong); }
.danger-zone { margin-top: 22px; padding: 17px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border: 1px solid #eccccc; border-radius: 12px; background: #fff9f9; }
.danger-zone strong { color: #8f2d2d; font-size: 12px; }
.danger-zone p { margin: 5px 0 0; color: #987171; font-size: 10px; }
.material-photo-field { padding: 13px; display: grid; grid-template-columns: 1fr; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 11px; background: #f9fbf7; }
.material-photo-field.has-photo { grid-template-columns: 126px 1fr; }
.material-photo-field > img { width: 126px; height: 92px; object-fit: cover; border-radius: 8px; background: #e6e9e2; }
.material-photo-field > img[hidden] { display: none !important; }
.material-photo-controls { min-width: 0; display: grid; gap: 9px; }
.material-thumb { width: 58px; height: 45px; object-fit: cover; border-radius: 7px; background: #e5e9e1; }
.material-thumb.empty { display: grid; place-items: center; color: #7f887d; font-size: 8px; text-align: center; }
.materials-table td:nth-child(3) { min-width: 260px; max-width: 420px; }
.materials-table td:nth-child(3) small { display: block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Configurações, gráficos e áreas especiais */
.settings-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.settings-summary { min-height: 240px; display: flex; flex-direction: column; }
.settings-summary p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.settings-summary dl { margin: 22px 0; display: grid; gap: 9px; }
.settings-summary dl div { padding-bottom: 8px; display: flex; justify-content: space-between; gap: 20px; border-bottom: 1px solid #e4e7e1; font-size: 11px; }
.settings-summary dt { color: #7b8479; }
.settings-summary dd { max-width: 58%; margin: 0; overflow: hidden; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.settings-summary .admin-button { width: max-content; margin-top: auto; }
.click-chart { margin-bottom: 20px; display: grid; grid-template-columns: 230px 1fr; align-items: end; gap: 28px; }
.click-chart > div > small { color: #7d867b; }
.chart-bars { height: 150px; display: flex; align-items: end; gap: 8px; }
.chart-bars > span { height: 100%; min-width: 0; flex: 1; display: flex; flex-direction: column; justify-content: end; align-items: center; gap: 7px; }
.chart-bars i { width: 100%; min-height: 4px; border-radius: 3px 3px 0 0; background: linear-gradient(var(--lime), var(--lime-strong)); }
.chart-bars small { color: #8b9388; font-size: 7px; writing-mode: vertical-rl; transform: rotate(180deg); }
.period-filter { margin-bottom: 14px; padding: 15px; display: flex; align-items: end; flex-wrap: wrap; gap: 12px; }
.period-filter label { min-width: 150px; display: flex; flex-direction: column; gap: 6px; color: #68736b; font-size: 10px; font-weight: 750; }
.period-filter input, .period-filter select { min-height: 40px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.report-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.analytics-grid { grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr); }
.media-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.media-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 8px 24px #17201907; }
.media-card > img, .media-pdf { width: 100%; height: 170px; object-fit: cover; background: #edf1ea; }
.media-pdf { display: grid; place-content: center; justify-items: center; gap: 8px; color: #5e6b60; }
.media-pdf i { color: #df4d4d; font-size: 34px; }
.media-pdf span { font-size: 9px; font-weight: 850; letter-spacing: .12em; }
.media-card > div:last-child { padding: 15px; display: grid; gap: 9px; }
.media-card strong { min-width: 0; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.media-card small { color: #89938a; font-size: 9px; }
.media-card input { width: 100%; min-height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: #f7f9f5; color: #6f796f; font-size: 9px; }
.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.tool-card { min-height: 250px; display: flex; align-items: flex-start; flex-direction: column; }
.tool-card > i, .security-icon { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 14px; background: #8ae91a16; color: #61ad08; font-size: 20px; }
.tool-card h2 { margin: 22px 0 7px; }
.tool-card p { margin: 0 0 24px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.tool-card > .admin-button, .tool-card > form, .tool-card > .inline-actions { margin-top: auto; }
.import-result { margin-top: 16px; }
.security-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.security-card { min-height: 290px; position: relative; display: flex; align-items: flex-start; flex-direction: column; }
.security-card > .status { position: absolute; top: 22px; right: 22px; }
.security-card h2 { margin: 26px 0 9px; }
.security-card p { max-width: 550px; margin: 0 0 28px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.security-card > .admin-button { margin-top: auto; }
.totp-secret { margin-bottom: 18px; padding: 16px; border: 1px solid #dce6d7; border-radius: 12px; background: #f5faef; }
.totp-secret small { display: block; color: #778176; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.totp-secret strong { display: block; margin: 8px 0; overflow-wrap: anywhere; color: #306400; font: 800 20px/1.3 monospace; letter-spacing: .1em; }
.totp-secret code { display: block; margin-top: 8px; padding: 9px; overflow-wrap: anywhere; border-radius: 7px; background: #eaf0e5; font-size: 8px; }

@media (max-width: 1250px) {
  .dashboard-metrics { grid-template-columns: repeat(3, 1fr); }
  .media-grid { grid-template-columns: repeat(3, 1fr); }
  .analytics-grid { grid-template-columns: 1fr; }
  .click-chart { grid-template-columns: 1fr; }
}

@media (max-width: 1020px) {
  .admin-sidebar { width: 228px; }
  .admin-shell { margin-left: 228px; }
  .admin-content { padding-inline: 26px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-grid { grid-template-columns: 1fr; }
  .material-form .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
  body.menu-open { overflow: hidden; }
  .auth-page { padding: 14px; }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 320px; padding: 29px; }
  .login-brand h1 { font-size: 56px; }
  .login-card { padding: 38px 26px; }
  .admin-auth-page { padding: 12px; place-items: start center; }
  .admin-login-shell { min-height: auto; grid-template-columns: 1fr; border-radius: 20px; }
  .admin-login-brand { min-height: 270px; padding: 28px; }
  .admin-login-brand > a { width: 185px; }
  .admin-login-brand h1 { font-size: 42px; }
  .student-login-brand h1 { font-size: 40px; }
  .admin-login-brand > div > span:last-child { margin-top: 14px; }
  .admin-login-icon { width: 42px; height: 42px; margin-bottom: 18px; }
  .admin-login-card { padding: 35px 25px; }
  .admin-login-heading h2 { font-size: 32px; }
  .install-card { padding: 27px 19px; }
  .admin-sidebar { width: min(86vw, 310px); padding: 20px 17px; transform: translateX(-100%); transition: transform .2s; box-shadow: 25px 0 70px #0008; }
  .menu-open .admin-sidebar { transform: none; }
  .sidebar-close { width: 40px; height: 40px; position: absolute; top: 13px; right: 13px; display: grid; place-items: center; border: 1px solid #ffffff1c; border-radius: 10px; background: #ffffff08; color: #fff; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 35; border: 0; background: #050806b8; backdrop-filter: blur(3px); }
  .menu-open .sidebar-backdrop { display: block; }
  .admin-sidebar nav a { min-height: 52px; font-size: 13px; }
  .admin-shell { margin-left: 0; }
  .admin-topbar { height: 66px; padding: 0 12px; }
  .menu-toggle { width: 42px; height: 42px; padding: 0 !important; display: grid; place-items: center; }
  .admin-topbar > div { margin-right: auto; }
  .admin-topbar > div small { display: none; }
  .admin-topbar > div strong { max-width: 48vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .admin-content { padding: 20px 13px 42px; }
  .page-heading, .editor-heading { align-items: flex-start; flex-direction: column; gap: 15px; }
  .page-heading h1, .editor-heading h1 { font-size: 29px; }
  .page-heading p, .editor-heading p { font-size: 12px; }
  .page-heading > .admin-button, .editor-heading > .admin-button { width: 100%; }
  .admin-panel { padding: 16px; border-radius: 14px; }
  .admin-editor, .admin-editor.is-wide, .admin-editor.compact-editor { max-width: none; }
  .form-grid, .material-form .form-grid { grid-template-columns: 1fr; gap: 14px; }
  .form-grid .wide, .material-form .form-grid .span-two, .material-form .form-grid .wide { grid-column: auto; }
  .admin-form input:not([type="checkbox"]):not([type="radio"]), .admin-form select, .admin-form textarea { min-height: 48px; font-size: 16px; }
  .editor-actions { display: grid; grid-template-columns: 1fr; }
  .editor-actions .admin-button, .editor-actions .danger-button { width: 100%; }
  .danger-zone { align-items: stretch; flex-direction: column; }
  .danger-zone .danger-button { width: 100%; }
  .material-photo-field.has-photo { grid-template-columns: 100px 1fr; }
  .material-photo-field > img { width: 100px; height: 84px; }
  .table-toolbar, .panel-heading { align-items: flex-start; flex-direction: column; }
  .table-toolbar form { width: 100%; display: grid; grid-template-columns: 1fr auto; }
  .table-toolbar input { width: 100%; }
  .data-table-wrap { margin-inline: -16px; padding-inline: 16px; }
  .data-table { min-width: 680px; }
  .module-block summary { padding: 15px; }
  .module-lessons { padding: 0 13px 13px; }
  .settings-cards, .tool-grid, .security-layout { grid-template-columns: 1fr; }
  .settings-summary, .tool-card, .security-card { min-height: auto; }
  .tool-card > .admin-button, .tool-card > form, .tool-card > .inline-actions, .security-card > .admin-button { margin-top: 10px; }
  .report-metrics { grid-template-columns: repeat(2, 1fr); }
  .media-grid { grid-template-columns: repeat(2, 1fr); }
  .period-filter { display: grid; grid-template-columns: 1fr 1fr; align-items: stretch; }
  .period-filter label:first-child, .period-filter .admin-button { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  .dashboard-metrics, .metric-grid, .report-metrics, .media-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 116px; }
  .metric-card strong { font-size: 32px; }
  .material-photo-field.has-photo { grid-template-columns: 1fr; }
  .material-photo-field > img { width: 100%; height: 160px; }
  .period-filter { grid-template-columns: 1fr; }
  .period-filter label:first-child, .period-filter .admin-button { grid-column: auto; }
  .admin-topbar > div strong { max-width: 40vw; }
}
