:root{
  --bg:#f7f9fc;
  --card:#ffffff;
  --border:#d9e2ef;
  --text:#111827;
  --muted:#4b5563;
  --accent:#1a73e8;
  --accent2:#1558b0;
  --danger:#d93025;
  --shadow: 0 10px 28px rgba(17,24,39,.10);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}
*{ box-sizing:border-box; }
body{ margin:0; background:var(--bg); color:var(--text); }
.wrap{ width:min(1500px, calc(100vw - 24px)); margin:12px auto; }

.header{ display:flex; justify-content:space-between; align-items:flex-start; gap:10px; margin-bottom:10px; }
.headerLeft{ display:grid; gap:4px; }
.header h1{ margin:0; font-size:20px; letter-spacing:.2px; }
.meta{ display:flex; align-items:center; gap:6px; font-size:12px; color:var(--muted); }

.pill{ display:inline-block; padding:3px 8px; border:1px solid var(--border); border-radius:999px; background:var(--card); font-size:11px; }
.linkbtn{ border:none; background:transparent; color:var(--accent); cursor:pointer; padding:0; font-size:12px; }

.card{ background:var(--card); border:1px solid var(--border); border-radius:12px; padding:10px; box-shadow:var(--shadow); }

.entryGrid{
  display:grid;
  grid-template-columns: repeat(10, minmax(100px, 1fr)) 240px;
  gap:8px;
  align-items:end;
}

.field{ display:grid; gap:4px; min-width:0; }
.lbl{ font-size:11px; color:var(--muted); font-weight:500; }

input, select{
  width:100%;
  font-size:15px;
  padding:8px 10px;
  border:1px solid #c9d6ea;
  border-radius:8px;
  outline:none;
  background:#fff;
  min-width:0;
  -webkit-appearance:none;
  appearance:none;
}
input:focus, select:focus{ border-color: rgba(26,115,232,.55); box-shadow: 0 0 0 3px rgba(26,115,232,.12); }

.buttons{ display:grid; grid-template-columns: 1fr 1fr; gap:6px; align-self:end; }

.btn{
  padding:8px 10px;
  border-radius:8px;
  border:1px solid #c9d6ea;
  background:#fff;
  color:var(--text);
  cursor:pointer;
  font-size:13px;
  line-height:1;
  user-select:none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn.primary{ background:var(--accent); border-color:var(--accent); color:#fff; }
.btn.primary:hover{ background:var(--accent2); border-color:var(--accent2); }
.btn.ghost{ background:#fff; }
.btn.danger{ border-color: rgba(217,48,37,.25); color: var(--danger); }
.btn:disabled{ opacity:.45; cursor:not-allowed; }

.tableWrap{ margin-top:10px; overflow-x:auto; border-radius:10px; border:1px solid var(--border); -webkit-overflow-scrolling:touch; }
.table{ width:100%; border-collapse:collapse; min-width: 1100px; }
.table th,.table td{ border-bottom:1px solid #edf1f7; padding:7px 8px; font-size:12px; white-space:nowrap; }
.table th{ text-align:left; color:var(--muted); background:#f8fafc; position:sticky; top:0; z-index:1; font-size:11px; text-transform:uppercase; letter-spacing:.4px; }
.actionsCol{ width: 130px; }
.rowActions{ display:flex; gap:6px; }
.rowActions .btn{ padding:5px 8px; font-size:12px; border-radius:7px; }
tr.selected td{ background: rgba(26,115,232,.06); }

/* Pagination */
.pagination{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  padding:8px 4px 4px;
}
.pagInfo{ font-size:12px; color:var(--muted); }
.pagBtn{ padding:6px 14px; font-size:13px; }

/* Always-visible status */
.statusBar{
  position: sticky;
  bottom: 0;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
}
.statusBarInner{ display:flex; align-items:center; justify-content:space-between; gap:10px; font-size:12px; color:var(--muted); }
.statusDot{ width:8px; height:8px; border-radius:999px; background: rgba(26,115,232,.55); flex-shrink:0; }
.statusBar[data-error="1"] .statusDot{ background: rgba(217,48,37,.75); }
.statusBar[data-error="1"] .statusText{ color: var(--danger); }

/* Ambient Weather temp fetch */
.airTempRow{ display:flex; gap:4px; align-items:center; }
.airTempRow input{ flex:1; min-width:0; }
.tempBtn{ padding:8px 9px; font-size:14px; flex-shrink:0; border-radius:8px; }
.dialog{ border:none; padding:0; background:transparent; }
.dialog::backdrop{ background: rgba(17,24,39,.45); }
.dialogCard{
  width:min(520px, calc(100vw - 24px));
  border-radius:14px;
  border:1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  padding:14px;
}
.dialogCard h2{ margin:0 0 6px; font-size:17px; }
.dialogCard p{ margin:0 0 10px; color:var(--muted); font-size:12px; }
.dialogBtns{ display:flex; gap:10px; justify-content:flex-end; margin-top:10px; }

@media (max-width: 1150px){
  .entryGrid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .buttons{ grid-column: 1 / -1; grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 640px){
  .wrap{ width:calc(100vw - 16px); margin:8px auto; }
  .header{ flex-direction:column; align-items:flex-start; gap:6px; }
  .header h1{ font-size:18px; }
  .buttons{ grid-template-columns: 1fr 1fr; }
  .table{ min-width: 900px; }
  input, select{ font-size:16px; padding:9px 10px; }
  .btn{ font-size:14px; padding:10px 10px; }
  .card{ padding:8px; border-radius:10px; }
}
