/* ===== shared look: light gray, 0/1 rain, frosted cards ===== */
:root {
  --bg: #b9bcc2;
  --ink: #1d242c;
  --ink-soft: #4b5560;
  --muted: #66707c;
  --line: rgba(43, 47, 54, .16);
  --card: #fbfcfd;
  --card-2: #eef0f3;
  --accent: #16583f;
  --accent-soft: rgba(22, 88, 63, .12);
  --danger: #a4342c;
  --danger-soft: rgba(164, 52, 44, .10);
  --warn: #8a5a12;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --radius: 12px;
  --shadow: 0 10px 28px -10px rgba(25, 35, 50, .30), 0 2px 6px rgba(25, 35, 50, .07);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

.rain {
  position: fixed;
  left: 0; top: 0;
  width: 100vw; height: 100dvh;
  z-index: 0;
  display: block;
  pointer-events: none;
  opacity: .30;
}

.veil {
  position: fixed; inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 42%, rgba(255,255,255,.55) 0%, rgba(255,255,255,.14) 45%, rgba(120,125,133,.22) 100%);
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
.muted { color: var(--muted); }
.muted-sm { color: var(--muted); font-size: 13px; }

/* ---------------- auth ---------------- */
.auth-page { display: grid; place-items: center; min-height: 100dvh; padding: 24px 18px; }

.auth-wrap { position: relative; z-index: 2; width: 100%; max-width: 420px; }

.auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 30px 28px 22px;
}

.auth-head { display: flex; gap: 13px; align-items: flex-start; margin-bottom: 24px; }
.auth-head h1 { font-size: 19px; line-height: 1.25; }

.brand-dot {
  width: 11px; height: 11px; margin-top: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  flex: 0 0 auto;
}

.field { display: block; margin-bottom: 15px; }
.field > span {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"], input[type="password"], input[type="date"], input[type="search"], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  min-height: 42px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(22, 88, 63, .55);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 62px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  background: transparent; border: 0; color: var(--accent); cursor: pointer;
  padding: 6px 8px; border-radius: 6px;
}
.pw-toggle:hover { background: var(--accent-soft); }

.btn {
  font: inherit; font-family: var(--mono); font-size: 12px;
  letter-spacing: .08em; text-transform: uppercase;
  border-radius: 9px; padding: 11px 16px; min-height: 42px;
  cursor: pointer; border: 1px solid var(--line);
  background: #fff; color: var(--ink);
  transition: background .18s, border-color .18s, color .18s, box-shadow .18s;
}
.btn:hover { border-color: rgba(22, 88, 63, .45); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.btn-primary:hover { background: #11452f; border-color: #11452f; }

.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); border-color: rgba(164, 52, 44, .35); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-block { width: 100%; margin-top: 4px; }
.btn-sm { min-height: 32px; padding: 6px 11px; font-size: 11px; border-radius: 7px; }

.form-msg { min-height: 18px; font-size: 13px; color: var(--muted); margin: 4px 0 10px; }
.form-msg.bad { color: var(--danger); }

.auth-foot { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ---------------- app shell ---------------- */
.shell { position: relative; z-index: 2; min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }

.topbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  background: #fbfcfd;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: #0d1319; }
.brand small { display: block; font-weight: 400; font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

.who { display: flex; align-items: center; gap: 12px; }
.who .name { font-size: 13.5px; }
.who .role {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 3px 9px;
}

.layout {
  display: grid;
  grid-template-columns: 232px 1fr;
  align-items: start;
  background: #eef1f4;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  min-height: calc(100dvh - 61px);
}
.side {
  position: sticky; top: 61px;
  background: #e9ecef;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 18px 14px;
  display: flex; flex-direction: column; gap: 4px;
  border-right: 1px solid var(--line);
  min-height: calc(100dvh - 61px);
}
.side button {
  text-align: left; font: inherit; font-size: 13.5px;
  letter-spacing: .005em;
  background: rgba(251,252,253,.72);
  border: 1px solid rgba(43,47,54,.10); border-radius: 9px;
  color: #12181f; font-weight: 650; padding: 10px 12px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  transition: background .16s, color .16s, border-color .16s;
}
.side button:hover { background: #fff; border-color: rgba(43,47,54,.22); color: #000; }
.side button.on {
  background: #fff; border-color: rgba(22,88,63,.42); color: #0f1a16; font-weight: 700;
  box-shadow: 0 2px 8px rgba(25,35,50,.10), inset 3px 0 0 var(--accent);
}
.side .count { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.side .group {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin: 14px 0 6px 12px;
}

.main {
  padding: 22px 24px 60px;
  min-width: 0;
  background: #eef1f4;
  min-height: calc(100dvh - 61px);
}

/* standalone page (E-Learning): full-width surface over the rain */
.el-main { background: #eef1f4; }
.shell { background: #eef1f4; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; justify-content: space-between; margin-bottom: 18px; }
.page-head h2 { font-size: 20px; font-weight: 700; color: #0d1319; letter-spacing: -.015em; }
.page-head p { color: var(--muted); font-size: 13.5px; margin-top: 3px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
}
.card + .card { margin-top: 16px; }
.card h3 { font-size: 14px; margin-bottom: 12px; font-weight: 700; color: #0d1319; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }

.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow); }
.stat .k { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stat .v { font-size: 26px; font-weight: 600; margin-top: 6px; letter-spacing: -.02em; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
tr:last-child td { border-bottom: 0; }
td .sub { display: block; color: var(--muted); font-size: 12px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase;
  border-radius: 999px; padding: 3px 9px; border: 1px solid var(--line); color: var(--ink-soft);
  background: #fff;
}
.pill.ok { color: var(--accent); border-color: rgba(22,88,63,.3); background: var(--accent-soft); }
.pill.warn { color: var(--warn); border-color: rgba(138,90,18,.3); background: rgba(138,90,18,.1); }
.pill.off { color: var(--muted); }
.pill.bad { color: var(--danger); border-color: rgba(164,52,44,.3); background: var(--danger-soft); }

.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.row > .field { margin-bottom: 0; flex: 1 1 160px; min-width: 140px; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.media-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.media-thumb {
  height: 118px; display: grid; place-items: center;
  background: linear-gradient(160deg, #eef1f4, #dfe3e8);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 26px; color: var(--accent); letter-spacing: .05em;
}
.media-body { padding: 12px 13px 13px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.media-body .t { font-weight: 600; font-size: 13.5px; line-height: 1.35; }
.media-body .m { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.media-actions { display: flex; gap: 7px; margin-top: auto; flex-wrap: wrap; }

.viewer {
  position: fixed; inset: 0; z-index: 40; display: none;
  background: rgba(20, 26, 33, .62);
  backdrop-filter: blur(4px);
  padding: 28px 16px;
  overflow: auto;
}
.viewer.open { display: grid; place-items: start center; }
.viewer-box {
  background: #fff; border-radius: 14px; box-shadow: 0 24px 60px -12px rgba(0,0,0,.5);
  width: min(980px, 100%); overflow: hidden;
}
.viewer-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.viewer-head .t { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.viewer-body { background: #0f1418; display: grid; place-items: center; }
.viewer-body video, .viewer-body audio { width: 100%; max-height: 72vh; display: block; }
.viewer-body iframe { width: 100%; height: 72vh; border: 0; background: #fff; }
.viewer-body .doc-msg { color: #cfd6dd; padding: 44px 20px; text-align: center; font-size: 14px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 14px);
  background: #1d242c; color: #fff; font-size: 13.5px; padding: 11px 16px; border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,.3); opacity: 0; pointer-events: none;
  transition: opacity .22s, transform .22s; z-index: 60; max-width: min(560px, 92vw);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--danger); }

.empty { text-align: center; color: var(--muted); padding: 42px 18px; font-size: 14px; }

.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .side {
    position: static; min-height: 0; border-right: 0; border-bottom: 1px solid var(--line);
    flex-direction: row; overflow-x: auto; padding: 10px 12px; gap: 6px;
  }
  .side .group { display: none; }
  .side button { white-space: nowrap; }
  .main { padding: 16px 14px 48px; }
  table { font-size: 12.5px; }
  th, td { padding: 8px 8px; }
}

/* ---------------- source tabs (E-Learning) ---------------- */
.src-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  background: #e6e9ed;
  border: 1px solid rgba(43,47,54,.12);
  border-radius: 10px;
}
.src-tab {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #3c454f;
  background: transparent;
  border: 0;
  border-radius: 7px;
  padding: 8px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background .16s, color .16s;
}
.src-tab:hover { color: #101720; }
.src-tab.on {
  background: #fff;
  color: #0e1a14;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(25,35,50,.14);
}
.src-tab .dot-sm {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; opacity: .35;
}
.src-tab.on .dot-sm { background: #16583f; opacity: 1; }

.pt { font-size: 12.5px; line-height: 1.45; color: #2a333d; margin-bottom: 3px; }
.pt:last-child { margin-bottom: 0; }
