/* Academy Portal — design tokens */
:root {
  --blue: #1f3cff;
  --blue-deep: #1229c7;
  --blue-soft: #e8ebff;
  --ink: #0b0b12;
  --text: #171826;
  --muted: #6b6f80;
  --paper: #f5f6fa;
  --card: #ffffff;
  --line: #e4e6ef;
  --ok: #178a52;
  --ok-soft: #e3f5ea;
  --warn: #b97a00;
  --warn-soft: #fff4d6;
  --bad: #c9271d;
  --bad-soft: #fde7e5;
  --info-soft: #e8ebff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(11, 11, 18, .05), 0 8px 24px -12px rgba(11, 11, 18, .12);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --blue: #6f83ff; --blue-deep: #4f66ff; --blue-soft: #1a2150;
    --ink: #f4f5fb; --text: #e7e8f2; --muted: #a2a6ba;
    --paper: #0f1017; --card: #171821; --line: #272938;
    --ok: #4fd08a; --ok-soft: #12301f; --warn: #f0b429; --warn-soft: #362a0b;
    --bad: #ff6b60; --bad-soft: #3a1512; --info-soft: #1a2150;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -14px rgba(0,0,0,.7);
  }
}
:root[data-theme="dark"] {
  --blue: #6f83ff; --blue-deep: #4f66ff; --blue-soft: #1a2150;
  --ink: #f4f5fb; --text: #e7e8f2; --muted: #a2a6ba;
  --paper: #0f1017; --card: #171821; --line: #272938;
  --ok: #4fd08a; --ok-soft: #12301f; --warn: #f0b429; --warn-soft: #362a0b;
  --bad: #ff6b60; --bad-soft: #3a1512; --info-soft: #1a2150;
}

*, *::before, *::after { 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(--text); background: var(--paper); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.2; margin: 0 0 .35em; letter-spacing: -.01em; }
h1 { font-size: 1.7rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .8em; }
small, .muted { color: var(--muted); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--blue); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
img, svg { max-width: 100%; }
table { border-collapse: collapse; width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Shell */
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; color: var(--ink); letter-spacing: -.02em; text-decoration: none !important; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--blue); color: #fff; font-weight: 900; font-size: .8rem; letter-spacing: 0; }
.brand-logo { height: 46px; width: auto; display: block; }
.brand-logo-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand-logo { display: none; } :root:not([data-theme="light"]) .brand-logo-dark { display: block; } }
:root[data-theme="dark"] .brand-logo { display: none; } :root[data-theme="dark"] .brand-logo-dark { display: block; }
.brand-logo-hero { height: 72px; }
.brand-name { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.brand-upload { max-width: 200px; object-fit: contain; }
.guest-hero .brand-name { color: #fff; font-size: 1.4rem; }
@media (min-width: 900px) { .brand-logo-hero { height: 96px; } }
.topbar .grow { flex: 1; }
.iconbtn { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; color: var(--ink); position: relative; }
.iconbtn:hover { background: var(--paper); }
.pill { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: .7rem; font-weight: 700; display: grid; place-items: center; }
.shell { display: grid; grid-template-columns: 1fr; min-height: calc(100vh - 56px); }
.sidebar { display: none; background: var(--card); border-right: 1px solid var(--line); padding: 18px 12px; }
.nav-open .sidebar { display: block; position: fixed; top: 56px; left: 0; bottom: 0; width: 270px; z-index: 50; overflow: auto; box-shadow: var(--shadow); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--text); font-weight: 600; }
.nav a:hover { background: var(--paper); text-decoration: none; }
.nav a.active { background: var(--blue-soft); color: var(--blue); }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .sep { margin: 12px 12px 6px; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.nav .count { margin-left: auto; background: var(--bad); color: #fff; font-size: .7rem; border-radius: 9px; padding: 1px 7px; }
.userbox { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-top: 12px; border-top: 1px solid var(--line); }
.avatar { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-weight: 800; font-size: .8rem; flex: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.1rem; }
.userbox form { margin-left: auto; }
.main { padding: 20px 16px 60px; max-width: 1240px; width: 100%; margin: 0 auto; }
@media (min-width: 960px) {
  .shell { grid-template-columns: 250px 1fr; }
  .sidebar { display: block; position: sticky; top: 56px; height: calc(100vh - 56px); overflow: auto; }
  .main { padding: 28px 32px 80px; }
  [data-toggle="nav"] { display: none; }
}

/* Page header */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 20px; }
.page-head .grow { flex: 1; min-width: 200px; }
.page-head .eyebrow { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--blue); font-weight: 800; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Cards & grid */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(12, 1fr); }
.col-12 { grid-column: span 12; }
.col-6 { grid-column: span 12; } .col-4 { grid-column: span 12; } .col-8 { grid-column: span 12; } .col-3 { grid-column: span 6; }
@media (min-width: 720px) { .col-6 { grid-column: span 6; } .col-4 { grid-column: span 6; } .col-8 { grid-column: span 12; } .col-3 { grid-column: span 3; } }
@media (min-width: 1100px) { .col-4 { grid-column: span 4; } .col-8 { grid-column: span 8; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.card.accent { background: linear-gradient(135deg, var(--blue) 0%, var(--blue-deep) 100%); color: #fff; border: 0; }
.card.accent h1, .card.accent h2, .card.accent .muted { color: #fff; }
.card.accent .muted { opacity: .8; }

/* Stat tiles */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); margin-bottom: 16px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(5, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .label { font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.stat .value { font-size: 1.75rem; font-weight: 800; color: var(--ink); letter-spacing: -.02em; line-height: 1.1; margin-top: 4px; }
.stat .value small { font-size: .9rem; font-weight: 600; color: var(--muted); }
.stat .delta { font-size: .8rem; margin-top: 4px; }
.stat.warn .value { color: var(--warn); }
.stat.bad .value { color: var(--bad); }

/* Charts */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font); fill: var(--muted); font-size: 10px; }
.chart .val { fill: var(--ink); font-weight: 700; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .bar { fill: var(--blue); }
.chart .bar.dim { fill: var(--blue-soft); }
.chart .line { fill: none; stroke: var(--blue); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--blue); opacity: .12; }
.chart .dot { fill: var(--card); stroke: var(--blue); stroke-width: 2; }
.chart .ring-track { fill: none; stroke: var(--line); stroke-width: 8; }
.chart .ring-fill { fill: none; stroke: var(--blue); stroke-width: 8; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; }
.chart .ring-fill.ok { stroke: var(--ok); } .chart .ring-fill.warn { stroke: var(--warn); } .chart .ring-fill.bad { stroke: var(--bad); }
.chart .ring-num { fill: var(--ink); font-size: 15px; font-weight: 800; }
.chart .radar-grid { fill: none; stroke: var(--line); }
.chart .radar-axis { stroke: var(--line); }
.chart .radar-area { fill: var(--blue); opacity: .18; stroke: var(--blue); stroke-width: 2; }
.chart .radar-dot { fill: var(--blue); }
.chart .radar-label { fill: var(--text); font-weight: 700; font-size: 10px; }
.empty { padding: 26px 10px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 10px; }
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 1fr) 2fr auto; gap: 10px; align-items: center; font-size: .88rem; }
.hbar .track { height: 10px; border-radius: 5px; background: var(--blue-soft); overflow: hidden; }
.hbar .fill { height: 100%; background: var(--blue); border-radius: 5px; }
.hbar .fill.ok { background: var(--ok); } .hbar .fill.warn { background: var(--warn); } .hbar .fill.bad { background: var(--bad); }
.hbar .num { font-weight: 700; color: var(--ink); min-width: 42px; text-align: right; }
.skill-list { display: grid; gap: 8px; }
.skill-list .hbar { grid-template-columns: 80px 1fr 34px; }
.progress-track { height: 8px; border-radius: 4px; background: var(--blue-soft); overflow: hidden; }
.progress-track .fill { height: 100%; background: var(--blue); }
.progress-track .fill.ok { background: var(--ok); } .progress-track .fill.warn { background: var(--warn); } .progress-track .fill.bad { background: var(--bad); }
.kv { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 16px; }
@media (min-width: 520px) { .kv { grid-template-columns: repeat(4, 1fr); } }
.kv .k { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.kv .v { font-size: 1.15rem; font-weight: 800; color: var(--ink); }
.kv .v small { font-size: .8rem; color: var(--muted); font-weight: 600; }

/* Timeline */
.timeline { display: flex; flex-wrap: wrap; gap: 5px; }
.tl { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: .68rem; font-weight: 700; background: var(--paper); border: 1px solid var(--line); color: var(--muted); }
.tl.present { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tl.late { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tl.absent { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.tl.excused { background: var(--info-soft); color: var(--blue); border-color: transparent; }
.tl.future { opacity: .55; border-style: dashed; }
.tl.now { outline: 2px solid var(--blue); outline-offset: 1px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: .78rem; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* Badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700; letter-spacing: .02em; text-transform: capitalize; background: var(--paper); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--blue); border-color: transparent; }
.badge.level { background: var(--ink); color: var(--paper); border-color: transparent; text-transform: none; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: color-mix(in srgb, var(--paper) 60%, transparent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { justify-content: flex-end; flex-wrap: nowrap; }
.person { display: flex; align-items: center; gap: 10px; }
.person .name { font-weight: 700; color: var(--ink); }
.person .sub { font-size: .8rem; color: var(--muted); }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .when { min-width: 58px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 700; color: var(--ink); }
.list .sub { font-size: .82rem; color: var(--muted); }
.notif { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.notif:last-child { border-bottom: 0; }
.notif .ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--info-soft); color: var(--blue); font-weight: 800; }
.notif.cancelled .ico { background: var(--bad-soft); color: var(--bad); }
.notif.account .ico, .notif.registration .ico { background: var(--ok-soft); color: var(--ok); }
.notif.unread .title::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); margin-left: 8px; vertical-align: middle; }

/* Forms */
.form { display: grid; gap: 14px; }
.form .row { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .form .row { grid-template-columns: 1fr 1fr; } .form .row.three { grid-template-columns: 1fr 1fr 1fr; } }
label { display: block; font-weight: 700; font-size: .85rem; margin-bottom: 5px; color: var(--ink); }
.input, select, textarea, input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"], input[type="date"], input[type="time"], input[type="datetime-local"], input[type="search"] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.is-invalid { border-color: var(--bad) !important; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.err { font-size: .8rem; color: var(--bad); margin-top: 4px; font-weight: 600; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; font-size: .92rem; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--blue); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span { display: inline-block; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); font-weight: 700; font-size: .85rem; background: var(--card); }
.chip input:checked + span { background: var(--blue); color: #fff; border-color: var(--blue); }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px var(--blue-soft); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg label { margin: 0; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: block; padding: 6px 10px; font-size: .78rem; font-weight: 700; color: var(--muted); border-right: 1px solid var(--line); }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { color: #fff; }
.seg input[value="present"]:checked + span { background: var(--ok); }
.seg input[value="late"]:checked + span { background: var(--warn); }
.seg input[value="absent"]:checked + span { background: var(--bad); }
.seg input[value="excused"]:checked + span { background: var(--blue); }
.score { width: 64px; text-align: center; padding: 8px 6px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 700; cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: transform .05s, background .15s; }
.btn:hover { background: var(--paper); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-deep); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: var(--card); color: var(--bad); border-color: var(--bad-soft); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.sm { padding: 6px 11px; font-size: .82rem; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.inline { display: inline; }

/* Flash */
.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; border: 1px solid transparent; font-weight: 600; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.bad { background: var(--bad-soft); color: var(--bad); }
.flash ul { margin: 6px 0 0 18px; padding: 0; font-weight: 500; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.cal .day { background: var(--card); border: 1px solid var(--line); border-radius: 12px; min-height: 160px; padding: 10px; }
.cal .day.today { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.cal .dh { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 800; }
.cal .dn { font-size: 1.2rem; font-weight: 800; color: var(--ink); margin-bottom: 6px; }
.ev { display: block; padding: 7px 9px; border-radius: 9px; background: var(--blue-soft); color: var(--text); font-size: .8rem; margin-bottom: 6px; border-left: 3px solid var(--blue); text-decoration: none !important; }
.ev:hover { filter: brightness(.97); }
.ev b { display: block; color: var(--ink); }
.ev.cancelled { background: var(--bad-soft); border-left-color: var(--bad); text-decoration: line-through !important; opacity: .8; }
.ev.moved { border-left-color: var(--warn); background: var(--warn-soft); }

/* Guest */
.guest { min-height: 100vh; display: grid; grid-template-columns: 1fr; background: var(--paper); }
@media (min-width: 900px) { .guest { grid-template-columns: 1.1fr 1fr; } }
.guest-hero { background: var(--blue); color: #fff; padding: 40px 28px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
@media (min-width: 900px) { .guest-hero { padding: 56px 64px; } }
.guest-hero .brand { color: #fff; }
.guest-hero .brand-mark { background: #fff; color: var(--blue); }
.guest-hero h1 { color: #fff; font-size: clamp(2.2rem, 5vw, 4.2rem); font-weight: 900; letter-spacing: -.03em; line-height: .98; margin: 32px 0 16px; }
.guest-hero h1 em { font-style: normal; color: #0b0b12; }
.guest-hero p { max-width: 460px; font-size: 1.05rem; opacity: .92; }
.guest-hero .hallo { position: absolute; right: -30px; bottom: -40px; font-size: 16rem; font-weight: 900; opacity: .08; letter-spacing: -.06em; line-height: 1; user-select: none; }
.guest-hero .points { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 8px; font-weight: 600; }
.guest-hero .points li::before { content: "✳ "; opacity: .8; }
.guest-panel { display: grid; place-items: center; padding: 28px 16px; }
.guest-card { width: 100%; max-width: 440px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: var(--shadow); }
.guest-card h2 { font-size: 1.4rem; font-weight: 800; }
.guest-card .foot { margin-top: 18px; font-size: .9rem; text-align: center; color: var(--muted); }
.strength { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 6px; }
.strength i { display: block; height: 100%; width: 0; background: var(--bad); transition: width .2s, background .2s; }

/* Pagination */
.pagination { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; justify-content: center; margin-top: 16px; }
.pagination a, .pagination span { padding: 6px 11px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: .85rem; }
.pagination .current { background: var(--blue); color: #fff; border-color: var(--blue); }
.pagination .dis { opacity: .4; }

/* Error page */
.errpage { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; }
.errpage .code { font-size: 6rem; font-weight: 900; color: var(--blue); letter-spacing: -.05em; line-height: 1; }

/* Utilities */
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .mt-s { margin-top: 8px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.center { text-align: center; }
.tabular { font-variant-numeric: tabular-nums; }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.two { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .two { grid-template-columns: 1fr 1fr; } }
.print-only { display: none; }
@media print { .sidebar, .topbar, .actions, .btn { display: none !important; } .main { padding: 0; } .card { box-shadow: none; break-inside: avoid; } }

/* Billing */
.money { font-variant-numeric: tabular-nums; }
.form.filters { display: grid; grid-template-columns: 1fr; align-items: end; }
@media (min-width: 760px) { .form.filters { grid-template-columns: 2fr repeat(auto-fit, minmax(120px, 1fr)) auto; } }
.table.items input { min-width: 0; }
.plan { display: grid; gap: 8px; }
.plan-row { display: grid; grid-template-columns: 28px 1fr 1fr; gap: 8px; align-items: center; }
.plan-row .seq { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: .78rem; font-weight: 800; background: var(--blue-soft); color: var(--blue); }
.plan-row input { padding: 8px 10px; }
/* Printable A4 documents (invoice / receipt) */
.print-body { background: var(--paper); margin: 0; }
.print-bar { max-width: 210mm; margin: 0 auto; padding: 14px 16px; }
.print-bar kbd { font: inherit; font-size: .78rem; padding: 1px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); }
.print-doc { max-width: 210mm; min-height: 280mm; margin: 0 auto 40px; padding: 18mm 16mm; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.doc-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; padding-bottom: 18px; border-bottom: 2px solid var(--ink); }
.doc-head .brand { font-size: 1.15rem; }
.doc-address { margin-top: 8px; font-size: .85rem; color: var(--muted); line-height: 1.5; }
.doc-title { text-align: right; }
.doc-kind { font-size: .75rem; text-transform: uppercase; letter-spacing: .14em; color: var(--blue); font-weight: 800; }
.doc-number { font-size: 1.6rem; font-weight: 900; color: var(--ink); letter-spacing: -.02em; }
.doc-meta { font-size: .85rem; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 18px 0; font-size: .92rem; }
.doc-parties .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; margin-bottom: 4px; }
.doc-parties .v { font-weight: 800; color: var(--ink); font-size: 1.05rem; }
.doc-table { margin-bottom: 18px; font-size: .92rem; }
.doc-table th { background: var(--paper); }
.doc-table tr:hover td { background: transparent; }
.doc-table tr.sum td { color: var(--muted); border-bottom: 0; padding: 5px 10px; }
.doc-table tr.total td { font-weight: 800; color: var(--ink); font-size: 1.05rem; border-top: 2px solid var(--ink); border-bottom: 0; }
.doc-table tr.total.balance td { color: var(--blue); }
.doc-two { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.doc-two h3, .doc-notes h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.doc-amount { margin: 6px 0 20px; padding: 18px 20px; border-radius: 12px; background: var(--blue-soft); }
.doc-amount .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--blue); font-weight: 800; }
.doc-amount .big { font-size: 2.1rem; font-weight: 900; color: var(--ink); letter-spacing: -.02em; line-height: 1.1; margin: 4px 0; }
.doc-amount .sub { font-size: .88rem; color: var(--muted); }
.doc-terms { font-size: .78rem; color: var(--muted); margin-top: 14px; }
.doc-foot { margin-top: 40px; display: grid; grid-template-columns: 1fr 1fr; gap: 40px; font-size: .8rem; color: var(--muted); }
.doc-foot .sign .line { border-top: 1px solid var(--ink); margin-bottom: 6px; height: 40px; border-top: 0; border-bottom: 1px solid var(--ink); }
.doc-thanks { grid-column: 1 / -1; text-align: center; padding-top: 14px; border-top: 1px solid var(--line); }
@media (max-width: 640px) { .doc-parties, .doc-two, .doc-foot { grid-template-columns: 1fr; } .print-doc { padding: 20px 16px; } .doc-head { flex-direction: column; } .doc-title { text-align: left; } }
@media print {
  @page { size: A4; margin: 12mm; }
  .print-bar { display: none !important; }
  .print-body { background: #fff; }
  .print-doc { max-width: none; min-height: 0; margin: 0; padding: 0; border: 0; box-shadow: none; border-radius: 0; color: #000; }
  .print-doc .badge { border: 1px solid #000; color: #000; background: #fff; }
  .doc-table tr.total.balance td { color: #000; }
}

/* ---------- Field & spacing fixes (every screen) ---------- */
/* inputs written without a type, plus url fields, get the same look as all other fields */
input:not([type]), input[type="url"] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
}
input:not([type]):focus, input[type="url"]:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
/* grid columns may shrink: long fields never push into the next column */
.form .row > *, .grid > *, .form > * { min-width: 0; }
.form .row > div > input, .form .row > div > select, .form .row > div > textarea { max-width: 100%; }
/* one rhythm for every form: label, field, hint */
.form { gap: 16px; }
.form .row { gap: 16px; align-items: start; }
.form label { margin-bottom: 6px; }
.form .hint { margin-top: 6px; line-height: 1.4; }
input, select, textarea { min-height: 44px; font-size: .95rem; }
textarea { min-height: 88px; }
input[type="checkbox"], input[type="radio"] { min-height: 0; }
.check input { min-height: 0; }

/* password field with eye - Arabic and English */
.pw-wrap { position: relative; display: block; width: 100%; }
.pw-wrap input { width: 100%; }
html[dir="ltr"] .pw-wrap input { padding-right: 46px; padding-left: 12px; }
html[dir="rtl"] .pw-wrap input { padding-left: 46px; padding-right: 12px; }
.pw-eye { position: absolute; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; padding: 0; z-index: 1; }
html[dir="ltr"] .pw-eye { right: 6px; left: auto; }
html[dir="rtl"] .pw-eye { left: 6px; right: auto; }
.pw-eye:hover, .pw-eye.on { color: var(--blue); background: var(--blue-soft); }
.pw-eye:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
