/* Layout */
.app { background: var(--bg); color: var(--text); min-height: 100dvh; display: flex; flex-direction: column; }
.header { background: var(--header-bg); color: var(--header-text); padding: 12px 16px; display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 100; }
.header h1 { font-family: var(--display); font-size: 20px; letter-spacing: 1px; }
.main { flex: 1; padding: 16px; max-width: 860px; margin: 0 auto; width: 100%; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

/* Tab bar */
.tab-bar { position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--border); display: flex; justify-content: space-around; padding-bottom: env(safe-area-inset-bottom); z-index: 100; }
.tab-bar button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; min-height: var(--tap-min); min-width: var(--tap-min); font-size: 10px; color: var(--text-muted); transition: color 0.15s; }
.tab-bar button.active { color: var(--brand); }
.tab-bar button svg { width: 22px; height: 22px; }

/* Bottom sheet */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-radius: var(--r) var(--r) 0 0; z-index: 201; transform: translateY(100%); transition: transform 0.3s ease-out; max-height: 90vh; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom); }
.sheet.open { transform: translateY(0); }
.sheet-header { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--border); }
.sheet-body { padding: 16px; }

/* Tiles (KPI cards) */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 12px; }
.tile .label { font-size: 12px; color: var(--text-muted); }
.tile .value { font-family: var(--mono); font-size: 20px; font-weight: 600; }

/* Chips */
.chip { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.mute { background: var(--border); color: var(--text-muted); }

/* Lists */
.list { border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.item { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; min-height: var(--tap-min); }
.item:last-child { border-bottom: none; }

/* Inputs */
input, select { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--r); padding: 8px 12px; min-height: var(--tap-min); }
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: -1px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: var(--r); font-weight: 600; min-height: var(--tap-min); transition: opacity 0.15s; }
.btn:active { opacity: 0.7; }
.btn-primary { background: var(--brand); color: var(--brand-on); }
.btn-outline { border: 1px solid var(--border); color: var(--text); }
