:root {
  --bg: #f6f4ee;
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --ink: #17251f;
  --ink-2: #4a5a52;
  --ink-3: #7b8a82;
  --line: #e4e0d5;
  --line-2: #efece4;
  --brand: #0f5c4a;
  --brand-ink: #ffffff;
  --brand-soft: #e3f0eb;
  --accent: #f2a93b;
  --accent-soft: #fdf1dc;
  --danger: #b4382f;
  --danger-soft: #fbe7e4;
  --warn: #a8640b;
  --warn-soft: #fcf0d8;
  --ok: #1d7a4a;
  --ok-soft: #e1f3e8;
  --info: #2b5fa8;
  --info-soft: #e5eefa;
  --violet: #6a48b0;
  --violet-soft: #efe9fa;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(23, 37, 31, .05), 0 4px 16px rgba(23, 37, 31, .05);
  --shadow-lg: 0 10px 40px rgba(23, 37, 31, .16);
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --side: 248px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1613; --surface: #161f1b; --surface-2: #1b2621; --ink: #e8efe9; --ink-2: #b2c0b8; --ink-3: #82938a;
    --line: #2a3832; --line-2: #222e29; --brand: #4fbf9d; --brand-ink: #062b21; --brand-soft: #173a30;
    --accent: #f5b555; --accent-soft: #3a2d15; --danger: #f08a80; --danger-soft: #3c1d1a; --warn: #f0b860;
    --warn-soft: #3a2c13; --ok: #6ad39a; --ok-soft: #173426; --info: #8db4ef; --info-soft: #1b2a40;
    --violet: #b9a2ec; --violet-soft: #2a2140; --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1613; --surface: #161f1b; --surface-2: #1b2621; --ink: #e8efe9; --ink-2: #b2c0b8; --ink-3: #82938a;
  --line: #2a3832; --line-2: #222e29; --brand: #4fbf9d; --brand-ink: #062b21; --brand-soft: #173a30;
  --accent: #f5b555; --accent-soft: #3a2d15; --danger: #f08a80; --danger-soft: #3c1d1a; --warn: #f0b860;
  --warn-soft: #3a2c13; --ok: #6ad39a; --ok-soft: #173426; --info: #8db4ef; --info-soft: #1b2a40;
  --violet: #b9a2ec; --violet-soft: #2a2140; --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 750; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
.muted { color: var(--ink-3); }
.small { font-size: .85rem; }
.tiny { font-size: .75rem; }
.strong { font-weight: 650; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 16px; height: 16px; }
.icon.lg { width: 28px; height: 28px; }
[hidden] { display: none !important; }

.app { min-height: 100vh; display: flex; }
.side { position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--surface); border-right: 1px solid var(--line); display: none; flex-direction: column; z-index: 20; }
.side .brand { display: flex; gap: .7rem; align-items: center; padding: 1.1rem 1.2rem; border-bottom: 1px solid var(--line-2); }
.logo { width: 36px; height: 36px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 800; font-size: .95rem; flex: none; }
.brand-name { font-weight: 750; font-size: .95rem; line-height: 1.15; }
.brand-sub { font-size: .75rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.side nav { padding: .75rem .6rem; overflow-y: auto; flex: 1; }
.side nav a { display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border-radius: 10px; color: var(--ink-2); font-weight: 550; margin-bottom: 2px; }
.side nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.side nav a.on { background: var(--brand-soft); color: var(--brand); }
.side .me { border-top: 1px solid var(--line-2); padding: .8rem 1rem; display: flex; gap: .6rem; align-items: center; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 15; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-2); }
.top-in { display: flex; align-items: center; gap: .75rem; height: 58px; padding: 0 16px; max-width: 1180px; margin: 0 auto; }
.top .mobile-brand { display: flex; align-items: center; gap: .6rem; min-width: 0; flex: 1; }
.top .mobile-brand .brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .spacer { flex: 1; display: none; }
.icon-btn { position: relative; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--ink-2); background: transparent; border: 0; cursor: pointer; }
.icon-btn:hover { background: var(--surface); color: var(--ink); text-decoration: none; }
.dot { position: absolute; top: 6px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #2b1d05; font-size: .68rem; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--bg); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--warn); display: grid; place-items: center; font-weight: 750; font-size: .8rem; flex: none; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.3rem; }
.avatar.brand { background: var(--brand-soft); color: var(--brand); }
.content { width: 100%; max-width: 1180px; margin: 0 auto; padding: 20px 16px 110px; }
.acting { background: var(--accent-soft); color: var(--warn); font-size: .85rem; padding: .45rem 16px; display: flex; gap: .75rem; align-items: center; justify-content: center; flex-wrap: wrap; }
.acting form { display: inline; }

.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); display: flex; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; font-weight: 600; color: var(--ink-3); padding: 4px 0; background: none; border: 0; font-family: inherit; cursor: pointer; min-width: 0; }
.tabbar a:hover { text-decoration: none; }
.tabbar a.on { color: var(--brand); }
.tabbar .fab .fab-in { width: 46px; height: 46px; margin-top: -20px; border-radius: 16px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; box-shadow: var(--shadow-lg); }
.tabbar .fab { color: var(--brand); }

.sheet-bg { position: fixed; inset: 0; background: rgba(10, 20, 15, .4); z-index: 40; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--surface); border-radius: 20px 20px 0 0; padding: 10px 12px calc(16px + env(safe-area-inset-bottom)); max-height: 80vh; overflow: auto; box-shadow: var(--shadow-lg); }
.sheet .grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 10px; }
.sheet a { display: flex; gap: .8rem; align-items: center; padding: .8rem .7rem; border-radius: 12px; color: var(--ink); font-weight: 550; }
.sheet a:hover { background: var(--surface-2); text-decoration: none; }
.menu { position: absolute; right: 16px; top: 54px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); min-width: 220px; padding: 6px; z-index: 50; }
.menu a, .menu button { display: flex; gap: .6rem; align-items: center; width: 100%; padding: .6rem .7rem; border-radius: 10px; color: var(--ink); font: inherit; background: none; border: 0; cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--surface-2); text-decoration: none; }
.menu .head { padding: .6rem .7rem; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }

@media (min-width: 960px) {
  .side { display: flex; }
  .main { margin-left: var(--side); }
  .tabbar, .top .mobile-brand { display: none; }
  .top .spacer { display: block; }
  .content { padding: 28px 32px 60px; }
  .top-in { padding: 0 32px; }
}

.page-head { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head .lead { color: var(--ink-2); margin-top: .3rem; max-width: 640px; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.crumb { display: inline-flex; align-items: center; gap: .3rem; font-size: .85rem; color: var(--ink-3); margin-bottom: .5rem; font-weight: 550; }
.crumb:hover { color: var(--brand); }
.eyebrow { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 42px; padding: 0 1rem; border-radius: 12px; border: 1px solid transparent; font: inherit; font-weight: 650; font-size: .92rem; cursor: pointer; background: var(--brand); color: var(--brand-ink); white-space: nowrap; transition: transform .05s, filter .15s; }
.btn:hover { text-decoration: none; filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn.accent { background: var(--accent); color: #2b1d05; }
.btn.ok { background: var(--ok); color: #fff; }
.btn.sm { min-height: 34px; padding: 0 .75rem; font-size: .85rem; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.lg { min-height: 52px; font-size: 1rem; border-radius: 14px; }
.btn[disabled] { opacity: .55; pointer-events: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 1.1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.1rem; border-bottom: 1px solid var(--line-2); }
.card-head h2, .card-head h3 { font-size: 1rem; }
.card-body { padding: 1.1rem; }
.card + .card, .stack > * + * { margin-top: 1rem; }
.grid { display: grid; gap: 1rem; }
.g2, .g3, .g4 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(2, 1fr); } .g4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); } }
.split { display: grid; gap: 1rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 1000px) { .split { grid-template-columns: minmax(0, 1fr) 360px; } .split.wide-side { grid-template-columns: minmax(0, 1fr) 420px; } }

.stats { display: grid; gap: .75rem; grid-template-columns: repeat(2, 1fr); margin-bottom: 1rem; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .95rem 1rem; display: block; color: inherit; }
a.stat:hover { text-decoration: none; border-color: var(--brand); }
.stat .label { font-size: .8rem; color: var(--ink-3); font-weight: 600; display: flex; align-items: center; gap: .4rem; }
.stat .value { font-size: 1.7rem; font-weight: 780; letter-spacing: -.02em; margin-top: .15rem; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: .78rem; color: var(--ink-3); }
.stat.hot { background: var(--accent-soft); border-color: transparent; }
.stat.hot .value { color: var(--warn); }

.hero { background: var(--brand); color: var(--brand-ink); border-radius: 20px; padding: 1.3rem 1.3rem; margin-bottom: 1rem; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,.08); }
.hero h1 { font-size: 1.4rem; }
.hero p { opacity: .85; margin: .35rem 0 0; }
.hero .btn { background: var(--surface); color: var(--brand); margin-top: 1rem; position: relative; z-index: 1; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li, .list > a { display: flex; gap: .85rem; align-items: center; padding: .85rem 1.1rem; border-bottom: 1px solid var(--line-2); color: inherit; }
.list > li:last-child, .list > a:last-child { border-bottom: 0; }
.list > a:hover { background: var(--surface-2); text-decoration: none; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; }
.list .meta { font-size: .82rem; color: var(--ink-3); display: flex; gap: .35rem .75rem; flex-wrap: wrap; }
.list.compact > li, .list.compact > a { padding: .65rem 1.1rem; }
.ico-tile { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; overflow: hidden; }
.ico-tile img { width: 100%; height: 100%; object-fit: cover; }
.ico-tile.accent { background: var(--accent-soft); color: var(--warn); }
.ico-tile.danger { background: var(--danger-soft); color: var(--danger); }
.ico-tile.info { background: var(--info-soft); color: var(--info); }

.chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 700; padding: .18rem .55rem; border-radius: 999px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; line-height: 1.5; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.chip.plain::before { display: none; }
.s-draft, .s-todo { background: var(--line-2); color: var(--ink-2); }
.s-submitted, .s-under_review, .s-published-project, .s-active { background: var(--info-soft); color: var(--info); }
.s-returned, .s-overdue { background: var(--danger-soft); color: var(--danger); }
.s-verified { background: var(--ok-soft); color: var(--ok); }
.s-assessed, .s-final { background: var(--violet-soft); color: var(--violet); }
.s-published { background: var(--brand-soft); color: var(--brand); }
.s-archived, .s-closed { background: var(--line-2); color: var(--ink-3); }
.tag { display: inline-flex; font-size: .76rem; font-weight: 600; padding: .2rem .55rem; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.tags { display: flex; flex-wrap: wrap; gap: .35rem; }

.pills { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: 2px; margin-bottom: 1rem; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pills a { padding: .45rem .85rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-weight: 600; font-size: .86rem; white-space: nowrap; display: inline-flex; gap: .4rem; align-items: center; }
.pills a:hover { text-decoration: none; border-color: var(--ink-3); }
.pills a.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pills .n { font-size: .72rem; background: var(--line-2); color: var(--ink-2); border-radius: 999px; padding: 0 .4rem; }
.pills a.on .n { background: rgba(255,255,255,.2); color: inherit; }

.progress { height: 8px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.progress.accent > span { background: var(--accent); }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .35rem .75rem; align-items: center; margin-bottom: .8rem; }
.bar-row .progress { grid-column: 1 / -1; }
.stack-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--line-2); }
.stack-bar span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem .9rem; margin-top: .75rem; font-size: .8rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }
.c-submitted, .c-under_review { background: var(--info); }
.c-returned { background: var(--danger); }
.c-verified { background: var(--ok); }
.c-assessed { background: var(--violet); }
.c-published { background: var(--brand); }
.c-draft, .c-archived { background: var(--ink-3); }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; padding: .7rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: .75rem 1rem; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click:hover td { background: var(--surface-2); cursor: pointer; }
@media (max-width: 700px) {
  table.stackable thead { display: none; }
  table.stackable, table.stackable tbody, table.stackable tr, table.stackable td { display: block; width: 100%; }
  table.stackable tr { padding: .7rem 1rem; border-bottom: 1px solid var(--line-2); }
  table.stackable td { border: 0; padding: .15rem 0; display: flex; justify-content: space-between; gap: 1rem; }
  table.stackable td::before { content: attr(data-label); color: var(--ink-3); font-size: .8rem; font-weight: 600; }
  table.stackable td.primary { font-weight: 650; font-size: 1rem; }
  table.stackable td.primary::before { display: none; }
}

form .field { margin-bottom: 1rem; }
.field label, .label { display: block; font-weight: 650; font-size: .88rem; margin-bottom: .35rem; color: var(--ink); }
.field .help { font-size: .8rem; color: var(--ink-3); margin-top: .3rem; }
.field .err, .errorlist { color: var(--danger); font-size: .82rem; margin: .3rem 0 0; padding: 0; list-style: none; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=tel], input[type=url], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .65rem .8rem; min-height: 44px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 88px; }
select[multiple] { min-height: 160px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; flex: none; }
.field.checkboxinput { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.field.checkboxinput label { margin: 0; order: 2; font-weight: 600; }
.field.checkboxinput input { order: 1; }
.field.checkboxinput .help, .field.checkboxinput .err { order: 3; width: 100%; margin-top: 0; }
.checks > div, .field.checkboxselectmultiple > div, .field.radioselect > div { display: flex; flex-wrap: wrap; gap: .45rem; }
.field.checkboxselectmultiple > div > div, .field.radioselect > div > div { display: contents; }
.field.checkboxselectmultiple label, .field.radioselect label, .choice { display: inline-flex !important; align-items: center; gap: .45rem; padding: .5rem .8rem; margin: 0 !important; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-weight: 600 !important; font-size: .86rem !important; cursor: pointer; user-select: none; }
.field.checkboxselectmultiple label:has(input:checked), .field.radioselect label:has(input:checked), .choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.field.checkboxselectmultiple label > input, .field.radioselect label > input { width: 16px; height: 16px; }
.form-grid { display: grid; gap: 0 1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .full { grid-column: 1 / -1; } }
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: .5rem; }
.form-section { padding: 1.1rem; border-bottom: 1px solid var(--line-2); }
.form-section:last-child { border-bottom: 0; }
.form-section > h3 { margin-bottom: .2rem; }
.form-section > .muted { margin-bottom: 1rem; font-size: .88rem; }
.sticky-actions { position: sticky; bottom: 76px; z-index: 5; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding: .8rem 1.1rem; border-radius: 0 0 var(--radius) var(--radius); display: flex; gap: .6rem; flex-wrap: wrap; justify-content: flex-end; }
@media (min-width: 960px) { .sticky-actions { bottom: 0; } }
.search { position: relative; flex: 1; min-width: 180px; }
.search .icon { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search input { padding-left: 2.4rem; }
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.toolbar select { width: auto; min-width: 150px; }

.messages { position: fixed; top: 66px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: .5rem; width: min(560px, calc(100% - 32px)); }
.msg { padding: .75rem 1rem; border-radius: 12px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); font-weight: 550; font-size: .9rem; display: flex; gap: .6rem; align-items: center; animation: drop .25s ease-out; }
.msg.error { background: var(--danger); color: #fff; }
.msg.success { background: var(--ok); color: #fff; }
.msg.warning { background: var(--accent); color: #2b1d05; }
.msg .x { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; opacity: .8; font-size: 1.1rem; }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } }
.note { padding: .85rem 1rem; border-radius: 12px; background: var(--info-soft); color: var(--info); font-size: .9rem; display: flex; gap: .6rem; align-items: flex-start; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.danger { background: var(--danger-soft); color: var(--danger); }
.note.ok { background: var(--ok-soft); color: var(--ok); }
.note .icon { margin-top: 1px; }
.note p:last-child { margin: 0; }

.empty { text-align: center; padding: 2.5rem 1.25rem; color: var(--ink-2); }
.empty .ico-tile { margin: 0 auto .9rem; width: 56px; height: 56px; border-radius: 16px; }
.empty h3 { margin-bottom: .3rem; color: var(--ink); }
.empty p { max-width: 380px; margin: 0 auto 1rem; font-size: .92rem; }

.tiles { display: grid; gap: .85rem; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: inherit; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.tile:hover { text-decoration: none; border-color: var(--ink-3); }
.tile .thumb { aspect-ratio: 4 / 3; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-3); position: relative; overflow: hidden; }
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.tile .thumb .kind { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.6); color: #fff; border-radius: 8px; padding: 2px 6px; display: inline-flex; align-items: center; gap: 4px; font-size: .7rem; font-weight: 700; }
.tile .thumb .kind .icon { width: 14px; height: 14px; }
.tile .thumb .play { position: absolute; width: 44px; height: 44px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; }
.tile .body { padding: .7rem .8rem .85rem; display: flex; flex-direction: column; gap: .3rem; flex: 1; }
.tile .title { font-weight: 650; font-size: .9rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .meta { font-size: .76rem; color: var(--ink-3); }

.player { background: #0b0f0d; border-radius: var(--radius); overflow: hidden; display: grid; place-items: center; min-height: 220px; }
.player video, .player img { width: 100%; max-height: 70vh; object-fit: contain; display: block; }
.player audio { width: calc(100% - 2rem); margin: 2rem 1rem; }
.doc-box { padding: 2rem 1rem; text-align: center; color: #cfd8d3; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 1rem 1.6rem; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: -4px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 1px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.timeline .when { font-size: .76rem; color: var(--ink-3); }
.timeline .what { font-weight: 600; font-size: .9rem; }
.timeline .said { font-size: .88rem; color: var(--ink-2); background: var(--surface-2); padding: .5rem .7rem; border-radius: 10px; margin-top: .3rem; white-space: pre-line; }

.dropzone { border: 2px dashed var(--line); border-radius: 18px; padding: 1.6rem 1rem; text-align: center; background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; display: block; }
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone .big { width: 56px; height: 56px; border-radius: 18px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; margin: 0 auto .8rem; }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.capture-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: 1rem; }
.capture-row label { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .7rem .3rem; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; font-weight: 650; font-size: .8rem; cursor: pointer; color: var(--ink-2); }
.capture-row label:hover { border-color: var(--brand); color: var(--brand); }
.capture-row input { display: none; }
.preview { display: flex; gap: .9rem; align-items: center; padding: .8rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.preview .pv { width: 84px; height: 84px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; flex: none; color: var(--ink-3); }
.preview .pv img, .preview .pv video { width: 100%; height: 100%; object-fit: cover; }
.upbar { height: 10px; border-radius: 999px; background: var(--line-2); overflow: hidden; margin-top: .6rem; }
.upbar span { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }

.rubric { width: 100%; border-collapse: separate; border-spacing: 0; }
.rubric-crit { padding: 1rem 1.1rem; border-bottom: 1px solid var(--line-2); }
.rubric-crit:last-child { border-bottom: 0; }
.levels { display: grid; gap: .5rem; grid-template-columns: repeat(2, 1fr); margin-top: .7rem; }
@media (min-width: 760px) { .levels { grid-template-columns: repeat(var(--n, 4), 1fr); } }
.level { position: relative; display: block; border: 1.5px solid var(--line); border-radius: 12px; padding: .6rem .7rem; cursor: pointer; background: var(--surface); }
.level input { position: absolute; opacity: 0; }
.level .ln { font-weight: 700; font-size: .85rem; }
.level .ls { font-size: .75rem; color: var(--ink-3); }
.level .ld { font-size: .75rem; color: var(--ink-2); margin-top: .2rem; }
.level:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.level:has(input:checked) .ln { color: var(--brand); }
.level:has(input:disabled) { cursor: default; }
.score-big { font-size: 2.2rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

.builder-row { display: grid; gap: .5rem; grid-template-columns: 1fr auto; padding: .7rem 0; border-bottom: 1px dashed var(--line); }
.builder-row .inputs { display: grid; gap: .5rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .builder-row .inputs { grid-template-columns: 1fr 1.4fr; } .builder-row.level-row .inputs { grid-template-columns: 1.2fr 90px 1.6fr; } }

.pick-list { max-height: 60vh; overflow: auto; }
.pick { display: flex; align-items: center; gap: .8rem; padding: .65rem 1.1rem; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.pick:hover { background: var(--surface-2); }
.pick select, .pick input[type=text] { width: auto; min-height: 36px; padding: .35rem .6rem; font-size: .85rem; }
.pick .grow { flex: 1; min-width: 0; }
.pick-grid { display: grid; gap: .5rem; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 640px) { .pick-grid { grid-template-columns: minmax(0, 1fr) 150px 160px; } }

.detail-grid { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; font-size: .9rem; }
.detail-grid dt { color: var(--ink-3); font-weight: 600; }
.detail-grid dd { margin: 0; }
.prose { white-space: pre-line; color: var(--ink-2); }
.divider { height: 1px; background: var(--line-2); margin: 1rem 0; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.mt { margin-top: 1rem; } .mt-s { margin-top: .5rem; } .mb { margin-bottom: 1rem; } .mb-s { margin-bottom: .5rem; }
.kid-card { display: flex; gap: 1rem; align-items: center; }

.offline-bar { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: .5rem 1rem; border-radius: 999px; font-size: .85rem; font-weight: 600; z-index: 70; box-shadow: var(--shadow-lg); }

.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 900px) { .auth { grid-template-columns: 1.05fr 1fr; } }
.auth-art { display: none; background: var(--brand); color: var(--brand-ink); padding: 3rem; position: relative; overflow: hidden; }
@media (min-width: 900px) { .auth-art { display: flex; flex-direction: column; justify-content: space-between; } }
.auth-art h1 { font-size: 2.4rem; font-weight: 800; max-width: 460px; letter-spacing: -.03em; }
.auth-art .steps { display: grid; gap: .8rem; max-width: 420px; }
.auth-art .step { display: flex; gap: .8rem; align-items: center; background: rgba(255,255,255,.1); padding: .8rem 1rem; border-radius: 14px; font-weight: 600; }
.auth-art .step b { width: 28px; height: 28px; border-radius: 9px; background: var(--accent); color: #2b1d05; display: grid; place-items: center; font-size: .85rem; }
.auth-form { display: grid; place-items: center; padding: 2rem 16px; }
.auth-form .box { width: 100%; max-width: 400px; }

.print-only { display: none; }
@media print {
  body { background: #fff; font-size: 12px; }
  .side, .top, .tabbar, .no-print, .messages { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0 !important; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  .print-only { display: block; }
  a { color: inherit; }
}
