/* HukuGuard dashboard: the original command centre look (Poppins, green, floating sidebar)
   with themes and font sizes. Theme colours are CSS variables set on <html data-theme>. */
:root, [data-theme="green"] {
  --side-bg: #0B281B; --side-hover: #16422F; --side-text: #A0B4A9; --side-accent: #4CAF50;
  --pri: #4CAF50; --pri-d: #2E7D32; --pri-bg: rgba(76, 175, 80, .1); --pri-glow: rgba(76, 175, 80, .3);
  --orb1: #2E7D32; --orb2: #FF9800;
  --bg: #F4F7FB; --card: #FFFFFF; --ink: #1A2235; --mute: #78829D; --line: #E2E8F0; --soft: #F4F7FB; --field: #FFFFFF;
  --head-grad: linear-gradient(135deg, #0B281B, #16422F);
}
[data-theme="ocean"] {
  --side-bg: #0A2340; --side-hover: #12365F; --side-text: #9DB3CF; --side-accent: #42A5F5;
  --pri: #1E88E5; --pri-d: #1565C0; --pri-bg: rgba(30, 136, 229, .1); --pri-glow: rgba(30, 136, 229, .3);
  --orb1: #1565C0; --orb2: #00ACC1; --bg: #F2F7FC; --head-grad: linear-gradient(135deg, #0A2340, #12365F);
}
[data-theme="sunset"] {
  --side-bg: #2A1408; --side-hover: #46230F; --side-text: #D2B39E; --side-accent: #FF9800;
  --pri: #F57C00; --pri-d: #E65100; --pri-bg: rgba(245, 124, 0, .1); --pri-glow: rgba(245, 124, 0, .3);
  --orb1: #E65100; --orb2: #FFC107; --bg: #FBF6F1; --head-grad: linear-gradient(135deg, #2A1408, #46230F);
}
[data-theme="royal"] {
  --side-bg: #1C1240; --side-hover: #2D1E62; --side-text: #B3A8D6; --side-accent: #9575CD;
  --pri: #6A4BC4; --pri-d: #4527A0; --pri-bg: rgba(106, 75, 196, .1); --pri-glow: rgba(106, 75, 196, .3);
  --orb1: #4527A0; --orb2: #EC407A; --bg: #F6F4FC; --head-grad: linear-gradient(135deg, #1C1240, #2D1E62);
}
[data-theme="slate"] {
  --side-bg: #1E242C; --side-hover: #2E3743; --side-text: #A9B4C2; --side-accent: #26A69A;
  --pri: #00897B; --pri-d: #00695C; --pri-bg: rgba(0, 137, 123, .1); --pri-glow: rgba(0, 137, 123, .3);
  --orb1: #00695C; --orb2: #78909C; --bg: #F3F5F7; --head-grad: linear-gradient(135deg, #1E242C, #2E3743);
}
[data-theme="midnight"] {
  --side-bg: #060B14; --side-hover: #142033; --side-text: #8E9BB3; --side-accent: #66BB6A;
  --pri: #4CAF50; --pri-d: #388E3C; --pri-bg: rgba(76, 175, 80, .16); --pri-glow: rgba(76, 175, 80, .35);
  --orb1: #1B5E20; --orb2: #283593;
  --bg: #0D1421; --card: #151F31; --ink: #E7ECF5; --mute: #8D9AB2; --line: #24324A; --soft: #1B273C; --field: #111A2A;
  --head-grad: linear-gradient(135deg, #060B14, #142033);
}
:root {
  --orange: #FF9800; --orange-bg: rgba(255, 152, 0, .1);
  --red: #E53935; --red-bg: rgba(229, 57, 53, .1);
  --blue: #2196F3; --blue-bg: rgba(33, 150, 243, .1);
  --purple: #5E35B1; --purple-bg: rgba(94, 53, 177, .1);
  --green: #2E7D32; --green-bg: rgba(76, 175, 80, .1);
  --amber: #F59E0B;
  --shadow: 0 4px 20px rgba(0, 0, 0, .04); --shadow-float: 0 10px 40px rgba(0, 0, 0, .12);
  --side-w: 260px; --side-c: 85px;
}
html { font-size: 16px; }
html[data-font="small"] { font-size: 14.5px; }
html[data-font="large"] { font-size: 17.5px; }
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', system-ui, sans-serif; }
body { background: var(--bg); color: var(--ink); min-height: 100vh; transition: background .3s; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--pri-d); text-decoration: none; cursor: pointer; }
.hidden { display: none !important; }
.orb { position: fixed; border-radius: 50%; filter: blur(90px); opacity: .3; z-index: 0; animation: floatOrb 15s infinite ease-in-out; pointer-events: none; }
.orb-1 { width: 500px; height: 500px; background: var(--orb1); top: -150px; left: -100px; }
.orb-2 { width: 400px; height: 400px; background: var(--orb2); bottom: -100px; right: -50px; animation-delay: -4s; }
[data-theme="midnight"] .orb { opacity: .18; }
@keyframes floatOrb { 50% { transform: translate(40px, -40px) scale(1.1); } }
::-webkit-scrollbar { width: 6px; height: 6px; } ::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 10px; }

/* ---------- floating sidebar ---------- */
.shell { display: flex; height: 100vh; overflow: hidden; position: relative; z-index: 1; }
.side { background: var(--side-bg); color: #fff; margin: 15px; border-radius: 20px; box-shadow: var(--shadow-float); display: flex; flex-direction: column;
  width: var(--side-w); flex-shrink: 0; border: 1px solid rgba(255, 255, 255, .05); overflow: hidden; transition: width .4s cubic-bezier(.2, .8, .2, 1); z-index: 100; }
.side-head { padding: 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.brand { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.brand img { width: 35px; height: 35px; border-radius: 8px; background: #fff; padding: 4px; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.brand b { font-size: 1rem; font-weight: 700; line-height: 1.2; display: block; }
.brand span { font-size: .65rem; color: var(--side-accent); font-weight: 600; text-transform: uppercase; }
.toggle-btn { background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); color: var(--side-text); cursor: pointer; font-size: 1.1rem; padding: 4px 8px; border-radius: 6px; }
.toggle-btn:hover { color: #fff; background: rgba(255, 255, 255, .15); }
.farm-select { margin: 10px 15px; padding: 10px; background: rgba(255, 255, 255, .05); border-radius: 12px; display: flex; align-items: center; gap: 12px; cursor: pointer; border: 1px solid rgba(255, 255, 255, .03); transition: .3s; }
.farm-select:hover { background: rgba(255, 255, 255, .09); }
.farm-select .fs-ic { width: 32px; height: 32px; border-radius: 8px; background: var(--side-hover); display: grid; place-items: center; font-size: 1.05rem; flex: none; }
.farm-select h4 { font-size: .85rem; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.farm-select p { font-size: .7rem; color: var(--side-text); display: flex; justify-content: space-between; gap: 6px; }
.nav { flex: 1; padding: 10px 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .18) transparent; }
.nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); }
.nav button { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 15px; padding: 12px 20px; margin: 4px 15px; width: calc(100% - 30px); border-radius: 10px; cursor: pointer;
  color: var(--side-text); white-space: nowrap; position: relative; font-size: .85rem; font-weight: 500; transition: .3s; }
.nav button i { font-size: 1.15rem; width: 24px; text-align: center; font-style: normal; }
.nav button:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nav button.on { background: var(--side-hover); color: #fff; border-left: 4px solid var(--side-accent); font-weight: 600; }
.nav button .count { position: absolute; right: 15px; background: var(--red); color: #fff; font-size: .65rem; padding: 2px 6px; border-radius: 10px; font-weight: 700; }
.nav button .lock { position: absolute; right: 15px; font-size: .6rem; font-weight: 800; color: #FFCC80; background: rgba(255, 152, 0, .18); border-radius: 10px; padding: 2px 7px; }
.nav .sep { height: 1px; background: rgba(255, 255, 255, .06); margin: 8px 20px; }
.side .sponsor { margin: 6px 15px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .06); border-radius: 14px; padding: 12px; font-size: .7rem; line-height: 1.45; color: var(--side-text); }
.side .sponsor b { color: #fff; display: block; font-size: .8rem; margin: 2px 0; }
.side .sponsor a { display: inline-block; margin-top: 6px; color: #FFCC80; font-weight: 600; }
.me { padding: 15px; margin: 10px 15px 15px; background: rgba(0, 0, 0, .2); border-radius: 14px; display: flex; align-items: center; gap: 12px; border: 1px solid rgba(255, 255, 255, .03); }
.me .av { width: 38px; height: 38px; border-radius: 50%; background: var(--pri); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .9rem; flex: none; border: 2px solid var(--side-accent); }
.me .who { min-width: 0; flex: 1; }
.me b { color: #fff; font-size: .8rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me span { font-size: .65rem; color: var(--side-text); }
.me .out { background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); color: var(--side-text); border-radius: 8px; padding: 6px 8px; cursor: pointer; font-size: .7rem; font-weight: 600; flex: none; }
.me .out:hover { background: var(--red); color: #fff; border-color: var(--red); }
.side.collapsed { width: var(--side-c); }
.side.collapsed .brand div, .side.collapsed .nav button span, .side.collapsed .farm-select .fs-txt, .side.collapsed .me .who, .side.collapsed .sponsor,
.side.collapsed .nav button .count, .side.collapsed .nav button .lock { display: none; }
.side.collapsed .side-head { padding: 20px 10px; justify-content: center; } .side.collapsed .brand img { display: none; }
.side.collapsed .nav button { justify-content: center; padding: 14px 0; margin: 4px 10px; width: calc(100% - 20px); }
.side.collapsed .farm-select, .side.collapsed .me { justify-content: center; padding: 10px 0; margin: 10px; flex-direction: column; }

/* ---------- top bar ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.top { padding: 15px 30px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); flex-shrink: 0; flex-wrap: wrap; }
.top h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.5px; color: var(--ink); }
.top .sub { font-size: .8rem; color: var(--mute); margin-top: 2px; }
.top .grow { flex: 1; }
.top .menu-btn { display: none; color: var(--ink); background: var(--card); border-color: var(--line); }
.pill { background: var(--card); padding: 6px 14px; border-radius: 8px; font-size: .8rem; font-weight: 600; border: 1px solid var(--line); display: inline-flex; align-items: center; gap: 8px; box-shadow: var(--shadow); color: var(--ink); white-space: nowrap; }
.pill.btn { cursor: pointer; } .pill.btn:hover { border-color: var(--pri); }
.pill i { font-style: normal; font-size: 1.05rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mute); flex: none; }
.dot.live { background: var(--pri); box-shadow: 0 0 0 3px var(--pri-bg); animation: pulse 2s infinite; } .dot.warn { background: var(--orange); } .dot.crit { background: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .45; } }
#st-pill.ok { color: var(--pri-d); border-color: var(--pri); } #st-pill.bad { color: var(--red); border-color: var(--red); }
#voice-pill.on { color: var(--pri-d); border-color: var(--pri); } #voice-pill.on i { animation: pulse 1.6s infinite; }
.plan-badge { font-size: .72rem; font-weight: 800; letter-spacing: .5px; padding: 7px 12px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.plan-free { background: var(--blue-bg); color: var(--blue); border-color: rgba(33, 150, 243, .3); }
.plan-plus { background: var(--orange-bg); color: #E65100; border-color: rgba(255, 152, 0, .35); }
.plan-pro { background: var(--purple-bg); color: var(--purple); border-color: rgba(94, 53, 177, .3); }
.content { flex: 1 1 auto; padding: 20px 30px 90px; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; }
.page { display: none; animation: fadeIn .3s ease; }
.page.on { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } }

/* ---------- grids and cards (original sizes) ---------- */
.grid { display: grid; gap: 15px; margin-bottom: 15px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g8 { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.g-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } .g-12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.g-311 { grid-template-columns: minmax(0, 2fr) minmax(0, 1.5fr) minmax(0, 1fr); } .g-31 { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; box-shadow: var(--shadow); position: relative; min-width: 0; overflow: hidden; }
.card > *:not(.watermark) { position: relative; z-index: 2; }
.watermark { position: absolute; right: -4%; bottom: -14%; font-size: 110px; opacity: .04; z-index: 0; pointer-events: none; user-select: none; font-style: normal; }
.card.flush { padding: 0; }
.ch { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; min-height: 26px; flex-wrap: wrap; }
.ch h3 { font-size: .95rem; font-weight: 700; display: flex; align-items: center; gap: 6px; color: var(--ink); }
.ch .hint { font-size: .72rem; color: var(--mute); }
.ch .grow { flex: 1; }

/* KPI tiles: original centred style */
.kpi { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 15px 8px; transition: .2s; }
.kpi.click { cursor: pointer; } .kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0, 0, 0, .06); }
.kpi .l { font-size: .7rem; color: var(--mute); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.kpi .l .ic, .kpi .l .em { width: 42px; height: 42px; border-radius: 50%; font-size: 1.3rem; }
.kpi .v { font-size: 1.7rem; font-weight: 700; color: var(--ink); margin: 2px 0; line-height: 1.15; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: .9rem; font-weight: 600; color: var(--mute); margin-left: 1px; }
.kpi .t { font-size: .65rem; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: var(--soft); color: var(--mute); margin-top: 2px; }
.kpi .t.up { background: var(--green-bg); color: var(--green); } .kpi .t.down { background: var(--red-bg); color: var(--red); }
.kpi-alert { border: 2px solid rgba(229, 57, 53, .2); background: var(--red-bg); } .kpi-alert .v, .kpi-alert .l { color: var(--red); }
.kpi-top { border-top: 3px solid var(--blue); }
.em { display: grid; place-items: center; font-style: normal; flex: none; }
.ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; font-style: normal; }
.ic svg { width: 16px; height: 16px; }
.c-orange { background: var(--orange-bg); color: #E65100; } .c-purple { background: var(--purple-bg); color: var(--purple); }
.c-blue { background: var(--blue-bg); color: var(--blue); } .c-green { background: var(--green-bg); color: var(--green); }
.c-red { background: var(--red-bg); color: var(--red); } .c-amber { background: var(--orange-bg); color: #E65100; }

.tag { display: inline-flex; align-items: center; gap: 4px; font-size: .65rem; font-weight: 800; letter-spacing: .6px; padding: 4px 10px; border-radius: 6px; background: var(--soft); color: var(--mute); white-space: nowrap; }
.tag.live { background: var(--pri-bg); color: var(--pri-d); } .tag.off { background: var(--red-bg); color: var(--red); }
.tag.warn { background: var(--orange-bg); color: #E65100; } .tag.crit { background: var(--red); color: #fff; } .tag.sim { background: var(--purple-bg); color: var(--purple); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-size: .78rem; font-weight: 600; cursor: pointer; transition: .2s; white-space: nowrap; }
.btn:hover { border-color: #CBD5E1; background: var(--soft); }
.btn.pri { background: var(--pri); border-color: var(--pri); color: #fff; box-shadow: 0 2px 8px var(--pri-glow); } .btn.pri:hover { background: var(--pri-d); transform: translateY(-1px); }
.btn.purple { background: var(--purple); border-color: var(--purple); color: #fff; box-shadow: 0 2px 8px rgba(94, 53, 177, .3); }
.btn.grad { background: linear-gradient(135deg, var(--purple), var(--orange)); border: 0; color: #fff; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--card); }
.btn.danger { background: var(--red-bg); color: var(--red); border-color: transparent; } .btn.danger:hover { background: var(--red); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: .7rem; } .btn.block { width: 100%; } .btn:disabled { opacity: .55; cursor: default; transform: none; }
.input, select.input, textarea.input { width: 100%; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--field); font-size: .85rem; outline: none; transition: .3s; color: var(--ink); }
select.input.sm, select.form-select { width: auto; padding: 6px 10px; font-size: .75rem; border-radius: 8px; font-weight: 500; }
.input:focus { border-color: var(--pri); box-shadow: 0 0 0 3px var(--pri-bg); }
label.f { display: block; font-size: .8rem; font-weight: 600; color: var(--ink); margin: 12px 0 5px; }
.muted { color: var(--mute); } .small { font-size: .78rem; } .bold { font-weight: 700; }
.row { display: flex; align-items: center; gap: 10px; }
.empty { text-align: center; color: var(--mute); font-size: .8rem; padding: 24px 10px; }
.empty b { display: block; color: var(--ink); font-size: .85rem; margin-bottom: 2px; }

.list { display: flex; flex-direction: column; gap: 10px; max-height: 340px; overflow-y: auto; padding-right: 4px; }
.item { background: var(--soft); padding: 12px; border-radius: 10px; display: flex; gap: 12px; align-items: flex-start; border: 1px solid rgba(0, 0, 0, .02); border-left: 3px solid transparent; transition: .2s; }
.item:hover { transform: translateX(3px); }
.item.crit { border-left-color: var(--red); background: var(--red-bg); } .item.warn { border-left-color: var(--orange); background: var(--orange-bg); }
.item.info { border-left-color: var(--blue); background: var(--blue-bg); } .item.good { border-left-color: var(--green); background: var(--green-bg); }
.item.log { border-left-color: var(--purple); background: var(--purple-bg); }
.item h4 { font-size: .8rem; font-weight: 700; color: var(--ink); }
.item p { font-size: .75rem; color: var(--mute); line-height: 1.4; margin-top: 2px; }
.item .time { font-size: .65rem; color: #9CA3AF; font-weight: 600; margin-top: 3px; }
.item .x { margin-left: auto; flex: none; }
.table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.table th { text-align: left; padding: 10px; border-bottom: 2px solid var(--line); color: var(--mute); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; font-size: .7rem; white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); font-weight: 500; font-variant-numeric: tabular-nums; }
.kv { width: 100%; border-collapse: collapse; font-size: .8rem; } .kv td { padding: 10px 4px; border-bottom: 1px solid var(--line); }
.kv td:last-child { text-align: right; font-weight: 700; font-size: .88rem; } .kv tr:last-child td { border-bottom: 0; }
.meter { margin-bottom: 16px; } .meter .mh { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 700; margin-bottom: 5px; }
.bar { height: 12px; background: var(--soft); border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.bar i { display: block; height: 100%; width: 0; border-radius: 8px; background: var(--pri); transition: width .6s ease, background .6s ease; }

.gauge { --p: 0; --c: var(--pri); width: 160px; height: 160px; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--soft) 0); display: grid; place-items: center; margin: 4px auto 8px; }
.gauge > div { width: 128px; height: 128px; border-radius: 50%; background: var(--card); display: grid; place-items: center; text-align: center; }
.gauge b { font-size: 2.2rem; font-weight: 800; display: block; line-height: 1; letter-spacing: -1px; color: var(--c); } .gauge span { font-size: .65rem; color: var(--mute); font-weight: 500; }

.sw { position: relative; display: inline-block; vertical-align: middle; width: 40px; height: 20px; flex: none; }
.sw input { opacity: 0; width: 0; height: 0; }
.sw span { position: absolute; inset: 0; background: #D1D5DB; border-radius: 34px; transition: .3s; cursor: pointer; box-shadow: inset 0 1px 3px rgba(0, 0, 0, .1); }
.sw span:before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; bottom: 2px; background: #fff; border-radius: 50%; transition: .3s; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); }
.sw input:checked + span { background: var(--pri); } .sw input:checked + span:before { transform: translateX(20px); }
.act { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .85rem; }
.act:last-child { border-bottom: 0; } .act .bold { font-weight: 600; } .act .small { font-size: .68rem; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100px; background: transparent; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; height: 14px; width: 14px; border-radius: 50%; background: var(--purple); cursor: pointer; margin-top: -5px; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
input[type=range]::-webkit-slider-runnable-track { height: 4px; background: var(--line); border-radius: 2px; }

/* media */
.media { position: relative; background: #0A0F1C; border-radius: 10px; overflow: hidden; aspect-ratio: 16 / 9; display: grid; place-items: center; box-shadow: inset 0 0 20px rgba(0, 0, 0, .8); }
.media video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.media .off { color: #C9D2E3; text-align: center; font-size: .8rem; }
.media .off b { display: block; color: #fff; font-size: .85rem; } .media .off i { display: block; font-style: normal; font-size: 2.5rem; margin-bottom: 8px; }
.media .fs { position: absolute; right: 10px; bottom: 10px; z-index: 5; background: rgba(0, 0, 0, .6); color: #fff; border: 1px solid rgba(255, 255, 255, .2); border-radius: 8px; padding: 6px 10px; font-size: .72rem; font-weight: 600; cursor: pointer; }
.media:fullscreen { border-radius: 0; aspect-ratio: auto; } .media:-webkit-full-screen { border-radius: 0; }
.chart { position: relative; height: 220px; } .chart.sm { height: 140px; } .chart.lg { height: 300px; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--mute); font-size: .78rem; pointer-events: none; }
.chart-empty > div { background: color-mix(in srgb, var(--card) 92%, transparent); padding: 12px 18px; border-radius: 12px; border: 1px dashed var(--line); max-width: 85%; line-height: 1.5; }
.chart-empty b { display: block; color: var(--ink); font-size: .85rem; }

.chips4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.chips4.c3 { grid-template-columns: repeat(3, 1fr); margin-top: 15px; border-top: 1px solid var(--line); padding-top: 10px; }
.chips4 div { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 8px 6px; text-align: center; }
.chips4.c3 div { background: transparent; border: 0; padding: 0; }
.chips4 b { display: block; font-size: 1.05rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.chips4.c3 b { font-size: 1.2rem; }
.chips4 span { font-size: .6rem; color: var(--mute); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.feed-row { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 20px; }
.feed-row .small { font-weight: 600; margin-bottom: 4px; }
.feed-big { font-size: 1.4rem; font-weight: 700; color: var(--purple); letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.feed-count { padding: 20px; background: rgba(0, 0, 0, .03); border-radius: 12px; text-align: center; }
[data-theme="midnight"] .feed-count { background: rgba(255, 255, 255, .04); }
.feed-count .small { color: var(--ink); font-weight: 500; font-size: .85rem; margin-bottom: 8px; }
.feed-count #f-count { font-family: ui-monospace, monospace; color: var(--pri-d); font-size: 2.2rem; font-weight: 800; letter-spacing: 3px; }
[data-theme="midnight"] .feed-count #f-count { color: var(--pri); }

/* lock */
.lockpane { text-align: center; padding: 30px 16px; }
.lockpane .ic { width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 12px; font-size: 1.5rem; }
.lockpane .ic svg { width: 22px; height: 22px; }
.lockpane h3 { font-size: 1.05rem; } .lockpane p { font-size: .85rem; color: var(--mute); margin: 6px auto 14px; max-width: 420px; line-height: 1.55; }

/* plans */
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.plan { display: flex; flex-direction: column; padding: 22px; }
.plan.cur { border: 2px solid var(--pri); box-shadow: 0 0 0 4px var(--pri-bg); }
.plan .pn { font-size: 1.15rem; font-weight: 700; display: flex; align-items: center; gap: 8px; } .plan .pt { font-size: .78rem; color: var(--mute); margin-top: 2px; }
.plan .pp { font-size: 2.2rem; font-weight: 800; margin: 14px 0 4px; letter-spacing: -1px; } .plan .pp small { font-size: .8rem; color: var(--mute); font-weight: 600; letter-spacing: 0; }
.plan ul { list-style: none; margin: 12px 0 18px; flex: 1; } .plan li { font-size: .82rem; padding: 6px 0 6px 24px; position: relative; color: var(--ink); border-bottom: 1px dashed var(--line); }
.plan li:before { content: "✓"; position: absolute; left: 2px; top: 5px; color: var(--pri-d); font-weight: 800; }
.plan .btn { padding: 12px; font-size: .85rem; font-weight: 700; }
.cmp td:not(:first-child), .cmp th:not(:first-child) { text-align: center; }

/* themes picker */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.theme { border: 2px solid var(--line); border-radius: 12px; padding: 10px; cursor: pointer; background: var(--card); position: relative; transition: .2s; }
.theme:hover { transform: translateY(-2px); } .theme.on { border-color: var(--pri); box-shadow: 0 0 0 3px var(--pri-bg); }
.theme .sw3 { display: flex; height: 44px; border-radius: 8px; overflow: hidden; margin-bottom: 8px; }
.theme .sw3 i { flex: 1; } .theme b { font-size: .8rem; display: block; } .theme span { font-size: .68rem; color: var(--mute); }
.theme .lk { position: absolute; top: 8px; right: 8px; font-size: .6rem; font-weight: 800; background: var(--orange-bg); color: #E65100; padding: 2px 7px; border-radius: 6px; }
.seg { display: inline-flex; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { all: unset; padding: 7px 16px; font-size: .8rem; font-weight: 600; border-radius: 8px; cursor: pointer; color: var(--mute); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

/* house picker (opens from the sidebar farm box) */
.hp-panel { position: fixed; top: 140px; left: 20px; width: 340px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-float); padding: 12px; z-index: 300; }
.hp-list { max-height: 320px; overflow-y: auto; margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.hp-item { display: flex; align-items: center; gap: 10px; padding: 9px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.hp-item:hover { background: var(--soft); } .hp-item.cur { background: var(--pri-bg); border-color: var(--pri); }
.hp-item b { font-size: .85rem; display: block; } .hp-item span { font-size: .7rem; color: var(--mute); } .hp-item .tag { margin-left: auto; }

/* AI chat (floating button and window, same chat on the AI assistant page) */
.hg-fab { position: fixed; bottom: 26px; right: 26px; z-index: 2500; width: 62px; height: 62px; border-radius: 50%; background: linear-gradient(135deg, var(--pri-d), var(--pri)); border: 3px solid #fff; cursor: pointer;
  box-shadow: 0 8px 24px var(--pri-glow); display: flex; align-items: center; justify-content: center; transition: transform .2s; }
.hg-fab:hover { transform: scale(1.1); } .hg-fab img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: #fff; }
.hg-fab .wake { position: absolute; top: -4px; right: -4px; width: 18px; height: 18px; border-radius: 50%; background: var(--red); border: 2px solid #fff; font-size: 9px; display: grid; place-items: center; }
.hg-overlay { position: fixed; inset: 0; background: rgba(10, 15, 28, .65); backdrop-filter: blur(6px); z-index: 2600; display: flex; align-items: center; justify-content: center; }
.hg-overlay .hg-chat { width: min(680px, 94vw); height: min(760px, 92vh); border-radius: 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, .4); }
.hg-chat { background: var(--bg); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); position: relative; width: 100%; height: calc(100vh - 160px); min-height: 520px; border-radius: 16px; }
.hg-head { background: var(--head-grad); color: #fff; padding: 14px 18px; display: flex; align-items: center; gap: 10px; }
.hg-head .ttl { flex: 1; min-width: 0; } .hg-head .t2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hg-head .hg-hbtn, .hg-head .hg-status { flex-shrink: 0; white-space: nowrap; }
.hg-head img { width: 42px; height: 42px; border-radius: 12px; background: #fff; padding: 3px; }
.hg-head .t1 { font-weight: 800; font-size: 1rem; } .hg-head .t2 { font-size: .66rem; color: rgba(255, 255, 255, .7); } .hg-head .sp { flex: 1; }
.hg-hbtn { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .15); color: #fff; border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: .72rem; font-weight: 600; }
.hg-hbtn:hover { background: rgba(255, 255, 255, .2); }
.hg-status { font-size: .68rem; font-weight: 700; padding: 5px 12px; border-radius: 20px; background: rgba(255, 255, 255, .12); white-space: nowrap; }
.hg-close { background: none; border: 0; color: #fff; font-size: 1.3rem; cursor: pointer; }
.hg-msgs { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px 18px; display: flex; flex-direction: column; gap: 12px; }
.bub { max-width: 84%; padding: 12px 14px; border-radius: 16px; font-size: .85rem; line-height: 1.55; animation: hgpop .25s ease; }
@keyframes hgpop { from { opacity: 0; transform: translateY(8px); } }
.bub.me { align-self: flex-end; background: linear-gradient(135deg, var(--pri), var(--pri-d)); color: #fff; border-bottom-right-radius: 4px; }
.bub.ai { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; color: var(--ink); box-shadow: var(--shadow); }
.bub .vtag { display: block; font-size: .62rem; opacity: .8; margin-bottom: 3px; font-weight: 600; }
.bub .acts { margin-top: 10px; background: var(--soft); border: 1px dashed #CBD5E1; border-radius: 12px; padding: 10px 12px; }
.bub .acts label { display: flex; gap: 8px; align-items: center; font-size: .78rem; padding: 4px 0; cursor: pointer; }
.chips { display: flex; gap: 8px; padding: 10px 18px; flex-wrap: wrap; flex-shrink: 0; border-top: 1px solid var(--line); }
.chip { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 6px 12px; font-size: .72rem; font-weight: 600; cursor: pointer; color: var(--ink); }
.chip:hover { border-color: var(--pri); color: var(--pri-d); }
.composer { display: flex; gap: 10px; padding: 14px 18px; background: var(--card); border-top: 1px solid var(--line); flex-shrink: 0; align-items: center; }
.composer .input { border-radius: 12px; padding: 12px 14px; }
.mic-btn { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 1.15rem; flex: none; transition: .2s; }
.mic-btn:hover { border-color: var(--pri); } .mic-btn.rec { background: var(--red); border-color: var(--red); color: #fff; animation: pulse 1s infinite; }
.send-btn { background: var(--pri-d); color: #fff; border: 0; border-radius: 12px; padding: 0 20px; height: 46px; font-weight: 700; cursor: pointer; font-size: .85rem; white-space: nowrap; flex-shrink: 0; }
.send-btn:disabled { opacity: .5; }
.hg-hist { position: absolute; top: 70px; left: 12px; right: 12px; max-height: 300px; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 14px; z-index: 10; box-shadow: var(--shadow-float); }
.hg-hist .hi { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: .8rem; }
.hg-hist .hi:hover { background: var(--soft); } .hg-hist .hi span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hg-hist .hi .del { color: var(--red); border: 0; background: none; cursor: pointer; font-size: .9rem; }
.hg-think { position: absolute; inset: 0; background: rgba(10, 15, 28, .9); z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; text-align: center; }
.hg-think img { width: 130px; height: 130px; border-radius: 26px; margin-bottom: 18px; box-shadow: 0 0 70px var(--pri-glow); object-fit: cover; }
.hg-think .dots::after { content: ""; animation: hgdots 1.2s infinite; }
@keyframes hgdots { 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.hg-listen { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 15; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-float); border-radius: 30px; padding: 10px 18px; display: flex; align-items: center; gap: 10px; font-size: .82rem; font-weight: 600; max-width: 90%; }
.hg-listen .wave { display: flex; gap: 3px; align-items: center; height: 18px; }
.hg-listen .wave i { width: 3px; background: var(--red); border-radius: 2px; animation: wave .9s infinite ease-in-out; }
.hg-listen .wave i:nth-child(2) { animation-delay: .15s; } .hg-listen .wave i:nth-child(3) { animation-delay: .3s; } .hg-listen .wave i:nth-child(4) { animation-delay: .45s; }
@keyframes wave { 0%, 100% { height: 5px; } 50% { height: 18px; } }
.hg-listen span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }

/* sign in */
.gate { position: fixed; inset: 0; background: var(--bg); z-index: 3000; display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.gate .box { width: 100%; max-width: 420px; position: relative; z-index: 2; }
.gate .logo { text-align: center; margin-bottom: 22px; }
.gate .logo img { width: 90px; border-radius: 20px; box-shadow: 0 8px 25px rgba(0, 0, 0, .1); background: #fff; padding: 10px; margin-bottom: 14px; }
.gate .logo b { display: block; color: var(--side-bg); font-size: 2.2rem; font-weight: 800; letter-spacing: -.5px; line-height: 1.1; }
[data-theme="midnight"] .gate .logo b { color: var(--ink); }
.gate .logo span { color: var(--mute); font-size: .95rem; font-weight: 500; }
.gate .card { padding: 24px; border-radius: 18px; }
.tabs { display: flex; background: var(--soft); border-radius: 12px; padding: 4px; margin-bottom: 4px; border: 1px solid var(--line); }
.tabs button { all: unset; flex: 1; text-align: center; padding: 9px 0; font-size: .85rem; font-weight: 600; color: var(--mute); border-radius: 9px; cursor: pointer; }
.tabs button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.gate .btn.pri { padding: 14px; font-size: 1rem; font-weight: 700; border-radius: 30px; letter-spacing: .4px; }
.err { color: var(--red); font-size: .78rem; margin-top: 8px; min-height: 16px; font-weight: 500; }
.scan { width: 130px; height: 130px; margin: 6px auto 12px; position: relative; }
.scan i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--pri); animation: ring 1.8s ease-out infinite; }
.scan i:nth-child(2) { animation-delay: .6s; } .scan i:nth-child(3) { animation-delay: 1.2s; }
.scan b { position: absolute; inset: 40px; border-radius: 50%; background: var(--pri); box-shadow: 0 0 24px var(--pri-glow); }
@keyframes ring { from { transform: scale(.35); opacity: 1; } to { transform: scale(1); opacity: 0; } }
.farm { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 10px; background: var(--card); }
.farm .h { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .9rem; }
.farm .hs { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.farm .hs div { display: flex; justify-content: space-between; align-items: center; font-size: .82rem; padding: 8px 10px; border-radius: 8px; background: var(--soft); cursor: pointer; }
.farm .hs div:hover { background: var(--pri-bg); }

/* modal, toast, alarm */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .8); backdrop-filter: blur(8px); display: grid; place-items: center; z-index: 2800; padding: 16px; }
.modal .card { width: 100%; max-width: 500px; padding: 28px; border-radius: 20px; animation: popIn .3s cubic-bezier(.16, 1, .3, 1); box-shadow: 0 20px 60px rgba(0, 0, 0, .2); }
@keyframes popIn { from { transform: scale(.95); opacity: 0; } }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; z-index: 3100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--side-bg); color: #fff; padding: 11px 16px; border-radius: 12px; font-size: .82rem; box-shadow: var(--shadow-float); max-width: 380px; animation: fadeIn .2s ease; }
.toast.crit { background: var(--red); }
.alarm { position: fixed; bottom: 30px; right: 30px; background: var(--red); color: #fff; padding: 20px; border-radius: 16px; box-shadow: 0 10px 30px rgba(229, 57, 53, .5); z-index: 2700;
  display: flex; align-items: center; gap: 15px; border: 2px solid #FFCDD2; animation: slideIn .4s cubic-bezier(.16, 1, .3, 1); max-width: 440px; }
.alarm i { font-size: 2.5rem; font-style: normal; } .alarm b { display: block; font-size: 1.05rem; font-weight: 800; letter-spacing: .5px; } .alarm span { font-size: .85rem; }
.alarm .btn { background: #fff; color: var(--red); border: 0; font-weight: 700; padding: 8px 14px; box-shadow: 0 2px 6px rgba(0, 0, 0, .12); white-space: nowrap; }
.alarm .btn.ghost { background: transparent; color: #fff; border: 1.5px solid rgba(255, 255, 255, .8); box-shadow: none; }
.alarm .btn:hover { filter: brightness(.96); } .alarm .btn.ghost:hover { background: rgba(255, 255, 255, .15); }
.alarm-btns { display: flex; flex-direction: column; gap: 8px; }
@keyframes slideIn { from { transform: translateX(120%); } }

.timeline { max-height: 420px; overflow-y: auto; padding-right: 6px; }
.tl { position: relative; padding-left: 22px; padding-bottom: 14px; border-left: 2px solid var(--line); margin-left: 6px; }
.tl:before { content: ""; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--blue); border: 2px solid var(--card); }
.tl.crit:before { background: var(--red); } .tl.warn:before { background: var(--orange); }
.tl h5 { font-size: .8rem; font-weight: 700; } .tl p { font-size: .72rem; color: var(--mute); line-height: 1.4; } .tl .tt { font-size: .65rem; color: #9CA3AF; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0 14px; }
.sect { font-size: .75rem; font-weight: 800; color: var(--mute); letter-spacing: .6px; text-transform: uppercase; margin: 18px 0 2px; }
.sect:first-child { margin-top: 0; }
.ai-box { width: 100%; min-height: 280px; padding: 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--field); font-size: .9rem; line-height: 1.6; color: var(--ink); white-space: pre-wrap; }

@media (max-width: 1680px) { #voice-pill span { display: none; } #voice-pill { padding: 6px 10px; } }
@media (max-width: 1600px) { .g8 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1280px) { #date-pill { display: none; } }
@media (max-width: 1350px) { .g-311 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .g-311 > :first-child { grid-column: 1 / -1; } .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1200px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-31 { grid-template-columns: 1fr; } }
@media (max-width: 920px) {
  .side { position: fixed; left: 0; top: 0; bottom: 0; margin: 10px; transform: translateX(-110%); transition: transform .25s ease; }
  .side.open { transform: none; }
  .top { padding: 12px 16px; } .top .menu-btn { display: inline-flex; } .top .sub, #date-pill { display: none; }
  .content { padding: 16px 16px 90px; }
  .g2, .g3, .g-21, .g-12, .g-311, .plans { grid-template-columns: 1fr; } .g-311 > :first-child { grid-column: auto; }
  .hg-chat { height: calc(100vh - 140px); }
}
@media (max-width: 560px) { .g8, .g4, .g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } #clock-pill, #voice-pill span { display: none; } .top h1 { font-size: 1.2rem; } .hp-panel { left: 10px; right: 10px; width: auto; } .hg-head { flex-wrap: wrap; } .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .chips .chip { flex-shrink: 0; } .hg-head .ttl { flex-basis: calc(100% - 120px); } }
@media print {
  .side, .top, .noprint, .toasts, .hg-fab, .orb { display: none !important; }
  .shell, .main { display: block; height: auto; overflow: visible; } .content { overflow: visible; padding: 0; } .card { box-shadow: none; break-inside: avoid; }
  .page { display: none !important; } .page.print { display: block !important; }
}
