html,body { margin:0; font-family: system-ui, Arial, sans-serif; }
h1 { color: #0ea5e9; margin-bottom: 8px; }
header { padding: 16px; border-bottom: 1px solid #eee; }
nav { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
button { cursor: pointer; }
main { max-width: 780px; margin: 0 auto; padding: 16px; }
.tab.hidden { display: none; }
label { display: block; margin: 8px 0; }
.card { background:#fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; margin-top: 12px; }
.status { color: #059669; }
.status.ok { color: #1a7f37; }
.status.fail { color: #d1242f; }
.note { font-size: 12px; color: #6b7280; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background:#111827; color:#fff; padding:10px 14px; border-radius:8px; opacity:0.95; }
.hint { color:#6b7280; font-size:12px; margin-top:6px; }
.footer { margin-top: 24px; font-size: 12px; color: #6b7280; text-align:center; }
table { border-collapse: collapse; width: 100%; margin-top: 12px; }
th, td { border-bottom: 1px solid #eee; padding: 6px; text-align: left; }
.just-saved { background: #ecfdf5; }
.just-saved td { transition: background-color 600ms ease; }
@keyframes pulseRow { 0%{background:#d1fae5;} 100%{background:#ecfdf5;} }
.just-saved { animation: pulseRow 1200ms ease 2; }

.update-banner {
  position: sticky; top: 0; z-index: 50; display:flex; justify-content: space-between; align-items:center;
  padding: 8px 12px; background:#fde68a; color:#78350f; border-bottom:1px solid #f59e0b;
}
.update-banner button { background:#111827; color:#fff; border:none; border-radius:6px; padding:6px 10px; }
.controls button#demo-add-1,
.controls button#demo-add-10,
.controls button#demo-add-30 { background:#e5e7eb; border:1px solid #d1d5db; border-radius:6px; padding:6px 10px; }

.controls { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-bottom:10px; }
.summary { display:flex; gap:16px; margin:8px 0; font-size:14px; color:#374151; }
.import-label input { display:inline-block; }
.badge { display:inline-block; padding:2px 8px; border-radius:9999px; font-size:12px; margin-right:6px; }
.badge.visual-clear { background:#e0f2fe; color:#0369a1; }
.badge.visual-slightly_cloudy { background:#fef3c7; color:#92400e; }
.badge.visual-cloudy { background:#fee2e2; color:#991b1b; }
.badge.visual-green { background:#dcfce7; color:#166534; }
.badge.visual-mustard_algae { background:#fde68a; color:#92400e; }
.badge.action { background:#eef2ff; color:#3730a3; }
.badge.chem { background:#f1f5f9; color:#0f172a; }
tr.expand + tr.details td { background:#f9fafb; }
tr.details td { padding:10px; }
.row-actions { display:flex; gap:6px; }
.just-saved { background:#ecfdf5; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background:#111827; color:#fff; padding:10px 14px; border-radius:8px; opacity:0.95; }
.status { color:#059669; }
canvas#spark { width:100%; height:120px; }

/* New UI styles for refactored interface */
.chip {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid #d1d5db;
  border-radius: 9999px;
  background: #ffffff;
  color: #374151;
  font-size: 14px;
  cursor: pointer;
  transition: all 150ms;
}

.chip:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.chip.active {
  background: #0ea5e9;
  color: #ffffff;
  border-color: #0ea5e9;
}

.health-banner {
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.health-banner.ok {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #10b981;
}

.health-banner.warn {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
}
@media (min-width:768px){ canvas#spark { height:140px; } }

.pager { display:flex; align-items:center; gap:8px; }
.danger { background:#fee2e2; border:1px solid #fecaca; border-radius:6px; padding:6px 10px; }
.danger:hover { background:#fecaca; }

#sync-ind{margin-left:8px;font-size:12px}
#account-status{margin-left:8px;font-size:12px;color:#6b7280}
#version-badge{margin-left:8px;font-size:12px;color:#6b7280}
.modal.hidden { display:none; }
.modal { position:fixed; inset:0; background:rgba(0,0,0,0.4); display:flex; align-items:center; justify-content:center; }
.modal-card { background:#fff; padding:16px; border-radius:8px; width:min(92vw, 420px); box-shadow:0 10px 30px rgba(0,0,0,0.2); }
.modal-actions { display:flex; justify-content:flex-end; margin-top:12px; }
.about-body div { margin:6px 0; }

.banner { margin:8px 0; padding:8px 10px; border-radius:6px; font-size:14px }
.banner.warn { background:#fff7ed; border:1px solid #fed7aa; color:#7c2d12 }
.banner.ok { background:#ecfdf5; border:1px solid #bbf7d0; color:#065f46 }

.muted{ color:#6b7280; font-size:12px; margin-left:8px }
.hidden{ display:none }

:root{
  --bg: #0ea5e9;        /* header background */
  --bg-dark: #0284c7;
  --fg: #ffffff;        /* header text/icons */
  --txt: #111827;       /* main text */
  --muted: #6b7280;
  --pill: #e5e7eb;
  --active: #ffffff;
  --active-underline: rgba(255,255,255,0.75);
  --ok: #189c3f;
  --warn: #d49700;
  --error: #cc2a2a;
  --card: #ffffff;
}

body{ background:#f7f7f8; color: var(--txt); }

.app-header{
  position: sticky; top: 0; z-index: 1000;
  background: var(--bg); color: var(--fg);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.nav-wrap{
  max-width: 1080px; margin: 0 auto;
  display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; gap: 12px;
  padding: 10px 12px;
}

.brand{ display: flex; align-items: center; gap: 10px; }
.app-title{ font-weight: 700; font-size: 20px; letter-spacing: 0.2px; }

.icon-btn{
  background: transparent; border: 0; color: var(--fg);
  font-size: 22px; line-height: 1; padding: 6px 8px; border-radius: 6px;
}
.icon-btn:focus-visible{ outline: 2px solid var(--active); }

.menu{ display: flex; gap: 8px; flex-wrap: wrap; }
.nav-btn{
  background: transparent; color: var(--fg); border: 0; padding: 8px 10px;
  border-radius: 6px; font-weight: 600; cursor: pointer;
}
.nav-btn:hover{ background: var(--bg-dark); }
.nav-btn[aria-current="page"]{
  border-bottom: 2px solid var(--active-underline);
}

.status{ display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: end; }
.badge{ background: rgba(255,255,255,0.2); color: var(--fg); padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.pill{ background: var(--pill); border: 0; padding: 6px 10px; border-radius: 999px; font-weight: 600; cursor: pointer; }
.pill:hover{ filter: brightness(0.95); }

.muted{ color: #e5f6ff; font-size: 12px; }
.hidden{ display: none !important; }

/* Mobile: collapse menu under hamburger */
@media (max-width: 820px){
  .nav-wrap{ grid-template-columns: 1fr auto; grid-template-areas:
    "brand status"
    "menu  menu";
  }
  .brand{ grid-area: brand; }
  .status{ grid-area: status; justify-content: end; }
  .menu{ grid-area: menu; display: none; padding: 8px 0; }
  .menu.open{ display: flex; border-top: 1px solid rgba(255,255,255,0.2); }
}

main{ max-width: 1080px; margin: 12px auto; padding: 0 12px; }

/* Tab content utility */
.tab{ display: none; }
.tab.active{ display: block; }

header.toolbar { margin-bottom: 16px; }
header.toolbar button { margin-right: 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.card__head { display: flex; justify-content: space-between; align-items: center; }
.badge--ok { background: var(--ok); }
.badge--warn { background: var(--warn); }
.badge--error { background: var(--error); }
.cards .summary { color: #374151; margin: 6px 0 8px; }
.cards .more { font-size: .85rem; color: #2563eb; cursor: pointer; }
.cards .details { display: none; border-top: 1px dashed #e5e7eb; margin-top: 8px; padding-top: 8px; }
.cards .details.open { display: block; }
.cards .details pre { max-height: 180px; overflow: auto; background: #0b1020; color: #e5e7eb; padding: 8px; border-radius: 8px; }
.card.flash { box-shadow: 0 0 0 3px var(--warn); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; }
.modal__content { background: var(--card); padding: 16px; border-radius: 8px; max-width: 90%; max-height: 90%; overflow: auto; }
#modal-close { float: right; }
.badge-ok { background: #e6ffed; color: #057a55; border: 1px solid #b5f5c9; }
.badge-warn { background: #fff8e1; color: #8a6d3b; border: 1px solid #ffe8a1; }
.badge-err { background: #ffe6e6; color: #8a1f1f; border: 1px solid #ffb3b3; }
.badge-run { background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; }

.health-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.card-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; }
.card-title { font-weight:600; }
.card-desc { font-size: 12px; color: #555; margin-bottom: 8px; }
.card-details { font-size: 13px; color: #111; }

.more { margin-top:8px; }
.link-more { background:none; border:none; color:#2563eb; cursor:pointer; padding:0; font-size:13px; }
.more-body { display:none; border-top:1px dashed #ddd; margin-top:6px; padding-top:6px; }
.more.open .more-body { display:block; }
.more-body pre { margin:0; white-space:pre-wrap; word-break:break-word; font-size:12px; }
