:root {
  --bg: #f3f4fb; --card: #ffffff; --ink: #14162b; --mute: #5b607a; --line: #e0e3f1;
  --pri: #4338ca; --pri-ink: #ffffff; --pri-soft: #e4e6fd; --acc: #d97706;
  --good: #15803d; --good-soft: #dcfce7; --warn: #b45309; --warn-soft: #fef3c7; --bad: #b91c1c; --bad-soft: #fee2e2;
  --r: 14px; --shadow: 0 1px 2px rgba(28, 25, 23, .06), 0 4px 14px rgba(28, 25, 23, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1020; --card: #1a1b30; --ink: #eceefb; --mute: #a2a6c4; --line: #32355a;
    --pri: #818cf8; --pri-ink: #0f1030; --pri-soft: #25285a; --acc: #fbbf24;
    --good: #4ade80; --good-soft: #14321f; --warn: #fbbf24; --warn-soft: #3a2c0c; --bad: #f87171; --bad-soft: #3b1616;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif; font-size: 16px; line-height: 1.5; min-height: 100vh; }
a { color: var(--pri); text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
#app { max-width: 760px; margin: 0 auto; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
main { padding: 12px 16px 88px; }
small { font-size: .75em; color: var(--mute); font-weight: 500; }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top h1 { flex: 1; margin: 0; font-size: 1.15rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .back { font-size: 1.4rem; line-height: 1; padding: 4px 8px; color: var(--ink); }
.logo { font-size: 1.4rem; }
.topbtn { background: var(--pri-soft); color: var(--pri); padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: .9rem; white-space: nowrap; }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex; justify-content: center; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 1; max-width: 152px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 10px; color: var(--mute); font-size: .78rem; font-weight: 600; }
.tabs a span { font-size: 1.3rem; filter: grayscale(1); opacity: .7; }
.tabs a.on { color: var(--pri); }
.tabs a.on span { filter: none; opacity: 1; }

.hero { background: var(--pri); color: var(--pri-ink); border-radius: 20px; padding: 18px 20px; box-shadow: var(--shadow); }
.hero.small { padding: 14px 18px; }
.hero small { color: inherit; opacity: .8; }
.hero-date { opacity: .85; font-size: .9rem; }
.hero-label { opacity: .9; margin-top: 6px; }
.hero-num { font-size: 2.3rem; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.hero-row { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: .92rem; opacity: .95; }
.hero-row span { background: rgba(255, 255, 255, .16); padding: 2px 10px; border-radius: 999px; }

.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 14px 0; }
.qbtn { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 52px; padding: 8px; border-radius: var(--r); background: var(--card); color: var(--ink); font-weight: 700; border: 1px solid var(--line); box-shadow: var(--shadow); text-align: center; }
.qbtn.primary { background: var(--acc); color: #fff; border-color: transparent; }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; color: var(--ink); box-shadow: var(--shadow); }
.card.wide { grid-column: 1 / -1; }
.card.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.card-k { color: var(--mute); font-size: .85rem; }
.card-v { font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.card-s { font-size: .82rem; color: var(--mute); }
.card-s.bad, b.bad, .bad { color: var(--bad); }
.good { color: var(--good); }

.sec { margin: 20px 0 8px; font-size: 1rem; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--ink); }
.row:last-child, .srow:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-main b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main span { color: var(--mute); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.row-amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.more-link { display: block; text-align: center; padding: 10px; font-weight: 600; }
.empty { padding: 22px 16px; text-align: center; color: var(--mute); }
.sumline { color: var(--mute); margin: 4px 0 12px; }
.sumline b { color: var(--ink); }

.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); white-space: nowrap; }
.badge.ok { background: var(--good-soft); color: var(--good); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }

.note { display: block; margin: 10px 0; padding: 10px 14px; border-radius: var(--r); font-size: .9rem; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.bad { background: var(--bad-soft); color: var(--bad); }
.filebar { display: block; width: calc(100% - 32px); margin: 8px 16px 0; padding: 8px 12px; border-radius: 10px; background: var(--pri-soft); color: var(--pri); font-size: .85rem; border: 0; text-align: start; }
.filebar.warn { background: var(--warn-soft); color: var(--warn); cursor: pointer; }
.filebar button { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 2px 10px; margin: 4px 2px 0; cursor: pointer; }

.search input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 1rem; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0; scrollbar-width: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); padding: 6px 14px; border-radius: 999px; font-size: .88rem; cursor: pointer; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; padding-bottom: 90px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: start; padding: 12px; min-height: 96px; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); cursor: pointer; }
.tile:active { transform: scale(.98); }
.tile.in { border-color: var(--pri); outline: 2px solid var(--pri); outline-offset: -2px; }
.tile-name { font-weight: 700; line-height: 1.3; }
.tile-price { font-weight: 800; color: var(--pri); font-variant-numeric: tabular-nums; margin-top: auto; }
.tile-stock { font-size: .75rem; color: var(--mute); }
.tile-stock.warn { color: var(--warn); } .tile-stock.bad { color: var(--bad); }
.tile-q { position: absolute; top: 8px; left: 8px; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px; background: var(--pri); color: var(--pri-ink); display: grid; place-items: center; font-weight: 800; font-size: .85rem; }

#cart { position: fixed; left: 0; right: 0; bottom: calc(62px + env(safe-area-inset-bottom)); z-index: 25; display: flex; justify-content: center; pointer-events: none; }
.cart { pointer-events: auto; width: 100%; max-width: 760px; margin: 0 8px; background: var(--card); border: 1px solid var(--line); border-radius: 18px 18px 14px 14px; box-shadow: 0 -6px 30px rgba(0, 0, 0, .14); overflow: hidden; }
.cart-head { display: flex; width: 100%; align-items: center; gap: 10px; padding: 14px 16px; border: 0; background: var(--pri); color: var(--pri-ink); cursor: pointer; font-size: 1rem; }
.cart-head b { margin-inline-start: auto; font-size: 1.15rem; }
.cart-body { display: none; padding: 10px 14px 14px; max-height: 58vh; overflow-y: auto; }
.cart.open .cart-body { display: block; }
.cline { display: grid; grid-template-columns: 1fr auto 72px 28px; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cline-name { font-weight: 600; line-height: 1.25; } .cline-name small { display: block; color: var(--acc); }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { width: 34px; height: 36px; border: 0; background: var(--bg); font-size: 1.2rem; cursor: pointer; }
.stepper input { width: 46px; height: 36px; border: 0; text-align: center; background: var(--card); }
.cline-price { width: 72px; height: 36px; border: 1px solid var(--line); border-radius: 10px; text-align: center; background: var(--card); }
.x { border: 0; background: none; color: var(--mute); cursor: pointer; font-size: 1rem; }
.seg { display: flex; margin: 12px 0 8px; background: var(--bg); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; border: 0; background: none; padding: 9px; border-radius: 10px; font-weight: 700; cursor: pointer; color: var(--mute); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.cart-actions { display: grid; grid-template-columns: auto 1fr; gap: 8px; margin-top: 12px; }

.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field span { font-size: .88rem; color: var(--mute); font-weight: 600; }
.field input, .field select, .catin { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 1rem; min-height: 48px; }
.field input:focus, .field select:focus, .search input:focus, .catin:focus { outline: 2px solid var(--pri); outline-offset: 0; border-color: transparent; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; font-size: .95rem; }
.check input { width: 20px; height: 20px; accent-color: var(--pri); }
.hint { font-size: .85rem; color: var(--mute); }
.calc { display: flex; justify-content: space-between; gap: 10px; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.calc b { font-variant-numeric: tabular-nums; }
.calc.total { background: var(--pri-soft); border-color: transparent; font-size: 1.08rem; }
.calc.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.calc.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.calc.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.calcs { display: flex; flex-direction: column; gap: 6px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-weight: 700; cursor: pointer; color: var(--ink); text-align: center; }
.btn.block { display: flex; width: 100%; margin-top: 8px; }
.btn.primary { background: var(--pri); color: var(--pri-ink); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.mini { font-size: .8rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; }

.menu { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.menu a { display: flex; align-items: center; gap: 8px; padding: 14px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.about { margin-top: 18px; color: var(--mute); font-size: .9rem; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.panel h3 { margin: 0 0 4px; font-size: 1rem; }
.panel p { margin: 0 0 8px; color: var(--mute); font-size: .92rem; }
.meter { display: grid; grid-template-columns: 110px 1fr 96px; align-items: center; gap: 8px; font-size: .85rem; margin: 6px 0; }
.meter div { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--pri); }
.meter i.bad { background: var(--bad); }
.meter small { text-align: end; }

.welcome { max-width: 440px; margin: 0 auto; padding: 48px 20px; text-align: center; }
.welcome h1 { margin: 8px 0; font-size: 2rem; }
.welcome p { color: var(--mute); }
.welcome .small { font-size: .85rem; margin-top: 20px; }
.w-logo { font-size: 3.4rem; }

#toast { position: fixed; z-index: 60; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .2s; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; display: flex; gap: 14px; align-items: center; max-width: calc(100% - 32px); box-shadow: 0 8px 30px rgba(0, 0, 0, .25); }
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast button { background: none; border: 0; color: var(--acc); font-weight: 800; cursor: pointer; }
#busy { position: fixed; inset: 0; z-index: 70; display: none; place-items: center; background: rgba(0, 0, 0, .35); }
#busy.show { display: grid; }
#busy div { background: var(--card); padding: 18px 22px; border-radius: 14px; display: flex; align-items: center; gap: 12px; }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--pri); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.splash { min-height: 80vh; display: grid; place-items: center; text-align: center; color: var(--mute); }
.splash .w-logo { margin-bottom: 8px; }
@media (min-width: 700px) { .cards { grid-template-columns: repeat(4, 1fr); } .card.wide { grid-column: span 4; } .menu { grid-template-columns: repeat(3, 1fr); } }

/* add / edit / delete from anywhere */
body.locked { overflow: hidden; }
.fab { position: fixed; z-index: 28; bottom: calc(74px + env(safe-area-inset-bottom)); left: max(16px, calc(50% - 364px)); width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--acc); color: #fff; font-size: 2.1rem; line-height: 1; font-weight: 400; cursor: pointer; box-shadow: 0 6px 20px color-mix(in srgb, var(--acc) 45%, transparent); display: grid; place-items: center; padding-bottom: 4px; }
.fab:active { transform: scale(.94); }
#sheet { position: fixed; inset: 0; z-index: 50; display: none; }
#sheet.show { display: block; }
.sh-back { position: absolute; inset: 0; background: rgba(0, 0, 0, .42); animation: shfade .15s ease-out; }
.sh-panel { position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 760px; max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column; background: var(--bg); border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .25); animation: shup .22s cubic-bezier(.2, .8, .2, 1); padding-bottom: env(safe-area-inset-bottom); }
.sh-grab { width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; flex: none; }
.sh-head { display: flex; align-items: center; gap: 10px; padding: 6px 16px 10px; border-bottom: 1px solid var(--line); flex: none; }
.sh-head h2 { flex: 1; margin: 0; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-x { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: .95rem; }
.sh-body { overflow-y: auto; padding: 14px 16px 18px; overscroll-behavior: contain; }
.sh-body .quick { margin: 0 0 4px; }
@keyframes shup { from { transform: translateY(100%); } to { transform: none; } }
@keyframes shfade { from { opacity: 0; } }
@media (min-width: 700px) {
  .sh-panel { top: 50%; bottom: auto; left: 50%; right: auto; width: min(560px, calc(100% - 32px)); max-height: 86vh; transform: translate(-50%, -50%); border-radius: 20px; animation: shfade .15s ease-out; padding-bottom: 0; }
  .sh-grab { display: none; }
  .sh-head { padding-top: 14px; }
}
.formbar { position: sticky; bottom: -18px; display: flex; gap: 8px; margin: 6px -16px -18px; padding: 10px 16px 14px; background: var(--bg); border-top: 1px solid var(--line); }
.formbar .btn.primary { flex: 1; }
main .formbar { position: static; margin: 4px 0 0; padding: 0; border: 0; background: none; }
.addgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.addgrid a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; min-height: 96px; padding: 10px 6px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); color: var(--ink); box-shadow: var(--shadow); }
.addgrid a:first-child { background: var(--acc); color: #fff; border-color: transparent; }
.addgrid a:first-child small { color: #fff; opacity: .85; }
.addgrid .ic { font-size: 1.6rem; line-height: 1.2; }
.addgrid b { font-size: .92rem; line-height: 1.3; }
.addgrid small { font-size: .72rem; }
.srow { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); background: var(--card); }
.srow .row { position: relative; z-index: 1; background: var(--card); border-bottom: 0; transition: transform .2s ease-out; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.srow.drag .row { transition: none; }
.sacts { position: absolute; top: 0; bottom: 0; left: 0; display: flex; direction: ltr; flex-direction: row-reverse; }
.sacts button, .sacts a { display: flex; align-items: center; justify-content: center; min-width: 70px; padding: 0 10px; border: 0; cursor: pointer; font-weight: 700; font-size: .82rem; background: var(--pri-soft); color: var(--pri); white-space: nowrap; }
.sacts .del { background: var(--bad); color: #fff; }
.sacts .alt { background: var(--warn-soft); color: var(--warn); }

@media (hover: hover) and (pointer: fine) {
  .sacts { z-index: 2; top: 50%; bottom: auto; left: 128px; transform: translateY(-50%); gap: 4px; visibility: hidden; opacity: 0; transition: opacity .12s; }
  .sacts button, .sacts a { min-width: 0; height: 32px; padding: 0 10px; border-radius: 8px; box-shadow: var(--shadow); }
  .srow:hover .sacts, .srow:focus-within .sacts { visibility: visible; opacity: 1; }
  .srow:hover .row { background: color-mix(in srgb, var(--pri-soft) 40%, var(--card)); }
  .srow.open .row { transform: none !important; }
  .srow.open .sacts { visibility: visible; opacity: 1; }
}
.tipline { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; padding: 9px 12px; border-radius: 12px; background: var(--pri-soft); color: var(--pri); font-size: .86rem; }
.tipline span { flex: 1; }
.tipline button { border: 0; background: var(--card); color: var(--pri); font-weight: 700; padding: 4px 12px; border-radius: 999px; cursor: pointer; }

/* student grades & attendance */
.demo { text-align: center; font-size: .78rem; padding: 5px 10px; background: var(--pri-soft); color: var(--pri); }
.demo a { font-weight: 700; text-decoration: underline; }
.demo-note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.medal { width: 30px; text-align: center; font-size: 1.3rem; font-weight: 700; color: var(--mute); }
.rowbtn { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: var(--card); cursor: pointer; text-align: start; }
.rowbtn:last-child { border-bottom: 0; }
.rowbadges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.datebar { display: flex; gap: 8px; align-items: center; }
.datebar input { flex: 1; min-height: 48px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 1rem; text-align: center; }
.iconbtn { width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 1.3rem; cursor: pointer; }
.dayname { text-align: center; font-weight: 700; margin: 8px 0; }
.counts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 10px; }
.counts span { font-size: .8rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
.counts .c-p { color: var(--good); } .counts .c-a { color: var(--bad); } .counts .c-l, .counts .c-e { color: var(--warn); }
.actrow { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.actrow .btn { flex: 1; min-width: 140px; }
.attlist { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.att { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; box-shadow: var(--shadow); border-inline-start: 5px solid var(--line); }
.att.st-p { border-inline-start-color: var(--good); } .att.st-l { border-inline-start-color: var(--warn); } .att.st-a { border-inline-start-color: var(--bad); } .att.st-e { border-inline-start-color: var(--mute); }
.att-top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.att-top b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-pct { font-size: .8rem; font-weight: 700; color: var(--mute); } .att-pct.bad { color: var(--bad); }
.seg4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.seg4 button { min-height: 46px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); font-weight: 700; font-size: .92rem; cursor: pointer; color: var(--ink); }
.seg4 button.on.s-p { background: var(--good); color: #fff; border-color: transparent; }
.seg4 button.on.s-a { background: var(--bad); color: #fff; border-color: transparent; }
.seg4 button.on.s-l { background: var(--warn); color: #fff; border-color: transparent; }
.seg4 button.on.s-e { background: var(--mute); color: #fff; border-color: transparent; }
.att-times { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; font-size: .85rem; color: var(--mute); }
.att-times label { display: flex; align-items: center; gap: 4px; }
.att-times input { min-height: 40px; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); font-size: .95rem; }
.att-times .mini { min-height: 40px; }
.progress { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; font-size: .88rem; color: var(--mute); }
.progress div { flex: 1; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--pri); }
.erow { min-height: 58px; }
.erow.todo .score { color: var(--mute); }
.score { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.score.bad { color: var(--bad); }
.row-side small { color: var(--mute); font-size: .72rem; }
#pad { position: fixed; left: 0; right: 0; bottom: 0; z-index: 55; display: none; }
#pad.show { display: block; }
.pad-panel { max-width: 760px; margin: 0 auto; background: var(--card); border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .3); padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.pad-head { display: flex; align-items: center; gap: 8px; }
.pad-head > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pad-head small { color: var(--mute); }
.pad-val { text-align: center; font-size: 2.4rem; font-weight: 800; min-height: 62px; line-height: 62px; font-variant-numeric: tabular-nums; direction: ltr; }
.pad-val i { font-size: 1.1rem; font-style: normal; color: var(--mute); font-weight: 500; }
.pad-val.bad { color: var(--bad); }
.pad-err { min-height: 20px; text-align: center; color: var(--bad); font-size: .85rem; }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; direction: ltr; }
.keys button { min-height: 54px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); font-size: 1.5rem; font-weight: 700; cursor: pointer; }
.keys button:active { background: var(--pri-soft); }
.pad-act { display: grid; grid-template-columns: auto auto 1fr; gap: 8px; margin-top: 8px; }
.pad-act .btn:disabled { opacity: .45; }
body.padopen main { padding-bottom: 420px; }
body.padopen .tabs { display: none; }
.scores { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.setrows { display: flex; flex-direction: column; gap: 6px; }
.setrow { display: grid; grid-template-columns: 1.4fr .8fr 6px .7fr 1fr; gap: 5px; }
.setrow input { min-width: 0; width: 100%; min-height: 44px; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: .92rem; }
.btn.wa { background: #16a34a; color: #fff; border-color: transparent; }
.panel .hint { display: block; margin-top: 8px; text-decoration: underline; }
.search { margin: 4px 0; }
.rc { background: #fff; color: #111; border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 12px; box-shadow: var(--shadow); }
.rc * { color: inherit; }
.rc-head { display: flex; justify-content: space-between; gap: 10px; border-bottom: 2px solid #4338ca; padding-bottom: 10px; }
.rc-head h2 { margin: 0; font-size: 1.15rem; color: #4338ca; }
.rc-sub { font-size: .85rem; color: #555; } .rc-class { text-align: end; font-size: .88rem; font-weight: 600; }
.rc-who { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; margin: 12px 0; }
.rc small { display: block; font-size: .72rem; color: #666; font-weight: 500; } .rc-who b, .rc-sum b { font-size: 1.02rem; }
.rc-tab { width: 100%; border-collapse: collapse; margin: 6px 0 12px; }
.rc-tab th, .rc-tab td { padding: 7px 8px; border: 1px solid #cfd2e6; text-align: center; font-size: .92rem; }
.rc-tab thead th { background: #e4e6fd; } .rc-tab tfoot th { background: #f1f2fb; }
.rc-tab td:first-child, .rc-tab th:first-child { text-align: start; }
.rc-sum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; background: #f4f5fb; border-radius: 10px; padding: 8px 4px; margin-bottom: 10px; }
.rc .bad { color: #b91c1c; } .rc .good { color: #15803d; }
.rc-att h4 { margin: 4px 0 6px; font-size: .95rem; } .rc-none { margin: 0 0 8px; color: #666; font-size: .9rem; }
.rc-note { font-size: .88rem; } .rc-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; padding-top: 10px; border-top: 1px dashed #aaa; font-size: .82rem; color: #444; }
@media print {
  :root { --bg: #fff; --card: #fff; --ink: #000; --line: #bbb; color-scheme: light; }
  .noprint, .top, .tabs, .demo, #toast, #pad, #busy { display: none !important; }
  body { background: #fff; } #app { max-width: none; padding: 0; } main { padding: 0 !important; }
  .rc { box-shadow: none; border: 1px solid #888; border-radius: 0; margin: 0; page-break-after: always; break-after: page; break-inside: avoid; }
  .rc:last-of-type { page-break-after: auto; break-after: auto; }
  @page { size: A4; margin: 14mm; }
}
@media (max-width: 380px) { .seg4 button { font-size: .85rem; } .rc-sum { grid-template-columns: repeat(2, 1fr); } }
.rc-class { flex: none; max-width: 48%; }

.print-lic{display:none}@media print{.print-lic{display:block;text-align:center;font-size:10px;color:#64748b;margin-top:8px}}

/* team layer */
.syncchip{font:inherit;font-size:11px;border:0;border-radius:99px;padding:3px 9px;margin-inline-start:6px;white-space:nowrap;cursor:pointer;background:#dcfce7;color:#166534}
.syncchip.s-syncing{background:#e0e7ff;color:#3730a3}.syncchip.s-offline{background:#fef3c7;color:#92400e}.syncchip.s-noauth,.syncchip.s-expired{background:#fee2e2;color:#991b1b}
.teamban{padding:6px 12px;font-size:13px;text-align:center}.teamban.warn{background:#fef3c7;color:#78350f}.teamban.bad{background:#fee2e2;color:#7f1d1d;font-weight:700}
.note.ok{background:#dcfce7;color:#14532d;padding:10px;border-radius:10px;margin:8px 0}.note.ok input{width:100%;box-sizing:border-box;margin:6px 0;font:inherit}
.panel input[readonly]{width:100%;box-sizing:border-box;font:inherit;margin:6px 0;padding:8px;border:1px solid #cbd5e1;border-radius:8px}
.row-side select{font:inherit;padding:4px;border-radius:8px}
