/* Aceleași culori și fonturi ca la cursuri, ca trecerea dintre ele să nu se simtă. */
:root {
  --bg: #f6f6f3; --surface: #ffffff; --surface-2: #f0f0ec; --text: #1b1c1e; --muted: #5e6268;
  --border: #e2e2dc; --accent: #2f5bea; --accent-soft: #e9eefd; --ok: #1d8049; --ok-soft: #e4f4ea;
  --bad: #c42b2b; --bad-soft: #fcebea; --warn: #a35f00; --warn-soft: #fff3df;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04); --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111214; --surface: #18191c; --surface-2: #202125; --text: #e7e7ea; --muted: #9a9ea6;
    --border: #2a2c31; --accent: #7d9bff; --accent-soft: #1d2540; --ok: #4fc58b; --ok-soft: #13281d;
    --bad: #ff7676; --bad-soft: #341a1a; --warn: #f1b45b; --warn-soft: #30250f; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111214; --surface: #18191c; --surface-2: #202125; --text: #e7e7ea; --muted: #9a9ea6;
  --border: #2a2c31; --accent: #7d9bff; --accent-soft: #1d2540; --ok: #4fc58b; --ok-soft: #13281d;
  --bad: #ff7676; --bad-soft: #341a1a; --warn: #f1b45b; --warn-soft: #30250f; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.8rem; margin: 0 0 .3em; }
h2 { font-size: 1.25rem; margin: 0; }
h3 { font-size: 1rem; margin: 1.4em 0 .5em; }
p { margin: .6em 0; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
[hidden] { display: none !important; }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: #fff; font-size: .9rem; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 32px 16px 64px; }
.wrap.narrow { max-width: 420px; padding-top: 56px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .92rem; padding: 8px 14px; border-radius: 10px; cursor: pointer; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: none; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.block { width: 100%; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }

/* Formulare */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 10px; margin-bottom: 20px; }
.tabs button { font: inherit; font-weight: 600; font-size: .92rem; padding: 7px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; font-size: .9rem; font-weight: 500; }
.field input { font: inherit; font-size: 1rem; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 9px; padding: 9px 12px; }
.field input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.hint { font-weight: 400; color: var(--muted); font-size: .82rem; }
.form-error { color: var(--bad); background: var(--bad-soft); border-radius: 8px; padding: 8px 12px; font-size: .9rem; margin: 0 0 14px; }
.form-error:empty { display: none; }

/* Dashboard */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.courses { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.course-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.stat b { display: block; font-size: 1.2rem; line-height: 1.3; }
.stat span { color: var(--muted); font-size: .78rem; }
.bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.modules { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.modules li { display: grid; grid-template-columns: 1fr 64px 44px; align-items: center; gap: 10px; font-size: .88rem; }
.modules li > span:last-child { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Tabele */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; }
td.wrap-text { white-space: normal; min-width: 220px; }
table.compact td { white-space: normal; }
table.compact td.num { white-space: nowrap; text-align: right; }
tr.selected td { background: var(--accent-soft); }
.link-btn { font: inherit; font-weight: 600; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.cell-progress { display: grid; grid-template-columns: 56px auto; align-items: center; gap: 8px; }

.pill { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.pill.admin { background: var(--accent-soft); color: var(--accent); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.weak { background: var(--warn-soft); color: var(--warn); }

.detail { margin-top: 28px; }
.detail-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.notice { padding: 14px 16px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); }

@media (max-width: 640px) {
  h1 { font-size: 1.5rem; }
  .panel { padding: 18px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .wrap.narrow { padding-top: 28px; }
}
