/* Mikata customer portal — app shell styles (instructor + enterprise admin).
   Light, dense, dashboard-grade. Shares the brand indigo with the marketing site. */
:root {
  --ai: #2b3a8f; --ai-deep: #1d2a6e; --ai-soft: #eef1ff;
  --sakura: #ff8aa6; --good: #1c9d6b; --warn: #d98a00; --bad: #d6455d;
  --ink: #161a2b; --body: #3a3f55; --muted: #6b7088;
  --bg: #f4f6fb; --panel: #ffffff; --line: #e6e8f2;
  --radius: 12px; --shadow: 0 6px 20px rgba(27,33,73,.06);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--body);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif; font-size: 15px; }
a { color: var(--ai); text-decoration: none; } a:hover { text-decoration: underline; }
h1,h2,h3 { color: var(--ink); margin: 0; }

.proto { background: var(--ai-deep); color: #fff; text-align: center; font-size: .8rem; padding: 5px; }

/* layout */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow:auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--ink); font-size: 1.1rem; padding: 6px 8px 16px; }
.brand .mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--ai), #4d63d6); color: #fff; }
.side .group { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 16px 8px 6px; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--body); font-weight: 500; }
.side nav a:hover { background: var(--ai-soft); text-decoration: none; }
.side nav a.active { background: var(--ai); color: #fff; }
.side nav a .ic { width: 20px; text-align: center; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 14px 26px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 1.25rem; }
.topbar .spacer { flex: 1; }
.switcher { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); }
.switcher select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font: inherit; }
.who { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--sakura); color: #fff; display: grid; place-items: center; font-weight: 700; }
.content { padding: 26px; max-width: 1180px; width: 100%; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap: 16px; margin-bottom: 22px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.tile .label { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tile .value { font-size: 1.9rem; font-weight: 800; color: var(--ink); margin-top: 6px; }
.tile .sub { font-size: .82rem; color: var(--muted); margin-top: 2px; }

/* cards & sections */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 22px; }
.card .hd { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.card .hd h2 { font-size: 1.05rem; }
.card .hd .spacer { flex: 1; }
.card .bd { padding: 18px; }
.card .bd.flush { padding: 0; }
/* Contain wide tables inside the card instead of letting them spill into the page margin. */
.card { overflow: hidden; }
.card .bd.flush { overflow-x: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }

/* observability chart grid */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 22px; margin-bottom: 22px; }
.chart-grid .card { margin-bottom: 0; }
.canvas-wrap { position: relative; height: 260px; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:hover { background: #fafbff; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-link { cursor: pointer; }

/* badges & bars */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.badge.green { background: #e6f6ee; color: var(--good); }
.badge.amber { background: #fdf2dd; color: var(--warn); }
.badge.red { background: #fbe6ea; color: var(--bad); }
.badge.blue { background: var(--ai-soft); color: var(--ai); }
.badge.grey { background: #eef0f6; color: var(--muted); }
.bar { background: #eef0f6; border-radius: 999px; height: 8px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--ai); }
.bar.warn > span { background: var(--warn); } .bar.bad > span { background: var(--bad); }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 9px; font-weight: 600; font-size: .9rem; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.btn:hover { border-color: var(--ai); text-decoration: none; }
.btn.primary { background: var(--ai); color: #fff; border-color: var(--ai); }
.btn.primary:hover { background: var(--ai-deep); }
.btn.sm { padding: 5px 11px; font-size: .82rem; }
.btn.danger { color: var(--bad); border-color: #f3c6cf; }
input, select, textarea { font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); }
.field { display: grid; gap: 5px; margin-bottom: 12px; }
.field label { font-size: .82rem; font-weight: 600; color: var(--ink); }
.muted { color: var(--muted); }
.right { text-align: right; }

/* roster progress */
.avatar-sm { width: 26px; height: 26px; border-radius: 50%; background: var(--ai-soft); color: var(--ai); display: inline-grid; place-items: center; font-size: .75rem; font-weight: 700; margin-right: 8px; vertical-align: middle; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(22,26,43,.45); display: none; place-items: center; z-index: 40; }
.modal-bg.open { display: grid; }
.modal { background: #fff; border-radius: 14px; width: min(560px, 92vw); max-height: 88vh; overflow: auto; box-shadow: 0 30px 60px rgba(0,0,0,.3); }
.modal .hd { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal .hd h3 { flex: 1; } .modal .bd { padding: 20px; } .modal .ft { padding: 16px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.x { cursor: pointer; color: var(--muted); font-size: 1.3rem; border: 0; background: none; }

/* role visibility */
.ent-only { display: none; }
body.role-enterprise .ent-only { display: revert; }
body.role-enterprise .inst-note { display: none; }

@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; } .side { position: static; height: auto; }
  .grid2 { grid-template-columns: 1fr; }
}

/* --- Internal admin portal theming: dark sidebar to signal staff-only tooling --- */
.side { background: #161a2b; border-right-color: #232845; }
.side .brand { color: #fff; }
.side .group { color: #8b91b5; }
.side nav a { color: #c7cbe4; }
.side nav a:hover { background: #232845; }
.side nav a.active { background: var(--ai); color: #fff; }
.proto { background: #6d213b; }
.staff-pill { display:inline-block; background:#3a1d2b; color:#ff9ab0; font-size:.72rem; padding:2px 8px; border-radius:999px; margin-left:8px; }
code { background:#eef0f6; padding:1px 6px; border-radius:5px; font-size:.85em; }

/* admin toolbar (filters + search) above a scoped table */
.toolbar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; padding:12px 18px; border-bottom:1px solid var(--line); }
.toolbar .grow { flex:1 1 220px; }
.segmented { display:inline-flex; border:1px solid var(--line); border-radius:9px; overflow:hidden; }
.segmented button { border:0; background:#fff; color:var(--body); padding:7px 12px; font:inherit; font-size:.85rem; cursor:pointer; border-right:1px solid var(--line); }
.segmented button:last-child { border-right:0; }
.segmented button.active { background:var(--ai); color:#fff; font-weight:600; }
.segmented button:hover:not(.active) { background:var(--ai-soft); }
/* truncate long identifiers/refs so a single cell can't blow out the table width */
.trunc { display:inline-block; max-width:22ch; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; vertical-align:bottom; }
.trunc.wide { max-width:30ch; }
.empty { padding:28px 18px; text-align:center; color:var(--muted); }
