/* FBEMC Usage Portal — E2 design tokens + components. Light theme only,
   but everything runs through variables so nothing is hardcoded twice. */
:root{
  --page:#F6F5F1; --surface:#FFFFFF;
  --brand:#3B5646; --brand-deep:#23382B; --accent:#FFAA06; --accent-ink:#9A6200;
  --ink:#22302A; --ink-2:#5B6A61; --muted:#8A948C;
  --grid:#E7E5DC; --border:#E2E0D6; --ok:#1E7A34; --bad:#B4231F;
  --usage:#008300; --temp:#F5A800; --temp-lo:#5FB0E8; /* temp lines only — light so they ride on the green bars; donut/compare keep --d4 */
  --d1:#008300; --d2:#eda100; --d3:#1baf7a; --d4:#2a78d6;
  --event:#7A1FA2; /* home-event pennant — violet: CVD-validated apart from d1/d2/d4, and not the alarm red */
  --radius:16px; --shadow:0 1px 2px rgba(35,56,43,.05),0 8px 22px rgba(35,56,43,.06);
}
*{box-sizing:border-box;margin:0}
body{background:var(--page);color:var(--ink);font:15px/1.5 "Work Sans","Segoe UI",sans-serif}
a{color:var(--brand);text-decoration:none}
a:hover{color:#517659}

/* topbar */
.topbar{background:var(--surface);display:flex;align-items:center;gap:24px;padding:0 28px;height:62px;border-bottom:1px solid var(--border);min-width:0}
.signout{font-size:13px;font-weight:600;white-space:nowrap}
.brandrow{display:flex;align-items:center;gap:11px;flex-shrink:0;color:inherit}
.brandrow .seal{display:block}
.logotype{font-weight:800;font-size:15px;color:var(--brand-deep);white-space:nowrap;line-height:1.2}
.logotype small{display:block;font-weight:700;font-size:10.5px;letter-spacing:.14em;color:var(--accent-ink);text-transform:uppercase}
.topnav{display:flex;gap:2px;margin-left:8px}
.topnav a{color:var(--ink-2);padding:8px 14px;font-size:14px;font-weight:600;border-radius:20px}
.topnav a.on{background:#E9EFE9;color:var(--brand-deep)}
.spacer{flex:1}
.acct{background:var(--page);border:1px solid var(--border);color:var(--ink);border-radius:20px;padding:7px 14px;font:600 13px "Work Sans",sans-serif;cursor:pointer}
.avatar{width:32px;height:32px;border-radius:50%;background:var(--brand);color:#fff;font-weight:800;display:flex;align-items:center;justify-content:center;font-size:13px}
.wrap{max-width:1080px;margin:0 auto;padding:22px 20px 48px}
.hello{font-size:22px;font-weight:800;margin:8px 2px 4px;color:var(--brand-deep)}

/* outage status */
.statusline{display:flex;align-items:center;gap:9px;background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:10px 16px;font-size:14px;margin-top:10px;box-shadow:var(--shadow)}
.statusline .dot{width:9px;height:9px;border-radius:50%;background:var(--ok)}
.statusline.out{background:#FBF1F0;border-color:#EAC8C5}
.statusline.out .dot{background:var(--bad)}
.statusline .when{color:var(--muted);margin-left:auto;font-size:12.5px}

/* cards */
.insights{display:grid;grid-template-columns:1.2fr 1fr 1fr;gap:16px;margin-top:18px}
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);padding:18px 20px}
.card h3{font-size:14px;font-weight:800;margin-bottom:4px}
.card .sub2{font-size:12.5px;color:var(--ink-2);margin-bottom:12px}
.nbar{display:grid;grid-template-columns:110px 1fr 56px;align-items:center;gap:10px;font-size:13px;margin:9px 0}
.nbar .track{background:var(--page);border-radius:8px;height:18px;overflow:hidden}
.nbar .fill{height:100%;border-radius:8px}
.nbar .val{font-weight:800;text-align:right}
.headline{font-size:14px;font-weight:800;color:var(--ok);margin-top:10px}
.headline.up{color:var(--bad)}
.headline.flat{color:var(--ink-2)}
.proj .num{font-size:38px;font-weight:800;color:var(--brand);line-height:1.1}
.proj .num small{font-size:16px;color:var(--ink-2);font-weight:600}
.meter{background:var(--page);height:10px;border-radius:6px;margin:12px 0 6px;overflow:hidden}
.meter div{height:100%;background:var(--accent);border-radius:6px}
.proj p{font-size:12.5px;color:var(--ink-2)}
.donut-wrap{display:flex;align-items:center;gap:14px}
.dleg{font-size:12.5px}
.dleg div{display:flex;align-items:center;gap:7px;margin:5px 0;white-space:nowrap}
.dleg .hrs{color:var(--muted);font-size:11px}
.dleg i{width:10px;height:10px;border-radius:3px;display:inline-block}
.dleg b{margin-left:auto;padding-left:10px}

/* main chart */
.chart-card{margin-top:16px;scroll-margin-top:12px} /* ##chart anchor lands here after every control click */
.chartnav{display:inline-flex;align-items:center;gap:6px;margin-left:14px}
.chartnav .range{font-size:13px;font-weight:700;color:var(--ink-2);white-space:nowrap;text-align:center;min-width:120px}
.chartnav svg{width:14px;height:14px;display:block;fill:none;stroke:currentColor;stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round}
.chartnav .btn{padding:6px 9px;display:inline-flex;line-height:1}
.chartnav .btn.off{color:var(--brand);opacity:.28;cursor:default}
.chart-head{display:flex;align-items:center;margin-bottom:10px}
.chart-head h2{font-size:16px;font-weight:800}
.tabs{margin-left:auto;display:flex;background:var(--page);border-radius:20px;padding:3px}
.tabs a{border:0;background:none;padding:6px 16px;font:700 13px "Work Sans",sans-serif;color:var(--ink-2);cursor:pointer;border-radius:16px}
.tabs a.on{background:var(--surface);color:var(--brand);box-shadow:0 1px 3px rgba(0,0,0,.12)}
.strip-label{font-size:11.5px;color:var(--muted);letter-spacing:.08em;text-transform:uppercase;margin:10px 0 2px;font-weight:700}
.chart-legend{display:flex;gap:20px;justify-content:center;font-size:12.5px;color:var(--ink-2);margin-top:6px}
.chart-legend i{display:inline-block;vertical-align:middle;margin-right:6px}
.chart-legend i.sw{width:13px;height:13px;background:var(--usage);border-radius:3px}
.chart-legend i.ln{width:22px;height:0;border-top:2px solid var(--temp);position:relative;top:-3px}
.chart-legend i.ln2{width:22px;height:0;border-top:2px solid var(--temp-lo);position:relative;top:-3px}
.chart-legend i.ln3{width:22px;height:0;border-top:2px dashed var(--ink-2);position:relative;top:-3px}

/* event cards / tip strip */
.cards2{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-top:16px}
.event-card h3{font-size:13px;font-weight:800;color:var(--event)}
.event-card h3 span{color:var(--muted);font-weight:500}
.event-card .cmp{font-size:26px;font-weight:800;margin:6px 0 2px}
.event-card .cmp small{font-size:13px;font-weight:500;color:var(--ink-2)}
.event-card p{font-size:13px;color:var(--ink-2)}
.tiprow{display:flex;gap:12px;align-items:center;background:#FFF6E2;border:1px solid #EFDFB4;border-radius:var(--radius);padding:14px 18px;margin-top:16px;font-size:14px}
.tiprow .bulb{font-size:22px}

/* buttons */
.actions{display:flex;gap:10px;margin-top:20px;flex-wrap:wrap}
.btn{display:inline-block;border-radius:20px;padding:10px 20px;font:800 14px "Work Sans",sans-serif;cursor:pointer;border:1px solid var(--border);background:var(--surface);color:var(--brand);text-decoration:none}
.btn.primary{background:var(--brand);border-color:var(--brand);color:#fff}
.btn.primary:hover{background:#517659;color:#fff}
.btn.warn{background:var(--accent);border-color:var(--accent);color:var(--brand-deep)}

/* sign in / register / forgot / reset */
.authhead{display:flex;align-items:center;gap:14px;margin-bottom:10px}
.authhead .hello{margin:0}
.authhead .sub2{margin:0;color:var(--ink-2)}
.actions.auth{margin-top:12px;align-items:center}
.authlink{font-size:13px;font-weight:600;margin-left:6px}

/* forms (FCC two-layer validation pattern) */
.formcard{max-width:560px}
.frow{margin:12px 0}
.frow label{display:block;font-size:13px;font-weight:700;margin-bottom:4px}
.frow label .req{color:var(--bad)}
.frow input[type=text],.frow input[type=password],.frow input[type=email],.frow input[type=date],.frow input[type=time],.frow select,.frow textarea{
  width:100%;border:1px solid var(--border);border-radius:8px;padding:9px 12px;font:14px "Work Sans","Segoe UI",sans-serif;background:#fff;color:var(--ink)}
.frow textarea{min-height:70px;resize:vertical}
.msgcard{border-radius:12px;padding:12px 16px;font-size:14px;margin:14px 0}
.msgcard.err{background:#FBF1F0;border:1px solid #EAC8C5;color:var(--bad)}
.msgcard.ok{background:#EFF6EF;border:1px solid #CBE0CB;color:var(--ok)}

/* tables */
table.list{width:100%;border-collapse:collapse;font-size:13.5px}
table.list th{text-align:left;font-size:11px;letter-spacing:.07em;text-transform:uppercase;color:var(--ink-2);border-bottom:1px solid var(--border);padding:8px}
table.list td{padding:8px;border-bottom:1px solid var(--grid)}

footer{margin-top:34px;color:var(--muted);font-size:12.5px;text-align:center}
.tip{position:fixed;pointer-events:none;background:var(--ink);color:#fff;border-radius:6px;padding:4px 8px;font-size:11.5px;display:none;z-index:9;line-height:1.35;white-space:nowrap}
/* desktop: the mobile chrome does not exist */
.tabbar,.sheet{display:none}

/* report outage: status card + form side by side */
.twocol{display:grid;grid-template-columns:1fr 1.6fr;gap:16px;align-items:stretch}
.statuscard{text-align:center;padding-top:22px;display:flex;flex-direction:column}
.statuscard .foot{margin-top:auto;padding-top:16px}
.statuscard .ico{width:54px;height:54px;border-radius:50%;border:2px solid var(--brand);color:var(--brand);display:flex;align-items:center;justify-content:center;font-size:24px;margin:0 auto 12px}
.statuscard .addr{font-size:14px;color:var(--ink-2);margin-bottom:10px}
.statuscard .st{font-weight:800;font-size:15px;color:var(--ok)}
.statuscard .st.out{color:var(--bad)}
.statuscard .when{font-size:12.5px;color:var(--muted);margin-top:6px}
@media(max-width:760px){.twocol{grid-template-columns:1fr}}

/* chart range chips + compare form + summary stats */
.chips{display:flex;gap:6px;align-items:center;flex-wrap:wrap;margin:-2px 0 12px}
.chips a{border:1px solid var(--border);background:var(--surface);color:var(--brand);border-radius:16px;padding:4px 13px;font-size:12.5px;font-weight:700}
.chips a.on{background:var(--brand);border-color:var(--brand);color:#fff}
.chips .sep{width:1px;height:20px;background:var(--border);margin:0 6px}
.chart-legend i.sw2{width:13px;height:13px;background:var(--d4);border-radius:3px}
.statsrow{display:flex;gap:26px;justify-content:center;flex-wrap:wrap;margin-top:12px;padding-top:12px;border-top:1px solid var(--grid);font-size:13px}
.statsrow span{text-align:center}
.statsrow small{display:block;font-size:11px;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);font-weight:700}
.statsrow b{font-size:15px}
.statsrow em{display:block;font-style:normal;font-size:11.5px;color:var(--ink-2)}

/* linked accounts rows */
.acctrow{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:9px 0;border-bottom:1px solid var(--grid)}
.acctrow:last-of-type{border-bottom:0}
.acctrow .who b{display:block;font-size:13.5px;line-height:1.3}
.acctrow .who small{display:block;font-size:12px;color:var(--muted)}
.acctrow .rm,table.list .rm{flex-shrink:0;color:var(--bad);font-size:12.5px;font-weight:700}
.acctrow .rm:hover,table.list .rm:hover{color:#8E1B17;text-decoration:underline}
.acctrow .rs{flex-shrink:0;color:var(--brand);font-size:12.5px;font-weight:700}
.acctrow .rs:hover{text-decoration:underline}
.badge-view{flex-shrink:0;background:#EFF6EF;border:1px solid #CBE0CB;color:var(--ok);border-radius:12px;padding:2px 10px;font-size:11px;font-weight:800;letter-spacing:.04em;text-transform:uppercase}

/* account switcher (select styled as the chip) */
select.acct{appearance:auto;max-width:260px;padding-right:10px}

/* ---- staff-posted dashboard notices ---- */
.notices{display:flex;flex-direction:column;gap:8px;margin-top:12px}
.notice{display:flex;gap:11px;align-items:flex-start;background:var(--surface);border:1px solid var(--border);border-left:4px solid var(--d4);border-radius:12px;padding:12px 16px;box-shadow:var(--shadow)}
.notice.alert{border-left-color:var(--bad);background:#FBF1F0;border-color:#EAC8C5}
.notice.promo{border-left-color:var(--accent);background:#FFF6E2;border-color:#EFDFB4}
.notice .ico{font-size:16px;line-height:1.35;flex-shrink:0}
.notice b{display:block;font-size:13.5px;margin-bottom:1px}
.notice p{font-size:13px;color:var(--ink-2);margin:0}

/* ---- "how does this work?" inline help ---- */
.help{position:relative;display:inline-block;margin-left:5px;vertical-align:middle}
.helpbtn{width:16px;height:16px;padding:0;border:1px solid var(--border);background:var(--page);color:var(--ink-2);border-radius:50%;font:700 11px/1 "Work Sans",sans-serif;cursor:pointer}
.helpbtn:hover{border-color:var(--d4);color:var(--d4)}
.helptext{display:none;position:absolute;left:0;top:22px;z-index:30;width:250px;background:var(--surface);border:1px solid var(--border);border-radius:10px;box-shadow:0 6px 20px rgba(35,56,43,.16);padding:10px 12px;font-size:12.5px;font-weight:400;line-height:1.45;color:var(--ink-2)}
.help.on .helptext{display:block}

/* =========================================================================
   MOBILE (<= 860px). Phones are the primary client, so this is a first-class
   layout, not a squeeze: bottom tab bar for the four everyday destinations,
   "More" sheet for the rest, single-column cards, 16px inputs (iOS zooms on
   anything smaller), thumb-sized buttons, and help bubbles docked above the
   tab bar instead of floating off the right edge.
   ========================================================================= */
@media(max-width:860px){
  .topbar{gap:10px;padding:0 14px;height:56px;position:sticky;top:0;z-index:20}
  .topbar .seal{width:30px;height:30px}
  .logotype{font-size:13px}
  .logotype small{font-size:9.5px;letter-spacing:.12em}
  .topnav,.signout,.avatar{display:none}
  .acct{max-width:46vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:7px 12px}
  select.acct{max-width:46vw}

  .wrap{padding:14px 12px calc(84px + env(safe-area-inset-bottom))}
  .hello{font-size:20px;margin:4px 2px 6px}
  .insights,.cards2,.twocol{grid-template-columns:1fr;gap:12px;margin-top:12px}
  .card{padding:16px 16px;border-radius:14px}
  .chart-card{margin-top:12px;scroll-margin-top:64px} /* sticky topbar */
  .chartnav{width:100%;margin:0;justify-content:space-between;gap:4px} /* own full-width row right under the title, never staggered */
  .chartnav .range{font-size:13px;min-width:0;flex:1}
  .chartnav .btn{padding:8px 10px}
  .chart-head h2{font-size:14px;flex:1 1 100%}

  /* outage statusline wraps: status on line one, time + link on line two */
  .statusline{flex-wrap:wrap;padding:10px 14px}
  .statusline .dot{flex-shrink:0}
  .statusline > span:nth-child(2){flex:1 1 0;min-width:0}
  .statusline .when{flex-basis:100%;margin-left:18px;font-size:12.5px}

  /* chart header: title, then the Day/Month/Year switch full width */
  .chart-head{flex-wrap:wrap;gap:8px}
  .chart-head h2{font-size:15px;flex:1 1 200px;min-width:0} /* day-view arrows stay on the title row; the Day/Month/Year switch wraps below */
  .chips input[type=date]{flex:1 1 150px}
  .tabs{margin-left:0;width:100%;display:grid;grid-template-columns:1fr 1fr 1fr;text-align:center}
  .tabs a{padding:9px 0}
  .chips{gap:5px}
  .chips a{flex:1 1 auto;text-align:center;white-space:nowrap;padding:8px 6px;font-size:12px} /* four year chips (incl. Vs Last Year) fit one row at 360px */
  .chips form{flex-wrap:wrap}
  .chart-legend{flex-wrap:wrap;gap:6px 16px}
  .statsrow{display:grid;grid-template-columns:1fr 1fr;gap:12px 8px}
  .statsrow b{font-size:14px}
  .donut-wrap{justify-content:center}

  /* buttons and forms: full-width thumb targets, no iOS focus zoom */
  .actions{gap:8px}
  .actions .btn{flex:1 1 auto;text-align:center;padding:12px 16px}
  .btn{padding:11px 18px}
  .formcard{max-width:none}
  .authhead{gap:12px}
  .authhead img{width:48px;height:auto}
  .actions.auth{flex-direction:column;align-items:stretch}
  .actions.auth .btn{width:100%}
  .authlink{margin:6px 0 0;text-align:center;font-size:14px}
  .frow input[type=text],.frow input[type=password],.frow input[type=email],.frow input[type=date],.frow input[type=time],.frow input[type=number],.frow select,.frow textarea,.chips input[type=date]{font-size:16px}
  .frow select,.frow input[type=date]{min-height:44px}
  select.acct{font-size:13px}

  /* list tables collapse to stacked rows (home events) */
  table.list,table.list tbody,table.list tr,table.list td{display:block}
  table.list tr:first-child{display:none}
  table.list tr{padding:10px 0;border-bottom:1px solid var(--grid)}
  table.list td{padding:1px 0;border:0}
  table.list td:first-child{font-size:12.5px;color:var(--muted)}

  /* help bubble docks above the tab bar, full width */
  .helptext{position:fixed;left:12px;right:12px;top:auto;bottom:calc(72px + env(safe-area-inset-bottom));width:auto;padding:14px 16px;font-size:14px}

  /* chart tooltip: touch places it above the bar, so let it wrap */
  .tip{white-space:normal;max-width:220px;font-size:12px;padding:6px 9px}

  /* ---- bottom tab bar ---- */
  .tabbar{position:fixed;left:0;right:0;bottom:0;z-index:30;display:grid;grid-template-columns:repeat(5,1fr);
    background:var(--surface);border-top:1px solid var(--border);padding:6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow:0 -4px 16px rgba(35,56,43,.06)}
  .tabbar a,.tabbar button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-height:48px;
    border:0;background:none;padding:0;color:var(--ink-2);font:700 10.5px "Work Sans",sans-serif;letter-spacing:.02em;cursor:pointer;border-radius:10px;-webkit-tap-highlight-color:transparent}
  .tabbar svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
  .tabbar .on{color:var(--brand-deep);font-weight:800}
  .tabbar .on svg{stroke-width:2.6}
  .tabbar .on svg{fill:var(--accent);stroke:var(--brand-deep)} /* one active fill for every tab: red on Alerts would read as an alarm */

  /* ---- "More" sheet ---- */
  .sheet{display:block;position:fixed;inset:0;z-index:25} /* under the tab bar so More stays tappable as a toggle */
  .sheet[hidden]{display:none}
  .sheet-bg{position:absolute;inset:0;background:rgba(35,56,43,.35)}
  .sheet-panel{position:absolute;left:0;right:0;bottom:0;background:var(--surface);border-radius:18px 18px 0 0;
    padding:8px 8px calc(74px + env(safe-area-inset-bottom));box-shadow:0 -8px 30px rgba(35,56,43,.18)}
  .sheet-grip{width:38px;height:4px;border-radius:2px;background:var(--border);margin:4px auto 10px}
  .sheet-panel a{display:block;padding:14px 16px;border-radius:12px;color:var(--ink);font-size:16px;font-weight:700}
  .sheet-panel a small{display:block;font-size:12.5px;font-weight:500;color:var(--ink-2);margin-top:1px}
  .sheet-panel a.on{background:#E9EFE9;color:var(--brand-deep)}
  .sheet-panel a:last-child{color:var(--bad);border-top:1px solid var(--grid);border-radius:0 0 12px 12px;margin-top:4px}
  body.sheet-open{overflow:hidden}
}
@media(max-width:400px){
  .logotype{font-size:12px}
  .acct{max-width:40vw}
}

/* ---- day view: compare-with-date control ---- */
.cmpform{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.cmpform .btn{padding:6px 14px;font-size:12.5px}
.datewrap{position:relative;display:inline-flex;align-items:center;gap:7px;border:1px solid var(--border);background:var(--surface);border-radius:16px;padding:5px 12px;font-size:12.5px;font-weight:700;color:var(--brand);cursor:pointer;min-height:32px}
.datewrap svg{width:15px;height:15px;flex-shrink:0;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.datewrap input{border:0;background:transparent;font:600 13px "Work Sans","Segoe UI",sans-serif;color:var(--ink);padding:0;margin:0;min-width:0;-webkit-appearance:none;appearance:none;cursor:pointer}
.datewrap .hint{display:none;color:var(--ink-2);font-weight:600}
.datewrap.empty .hint{display:inline}
.datewrap.empty input{position:absolute;inset:0;width:100%;height:100%;opacity:0}
.datewrap input{width:7.6em}
.datewrap input::-webkit-calendar-picker-indicator{display:none} /* chip already carries the calendar icon */
@media(max-width:860px){
  .cmpform{flex-wrap:nowrap;gap:6px}
  .datewrap{flex:1 1 auto;min-width:0;padding:8px 10px;font-size:12px;min-height:40px}
  .datewrap .lbl{white-space:nowrap}
  .datewrap input{font-size:14px;flex:1}
  .datewrap:not(.empty) .lbl{display:none} /* once a date is set the icon + date is the label; keeps Compare/Clear on the same row */
  .cmpform .btn{flex:0 0 auto;padding:8px 12px;font-size:12px}
}

/* ---- staff view-as (read-only) ---- */
.viewasbar{position:sticky;top:0;z-index:60;display:flex;align-items:center;justify-content:space-between;gap:12px;background:var(--accent);color:var(--brand-deep);padding:8px 20px;font-size:13.5px;border-bottom:1px solid #D99400}
.viewasbar .btn{padding:5px 14px;font-size:12.5px;background:var(--brand-deep);border-color:var(--brand-deep);color:#fff;flex-shrink:0}
body.viewas form:not(.cmpform) button[type=submit],body.viewas form:not(.cmpform) input[type=submit],body.viewas a.rm,body.viewas .acctrow .rm{opacity:.4;pointer-events:none}
@media(max-width:860px){.viewasbar{padding:8px 12px;font-size:12.5px}.viewasbar+.topbar{top:auto;position:static}}
