/* Mushi Admin: one stylesheet, three layouts (wide >= 1100, medium 700-1099, compact < 700), light and dark themes.
   The content uses the whole width of the window; only running text keeps a readable measure. */
@font-face{font-family:'Manrope';src:url('fonts/manrope.ttf') format('truetype');font-weight:200 800;font-style:normal;font-display:swap}
:root{
  --ink:#0B2E33; --muted:#4A6A6B; --bg:#F2F8F5; --card:#FFFFFF; --line:#DCEBE5; --line2:#E9F2EE; --hover:#F7FBF9;
  --field:#FFFFFF; --field-line:#C9DDD5;
  --teal:#00383E; --teal2:#0A4A45; --side:#00383E; --green:#0B7F66; --green-hi:#0F9D7A; --mint:#6FF3B7; --soft:#D8F5E8;
  --accent-text:#0B7F66; --avatar-fg:#00383E;
  --red:#B42332; --red-text:#B42332; --red-soft:#FDE8EA; --amber:#7A4B00; --amber-soft:#FFF1D1; --grey-soft:#E6EEEB;
  --ok-fg:#07604D; --bad-fg:#A11F2C; --off-fg:#3E5A5B; --err-fg:#8E1B28; --danger-line:#F0C3C8;
  --chip-on-bg:#00383E; --chip-on-fg:#FFFFFF; --toggle-off:#B9CBC4; --bar-b:#9ED8C6;
  --sk1:#E6F0EC; --sk2:#F3F8F6; --topbar-bg:rgba(255,255,255,.97); --shadow:0 12px 36px rgba(0,40,40,.18);
  --r-lg:20px; --r-md:14px; --r-sm:10px; --pad:clamp(16px,2.6vw,56px); --topbar-h:calc(64px + env(safe-area-inset-top,0px));
  color-scheme:light;
}
:root[data-theme="dark"]{
  --ink:#E6F3EE; --muted:#9DB8B2; --bg:#0A1C1E; --card:#102A2C; --line:#1F4244; --line2:#183637; --hover:#153234;
  --field:#0C2325; --field-line:#2E5A5C;
  --teal:#04262A; --teal2:#0A4A45; --side:#061F22; --soft:#0F3D35;
  --accent-text:#6FF3B7; --avatar-fg:#8EF0CC;
  --red-text:#FF9AA3; --red-soft:#43161B; --amber:#FFD98A; --amber-soft:#3A2C0A; --grey-soft:#1D3A3C;
  --ok-fg:#8EF0CC; --bad-fg:#FFB3BA; --off-fg:#B5CCC7; --err-fg:#FFB3BA; --danger-line:#5A2A30;
  --chip-on-bg:#6FF3B7; --chip-on-fg:#00383E; --toggle-off:#3C5E5F; --bar-b:#3F8F7C;
  --sk1:#173537; --sk2:#1F4143; --topbar-bg:rgba(10,28,30,.97); --shadow:0 12px 36px rgba(0,0,0,.55);
  color-scheme:dark;
}
*{box-sizing:border-box}
html,body{height:100%}
/* The app root always fills the window (dvh follows the phone's collapsing browser bars; vh is the fallback).
   Every screen below sizes itself from this, never from a fixed height. */
#app{min-height:100vh;min-height:100dvh;display:flex;flex-direction:column}
#app>*{flex:1 1 auto}
html{-webkit-tap-highlight-color:transparent;scroll-padding-top:calc(var(--topbar-h) + 12px)}
body{overflow-wrap:break-word}
body{margin:0;font-family:'Manrope',system-ui,-apple-system,'Segoe UI',sans-serif;color:var(--ink);background:var(--bg);font-variant-numeric:tabular-nums;-webkit-text-size-adjust:100%;line-height:1.4}
h1,h2,h3,p{margin:0}
a{color:inherit;text-decoration:none}
button,input,select,textarea{font:inherit;color:inherit}
::placeholder{color:var(--muted);opacity:.85}
:focus-visible{outline:3px solid var(--green-hi);outline-offset:2px;border-radius:8px}
[hidden]{display:none!important}
html.locked{overflow:hidden}
html.typing .dock{display:none}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.skip{position:absolute;left:-999px;top:8px;background:var(--card);padding:10px 14px;border-radius:10px;z-index:80;font-weight:800}
.skip:focus{left:8px}

/* ---------- shell: sidebar / rail / bottom bar ---------- */
.shell{display:grid;grid-template-columns:248px minmax(0,1fr);min-height:100vh;min-height:100dvh}
.side{background:var(--side);color:#CFEFE6;padding:20px 14px 16px;display:flex;flex-direction:column;gap:4px;position:sticky;top:0;align-self:start;height:100vh;height:100dvh;overflow-y:auto}
.brand{display:flex;align-items:center;gap:10px;padding:4px 8px 18px;color:#fff;font-weight:800;font-size:18px}
.brand svg{flex:none}
.nav{display:flex;flex-direction:column;gap:4px}
.nav a{display:flex;align-items:center;gap:12px;min-height:44px;padding:0 12px;border-radius:12px;font-weight:700;font-size:14px;color:#CFEFE6;position:relative}
.nav a:hover{background:rgba(255,255,255,.07)}
.nav a[aria-current="page"]{background:rgba(111,243,183,.14);color:#fff}
.nav a[aria-current="page"]::before{content:"";position:absolute;left:-14px;top:10px;bottom:10px;width:4px;border-radius:0 4px 4px 0;background:var(--mint)}
.nav svg{flex:none;width:22px;height:22px}
.side-foot{margin-top:auto;display:flex;align-items:center;gap:10px;padding:12px 8px 0;border-top:1px solid rgba(255,255,255,.12);font-size:13px}
.who{width:36px;height:36px;border-radius:50%;background:#D8F5E8;color:#00383E;display:grid;place-items:center;font-weight:800;flex:none}
.who-text{min-width:0}.who-text b{display:block;color:#fff;font-size:13px;overflow:hidden;text-overflow:ellipsis}.who-text span{font-size:12px;color:#9ED8C6;overflow:hidden;text-overflow:ellipsis;display:block}

.dock{position:sticky;bottom:0;z-index:5}
.bottom{display:none;background:var(--card);border-top:1px solid var(--line);padding:6px max(6px,env(safe-area-inset-right,0px)) calc(6px + env(safe-area-inset-bottom,0px)) max(6px,env(safe-area-inset-left,0px));justify-content:space-around}
.bottom a{flex:1;min-width:0;display:flex;flex-direction:column;align-items:center;gap:2px;padding:6px 2px;font-size:11px;font-weight:700;color:var(--muted);min-height:52px;justify-content:center}
.bottom a svg{width:24px;height:24px}
.bottom a[aria-current="page"]{color:var(--accent-text)}
.bottom a[aria-current="page"] .pill{background:var(--soft)}
.bottom .pill{width:56px;height:30px;border-radius:15px;display:grid;place-items:center}

.col{display:flex;flex-direction:column;min-width:0;min-height:100vh;min-height:100dvh}

/* ---------- header (top bar) ---------- */
.topbar{position:sticky;top:0;z-index:30;height:var(--topbar-h);display:flex;align-items:center;gap:12px;padding:env(safe-area-inset-top,0px) max(var(--pad),env(safe-area-inset-right,0px)) 0 max(var(--pad),env(safe-area-inset-left,0px));background:var(--topbar-bg);border-bottom:1px solid var(--line)}
.tb-mark{display:none;flex:none}
.crumbs{display:flex;align-items:center;gap:8px;min-width:0;flex:0 0 auto;max-width:34%;font-weight:700;font-size:15px;white-space:nowrap}
.crumbs a{color:var(--muted)}.crumbs a:hover{color:var(--ink)}
.crumbs .sep{color:var(--muted)}
.crumbs b{font-weight:800;overflow:hidden;text-overflow:ellipsis;min-width:0}
.tb-search{position:relative;flex:1 1 320px;max-width:640px;min-width:150px;margin:0 auto}
.tb-search .search{width:100%;min-height:44px}
.tb-search kbd{flex:none;font:inherit;font-size:12px;font-weight:800;color:var(--muted);border:1px solid var(--line);border-radius:6px;padding:1px 7px}
.topbar .search-btn,.topbar .tb-cancel{display:none}
.tb-right{display:flex;align-items:center;gap:8px;margin-left:auto;flex:none}
.tb-search+.tb-right{margin-left:0}
.status-chip{display:inline-flex;align-items:center;gap:8px;min-height:36px;padding:0 12px;border-radius:999px;border:1px solid var(--line);background:var(--card);font-size:13px;font-weight:700;white-space:nowrap;cursor:pointer}
.status-chip:hover{background:var(--hover)}
.status-chip .dot{width:8px;height:8px;border-radius:50%;background:currentColor;flex:none}
.status-chip.ok .dot{color:#1DB586}.status-chip.bad .dot{color:#E5484D}.status-chip.warn{background:var(--amber-soft);color:var(--amber);border-color:transparent}
.status-chip.warn .dot{color:currentColor}
.status-chip .short{display:none}
.icon-btn{width:44px;height:44px;border-radius:12px;display:grid;place-items:center;border:1px solid transparent;background:transparent;cursor:pointer;position:relative;flex:none;color:var(--ink)}
.icon-btn:hover{background:var(--hover)}
.icon-btn svg{width:22px;height:22px}
.icon-btn .count{position:absolute;top:1px;right:-3px;min-width:18px;height:18px;border-radius:9px;background:var(--red);color:#fff;font-size:11px;font-weight:800;display:grid;place-items:center;padding:0 5px;border:2px solid var(--topbar-bg);box-sizing:content-box}
.tb-new{gap:8px}
.tb-new svg{width:18px;height:18px}
.user-btn{display:flex;align-items:center;gap:10px;padding:0 10px 0 5px;min-height:44px;border-radius:999px;border:1px solid var(--line);background:var(--card);cursor:pointer}
.user-btn:hover{background:var(--hover)}
.user-btn .avatar{width:34px;height:34px;font-size:13px}
.user-btn .name{font-weight:700;font-size:14px;max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.user-btn svg{width:16px;height:16px;color:var(--muted)}
.pop-wrap{position:relative}
.pop-bg{display:none}
.pop{position:absolute;top:calc(100% + 8px);right:0;width:min(92vw,360px);background:var(--card);border:1px solid var(--line);border-radius:16px;box-shadow:var(--shadow);padding:8px;z-index:40;max-height:min(80vh,560px);overflow:auto}
.pop-head{padding:10px 12px 12px;border-bottom:1px solid var(--line2);margin-bottom:6px}
.pop-head b{display:block;font-size:15px}.pop-head span{display:block;font-size:13px;color:var(--muted);overflow:hidden;text-overflow:ellipsis}
.pop .item{display:flex;align-items:center;gap:12px;width:100%;min-height:44px;padding:8px 12px;border-radius:10px;border:0;background:transparent;font-weight:700;font-size:14px;text-align:left;cursor:pointer;color:var(--ink)}
.pop .item:hover{background:var(--hover)}
.pop .item svg{width:20px;height:20px;flex:none;color:var(--muted)}
.pop .item .grow{flex:1;min-width:0}
.pop .item small{display:block;font-weight:500;color:var(--muted);font-size:12px}
.pop .item.danger{color:var(--red-text)}.pop .item.danger svg{color:var(--red-text)}
.pop .toggle{width:44px;height:26px}.pop .toggle::after{width:20px;height:20px}.pop .toggle[aria-checked="true"]::after{left:21px}
.pop-empty{padding:18px 12px;text-align:center;color:var(--muted);font-size:14px}
.alert-item{display:flex;gap:12px;align-items:flex-start}
.alert-item .dot{width:10px;height:10px;border-radius:50%;background:var(--amber);margin-top:5px;flex:none}
.alert-item.bad .dot{background:#E5484D}
.only-s{display:none!important}
/* global search results */
.sr-pop{position:absolute;top:calc(100% + 6px);left:0;right:0;background:var(--card);border:1px solid var(--line);border-radius:16px;box-shadow:var(--shadow);padding:6px;z-index:40;max-height:min(70vh,420px);overflow:auto}
.sr-pop [role="option"]{display:flex;align-items:center;gap:12px;min-height:52px;padding:8px 10px;border-radius:10px;cursor:pointer}
.sr-pop [role="option"][aria-selected="true"],.sr-pop [role="option"]:hover{background:var(--hover);outline:2px solid var(--green-hi);outline-offset:-2px}
.sr-pop [role="option"]:hover:not([aria-selected="true"]){outline:0}
.sr-pop .who-box b{font-size:14px}.sr-pop .who-box span{font-size:12px}
.sr-pop .sr-all{font-weight:800;color:var(--accent-text);font-size:14px}
.sr-pop .pop-empty{padding:14px}

/* ---------- page frame: the content takes the whole width ---------- */
.main{padding:var(--pad) max(var(--pad),env(safe-area-inset-right,0px)) var(--pad) max(var(--pad),env(safe-area-inset-left,0px));display:flex;flex-direction:column;gap:clamp(16px,2vw,28px);min-width:0;width:100%;flex:1}
.top{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.top .grow{flex:1 1 220px;min-width:0}
.h1{font-size:clamp(24px,2.6vw,36px);font-weight:800;letter-spacing:-.02em;line-height:1.15}
.h1:focus{outline:0}
.lead{color:var(--muted);font-size:14px;margin-top:4px}
.back{display:inline-flex;align-items:center;gap:6px;min-height:44px;font-weight:700;color:var(--accent-text);font-size:14px;align-self:flex-start}
.search{display:flex;align-items:center;gap:10px;background:var(--field);border:1px solid var(--line);border-radius:999px;padding:0 16px;min-height:46px;flex:1 1 280px;min-width:0}
.search input{border:0;background:transparent;outline:0;flex:1;min-width:0;font-size:14px;padding:12px 0}
.search svg{width:20px;height:20px;color:var(--muted);flex:none}
.search:focus-within{border-color:var(--green-hi);box-shadow:0 0 0 3px rgba(15,157,122,.18)}

/* ---------- controls ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:0 18px;border-radius:12px;border:1px solid transparent;font-weight:800;font-size:14px;cursor:pointer;background:var(--green);color:#fff;white-space:nowrap}
.btn:hover{background:#096b57}
.btn:disabled{opacity:.55;cursor:default}
.btn.ghost{background:var(--card);color:var(--ink);border-color:var(--line)}
.btn.ghost:hover{background:var(--hover)}
.btn.danger{background:var(--card);color:var(--red-text);border-color:var(--danger-line)}
.btn.danger:hover{background:var(--red-soft)}
.btn.solid-danger{background:var(--red);color:#fff;border-color:transparent}
.btn.solid-danger:hover{background:#951b27}
.btn.sm{min-height:36px;padding:0 12px;font-size:13px;border-radius:10px}
.btn svg{width:18px;height:18px}
.chips{display:flex;gap:8px;overflow-x:auto;padding:2px 2px 6px;margin:0 -2px;scrollbar-width:none}
.chips::-webkit-scrollbar{display:none}
.chip{flex:none;display:inline-flex;align-items:center;gap:6px;min-height:40px;padding:0 16px;border-radius:999px;background:var(--card);border:1px solid var(--line);font-weight:700;font-size:13px;color:var(--ink);cursor:pointer}
.chip:hover{background:var(--hover)}
.chip[aria-pressed="true"]{background:var(--chip-on-bg);color:var(--chip-on-fg);border-color:var(--chip-on-bg)}
.select{display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:0 14px;border-radius:12px;background:var(--field);border:1px solid var(--line);font-weight:700;font-size:14px}
select.select{appearance:none;-webkit-appearance:none;padding-right:38px;cursor:pointer;background-image:url("chevron.svg");background-repeat:no-repeat;background-position:right 12px center;background-size:16px}
:root[data-theme="dark"] select.select{background-image:url("chevron-light.svg")}
.field{display:flex;flex-direction:column;gap:6px;min-width:0}
.field label{font-weight:700;font-size:13px}
.field .hint{font-size:12px;color:var(--muted)}
.field .bad{font-size:12px;color:var(--red-text);font-weight:700}
.input{min-height:46px;border:1.5px solid var(--field-line);background:var(--field);border-radius:12px;padding:0 14px;font-size:15px;width:100%;min-width:0}
textarea.input{padding:12px 14px;min-height:92px;resize:vertical}
.input:focus{outline:0;border-color:var(--green-hi);box-shadow:0 0 0 3px rgba(15,157,122,.18)}
.toggle{width:52px;height:30px;border-radius:15px;background:var(--toggle-off);position:relative;flex:none;border:0;cursor:pointer}
.toggle::after{content:"";position:absolute;top:3px;left:3px;width:24px;height:24px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.25);transition:left .15s}
.toggle[aria-checked="true"]{background:var(--green)}.toggle[aria-checked="true"]::after{left:25px}
.toggle::before{content:"";position:absolute;inset:-8px -4px} /* a 46 px tall touch area around the 30 px switch */
.badge{display:inline-flex;align-items:center;gap:6px;min-height:26px;padding:0 10px;border-radius:999px;font-size:12px;font-weight:800;white-space:nowrap}
.badge::before{content:"";width:7px;height:7px;border-radius:50%;background:currentColor}
.badge.ok{background:var(--soft);color:var(--ok-fg)}.badge.warn{background:var(--amber-soft);color:var(--amber)}
.badge.bad{background:var(--red-soft);color:var(--bad-fg)}.badge.off{background:var(--grey-soft);color:var(--off-fg)}
.avatar{width:40px;height:40px;border-radius:50%;background:var(--soft);color:var(--avatar-fg);display:grid;place-items:center;font-weight:800;flex:none;font-size:14px}
.avatar.lg{width:64px;height:64px;font-size:24px}

/* ---------- cards ---------- */
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--r-lg);padding:clamp(16px,2vw,28px);min-width:0}
.card>h2,.card-h h2{font-size:17px;font-weight:800}
.card-h{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:14px}
.card-h .grow{flex:1 1 160px}
.card-h p{font-size:13px;color:var(--muted);margin-top:2px}
.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,190px),1fr));gap:14px}
.kpi{background:var(--card);border:1px solid var(--line);border-radius:var(--r-lg);padding:18px 20px;display:flex;flex-direction:column;gap:6px;min-width:0}
a.kpi{cursor:pointer}
a.kpi:hover{border-color:var(--green-hi);background:var(--hover)}
.kpi .l{font-size:13px;font-weight:700;color:var(--muted)}
.kpi .v{font-size:clamp(26px,2.4vw,38px);font-weight:800;letter-spacing:-.02em;line-height:1.05;overflow-wrap:anywhere}
.kpi .s{font-size:13px;color:var(--muted)}
.kpi .v small{font-size:.5em;font-weight:700;color:var(--muted);margin-left:4px}
.delta{display:inline-flex;align-items:center;gap:4px;font-size:12px;font-weight:800;padding:2px 8px;border-radius:999px;align-self:flex-start}
.delta.up{background:var(--soft);color:var(--ok-fg)}.delta.down{background:var(--red-soft);color:var(--bad-fg)}
.cols{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:clamp(14px,1.6vw,24px)}
.c3{grid-column:span 3}.c4{grid-column:span 4}.c5{grid-column:span 5}.c6{grid-column:span 6}.c7{grid-column:span 7}.c8{grid-column:span 8}.c9{grid-column:span 9}.c12{grid-column:span 12}
.stack{display:flex;flex-direction:column;gap:clamp(14px,1.6vw,22px);min-width:0}

/* ---------- the month cycle: the one memorable element ---------- */
.cycle{background:var(--teal);color:#fff;border-radius:var(--r-lg);padding:clamp(18px,2.4vw,32px);display:grid;grid-template-columns:minmax(0,1.6fr) minmax(0,1fr);gap:20px clamp(24px,3vw,56px);position:relative;overflow:hidden;border:1px solid rgba(255,255,255,.06)}
.cycle h2{font-size:clamp(18px,2vw,24px);font-weight:800}
.cycle p{color:#BFE9DC;font-size:14px;margin-top:6px;max-width:64ch}
.days{display:grid;grid-template-columns:repeat(var(--n,31),1fr);gap:3px;margin-top:18px}
.days i{height:34px;border-radius:5px;background:rgba(255,255,255,.14)}
.days i.done{background:var(--mint)}.days i.now{background:#fff;box-shadow:0 0 0 2px var(--mint)}
.days-l{display:flex;justify-content:space-between;font-size:12px;color:#9ED8C6;margin-top:8px}
.cycle .next{background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.14);border-radius:var(--r-md);padding:16px 18px;display:flex;flex-direction:column;gap:10px;align-self:start}
.cycle .next b{font-size:26px;font-weight:800;letter-spacing:-.02em}
.cycle .next span{font-size:13px;color:#BFE9DC}
.cycle .btn.ghost{background:transparent;color:#fff;border-color:rgba(255,255,255,.35)}
.cycle .btn.ghost:hover{background:rgba(255,255,255,.1)}
.cycle .warn{color:#FFD98A;font-weight:700}

/* ---------- charts ---------- */
.bars{display:flex;align-items:flex-end;gap:clamp(8px,2vw,28px);height:clamp(190px,18vw,300px);padding-top:8px}
.bars .m{flex:1;display:flex;flex-direction:column;align-items:center;gap:8px;min-width:0;height:100%;justify-content:flex-end}
.bars .pair{display:flex;align-items:flex-end;gap:4px;width:100%;justify-content:center;flex:1}
.bars .pair i{display:block;width:min(clamp(26px,2.4vw,48px),38%);border-radius:7px 7px 3px 3px;min-height:2px;height:var(--h,0%)}
.bars .a{background:var(--green-hi)}.bars .b{background:var(--bar-b)}
.bars .m span{font-size:12px;font-weight:700;color:var(--muted)}
.legend{display:flex;gap:16px;flex-wrap:wrap;font-size:13px;font-weight:700;color:var(--muted)}
.legend i{display:inline-block;width:10px;height:10px;border-radius:3px;margin-right:6px;vertical-align:-1px}
.legend .la{background:#0F9D7A}.legend .lb{background:var(--bar-b)}
.hbar{display:grid;grid-template-columns:minmax(84px,150px) minmax(0,1fr) auto;gap:12px;align-items:center;padding:7px 0;font-size:14px}
.hbar .t{height:12px;border-radius:6px;background:var(--line2);overflow:hidden}
.hbar .t i{display:block;height:100%;border-radius:6px;background:var(--green-hi);width:var(--w,0%)}
.hbar b{font-weight:800}

/* ---------- tables that become cards ---------- */
.tbl{display:flex;flex-direction:column}
.thead,.row{display:grid;grid-template-columns:var(--cols);gap:14px;align-items:center}
.thead{padding:10px 14px;font-size:12px;font-weight:700;color:var(--muted);background:var(--card);border-bottom:1px solid var(--line2)}
.row{padding:12px 14px;border-top:1px solid var(--line2);font-size:14px;min-height:60px}
.thead+.tbl .row:first-child{border-top:0}
a.row:hover{background:var(--hover)}
.row .pri,.lot .pri{display:flex;align-items:center;gap:12px;min-width:0}
.row .pri b{display:block;font-weight:800;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.lot .pri b{display:block;font-weight:800}
.row .pri span{display:block;font-size:13px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.row .pri.wrap b{white-space:normal;overflow:visible}
.row .pri .avatar{display:grid;font-size:14px;color:var(--avatar-fg)}
.row>div{min-width:0;overflow-wrap:anywhere}
.num{text-align:right;font-weight:800}
.right{text-align:right}
.muted{color:var(--muted)}
.pos{color:var(--ok-fg);font-weight:800}.neg{color:var(--bad-fg);font-weight:800}
.more{display:flex;justify-content:center;padding-top:14px}

/* ---------- details ---------- */
.kv{display:flex;flex-wrap:wrap;gap:8px 24px;font-size:14px}
.kv div{display:flex;flex-direction:column;gap:2px;min-width:120px;max-width:100%;overflow-wrap:anywhere}
.kv span{font-size:12px;color:var(--muted);font-weight:600}
.code{display:inline-flex;align-items:center;gap:8px;background:var(--bg);border:1px dashed var(--field-line);border-radius:10px;padding:6px 10px;font-weight:800;letter-spacing:.02em;font-size:14px}
.code .btn{min-height:28px;padding:0 8px;font-size:12px}
.lots{display:flex;flex-direction:column;gap:10px}
.lot{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px 12px;align-items:center;padding:12px 14px;border:1px solid var(--line);border-radius:var(--r-md)}
.lot small{color:var(--muted);font-size:12px}
.meter{grid-column:1/-1;height:8px;border-radius:4px;background:var(--line2);overflow:hidden}
.meter i{display:block;height:100%;background:var(--green-hi);border-radius:4px;width:var(--w,0%)}
.note{display:flex;gap:10px;padding:12px 0;border-top:1px solid var(--line2);font-size:14px}
.note small{color:var(--muted);display:block;margin-top:2px}
.note b{font-weight:700;white-space:pre-wrap;overflow-wrap:anywhere}
.sticky-actions{display:none}
.form-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,200px),1fr));gap:14px}
.callout{display:flex;gap:12px;padding:14px 16px;border-radius:var(--r-md);background:var(--amber-soft);color:var(--amber);font-size:14px;font-weight:600}
.callout.bad{background:var(--red-soft);color:var(--err-fg)}
.callout.info{background:var(--soft);color:var(--ok-fg)}
.seg{display:flex;background:var(--grey-soft);border-radius:12px;padding:4px;gap:2px;flex-wrap:wrap}
.seg button{flex:1 1 auto;min-height:40px;border:0;border-radius:9px;background:transparent;font-weight:800;font-size:13px;cursor:pointer;color:var(--muted);padding:0 10px}
.seg button[aria-pressed="true"]{background:var(--card);color:var(--ink);box-shadow:0 1px 2px rgba(0,0,0,.08)}
.set{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px 16px;align-items:center;padding:14px 0;border-top:1px solid var(--line2)}
.set:first-of-type{border-top:0}
.set .t{font-weight:800;font-size:15px}.set .d{font-size:13px;color:var(--muted);grid-column:1}
.set .ctl{grid-row:1/span 2;grid-column:2}
.empty{display:flex;flex-direction:column;align-items:center;text-align:center;gap:10px;padding:28px 12px;color:var(--muted)}
.empty b{color:var(--ink);font-size:16px}
.empty svg{width:56px;height:56px}
.err{display:flex;flex-direction:column;align-items:flex-start;gap:10px;padding:18px;border-radius:var(--r-md);background:var(--red-soft);color:var(--err-fg);font-weight:700}
.err .btn{background:var(--card);color:var(--ink);border-color:var(--danger-line)}

.bad-msg{color:var(--red-text);font-weight:700;font-size:13px}
.bad-msg:empty{display:none}
.who-box{min-width:0}
.who-box b,.who-box span{display:block}
.who-box span{font-size:13px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.big{display:flex;align-items:baseline;gap:10px;margin-bottom:16px}
.big-n{font-size:clamp(40px,5vw,56px);font-weight:800;letter-spacing:-.03em;line-height:1}
.spaced{margin-top:14px}
.lots .tbl{gap:10px}
.lot .right{text-align:right}

/* ---------- loading ---------- */
.sk{display:block;border-radius:10px;background:linear-gradient(90deg,var(--sk1) 25%,var(--sk2) 50%,var(--sk1) 75%);background-size:200% 100%;animation:sk 1.3s infinite linear;min-height:16px}
@keyframes sk{from{background-position:200% 0}to{background-position:-200% 0}}
.spin{width:18px;height:18px;border:3px solid rgba(255,255,255,.4);border-top-color:#fff;border-radius:50%;animation:rot .7s linear infinite;display:inline-block}
.btn.ghost .spin{border-color:var(--line);border-top-color:var(--green-hi)}
@keyframes rot{to{transform:rotate(360deg)}}

/* ---------- toast and modal ---------- */
.toasts{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(16px + env(safe-area-inset-bottom));z-index:90;display:flex;flex-direction:column;gap:8px;width:min(92vw,480px);pointer-events:none}
.toast{pointer-events:auto;display:flex;align-items:flex-start;gap:12px;background:#00383E;color:#fff;border:1px solid rgba(255,255,255,.16);border-radius:14px;padding:12px 8px 12px 16px;font-weight:700;font-size:14px;box-shadow:0 8px 28px rgba(0,0,0,.3)}
.toast.err{background:#8E1B28}
.toast .t-text{flex:1;min-width:0;padding-top:2px;overflow-wrap:anywhere}
.toast .t-x{flex:none;width:32px;height:32px;border-radius:8px;border:0;background:transparent;color:#fff;font-size:20px;line-height:1;cursor:pointer;opacity:.8}
.toast .t-x:hover{background:rgba(255,255,255,.14);opacity:1}
.modal-bg{position:fixed;left:0;right:0;top:0;height:100vh;height:var(--vvh,100dvh);background:rgba(0,30,34,.55);z-index:70;display:grid;place-items:center;padding:16px;overscroll-behavior:contain}
.modal{background:var(--card);border:1px solid var(--line);border-radius:22px;padding:22px;width:min(100%,480px);max-height:calc(100vh - 32px);max-height:calc(var(--vvh,100dvh) - 32px);overflow:auto;overscroll-behavior:contain;display:flex;flex-direction:column;gap:14px}
.modal h2{font-size:20px;font-weight:800}
.modal p{font-size:14px;color:var(--muted)}
.modal .actions{display:flex;gap:10px;justify-content:flex-end;flex-wrap:wrap}
.pick-list{display:flex;flex-direction:column;gap:4px;min-height:60px}
.pick-list a{display:flex;align-items:center;gap:12px;min-height:52px;padding:8px 10px;border-radius:10px;border:1px solid var(--line)}
.pick-list a:hover{background:var(--hover)}

/* ---------- login ---------- */
.auth{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);min-height:100vh;min-height:100dvh}
.auth-art{background:var(--teal);color:#fff;padding:clamp(24px,5vw,72px);padding-top:max(clamp(24px,5vw,72px),env(safe-area-inset-top));display:flex;flex-direction:column;justify-content:space-between;gap:28px}
.auth-art h1{font-size:clamp(28px,3.4vw,52px);font-weight:800;letter-spacing:-.025em;line-height:1.08;max-width:14ch}
.auth-art p{color:#BFE9DC;font-size:16px;max-width:42ch;line-height:1.5}
.auth-art .small{font-size:13px;color:#9ED8C6}
.auth-form{display:grid;place-items:center;padding:clamp(20px,5vw,64px) max(clamp(20px,5vw,64px),env(safe-area-inset-right,0px)) max(clamp(20px,5vw,64px),env(safe-area-inset-bottom,0px)) max(clamp(20px,5vw,64px),env(safe-area-inset-left,0px))}
.auth-card{width:100%;max-width:400px;display:flex;flex-direction:column;gap:18px}
.auth-card h2{font-size:26px;font-weight:800;letter-spacing:-.02em}

/* ---------- very wide screens: more room for charts, no overgrown text ---------- */
@media (min-width:1800px){
  .kpi{padding:22px 26px}
  .cycle .next b{font-size:32px}
  .days i{height:42px}
  .hbar{grid-template-columns:minmax(120px,200px) minmax(0,1fr) auto}
}
@media (min-width:2400px){
  .c3{grid-column:span 3}
  .row{min-height:68px;font-size:15px}
}
@media (min-width:1100px){
  .tbl-wrap .thead{position:sticky;top:var(--topbar-h);z-index:3}
}
@media (min-width:700px) and (max-width:1699px){ .kpis{grid-template-columns:repeat(3,minmax(0,1fr))} }
@media (max-width:1399px){ .chip-next{display:none} }
@media (max-width:1299px){ .user-btn .name{display:none} .user-btn{padding:0 8px 0 5px} }

/* ---------- medium: icon rail, search as an icon ---------- */
@media (max-width:1099px){
  .shell{grid-template-columns:76px minmax(0,1fr)}
  .side{padding:16px 10px;align-items:center}
  .brand{padding:4px 0 14px}.brand span,.nav .lbl,.who-text{display:none}
  .nav a{justify-content:center;padding:0;width:52px}
  .nav a[aria-current="page"]::before{left:-10px}
  .side-foot{justify-content:center;padding:12px 0 0;width:100%}
  .c3,.c4,.c5,.c6,.c7,.c8,.c9{grid-column:span 12}
  .cycle{grid-template-columns:1fr}
  .auth{grid-template-columns:1fr;grid-template-rows:auto minmax(0,1fr)}
  .auth-art{min-height:240px}
  .tb-search{display:none}
  .topbar .search-btn{display:grid}
  .topbar.searching .tb-search{display:flex;align-items:center;gap:8px;position:absolute;left:0;right:0;top:0;height:var(--topbar-h);max-width:none;margin:0;padding:0 var(--pad);background:var(--card);z-index:50}
  .topbar.searching .tb-search .search{flex:1}
  .topbar.searching .tb-search .tb-cancel{display:grid}
  .topbar.searching .sr-pop{left:var(--pad);right:var(--pad);top:calc(100% - 4px)}
  .tb-search kbd{display:none}
  .status-chip .long{display:none}.status-chip .short{display:inline}
  .tb-new .btn-text{display:none}.tb-new{padding:0;width:44px}
}
/* ---------- compact: bottom bar, cards instead of tables, sheets ---------- */
@media (max-width:699px){
  .shell{grid-template-columns:minmax(0,1fr)}
  .side{display:none}
  .bottom{display:flex}
  .main{padding-bottom:20px}
  .tb-mark{display:grid;place-items:center;min-width:44px;min-height:44px;margin-left:-8px}
  .crumbs a,.crumbs .sep{display:none}
  .crumbs{flex:1}
  .tb-right{margin-left:0}
  .tb-right .chip-ia,.tb-right .tb-new{display:none}
  .only-s{display:flex!important}
  .days i{height:26px;border-radius:4px}
  .days{gap:2px}
  .thead{display:none}
  .row{grid-template-columns:minmax(0,1fr);gap:8px;padding:14px;border:1px solid var(--line);border-radius:var(--r-md);margin-top:10px;background:var(--card)}
  .tbl{margin-top:-10px}
  .card .tbl{margin-top:-4px}
  .row>[data-l]{display:flex;justify-content:space-between;gap:12px;font-size:14px}
  .row>[data-l]::before{content:attr(data-l);color:var(--muted);font-weight:600;flex:none}
  .row>.pri{padding-bottom:4px}
  .num,.right{text-align:right}
  .hbar{grid-template-columns:minmax(72px,96px) minmax(0,1fr) auto;gap:8px}
  .sticky-actions{display:flex;gap:10px;padding:10px 16px;background:var(--topbar-bg);border-top:1px solid var(--line)}
  .sticky-actions .btn{flex:1}
  .hide-s{display:none!important}
  .auth-art{padding:20px 24px;padding-top:max(20px,env(safe-area-inset-top));min-height:0;gap:16px}
  .auth-art h1{font-size:clamp(22px,7vw,28px)}
  .auth-art p{display:none}
  .bars{height:160px}
  .set{grid-template-columns:minmax(0,1fr)}
  .set .ctl{grid-row:auto;grid-column:1;justify-self:start}
  .toasts{bottom:auto;top:calc(var(--topbar-h) + 8px)}
  .modal-bg{align-items:end;padding:0}
  .modal{width:100%;border-radius:22px 22px 0 0;padding-bottom:calc(22px + env(safe-area-inset-bottom,0px));max-height:calc(var(--vvh,100dvh) - 24px)}
  .modal .actions .btn{flex:1 1 140px}
  /* popovers become bottom sheets, the search a full-screen panel */
  .pop-bg:not([hidden]){display:block;position:fixed;inset:0;background:rgba(0,30,34,.5);z-index:39}
  .pop{position:fixed;left:0;right:0;bottom:0;top:auto;width:auto;max-height:calc(var(--vvh,100dvh) - 24px);border-radius:22px 22px 0 0;overscroll-behavior:contain;padding:12px 12px calc(12px + env(safe-area-inset-bottom));border-bottom:0}
  .sr-pop{position:fixed;left:0!important;right:0!important;top:var(--topbar-h)!important;bottom:0;max-height:none;border-radius:0;border-width:1px 0 0}
}
/* ---------- touch screens: 16 px fields (iOS does not zoom in), room for the keyboard, landscape phones ---------- */
@media (max-width:1099px),(pointer:coarse){
  .input,.search input,select.select,textarea.input,.tb-search input{font-size:16px}
  .input,.search,.chip,.btn,.seg button{scroll-margin:96px 0 140px}
  /* tablets are touched too: every control reaches 44 px */
  .chip,.btn.sm,.btn.ghost,.status-chip,.seg button,.toast .t-x,.crumbs a,.brand{min-height:44px}
  .toast .t-x{min-width:44px}
  .brand{min-width:44px;justify-content:center}
  .crumbs a{display:inline-flex;align-items:center}
  .topbar.searching .tb-search{padding-top:env(safe-area-inset-top,0px)}
}
@media (max-width:420px){ .user-btn svg{display:none} .user-btn{padding:0 5px} }
@media (max-width:699px){
  /* figures two by two: a whole screen of single cards was a long scroll */
  .kpis{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .kpi{padding:14px 14px;gap:4px}
  .kpi .v{font-size:clamp(22px,7vw,28px)}
  .kpi .v small{display:block;margin:2px 0 0;font-size:12px}
  .kpi:only-child,.kpis>:last-child:nth-child(odd){grid-column:1/-1}
  /* a customer's header: the avatar sits above, the details use the full width */
  .card>.top>.avatar.lg{width:48px;height:48px;font-size:18px}
  .card>.top>.grow.stack{flex:1 1 100%}
  .seg{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
  .seg button:last-child:nth-child(odd){grid-column:1/-1}
  .input,.search,.chip,.btn,.seg button{scroll-margin-bottom:190px}
  .card:has(.tbl-wrap){background:transparent;border:0;padding:0} /* the rows are cards already: no card inside a card */
  .card:has(.tbl-wrap)>.card-h{padding:0 2px}
  .lot.admin-row{grid-template-columns:minmax(0,1fr);gap:10px}
  .lot.admin-row>.btn,.lot.admin-row>.badge{justify-self:start}
  .lot.admin-row .who-box span{white-space:normal;overflow-wrap:anywhere}
  .chip{min-height:44px}
  .btn.sm{min-height:44px}
  .status-chip{min-height:44px}
  .seg button{min-height:44px}
  .crumbs{max-width:none}
  .card-h .btn,.top .btn{flex:0 0 auto}
}
@media (max-width:1099px) and (orientation:landscape) and (max-height:520px){
  :root{--topbar-h:calc(52px + env(safe-area-inset-top,0px))}
  .main{padding-top:14px;padding-bottom:14px;gap:14px}
  .bottom{padding-top:2px;padding-bottom:calc(2px + env(safe-area-inset-bottom,0px))}
  .sticky-actions{padding-top:4px;padding-bottom:4px}
  .bottom a{padding-top:0;padding-bottom:0}
  .bottom a{min-height:44px;flex-direction:row;gap:8px;justify-content:center}
  .bottom .pill{width:auto;height:auto;background:transparent!important}
  .auth{grid-template-columns:minmax(0,1fr) minmax(0,1.1fr);grid-template-rows:none}
  .auth-art{min-height:0;padding:18px 24px;gap:10px}
  .auth-art h1{font-size:22px}
  .auth-art p:not(.small){display:none}
  .auth-form{padding:14px 24px}
  .auth-card{gap:12px}
  .h1{font-size:22px}
  .modal{max-height:calc(var(--vvh,100dvh) - 12px)}
  .pop{max-height:calc(var(--vvh,100dvh) - 12px)}
}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}

/* Ajustes > Correo */
.fs{border:1px solid var(--line);border-radius:var(--r-md);padding:14px 16px;margin:0;min-width:0;display:flex;flex-direction:column;gap:12px}
.fs legend{font-weight:800;font-size:14px;padding:0 6px}
.mail-status{display:flex;flex-wrap:wrap;gap:8px 12px;align-items:center}
.mail-status .bad-msg{font-size:13px;font-weight:700;color:var(--red-text)}
.mail-result{min-width:0}
.pw-field{display:flex;flex-direction:column;gap:6px;min-width:0}
.hint .btn.sm{min-height:28px;padding:0 10px;margin-left:6px}

/* Recargas: pedidos y catálogo */
.seg.tabs{align-self:flex-start;max-width:100%}
.row-btn{width:100%;text-align:left;background:none;border:0;font:inherit;color:inherit;cursor:pointer}
.row-btn:hover{background:var(--soft)}
.block{display:block}
.pkg-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,210px),1fr));gap:14px;margin-top:10px}
.pkg-card{position:relative;display:flex;flex-direction:column;gap:6px;padding:18px 16px;border:1.5px solid var(--line);border-radius:var(--r-md);background:var(--card);min-width:0}
.pkg-card.off{opacity:.55}
.pkg-badge{align-self:flex-start;background:var(--soft);color:var(--ok-fg);font-size:12px;font-weight:800;border-radius:999px;padding:3px 10px}
.pkg-name{font-size:17px}.pkg-credits{font-weight:700;color:var(--muted)}.pkg-price{font-size:24px;font-weight:800}
.pkg-row .pkg-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.pick-list{display:flex;flex-direction:column;gap:6px}
.pick{display:flex;gap:8px;align-items:center;min-height:44px;padding:0 12px;border:1px solid var(--line);border-radius:12px;background:var(--field);font:inherit;color:inherit;text-align:left;cursor:pointer}
.seg.tabs{display:flex;flex-wrap:nowrap}
.seg.tabs button{flex:1 1 auto;padding-left:14px;padding-right:14px;white-space:nowrap}
@media (max-width:640px){.seg.tabs{align-self:stretch}}
