/* Limitless palette: navy #070e1c, sky #94d5ff. */
:root {
  --bg: #070e1c;
  --panel: #0d182c;
  --panel-2: #12203a;
  --line: rgba(148, 213, 255, .12);
  --text: #e8f1fb;
  --muted: #8da3bf;
  --sky: #94d5ff;
  --sky-strong: #5fbcf5;
  --ok: #5ad19a;
  --warn: #f5c35f;
  --danger: #ff7d7d;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 Heebo, system-ui, sans-serif; }
a { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.3; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0 0 .6rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
.ltr { direction: ltr; unicode-bidi: embed; text-align: right; }

/* layout */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; gap: 1.5rem; align-items: center; padding: .7rem 1.5rem; background: rgba(7, 14, 28, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .5rem; color: var(--text); font-weight: 800; font-size: 1.1rem; }
.brand small { color: var(--muted); font-weight: 400; font-size: .85rem; }
.brand.big { font-size: 1.6rem; justify-content: center; }
.logo { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, #12305a, #0a1a33); color: var(--sky); border: 1px solid var(--line); }
.topnav { display: flex; gap: 1.1rem; flex: 1; }
.topnav a { color: var(--muted); }
.topnav a:hover { color: var(--text); text-decoration: none; }
.me { display: flex; gap: .8rem; align-items: center; color: var(--muted); font-size: .9rem; }
.page { max-width: 1120px; margin: 0 auto; padding: 1.6rem 1.5rem 4rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.row { display: flex; gap: .7rem; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.cols-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; align-items: start; }
.narrow { max-width: 460px; margin: 0 auto; }

/* cards */
.card { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1rem; color: var(--text); }
a.card:hover { text-decoration: none; border-color: rgba(148, 213, 255, .35); transform: translateY(-1px); transition: .15s; }
.ws-card { border-right: 3px solid var(--sky); }
.ws-card.archived { opacity: .6; border-right-color: var(--muted); }
.stats { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: .6rem 0; color: var(--muted); font-size: .9rem; }
.stats b { color: var(--text); }
.stats .hot b, .kpi.hot b { color: var(--warn); }
.attention { margin-top: .6rem; padding: .35rem .7rem; border-radius: 8px; background: rgba(245, 195, 95, .1); color: var(--warn); font-size: .85rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; }
.kpi b { display: block; font-size: 1.8rem; font-weight: 800; color: var(--sky); }
.kpi span { color: var(--muted); font-size: .9rem; }
.line { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--line); color: var(--text); }
.line:last-child { border-bottom: 0; }
a.line:hover { color: var(--sky); text-decoration: none; }
.notice { padding: .7rem .9rem; border-radius: 8px; background: rgba(148, 213, 255, .1); border: 1px solid rgba(148, 213, 255, .3); font-weight: 500; user-select: all; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }

/* workspace */
.ws-head { margin-bottom: 1rem; }
.crumbs { color: var(--muted); font-size: .85rem; margin-bottom: .4rem; }
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin-top: .8rem; overflow-x: auto; }
.tabs a { padding: .6rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--sky); border-bottom-color: var(--sky); font-weight: 700; }
.dot { font-style: normal; display: inline-block; min-width: 1.3em; padding: 0 .35em; border-radius: 99px; background: var(--warn); color: #1a1200; font-size: .75rem; text-align: center; font-weight: 700; }
.tab-body { margin-top: 1rem; }

/* badges */
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 600; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); vertical-align: middle; }
.badge.mode-coaching { color: var(--sky); }
.badge.mode-build { color: #c7a6ff; }
.badge.task-open, .badge.help-open { color: var(--sky); }
.badge.task-submitted { color: var(--warn); border-color: rgba(245, 195, 95, .4); }
.badge.task-approved, .badge.help-resolved { color: var(--ok); }
.badge.task-returned { color: var(--danger); }
.badge.archived { color: var(--muted); }

/* forms */
label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; color: var(--muted); }
label.check { flex-direction: row; align-items: center; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; width: 100%; }
input[type=checkbox] { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(148, 213, 255, .5); outline-offset: 1px; border-color: transparent; }
textarea { resize: vertical; margin-bottom: .6rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem 1rem; }
.form-grid .wide, .form-grid h2 { grid-column: 1 / -1; }
details.card > summary { list-style: none; display: inline-block; cursor: pointer; }
details.card > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 1rem; }
.btn { display: inline-flex; align-items: center; gap: .4rem; font: inherit; font-weight: 600; padding: .55rem 1.1rem; border-radius: 9px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; }
.btn:hover { border-color: rgba(148, 213, 255, .4); text-decoration: none; }
.btn.primary { background: var(--sky); color: #04101f; border-color: var(--sky); }
.btn.primary:hover { background: var(--sky-strong); }
.btn:disabled { opacity: .5; cursor: wait; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--sky); cursor: pointer; }
.link.danger { color: var(--danger); }

/* tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: right; color: var(--muted); font-weight: 500; font-size: .85rem; padding: .5rem; border-bottom: 1px solid var(--line); }
.table td { padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr[data-href] { cursor: pointer; }
.table tr[data-href]:hover td { background: rgba(148, 213, 255, .04); }
.table .actions { display: flex; gap: .8rem; flex-wrap: wrap; }
.table select { width: auto; padding: .25rem .5rem; }
.matrix td.yes { color: var(--ok); text-align: center; font-weight: 700; }
.matrix td.no { color: var(--muted); text-align: center; }
.matrix th:not(:first-child) { text-align: center; }

/* learning */
.progress { height: 6px; background: var(--panel-2); border-radius: 99px; overflow: hidden; margin: .4rem 0; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--sky-strong), var(--sky)); border-radius: 99px; }
.lessons { list-style: none; padding: 0; margin: 1rem 0 0; counter-reset: l; }
.lessons li { display: flex; justify-content: space-between; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.lessons a { display: flex; align-items: center; gap: .7rem; color: var(--text); }
.tick { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line); color: var(--bg); font-size: .8rem; font-weight: 800; }
.lessons li.done .tick { background: var(--ok); border-color: var(--ok); }
.lesson { max-width: 760px; margin: 1rem auto; padding: 2rem 2.2rem; }
.lesson h1 { margin-bottom: 1.2rem; }
.lesson-foot { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* markdown */
.md { line-height: 1.75; }
.md h2, .md h3, .md h4 { margin-top: 1.4rem; color: var(--sky); }
.md ul, .md ol { padding-right: 1.3rem; margin: .4rem 0 .8rem; }
.md li { margin: .25rem 0; }
.md code { background: var(--panel-2); padding: .1rem .35rem; border-radius: 5px; font-size: .9em; direction: ltr; unicode-bidi: embed; }
.md pre { background: #050b16; border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem; overflow-x: auto; text-align: left; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: .8rem 0; padding: .6rem 1rem; border-right: 3px solid var(--sky); background: rgba(148, 213, 255, .06); border-radius: 6px; }
.md .exercise { margin-top: 1.5rem; padding: .4rem 1.2rem 1rem; border-radius: 10px; background: rgba(90, 209, 154, .07); border: 1px solid rgba(90, 209, 154, .3); }
.md .exercise h2, .md .exercise h3 { color: var(--ok); }

/* threads & activity */
.thread { list-style: none; padding: 0; margin: .6rem 0 1rem; }
.thread li { padding: .7rem .9rem; border: 1px solid var(--line); border-radius: 10px; margin-bottom: .6rem; background: var(--panel-2); }
.thread li.submit { border-right: 3px solid var(--warn); }
.thread li.approve { border-right: 3px solid var(--ok); }
.thread li.return { border-right: 3px solid var(--danger); }
.activity { list-style: none; padding: 0; margin: 0; }
.activity li { padding: .45rem 0; border-bottom: 1px solid var(--line); }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(circle at 50% 0%, #12305a 0%, var(--bg) 60%); }
.auth-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: .9rem; padding: 2rem; text-align: center; }
.auth-card label { text-align: right; }

#toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translate(-50%, 2rem); opacity: 0; transition: .2s; padding: .7rem 1.2rem; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); z-index: 20; pointer-events: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { border-color: var(--danger); color: var(--danger); }

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: .6rem 1rem; padding: .6rem 1rem; }
  .brand small { display: none; }
  .topnav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .page { padding: 1rem .9rem 3rem; }
  .cols-2, .form-grid { grid-template-columns: 1fr; }
  .grid, .cols { grid-template-columns: 1fr; }
  .lesson { padding: 1.3rem 1.1rem; }
  .table { font-size: .88rem; }
  .table th:nth-child(5), .table td:nth-child(5) { display: none; }
}
