/* DENONTEK Cloud portal. Colours follow the DENONTEK device web app. */
:root {
  --canvas: #f3f3f3; --surface: #fff; --ink: #313131; --muted: #717171; --faint: #8f8f8f;
  --line: #e1e1e1; --line2: #eeeeee; --soft: #f5f5f5; --header: #fbfbfb;
  --red: #be1103; --red-dark: #981006; --red-soft: #faeeec;
  --blue: #3d6978; --blue-soft: #edf4f7;
  --orange: #9e722a; --orange-soft: #f6efe3;
  --danger: #ae4d48; --danger-soft: #f7ebea;
  --dark: #333333;
  --sw-on: #5fb784; --sw-off: #eba7a1;
  --r-lg: 18px; --r-md: 12px; --r-sm: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--canvas); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-variant-numeric: tabular-nums; min-height: 100vh; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
[hidden] { display: none !important; }
a { color: var(--red); }
svg.i { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- buttons, inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); font-weight: 500; font-size: 13px; white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--soft); }
.btn.pri { background: var(--red); border-color: var(--red); color: #fff; }
.btn.pri:hover:not(:disabled) { background: var(--red-dark); }
.btn.stop { background: var(--dark); border-color: var(--dark); color: #fff; }
.btn.stop:hover:not(:disabled) { background: #1f1f1f; }
.btn.ghost { border-color: transparent; background: none; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: var(--soft); color: var(--ink); }
.btn.danger { color: var(--danger); }
.btn.big { height: 42px; border-radius: var(--r-md); font-size: 14px; }
.btn.wide { width: 100%; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.field small { display: block; color: var(--faint); font-size: 12px; margin-top: 5px; }
.input, select.input { width: 100%; height: 42px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 12px; background: var(--surface); }
.input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.input.code { letter-spacing: 8px; font-size: 22px; text-align: center; font-weight: 600; }
.err { color: var(--danger); font-size: 13px; margin: -4px 0 12px; min-height: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; font-size: 13px; font-weight: 500; background: var(--surface); flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 5px 12px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--red-soft); color: var(--red); font-weight: 600; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 32px; box-shadow: 0 10px 50px #34343408; }
.auth-card img { width: 190px; display: block; margin-bottom: 26px; }
.auth-card h1 { font-size: 22px; font-weight: 650; letter-spacing: -.4px; margin-bottom: 4px; }
.auth-card p.sub { color: var(--muted); margin-bottom: 22px; }
.auth-card .row { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: 13px; color: var(--muted); }
.linkbtn { border: 0; background: none; color: var(--red); font-weight: 500; padding: 0; }
.linkbtn:disabled { color: var(--faint); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--header) 239px, var(--line) 239px, var(--line) 240px, var(--canvas) 240px); }
.nav { background: var(--header); border-right: 1px solid var(--line); padding: 22px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.nav .logo { padding: 6px 10px 24px; }
.nav .logo img { width: 170px; display: block; }
.org { margin: 0 4px 18px; padding: 11px 13px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); font-weight: 600; word-break: break-word; }
.org small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.nav a.item, .nav button.item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: var(--r-sm); font-weight: 500; color: #555; text-decoration: none; border: 0; background: none; text-align: left; }
.nav a.item:hover, .nav button.item:hover { background: var(--soft); }
.nav a.item[aria-current="page"] { background: var(--red-soft); color: var(--red); }
.nav .grp { margin: 20px 12px 6px; font-size: 12px; color: var(--faint); }
.nav .br { display: flex; justify-content: space-between; align-items: center; padding: 7px 12px; border-radius: var(--r-sm); text-decoration: none; color: var(--ink); }
.nav .br:hover { background: var(--soft); }
.nav .br[aria-current="true"] { background: var(--red-soft); color: var(--red); }
.nav .br span.n { color: var(--faint); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); margin-right: 9px; flex: none; }
.dot.warn { background: var(--red); }
.dot.none { background: #c8c8c8; }
.nav .foot { margin-top: auto; padding-top: 16px; }
.main { display: flex; flex-direction: column; min-width: 0; }
.bar { background: var(--header); height: 64px; display: flex; align-items: center; gap: 16px; padding: 0 28px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.search { flex: 1; max-width: 380px; height: 36px; border: 1px solid var(--line); border-radius: 8px; display: flex; align-items: center; padding: 0 12px; gap: 8px; color: var(--faint); background: var(--surface); }
.search input { border: 0; outline: 0; flex: 1; min-width: 0; background: none; height: 100%; }
.grow { flex: 1; }
.who { display: flex; align-items: center; gap: 10px; font-weight: 500; border: 0; background: none; text-decoration: none; color: var(--ink); }
.av { width: 32px; height: 32px; border-radius: 50%; background: var(--red-soft); color: var(--red); display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.conn { font-size: 12px; color: var(--orange); display: flex; align-items: center; gap: 6px; }
.conn::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--orange); }
.content { padding: 24px 28px 40px; flex: 1; }
.mtop, .tabs { display: none; }

/* ---------- page parts ---------- */
.head { margin-bottom: 18px; display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.head h1 { font-size: 29px; font-weight: 650; letter-spacing: -1px; line-height: 1.15; }
.head p { color: var(--muted); margin-top: 4px; }
.head p b { color: var(--ink); font-weight: 600; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel.pad { padding: 16px 18px; }
.ph { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ph h2 { font-size: 15px; font-weight: 600; }
.ph .sub { color: var(--faint); font-size: 13px; }
.panel h3 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.panel p.s { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

/* timeline */
.tl { padding: 12px 18px 6px; overflow-x: auto; }
.tl-inner { min-width: 640px; padding-bottom: 22px; }
.scale, .trow { display: grid; grid-template-columns: 150px 1fr; align-items: center; }
.scale .t { position: relative; height: 18px; color: var(--faint); font-size: 12px; }
.scale .t span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.trow { height: 38px; border-top: 1px solid var(--line2); }
.trow .n { font-weight: 500; font-size: 13px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 8px; }
.trow .n small { display: block; color: var(--faint); font-weight: 400; font-size: 11.5px; }
.trow.off .n { color: var(--muted); }
.track { position: relative; height: 100%; }
.track .base { position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: #ececec; border-radius: 2px; }
.track .done { position: absolute; left: 0; top: 50%; height: 2px; background: #c4c4c4; }
.tick { position: absolute; top: 50%; width: 9px; height: 9px; border-radius: 50%; transform: translate(-50%, -50%); background: var(--surface); border: 2px solid var(--dark); z-index: 2; }
.tick.b { border-color: var(--orange); }
.tick.past { background: #c4c4c4; border-color: #c4c4c4; }
.tick.next { width: 13px; height: 13px; background: var(--red); border-color: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.trow.off .tick { border-color: #d6d6d6; background: var(--surface); box-shadow: none; width: 9px; height: 9px; }
.trow.off .tick.past { background: #e6e6e6; border-color: #e6e6e6; }
.sw { position: absolute; top: calc(50% + 8px); height: 5px; border-radius: 3px; }
.sw.on { background: var(--sw-on); }
.sw.off { background: var(--sw-off); }
.trow.off .sw { opacity: .35; }
.now { position: absolute; top: -4px; bottom: -4px; width: 0; border-left: 1.5px dashed var(--blue); z-index: 3; }
.now.first { top: -22px; }
.now em { position: absolute; bottom: -22px; left: 6px; font-style: normal; font-size: 11.5px; font-weight: 600; color: var(--blue); white-space: nowrap; }
.trow .note { font-size: 12px; color: var(--faint); position: absolute; left: 0; top: 50%; transform: translateY(-50%); background: var(--surface); padding-right: 8px; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; padding: 2px 18px 14px 168px; color: var(--muted); font-size: 12px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--dark); margin-right: 6px; vertical-align: -1px; }
.legend i.b { border-color: var(--orange); }
.swatch { display: inline-block; width: 16px; height: 5px; border-radius: 3px; vertical-align: 2px; margin-right: 7px; }
.swatch.on { background: var(--sw-on); }
.swatch.off { background: var(--sw-off); }

/* units table */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { white-space: nowrap; text-align: left; font-weight: 500; color: #737373; font-size: 12.5px; padding: 10px 14px; background: var(--soft); border-bottom: 1px solid var(--line); }
td { white-space: nowrap; padding: 12px 14px; border-bottom: 1px solid #eaeaea; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: #fafafa; }
.u b { font-weight: 600; }
.u small { display: block; color: var(--faint); font-size: 12px; }
.st { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; font-size: 13px; color: var(--blue); }
.st i { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.st.r { color: var(--orange); }
.st.r i { background: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft); }
.st.x { color: var(--danger); }
.st.x i { background: var(--danger); }
.st.h { color: var(--muted); }
.st.h i { background: var(--faint); }
.big { font-weight: 600; font-size: 15px; }
.dim { color: var(--faint); font-size: 12px; }
.sig { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; vertical-align: -1px; }
.sig b { width: 3px; background: var(--dark); border-radius: 1px; }
.sig b.e { background: #d6d6d6; }
.acts { display: flex; gap: 6px; justify-content: flex-end; }

/* right rail */
.rail { display: flex; flex-direction: column; gap: 16px; }
.emg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.emg .btn { height: 38px; }
.act { display: flex; align-items: center; gap: 12px; padding: 11px 0; border: 0; border-top: 1px solid var(--line2); background: none; width: 100%; text-align: left; }
.act:first-of-type { border-top: 0; }
.act:hover:not(:disabled) b { color: var(--red); }
.ic { width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--red-soft); color: var(--red); flex: none; }
.act b { font-weight: 500; font-size: 13.5px; display: block; }
.act small { color: var(--faint); font-size: 12px; }
.alert { border: 1px solid #e8cfcd; border-left: 4px solid var(--danger); background: var(--danger-soft); border-radius: var(--r-md); padding: 10px 12px; font-size: 13px; }
.alert b { display: block; color: var(--danger); font-weight: 600; margin-bottom: 2px; }
.log > div { display: flex; gap: 12px; padding: 8px 0; font-size: 13px; border-top: 1px solid var(--line2); }
.log > div:first-of-type { border-top: 0; }
.log span.t { color: var(--faint); width: 44px; flex: none; }
.log.full span.t { width: 120px; }

/* unit page */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 13px; margin-bottom: 10px; }
.back:hover { color: var(--ink); }
.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 0; }
.kv > div:nth-child(even) { overflow-wrap: anywhere; }
.kv > div { padding: 9px 0; border-top: 1px solid var(--line2); }
.kv > div:nth-child(-n+2) { border-top: 0; }
.kv > div:nth-child(odd) { color: var(--muted); }
.ringrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ringrow select { width: auto; height: 34px; }
.list > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line2); }
.list > div:first-child { border-top: 0; }
.days { color: var(--muted); font-size: 12.5px; }
.pill { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); }

/* modal, toast */
.modal { position: fixed; inset: 0; background: #2b2b2b60; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-card { position: relative; width: 100%; max-width: 440px; max-height: 90vh; overflow-y: auto; background: var(--surface); border-radius: 20px; padding: 24px; }
.modal-card h2 { font-size: 18px; font-weight: 650; margin-bottom: 4px; padding-right: 30px; }
.modal-card p.s { color: var(--muted); margin-bottom: 18px; }
.modal-card .x { position: absolute; right: 12px; top: 12px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 20px; }
.modal-card .x:hover { background: var(--soft); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.scanbox { position: relative; border-radius: var(--r-md); overflow: hidden; background: #111; margin-bottom: 14px; aspect-ratio: 4 / 3; }
.scanbox video { width: 100%; height: 100%; object-fit: cover; display: block; }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--dark); color: #fff; border-radius: var(--r-md); padding: 10px 16px; font-size: 13.5px; box-shadow: 0 8px 24px #0000002a; }
.toast.bad { background: var(--danger); }
.loading { display: flex; align-items: center; justify-content: center; min-height: 60vh; color: var(--muted); }

/* phone summary card (mobile overview) */
.nextcard { display: none; }


/* ---------- unit sections and editors ---------- */
.utabs { display: flex; gap: 4px; margin: -4px 0 18px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.utabs a { padding: 9px 12px 10px; color: var(--muted); text-decoration: none; font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.utabs a:hover { color: var(--ink); }
.utabs a[aria-current="page"] { color: var(--red); border-bottom-color: var(--red); font-weight: 600; }
.grow { flex: 1; }
.padx { padding: 4px 18px 6px; }
.dim { color: var(--faint); }
p.note { color: var(--muted); font-size: 13px; padding: 10px 18px 0; }
.input.sm, select.input.sm { height: 34px; padding: 0 8px; width: auto; font-size: 13px; }
.input[type="number"].sm { width: 64px; }
.ph select.input { width: auto; height: 36px; min-width: 170px; }
.num { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.field .num .input { width: 90px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
.grid2 .input { min-width: 0; }
.ttbar, .savebar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 18px; }
.ttbar { border-bottom: 1px solid var(--line2); }
.savebar { border-top: 1px solid var(--line2); }
.panel.pad .savebar { padding: 12px 0 0; margin-top: 6px; }
.savebar .err { margin: 0; }
.tted td { padding: 8px 10px; }
.tted th { padding: 8px 10px; }
.rep { display: inline-flex; align-items: center; gap: 6px; margin-right: 10px; font-size: 13px; white-space: nowrap; }
.chips { display: inline-flex; gap: 3px; }
.chips button { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--faint); font-size: 12px; font-weight: 600; padding: 0; }
.chips button[aria-pressed="true"] { background: var(--red-soft); border-color: #f0c9c4; color: var(--red); }
.field .chips { display: flex; margin-top: 2px; }
.trow2 { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line2); cursor: pointer; }
.trow2:first-of-type { border-top: 0; }
.trow2 b { display: block; font-weight: 500; }
.trow2 small { display: block; color: var(--faint); font-size: 12px; }
.tg { appearance: none; -webkit-appearance: none; flex: none; width: 40px; height: 23px; border-radius: 12px; background: #d6d6d6; position: relative; cursor: pointer; transition: background .15s; }
.tg::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px #0003; transition: left .15s; }
.tg:checked { background: var(--red); }
.tg:checked::after { left: 20px; }
.tg:disabled { opacity: .5; }
.srow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line2); }
.srow label { display: inline-flex; align-items: center; gap: 6px; }
#specials { margin-bottom: 10px; }
table.mini { margin: 6px 0 4px; }
table.mini td, table.mini th { padding: 6px 8px; }
.choice { display: grid; gap: 8px; margin-bottom: 6px; }
.choice label { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--r-md); padding: 11px 12px; cursor: pointer; }
.choice label:has(input:checked) { border-color: var(--red); background: var(--red-soft); }
.choice input { margin-top: 3px; accent-color: var(--red); }
.choice b { display: block; font-weight: 600; }
.choice small { display: block; color: var(--muted); font-size: 12.5px; }
.checklist { max-height: 46vh; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-md); padding: 4px 12px; }
.checklist .h { font-size: 12px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; padding: 10px 0 2px; }
.ck { display: flex; align-items: center; gap: 8px; padding: 7px 0; }
.ck input, .rep input, td input[type="checkbox"] { accent-color: var(--red); width: 16px; height: 16px; }
.spin { display: block; width: 22px; height: 22px; margin: 0 auto 10px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--red); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 800px) {
  .grid2 { grid-template-columns: 1fr; }
  .tted thead { display: none; }
  .tted, .tted tbody { display: block; }
  .tted tr { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line2); position: relative; }
  .tted td { padding: 0; border: 0; white-space: normal; }
  .tted td:last-child { position: absolute; right: 8px; top: 8px; }
  .tted td:first-child .input { width: 150px; height: 38px; font-size: 15px; font-weight: 600; }
  .savebar .btn, .ttbar .btn { flex: 1; }
}


/* ---------- bell timetable: same view as the local app ---------- */
.lt { padding: 22px; }
.lt-title { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.lt-title h2 { font-size: 19px; letter-spacing: -.5px; line-height: 1.25; font-weight: 700; }
.lt-title p { font-size: 12px; color: var(--muted); margin-top: 5px; }
.lt-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.lbtn { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 40px; padding: 10px 12px; border: 1px solid transparent; border-radius: 10px; font-size: 11px; font-weight: 650; line-height: 1.2; text-transform: uppercase; background: none; }
.lbtn.outline { background: #fff; border-color: var(--line); color: var(--red); }
.lbtn.light { background: #f1f1f1; border-color: #f1f1f1; color: #606060; }
.lbtn.primary { background: var(--red); color: #fff; min-height: 44px; padding: 11px 18px; }
.lbtn.primary:hover:not(:disabled) { background: var(--red-dark); }
.lbtn:disabled { opacity: .45; cursor: not-allowed; }
.lbtn.sq { min-width: 40px; padding: 8px; font-size: 14px; }
.lt-profile { display: flex; align-items: center; gap: 12px; padding: 14px; background: #f3f3f3; border: 1px solid #e4e4e4; border-radius: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.lt-profile label { flex: 1; min-width: 160px; max-width: 360px; }
.lt-profile label span { display: block; font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: #4a4a4a; margin-bottom: 5px; }
.lt-profile select.input { background: #fff; height: 44px; }
.lt-profile small { color: var(--muted); font-size: 12px; flex-basis: 100%; }
.lt-filter { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 16px 0; }
.lt-seg { display: flex; gap: 3px; background: #ededed; border-radius: 9px; padding: 4px; }
.lt-seg button { border: 0; background: transparent; color: var(--muted); border-radius: 6px; min-height: 38px; padding: 8px 14px; font-size: 12px; font-weight: 600; }
.lt-seg button[aria-pressed="true"] { background: #fff; color: var(--red); box-shadow: 0 1px 4px #28282810; }
.lt-count { font-size: 11px; color: var(--muted); }
.lt-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.lt-table { width: 100%; border-collapse: collapse; }
.lt-table th { text-align: center; padding: 12px 8px; background: #f5f5f5; color: #737373; font-size: 9px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; border-bottom: 0; }
.lt-table td { text-align: center; padding: 12px 8px; border-top: 1px solid #eaeaea; border-bottom: 0; vertical-align: middle; white-space: nowrap; }
.lt-table tr.lt-off td { background: #fafafa; }
.lt-n { font-size: 12px; color: var(--muted); font-weight: 650; }
.lt-check, .lday input { accent-color: var(--red); }
.lt-check { width: 22px; height: 22px; margin: 0; vertical-align: middle; }
.lt-in { height: 42px; border: 1px solid #d8d8d8; border-radius: 8px; background: #fff; padding: 6px; font-size: 13px; width: 65px; max-width: 100%; text-align: center; font-variant-numeric: tabular-nums; }
.lt-in.lt-sm { width: 50px; }
.lt-in.lt-time { width: 136px; font-weight: 650; }
.lt-in:disabled { background: #f1f1f1; color: #919191; cursor: not-allowed; }
.lt-in:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.lt-in[type="number"] { appearance: textfield; -moz-appearance: textfield; }
.lt-in[type="number"]::-webkit-inner-spin-button, .lt-in[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.c-time { position: relative; }
.c-time.lt-notime .lt-time:not(:focus) { color: transparent; -webkit-text-fill-color: transparent; }
.c-time.lt-notime::after { content: "--:-- --"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 650; color: #919191; pointer-events: none; }
.lt-out, .lt-days { display: flex; gap: 4px; justify-content: center; }
.lday { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; font-size: 9px; font-weight: 650; min-height: 45px; min-width: 27px; border: 1px solid #e4e4e4; border-radius: 6px; padding: 4px; cursor: pointer; }
.lday input { width: 18px; height: 18px; margin: 0; }
.lday:has(input:checked) { background: #faeeec; border-color: #dfb0ab; }
.lday:has(input:disabled) { cursor: not-allowed; }
.lt-empty { padding: 26px; text-align: center; color: var(--muted); border: 1px solid var(--line); border-radius: 12px; }
.lt-pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.lt-pager .ctl { display: flex; gap: 6px; align-items: center; }
.lt-pager select { min-height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; }
.lt-save { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line2); }
.lt-save strong { display: block; font-size: 13px; }
.lt-save small { display: block; font-size: 11px; color: var(--muted); }
.lt-save small.bad { color: var(--danger); }
@media (max-width: 800px) {
  .lt { padding: 16px; border-radius: 15px; }
  .lt-title { gap: 10px; margin-bottom: 16px; }
  .lt-title h2 { font-size: 18px; }
  .lt-title p { font-size: 11px; }
  .lt-actions { gap: 5px; }
  .lt-actions .lbtn { font-size: 10px; min-height: 38px; padding: 8px 12px; }
  .lt-profile { padding: 12px; }
  .lt-profile label { max-width: none; }
  .lt-filter { flex-wrap: wrap; gap: 9px; }
  .lt-seg { width: 100%; }
  .lt-seg button { flex: 1; padding: 7px; font-size: 11px; }
  .lt-count { font-size: 10px; }
  .lt-pager .ctl { gap: 4px; }
  .lt-pager .ctl label { display: none; }
  .lt-wrap { border: 0; overflow: visible; }
  .lt-table, .lt-table tbody { display: block; width: 100%; }
  .lt-table thead { display: none; }
  .lt-table tr { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 14px 4px; padding: 14px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
  .lt-table tr.lt-off { background: #f9f9f9; }
  .lt-table tr.lt-off td { background: none; }
  .lt-table td { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; min-width: 0; padding: 0; border: 0; white-space: normal; }
  .lt-table td::before { display: block; width: 100%; content: attr(data-label); text-transform: uppercase; font-size: 9px; font-weight: 650; letter-spacing: .03em; color: var(--muted); margin-bottom: 6px; text-align: center; }
  .c-num { grid-column: 1; grid-row: 1; }
  .c-en { grid-column: 2; grid-row: 1; }
  .c-time { grid-column: 3 / 6; grid-row: 1; }
  .c-out { grid-column: 6 / 8; grid-row: 1; }
  .single .c-time { grid-column: 3 / 8; }
  .c-on { grid-column: 1 / 3; grid-row: 2; }
  .c-pul { grid-column: 3; grid-row: 2; }
  .c-off { grid-column: 4 / 6; grid-row: 2; }
  .c-cnt { grid-column: 6 / 8; grid-row: 2; }
  .c-days { grid-column: 1 / -1; grid-row: 3; }
  .lt-n { padding: 11px 0; font-size: 14px; }
  .lt-check { width: 19px; height: 19px; margin: 11px 0 0; }
  .c-pul .lt-check { width: 22px; height: 22px; margin: 10px 0; }
  .lt-in, .lt-in.lt-sm, .lt-in.lt-time { width: 100%; height: 44px; font-size: 16px; padding: 4px; border-radius: 7px; }
  .lt-in.lt-time { font-size: 14px; min-width: 0; }
  .c-time.lt-notime::after { top: auto; height: 44px; font-size: 14px; }
  .c-out::before { display: none !important; }
  .lt-out { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; width: 100%; }
  .lt-out .lday { min-width: 0; height: 60px; padding: 0 0 11px; gap: 0; justify-content: space-between; border: 0; background: transparent !important; }
  .lt-out .lday span { line-height: 13px; }
  .lt-out input, .lt-days input { width: 19px; height: 19px; }
  .lt-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; width: 100%; }
  .lt-days .lday { min-width: 0; min-height: 46px; padding: 5px 0; }
  .lt-save { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); background: #fff; margin: 16px -16px -16px; padding: 12px 16px; border-radius: 0 0 15px 15px; box-shadow: 0 -6px 16px #0000000d; z-index: 5; }
  .lt-save .lbtn { flex: 1; }
  .lt-save > div:first-child { flex-basis: 100%; }
  .lt-save strong { font-size: 12px; }
  .lt-save small { font-size: 10px; }
  .lt-save .grow { display: none; }
}


.lt-mode button { padding: 8px 16px; }
.lt-row { margin-bottom: 16px; }
.lt-easy th:last-child, .lt-easy td.e-del { width: 48px; }
.lt-sel { width: 104px; text-align: left; padding: 6px 8px; }
.lt-rep { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; }
.lt-repv { display: inline-flex; align-items: center; gap: 6px; margin-left: 12px; font-size: 12px; color: var(--muted); }
.lt-repv .lt-in { height: 36px; }
.lt-addrow { margin-top: 12px; }
.lt-addrow .lbtn { width: 100%; min-height: 44px; border: 1px dashed #cfcfcf; background: #fafafa; }
.lt-filter .lbtn { min-height: 38px; }
@media (max-width: 800px) {
  .lt-mode { width: 100%; }
  .lt-mode button { flex: 1; }
  .lt-easy tr { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .lt-easy .e-time { grid-column: 1 / 4; grid-row: 1; }
  .lt-easy .e-bell { grid-column: 4 / 6; grid-row: 1; }
  .lt-easy .single .e-time, .lt-easy tr.single .e-time { grid-column: 1 / 6; }
  .lt-easy .e-del { grid-column: 6; grid-row: 1; justify-content: flex-end; align-items: flex-end; }
  .lt-easy .e-on { grid-column: 1 / 3; grid-row: 2; }
  .lt-easy .e-rep { grid-column: 3 / 7; grid-row: 2; align-items: flex-start; }
  .lt-easy .e-days { grid-column: 1 / -1; grid-row: 3; }
  .lt-easy .lt-sel { width: 100%; height: 44px; font-size: 14px; }
  .lt-easy .lt-rep { min-height: 44px; }
  .lt-easy .lt-repv { margin: 4px 0 0; flex-wrap: wrap; }
  .lt-easy .lt-repv { gap: 4px; font-size: 11px; }
  .lt-easy .lt-repv .lt-in { width: 44px; height: 38px; font-size: 14px; }
  .lt-easy .e-rep::before { text-align: left !important; }
  .lt-easy .e-rep { align-items: stretch; }
  .lt-easy .e-del .lbtn { min-height: 44px; width: 44px; }
}


/* ---------- Easy Timetable wizard (same as the local app) ---------- */
.lbtn.sm { min-height: 40px; padding: 10px 14px; font-size: 11px; }
.tw-overlay { position: fixed; inset: 0; background: #0007; z-index: 300; display: flex; align-items: flex-end; justify-content: center; }
.tw-overlay[hidden] { display: none; }
.tw-box { background: var(--canvas); width: 100%; max-width: 520px; height: min(92vh, 780px); border-radius: 18px 18px 0 0; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 -8px 40px #0003; }
@media (min-width: 700px) { .tw-overlay { align-items: center; } .tw-box { border-radius: 18px; } }
.tw-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.tw-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; flex: none; }
.tw-head div { flex: 1; line-height: 1.2; } .tw-head b { font-size: 16px; } .tw-head small { display: block; color: var(--muted); font-size: 12px; }
.tw-x { border: 0; background: none; font-size: 26px; line-height: 1; color: var(--muted); padding: 4px 8px; }
.tw-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.tw-msg { max-width: 86%; padding: 11px 15px; border-radius: 18px; font-size: 15px; line-height: 1.5; white-space: pre-line; animation: twIn .18s ease-out; }
.tw-bot { background: var(--surface); border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 6px; }
.tw-me { background: var(--red); color: #fff; align-self: flex-end; border-bottom-right-radius: 6px; }
.tw-wide { max-width: 100%; width: 100%; white-space: normal; }
@keyframes twIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.tw-foot { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); max-height: 46vh; overflow-y: auto; }
.tw-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tw-chip { border: 1.5px solid var(--red); background: #fff; color: var(--red); border-radius: 999px; padding: 10px 16px; font-size: 14px; font-weight: 600; min-height: 44px; }
.tw-chip.main { background: var(--red); color: #fff; }
.tw-chip.soft { border-color: var(--line); color: var(--muted); font-weight: 500; }
.tw-chip.off { border-color: var(--line); color: #bbb; background: #f6f6f6; cursor: not-allowed; }
.tw-chip:active { transform: scale(.97); }
.tw-in { display: flex; gap: 8px; margin-top: 10px; }
.tw-in input { flex: 1; min-width: 0; font-size: 18px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 14px; min-height: 48px; background: #fff; }
.tw-days { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.tw-day { border: 1.5px solid var(--line); background: #fff; border-radius: 14px; padding: 10px 4px; font-size: 14px; font-weight: 600; color: var(--muted); min-height: 46px; }
.tw-day.on { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.tw-table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 8px 0 4px; }
.tw-table td { padding: 7px 4px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: normal; background: none; }
.tw-table td:first-child { font-weight: 700; white-space: nowrap; }
.tw-ring { color: var(--muted); font-size: 13px; }
.tw-sum { margin-top: 8px; font-size: 14px; color: var(--muted); }
.tw-sub { margin-top: 12px; font-weight: 700; color: var(--red); font-size: 14px; }
.tw-note { margin-top: 8px; font-size: 13px; color: var(--muted); line-height: 1.4; }
.tw-note.warn { color: var(--danger); }
.tw-pulse { animation: twPulse 1s ease-in-out 4; }
@keyframes twPulse { 50% { transform: scale(1.08); box-shadow: 0 0 0 8px #be110333; } }


/* ---------- busy spinner for every command ---------- */
.busy { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 400; display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px); padding: 11px 18px; border-radius: 999px; background: #2f2f2f; color: #fff; font-size: 13.5px; font-weight: 500; box-shadow: 0 8px 28px #0003; }
.busy small { color: #c9c9c9; font-weight: 400; margin-left: 4px; }
.busy .sp { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid #ffffff40; border-top-color: #fff; animation: spin .8s linear infinite; }
@media (max-width: 800px) { .busy { top: calc(10px + env(safe-area-inset-top)); } }

/* ---------- mobile ---------- */
@media (max-width: 1100px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
  .rail { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 800px) {
  .shell { display: block; background: var(--canvas); }
  .nav, .bar { display: none; }
  .mtop { display: block; background: var(--header); border-bottom: 1px solid var(--line); padding: 16px 16px 14px; position: sticky; top: 0; z-index: 20; }
  .mtop .r { display: flex; align-items: center; justify-content: space-between; }
  .mtop img { width: 128px; display: block; }
  .mtop small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 10px; }
  .content { padding: 16px 16px 96px; }
  .head h1 { font-size: 22px; letter-spacing: -.5px; }
  .tabs { display: flex; justify-content: space-around; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 8px 0 calc(10px + env(safe-area-inset-bottom)); background: #fcfcfc; border-top: 1px solid var(--line); }
  .tabs a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11.5px; color: var(--faint); text-decoration: none; min-width: 64px; }
  .tabs a svg { width: 21px; height: 21px; }
  .tabs a[aria-current="page"] { color: var(--red); font-weight: 600; }
  .nextcard { display: flex; background: var(--red); color: #fff; border-radius: 16px; padding: 14px 16px; justify-content: space-between; align-items: center; margin-bottom: 12px; }
  .nextcard small { display: block; color: #f3c9c4; }
  .nextcard .tm { font-size: 30px; font-weight: 650; line-height: 1.05; }
  .nextcard .pill { background: #fff; color: var(--red); }
  .hide-m { display: none !important; }
  .legend { padding-left: 18px; }
  .rail { grid-template-columns: minmax(0, 1fr); }
  td, th { padding-left: 10px; padding-right: 10px; }
}
@media (min-width: 801px) { .only-m { display: none !important; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

/* unit list on phones */
.plist { background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--line); overflow: hidden; }
.plist .h { padding: 10px 14px; font-size: 12.5px; color: var(--muted); background: var(--soft); border-bottom: 1px solid var(--line2); }
.pi { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line2); text-decoration: none; color: inherit; }
.pi:last-child { border-bottom: 0; }
.pi .t { flex: 1; min-width: 0; }
.pi b { font-weight: 600; font-size: 14px; display: block; }
.pi small { font-size: 12px; display: block; }
.pi .r { text-align: right; font-weight: 600; }
.pi .r small { font-weight: 400; color: var(--faint); }
.mgap { display: flex; flex-direction: column; gap: 12px; }
