:root{
  --brand:#285E4F;
  --bg:#f5f6f8;
  --card:#ffffff;

  --text:#0b0f17;
  --muted:#6b7280;
  --line:rgba(15, 23, 42, .10);

  --ok-bg:rgba(16,185,129,.12);
  --ok-text:#047857;

  --bad-bg:rgba(244,63,94,.12);
  --bad-text:#9f1239;

  --due-bg:rgba(99,102,241,.14);
  --due-text:#3730a3;

  --soon-bg:rgba(59,130,246,.14);
  --soon-text:#1d4ed8;

  --over-bg:rgba(245,158,11,.16);
  --over-text:#9a3412;

  --shadow: 0 10px 28px rgba(2,6,23,.07);
  --shadow-press: 0 16px 34px rgba(2,6,23,.10);
}

*{box-sizing:border-box;}
html,body{height:100%;}
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

.app{min-height:100%;display:flex;flex-direction:column;}

.topbar{
  padding:14px max(14px, env(safe-area-inset-left)) 12px max(14px, env(safe-area-inset-right));
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  background:rgba(255,255,255,.78);
  backdrop-filter:saturate(1.2) blur(16px);
  border-bottom:1px solid rgba(15, 23, 42, .08);
  position:sticky;top:0;z-index:10;
}

.brand{display:flex;align-items:center;gap:12px;}
.tick{
  width:44px;height:44px;border-radius:16px;
  background:var(--brand);color:white;display:grid;place-items:center;
  font-weight:900;font-size:24px;
  box-shadow: 0 14px 26px rgba(40,94,79,.20);
}
.brand-title{font-weight:900;letter-spacing:.01em;}
.brand-subtitle{color:var(--muted);font-size:12px;margin-top:2px;}

.status{display:flex;align-items:center;gap:8px;color:var(--muted);font-size:12px;font-weight:800;}
.dot{width:10px;height:10px;border-radius:999px;background:#22c55e;box-shadow:0 0 0 4px rgba(34,197,94,.12);}

.main{
  flex:1;
  padding:16px max(14px, env(safe-area-inset-left)) 18px max(14px, env(safe-area-inset-right));
  max-width:880px;width:100%;margin:0 auto;
}

.screen{animation:fadeIn .12s ease-out;}
@keyframes fadeIn{from{opacity:.7; transform:translateY(3px)} to{opacity:1; transform:translateY(0)}}
.hidden{display:none !important;}

.screen-title-row{display:flex;align-items:center;justify-content:space-between;gap:12px;}
.screen-title{
  margin:14px 0 12px;
  font-size:26px;
  font-weight:900;
  letter-spacing:-.02em;
}

.btn-ghost{
  border:1px solid rgba(15,23,42,.10);
  background:rgba(255,255,255,.8);
  color:rgba(15,23,42,.65);
  border-radius:999px;
  padding:10px 14px;
  font-weight:900;
}

.tile-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:14px;
  margin-top:10px;
}

.tile{
  background:var(--card);
  border:1px solid rgba(15,23,42,.10);
  border-radius:22px;
  padding:14px 14px 12px;
  min-height:124px;
  touch-action:manipulation;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
  box-shadow: var(--shadow);
  text-align:left;
}

.tile:hover{ border-color: rgba(15,23,42,.16); }
.tile:active{
  transform:scale(.985);
  box-shadow: var(--shadow-press);
}

.tile.pulse{ animation: tilePulse .65s ease-out 1; }
@keyframes tilePulse{
  0%{ box-shadow: var(--shadow); }
  35%{ box-shadow: 0 0 0 10px rgba(40,94,79,.12), var(--shadow); }
  100%{ box-shadow: var(--shadow); }
}

.tile-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}

.tile-left{
  display:flex;
  align-items:flex-start;
  gap:10px;
  min-width:0;
}

.tile-icon{
  width:30px;height:30px;border-radius:12px;
  background:rgba(15,23,42,.04);
  border:1px solid rgba(15,23,42,.07);
  display:grid;place-items:center;
  flex:0 0 auto;
}
.tile-icon svg{
  width:18px;height:18px;
  stroke:rgba(15,23,42,.55);
  stroke-width:2;
  fill:none;
}

.tile-title{
  font-weight:900;
  font-size:16px;
  line-height:1.15;
  letter-spacing:-.01em;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.tile-type{
  font-size:12px;
  color:var(--muted);
  font-weight:800;
  margin-top:4px;
}

.badge{
  font-size:12px;
  font-weight:900;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(15,23,42,.10);
  min-width:74px;
  text-align:center;
  background:rgba(15,23,42,.03);
  color:rgba(15,23,42,.70);
  flex:0 0 auto;
  line-height:1.1;
}

.badge.ok{background:var(--ok-bg);color:var(--ok-text);border-color:rgba(16,185,129,.22);}
.badge.bad{background:var(--bad-bg);color:var(--bad-text);border-color:rgba(244,63,94,.22);}
.badge.due{background:var(--due-bg);color:var(--due-text);border-color:rgba(99,102,241,.22);}
.badge.soon{background:var(--soon-bg);color:var(--soon-text);border-color:rgba(59,130,246,.22);}
.badge.over{background:var(--over-bg);color:var(--over-text);border-color:rgba(245,158,11,.22);}
.badge.new{background:rgba(255,255,255,.9);color:rgba(15,23,42,.75);border-color:rgba(15,23,42,.10);}

.tile-bottom{
  margin-top:14px;
  display:flex;
  flex-direction:column;
  gap:6px;
}

.tile-last{
  font-size:12px;
  color:rgba(15,23,42,.55);
  font-weight:800;
}

.tile-due{
  font-size:13px;
  font-weight:900;
  color:rgba(15,23,42,.82);
  letter-spacing:-.01em;
}

.tagline{
  text-align:center;
  color:rgba(15,23,42,.45);
  font-weight:900;
  margin:18px 0 6px;
  letter-spacing:.10em;
}

/* Screens */
.screen-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:6px;}
.screen-head.compact{margin-top:0;}
.btn-icon{
  width:46px;height:46px;border-radius:18px;border:1px solid rgba(15,23,42,.10);
  background:rgba(255,255,255,.85);
  font-size:18px;font-weight:900;
  box-shadow: 0 10px 22px rgba(2,6,23,.08);
}
.btn-icon:active{transform:scale(.99);}

.screen-head-center{flex:1;display:flex;flex-direction:column;align-items:center;gap:8px;}
.asset-title-row{display:flex;align-items:center;gap:10px;}
.asset-icon{
  width:28px;height:28px;border-radius:12px;
  background:rgba(15,23,42,.04);
  border:1px solid rgba(15,23,42,.07);
  display:grid;place-items:center;
}
.asset-icon svg{width:18px;height:18px;stroke:rgba(15,23,42,.55);stroke-width:2;fill:none;}
.asset-title{font-weight:900;font-size:18px;letter-spacing:-.01em;}

.pill{
  display:inline-flex;align-items:center;gap:6px;
  padding:8px 12px;border-radius:999px;border:1px solid rgba(15,23,42,.10);
  background:rgba(255,255,255,.8);
  color:rgba(15,23,42,.55);
  font-weight:900;font-size:12px;
}

/* Temp input: tighten */
.temp-display-wrap{margin:12px 0 10px;}
.temp-display{
  background:rgba(255,255,255,.95);
  border:1px solid rgba(15,23,42,.10);
  border-radius:22px;
  padding:12px 12px;
  font-weight:950;
  font-size:46px;
  text-align:center;
  letter-spacing:-.03em;
  box-shadow: var(--shadow);
}
.temp-display.ok{border-color:rgba(16,185,129,.28);background:var(--ok-bg);color:var(--ok-text);}
.temp-display.bad{border-color:rgba(244,63,94,.28);background:var(--bad-bg);color:var(--bad-text);}
.temp-display.neutral{color:var(--text);}

.temp-mini-actions{display:flex;justify-content:center;gap:10px;margin-top:10px;}
.btn-mini{
  width:64px;height:40px;border-radius:16px;border:1px solid rgba(15,23,42,.10);
  background:rgba(255,255,255,.85);color:rgba(15,23,42,.62);
  font-weight:950;font-size:18px;
  box-shadow:0 10px 20px rgba(2,6,23,.07);
}
.btn-mini:active{transform:scale(.99);}

.temp-hint{margin-top:10px;text-align:center;color:rgba(15,23,42,.55);font-weight:900;min-height:18px;}

.keypad{margin-top:8px;}
.keys{display:grid;grid-template-columns:repeat(3, minmax(0,1fr));gap:10px;}
.key{
  height:56px;
  border-radius:22px;
  border:1px solid rgba(15,23,42,.10);
  background:rgba(255,255,255,.92);
  font-size:20px;
  font-weight:950;
  box-shadow:0 10px 20px rgba(2,6,23,.07);
}
.key:active{transform:scale(.99);}

.actions{display:flex;gap:10px;margin-top:10px;}
.btn-primary{
  flex:1;height:60px;border-radius:22px;border:0;background:var(--brand);color:white;
  font-weight:950;font-size:18px;box-shadow:0 16px 26px rgba(40,94,79,.20);
}
.btn-primary:active{transform:scale(.99);}

.btn-secondary{
  height:56px;border-radius:20px;border:1px solid rgba(15,23,42,.10);
  background:rgba(255,255,255,.85);
  color:rgba(15,23,42,.62);
  font-weight:950;font-size:16px;padding:0 18px;
}

/* Simple page */
.simple-panel{
  margin-top:14px;
  background:rgba(255,255,255,.92);
  border:1px solid rgba(15,23,42,.10);
  border-radius:22px;
  padding:14px;
  box-shadow: var(--shadow);
  display:flex;
  flex-direction:column;
  gap:12px;
}
.big{height:70px;font-size:20px;border-radius:22px;}

.btn-warn{
  height:70px;border-radius:22px;border:1px solid rgba(245,158,11,.28);
  background:rgba(245,158,11,.12);color:var(--over-text);
  font-weight:950;font-size:20px;
  box-shadow:0 14px 22px rgba(245,158,11,.12);
}
.simple-footnote{text-align:center;color:rgba(15,23,42,.48);font-weight:900;font-size:12px;padding-top:2px;}

/* Overlay / toast / admin */
.overlay{position:fixed;inset:0;background:rgba(2,6,23,.55);display:grid;place-items:center;z-index:50;}
.overlay-card{
  width:min(420px, 90vw);
  background:white;border-radius:30px;padding:26px 22px;text-align:center;
  box-shadow:0 30px 70px rgba(2,6,23,.35);
}
.overlay-tick{
  width:90px;height:90px;border-radius:30px;background:var(--brand);color:white;
  display:grid;place-items:center;font-size:46px;font-weight:1000;margin:0 auto 14px;
  animation:pop .18s ease-out;
}
@keyframes pop{from{transform:scale(.92)} to{transform:scale(1)}}
.overlay-title{font-weight:1000;font-size:22px;}
.overlay-sub{margin-top:8px;color:rgba(15,23,42,.55);font-weight:900;font-size:13px;}

.toast{
  position:fixed;left:50%;bottom:18px;transform:translateX(-50%);
  background:#0f172a;color:white;padding:12px 14px;border-radius:999px;font-weight:900;font-size:13px;
  box-shadow:0 18px 35px rgba(2,6,23,.35);z-index:60;max-width:min(560px, 92vw);
  text-align:center;
}

.admin-actions{margin:14px 0 10px;}
.log-list{display:flex;flex-direction:column;gap:10px;margin-top:10px;}
.log-item{
  background:rgba(255,255,255,.92);
  border:1px solid rgba(15,23,42,.10);
  border-radius:20px;
  padding:12px;
  display:flex;justify-content:space-between;gap:12px;
  box-shadow: var(--shadow);
}
.log-left{display:flex;flex-direction:column;gap:4px;}
.log-asset{font-weight:950;}
.log-meta{color:rgba(15,23,42,.55);font-weight:900;font-size:12px;}
.log-right{display:flex;flex-direction:column;align-items:flex-end;gap:6px;}

/* Tablet / mounted */
@media (min-width: 900px) {
  .tile-grid{grid-template-columns:repeat(3, minmax(0,1fr));}
  .tile{min-height:132px;}
}


/* --- V7 F2T Precision Pass --- */

.tile-grid{
  grid-template-columns: 1fr !important;
  gap:18px;
}

@media (min-width: 768px){
  .tile-grid{
    grid-template-columns: repeat(2, minmax(0,1fr)) !important;
  }
}
@media (min-width: 1100px){
  .tile-grid{
    grid-template-columns: repeat(3, minmax(0,1fr)) !important;
  }
}

.tile{
  border-radius:18px;
  padding:16px 16px 14px;
  box-shadow: 0 6px 18px rgba(2,6,23,.06);
}

.tile-top{
  flex-direction:column;
  align-items:flex-start;
  gap:12px;
}

.badge{
  align-self:flex-start;
  min-width:unset;
  padding:6px 12px;
  font-size:11px;
  letter-spacing:.04em;
}

.tile-title{
  font-weight:950;
  font-size:17px;
}

.tile-type{
  font-size:12px;
  opacity:.65;
}

.tile-last{
  opacity:.6;
  font-weight:800;
}

.tile-due{
  font-weight:950;
  font-size:14px;
}

.badge.due{
  background:rgba(99,102,241,.10);
}
.badge.soon{
  background:rgba(59,130,246,.10);
}
.badge.over{
  background:rgba(245,158,11,.12);
}
.badge.bad{
  background:rgba(244,63,94,.10);
}


/* V8: simple actions stack + subtle overdue transition */
.simple-actions{display:flex;flex-direction:column;gap:12px;}
.simple-divider{height:1px;background:rgba(15,23,42,.10);margin:4px 0 2px;}
.simple-label{font-size:12px;font-weight:900;letter-spacing:.10em;opacity:.55;margin-top:2px;}

.tile.overdue-transition{animation: overdueGlow 1.2s ease-out 1;}
@keyframes overdueGlow{
  0%{ box-shadow: 0 0 0 rgba(245,158,11,0), var(--shadow); }
  40%{ box-shadow: 0 0 0 10px rgba(245,158,11,.12), var(--shadow); }
  100%{ box-shadow: 0 0 0 rgba(245,158,11,0), var(--shadow); }
}


/* V9: unify simple button heights */
.simple-actions .big {
  height: 68px !important;
}



/* V10: unify DONE + issue button heights precisely */
.simple-actions button.big{
  height: 74px !important;
}
.simple-actions .btn-primary.big{
  height: 74px !important;
}


/* V11: make primary + secondary big buttons identical height and baseline */
.simple-actions .btn-primary.big,
.simple-actions .btn-secondary.big{
  height: 74px !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
}


/* V12: ensure DONE doesn't look thinner (force big typography + radius consistency) */
.simple-actions .btn-primary.big,
.simple-actions .btn-secondary.big{
  height: 74px !important;
  font-size: 20px !important;
  border-radius: 22px !important;
  letter-spacing: .02em !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  line-height: 1.15 !important;
}


/* V13: belt-and-braces sizing for simple action buttons */
.simple-actions .btn-primary.big,
.simple-actions .btn-secondary.big{
  height: 74px !important;
  min-height: 74px !important;
}


/* V14: fixed grouping + jump chips */
.jump-bar{
  display:flex;
  gap:10px;
  overflow:auto;
  padding:6px 2px 10px;
  -webkit-overflow-scrolling: touch;
}
.jump-chip{
  flex:0 0 auto;
  border:1px solid rgba(15,23,42,.10);
  background:rgba(255,255,255,.78);
  color:rgba(15,23,42,.70);
  border-radius:999px;
  padding:10px 12px;
  font-weight:900;
  font-size:12px;
  letter-spacing:.02em;
  box-shadow: 0 8px 18px rgba(2,6,23,.06);
}
.jump-chip:active{ transform:scale(.98); }

.sections{
  display:flex;
  flex-direction:column;
  gap:18px;
}

.section{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.section-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:8px 2px 2px;
  position:sticky;
  top:76px;
  background: linear-gradient(to bottom, rgba(245,246,248, .98), rgba(245,246,248, .70));
  backdrop-filter: blur(10px);
  z-index:4;
}
.section-title{
  font-weight:1000;
  font-size:12px;
  letter-spacing:.14em;
  color:rgba(15,23,42,.55);
}
.section-meta{
  font-weight:900;
  font-size:12px;
  color:rgba(15,23,42,.45);
}

.section-grid{
  display:grid;
  grid-template-columns: 1fr;
  gap:18px;
}

@media (min-width: 768px){
  .section-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (min-width: 1100px){
  .section-grid{ grid-template-columns: repeat(3, minmax(0,1fr)); }
}

/* neutralize old tile-grid layout since we now render sections inside it */
#tileGrid.tile-grid{
  grid-template-columns: 1fr !important;
  gap:0 !important;
}


/* V15: jump-to fix — keep target section below sticky header */
.section{
  scroll-margin-top: 120px; /* accounts for top bar + jump chips + sticky header */
}

/* --- Setup Wizard (Solo) --- */
.setup-input{
  width:100%;
  height:52px;
  border-radius:18px;
  border:1px solid rgba(15,23,42,.12);
  background:rgba(255,255,255,.92);
  padding:0 14px;
  font-weight:900;
  font-size:16px;
  outline:none;
  box-shadow: 0 10px 20px rgba(2,6,23,.06);
}

.setup-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:6px 2px;
}

.setup-label{
  font-weight:900;
  color:rgba(15,23,42,.72);
}

.setup-stepper{display:flex;align-items:center;gap:10px;}
.setup-step{
  width:44px;height:44px;border-radius:16px;
  border:1px solid rgba(15,23,42,.10);
  background:rgba(255,255,255,.85);
  font-weight:1000;font-size:20px;
  box-shadow:0 10px 20px rgba(2,6,23,.07);
}
.setup-step:active{transform:scale(.99);}

.setup-count{
  width:34px;
  text-align:center;
  font-weight:1000;
  color:rgba(15,23,42,.70);
}

.setup-time{
  height:44px;
  border-radius:16px;
  border:1px solid rgba(15,23,42,.10);
  background:rgba(255,255,255,.92);
  padding:0 12px;
  font-weight:950;
}
