/* ============ GasCert Pro — light green & white, black text ============ */
:root {
  --green: #7cb342;
  --green-dark: #558b2f;
  --green-light: #e8f5e9;
  --green-pale: #f4faf0;
  --text: #111;
  --muted: #666;
  --border: #d7e5cc;
  --red: #c62828;
  --amber: #ef6c00;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(0,0,0,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, Arial, sans-serif;
  color: var(--text);
  background: var(--green-pale);
  font-size: 15px;
}
.hidden { display: none !important; }
h1,h2,h3,h4 { color: var(--text); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.error { color: var(--red); background:#fdecea; padding:8px 10px; border-radius:6px; margin:8px 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; border: none; cursor: pointer;
  padding: 9px 18px; border-radius: 8px; font-size: 14.5px; font-weight: 600;
  background: #eee; color: var(--text); transition: filter .15s;
  text-decoration: none;
}
.btn:hover { filter: brightness(.95); }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); filter:none; }
.btn-outline { background: #fff; border: 1.5px solid var(--green); color: var(--green-dark); }
.btn-danger { background: #fff; border: 1.5px solid var(--red); color: var(--red); }
.btn-lg { padding: 16px 34px; font-size: 19px; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-link { background: none; color: var(--green-dark); text-decoration: underline; padding: 6px; }

/* ---------- landing ---------- */
.landing { min-height: 100vh; background: linear-gradient(180deg, #fff 0%, var(--green-light) 100%); }
.landing-header { display:flex; justify-content:space-between; align-items:center; padding: 18px 40px; }
.landing-logo { font-size: 22px; font-weight: 800; }
.landing-logo span, .sidebar-logo span { color: var(--green); }
.hero { text-align:center; padding: 70px 20px 50px; max-width: 860px; margin: 0 auto; }
.hero h1 { font-size: 40px; line-height:1.15; margin: 0 0 18px; }
.hero h1 span { color: var(--green-dark); }
.hero p { font-size: 17px; color:#333; max-width: 640px; margin: 0 auto 28px; }
.hero-actions { display:flex; gap:14px; justify-content:center; }
.features { display:grid; grid-template-columns: repeat(auto-fit,minmax(310px,1fr)); gap:24px; max-width:1150px; margin:0 auto; padding: 20px 30px 70px; }
.feature-card { background:#fff; border:1px solid var(--border); border-radius:var(--radius); padding:29px; box-shadow:var(--shadow); }
.feature-icon { font-size: 36px; }
.feature-card h3 { margin: 12px 0 7px; font-size: 22px; }
.feature-card p { margin:0; color:#333; font-size:17px; }
.landing-company {
  display:flex; align-items:center; justify-content:center; gap:16px;
  background:#fff; border:1px solid var(--border); border-radius:12px;
  box-shadow:var(--shadow); padding:16px 26px; margin: 8px auto 0;
  max-width: 560px; font-size: 16px;
}
.landing-company img { max-height: 60px; max-width: 140px; }
.landing-footer { text-align:center; padding: 24px; color: var(--muted); font-size: 13px; }

/* ---------- overlays / modals ---------- */
.overlay { position: fixed; inset:0; background: rgba(0,0,0,.45); display:flex; align-items:center; justify-content:center; z-index: 100; padding: 20px; }
.modal { background:#fff; border-radius: 14px; padding: 26px; width: 100%; max-width: 400px; box-shadow: 0 10px 40px rgba(0,0,0,.25); max-height: 92vh; overflow-y:auto; }
.modal-wide { max-width: 720px; }
.modal h2 { margin-top: 0; }
.modal label { display:block; margin: 12px 0 4px; font-weight: 600; font-size: 13.5px; }
.modal input, .modal select, .modal textarea { width: 100%; }

/* ---------- app shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--border);
  display:flex; flex-direction:column; position: sticky; top:0; height:100vh;
}
.sidebar-logo { font-size: 19px; font-weight: 800; padding: 20px 18px 14px; }
#nav { display:flex; flex-direction:column; padding: 6px 10px; gap: 2px; flex:1; overflow-y:auto; }
#nav a { padding: 10px 12px; border-radius: 8px; text-decoration:none; color: var(--text); font-weight: 600; font-size: 14px; }
#nav a:hover { background: var(--green-pale); }
#nav a.active { background: var(--green-light); color: var(--green-dark); }
.sidebar-footer { padding: 14px; border-top: 1px solid var(--border); }
.sidebar-user { font-size: 13px; margin-bottom: 8px; font-weight:600; }
.sidebar-user .muted { font-weight:400; }
.view { flex: 1; padding: 26px 32px; max-width: 1200px; }

/* ---------- generic UI ---------- */
.page-head { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:12px; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 26px; }
.card { background:#fff; border:1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card h3 { margin-top:0; }
.grid-2 { display:grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display:grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.grid-4 { display:grid; grid-template-columns: repeat(4,1fr); gap: 14px; }
/* ---------- mobile: menu tiles + floating home button ---------- */
@media (max-width: 900px) {
  .grid-2,.grid-3,.grid-4 { grid-template-columns: 1fr; }
  .app { flex-direction: column; }
  .sidebar { display: none; }
  .view { padding: 16px 14px 96px; }
  .page-head h1 { font-size: 21px; }
  .hero h1 { font-size: 28px; }
  .wiz-nav { bottom: 12px; }
}

input, select, textarea {
  padding: 12px; border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 15px; font-family: inherit; color: var(--text); background:#fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); }
/* dropdowns showing their placeholder option appear faded, like input placeholders */
select:required:invalid { color: #999; }
select option { color: var(--text); }
label.field { display:flex; flex-direction:column; gap:4px; font-weight:600; font-size:13px; }
label.field input, label.field select, label.field textarea { font-weight: 400; }
label.check { display:flex; align-items:center; gap:8px; font-weight:500; font-size:14px; }
label.check input { width:auto; }

table.data { width:100%; border-collapse: collapse; background:#fff; }
table.data th { background: var(--green-light); text-align:left; padding: 9px 10px; font-size: 13px; border-bottom: 2px solid var(--green); }
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: top; }
table.data tr:hover td { background: var(--green-pale); }

.badge { display:inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge-green { background: var(--green-light); color: var(--green-dark); }
.badge-amber { background: #fff3e0; color: var(--amber); }
.badge-red { background: #fdecea; color: var(--red); }
.badge-grey { background: #eee; color: #555; }

/* ---------- Skyscanner-style menu tiles ---------- */
.menu-grid { display:grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.menu-tile {
  display:flex; flex-direction:column; align-items:center; gap: 9px;
  background:#fff; border: 1.5px solid var(--border); border-radius: 18px;
  padding: 18px 8px 14px; text-decoration:none; color: var(--text);
  font-weight: 700; font-size: 14.5px; box-shadow: var(--shadow);
  transition: transform .1s, box-shadow .1s;
}
.menu-tile:hover { border-color: var(--green); }
.menu-tile:active { transform: scale(.96); }
.menu-tile .mi {
  position: relative; font-size: 32px;
  width: 62px; height: 62px; border-radius: 50%;
  background: var(--green-light); display:flex; align-items:center; justify-content:center;
}
.menu-tile .mi-badge {
  position:absolute; top:-4px; right:-4px; background: var(--red); color:#fff;
  font-size: 12px; font-weight:800; min-width: 22px; height: 22px; border-radius: 11px;
  display:flex; align-items:center; justify-content:center; padding: 0 5px;
}

/* floating home button (phones) */
.fab-home { display: none; }

/* dashboard tiles */
.tiles { display:grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap:16px; margin-bottom: 22px; }
.tile { background:#fff; border:1px solid var(--border); border-left: 5px solid var(--green); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); cursor:pointer; }
.tile:hover { background: var(--green-pale); }
.tile .num { font-size: 30px; font-weight: 800; color: var(--green-dark); }
.tile .lbl { font-size: 13px; color: var(--muted); font-weight: 600; }
.quick-actions {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 10px; margin-bottom: 22px;
}
.quick-actions .btn {
  width: 100%; padding: 13px 8px; text-align: center; white-space: nowrap;
  display: flex; align-items: center; justify-content: center;
}
/* invisible border matches the outline buttons' border so all four are exactly level */
.quick-actions .btn-primary { border: 1.5px solid var(--green); }

/* collapsible sections */
.collapse { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; background:#fff; }
.collapse > .collapse-head {
  padding: 11px 14px; cursor: pointer; font-weight: 700; font-size: 14px;
  display:flex; justify-content:space-between; align-items:center; background: var(--green-pale);
  border-radius: 8px;
}
.collapse.open > .collapse-head { border-bottom: 1px solid var(--border); border-radius: 8px 8px 0 0; }
.collapse > .collapse-body { display:none; padding: 14px; }
.collapse.open > .collapse-body { display:block; }
.collapse-head .chev::after { content:"▸"; }
.collapse.open .collapse-head .chev::after { content:"▾"; }

/* signature pad */
.sigpad { border: 1.5px dashed var(--green); border-radius: 8px; background: #fff; touch-action: none; display:block; }
.sig-img { border:1px solid var(--border); border-radius:8px; max-height:80px; background:#fff; }

/* appliance block */
.appliance-block { border: 1.5px solid var(--green); border-radius: 10px; padding: 14px; margin-bottom: 14px; background: #fff; }
.appliance-block h4 { margin: 0 0 10px; color: var(--green-dark); }

/* calendar */
.cal-grid { display:grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell { background:#fff; border:1px solid var(--border); border-radius: 6px; min-height: 86px; padding: 5px; font-size: 12px; }
.cal-cell.other { background: #f6f6f6; color:#aaa; }
.cal-cell .d { font-weight: 700; }
.cal-cell.today { border-color: var(--green); border-width:2px; }
.cal-job { background: var(--green-light); color: var(--green-dark); border-radius: 4px; padding: 2px 5px; margin-top: 3px; cursor: pointer; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cal-job.reminder { background:#fff3e0; color: var(--amber); }
.cal-head { display:flex; justify-content:space-between; align-items:center; margin-bottom: 10px; }
.cal-dow { text-align:center; font-weight:700; font-size:12px; padding:4px 0; color: var(--muted); }

/* toolbar */
.toolbar { display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin-bottom: 14px; }
.toolbar input[type=search] { min-width: 240px; }

/* tables where each entry must stay on one aligned line (scrolls sideways in its card) */
table.one-row td, table.one-row th { white-space: nowrap; }

/* filter buttons always in one level row, equal widths */
.filter-row { display:flex; gap:8px; flex-wrap:nowrap; margin-bottom: 14px; }
.filter-row .btn { flex:1 1 0; white-space:nowrap; text-align:center; padding: 10px 6px; }

.toast { position: fixed; bottom: 24px; right: 24px; background: var(--green-dark); color:#fff; padding: 12px 20px; border-radius: 8px; box-shadow: var(--shadow); z-index: 200; font-weight:600; }

.type-picker { display:grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.type-card { border: 1.5px solid var(--border); border-radius: 10px; padding: 18px; cursor:pointer; background:#fff; }
.type-card:hover { border-color: var(--green); background: var(--green-pale); }
.type-card h4 { margin: 0 0 6px; }
.type-card p { margin: 0; font-size: 13px; color: var(--muted); }

.row-actions { display:flex; gap:6px; flex-wrap:wrap; }
.photo-thumb { max-width: 110px; max-height: 110px; border-radius: 8px; border: 1px solid var(--border); }

/* ---------- segmented Yes/No/Pass/Fail buttons ---------- */
.seg-field { display:flex; flex-direction:column; gap:6px; font-weight:600; font-size:13px; }
.seg { display:flex; gap:6px; flex-wrap:wrap; }
.seg-btn {
  /* every option button is one third of the row, so Yes/No rows match Yes/No/N-A rows */
  flex: 1 1 calc(33.333% - 6px); max-width: calc(33.333% - 2px);
  min-width: 62px; padding: 11px 8px; cursor: pointer;
  border: 1.5px solid var(--border); border-radius: 10px; background: #fff;
  font-weight: 700; font-size: 13.5px; color: #666; transition: all .12s;
}
.seg-btn:hover { border-color: var(--green); color: var(--green-dark); }
.seg-btn.on { transform: scale(1.02); box-shadow: var(--shadow); }
.seg-btn.on.tone-good { background: var(--green); border-color: var(--green); color:#fff; }
.seg-btn.on.tone-bad { background: var(--red); border-color: var(--red); color:#fff; }
.seg-btn.on.tone-neutral { background:#546e7a; border-color:#546e7a; color:#fff; }

/* ---------- certificate wizard ---------- */
.wiz-chips { display:flex; gap:8px; overflow-x:auto; padding: 2px 0 14px; }
.wiz-chip {
  display:flex; align-items:center; gap:8px; white-space:nowrap; cursor:pointer;
  padding: 9px 15px; border-radius: 24px; border:1.5px solid var(--border);
  background:#fff; font-weight:700; font-size:13px; color:#666;
}
.wiz-chip .n {
  display:inline-flex; align-items:center; justify-content:center;
  width:20px; height:20px; border-radius:50%; background:var(--border);
  color:#555; font-size:11.5px;
}
.wiz-chip.on { background: var(--green); border-color: var(--green); color:#fff; }
.wiz-chip.on .n { background:#fff; color: var(--green-dark); }
.wiz-chip.done { background: var(--green-light); border-color: var(--green); color: var(--green-dark); }
.wiz-chip.done .n { background: var(--green); color:#fff; }
.wiz-step { display:none; }
.wiz-step.on { display:block; animation: wizfade .18s ease; }
@keyframes wizfade { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform:none; } }
.wiz-nav {
  display:flex; justify-content:space-between; align-items:center; gap:10px;
  margin: 16px 0; position: sticky; bottom: 12px;
  background:#fff; border:1px solid var(--border); border-radius: 12px;
  padding: 10px 14px; box-shadow: var(--shadow);
}
@media (max-width: 900px) { .wiz-nav { bottom: 12px; } }
.wiz-progress { font-weight:700; font-size:13px; color: var(--muted); }
.type-card .type-icon { font-size: 30px; }

/* ---------- Gas Pro-style polish (light green / white / black) ---------- */
.card h3 {
  border-bottom: 2px solid var(--green-light);
  padding-bottom: 8px; margin-bottom: 14px;
}
table.data tbody tr:nth-child(even) td { background: #fafcf7; }
table.data tr:hover td { background: var(--green-pale); }
.tile { transition: transform .12s, box-shadow .12s; }
.tile:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.appliance-block {
  box-shadow: var(--shadow);
  border-width: 1px; border-left: 5px solid var(--green);
  padding: 0;
}
.appliance-block > .collapse-head { background: var(--green-light); font-size: 15px; }
.btn-primary { box-shadow: 0 2px 6px rgba(124,179,66,.4); }
.page-head h1 { letter-spacing: -.3px; }
.collapse > .collapse-head { user-select: none; }

.back-btn { margin-bottom: 12px; }

/* password fields with a reveal (eye) button */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 46px; }
.pw-eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: none; border: none; font-size: 18px; cursor: pointer; padding: 6px 8px;
}

/* dashboard welcome: centred, bold */
.dash-welcome { text-align: center; margin-bottom: 20px; }
.dash-welcome h1 { margin: 0; font-size: 27px; font-weight: 900; letter-spacing: -.3px; }
.dash-welcome p { margin: 6px 0 0; font-weight: 700; color: #3a3a3a; }

/* ---------- touch behaviour (all sizes) ---------- */
.btn, .seg-btn, .menu-tile, .wiz-chip, .collapse-head, .tile, .cal-job, #nav a { touch-action: manipulation; }

/* ---------- mobile optimisation (after base rules so they win) ---------- */
@media (max-width: 900px) {
  /* menu tiles & floating home button */
  .menu-grid { grid-template-columns: repeat(2, 1fr); }
  .menu-tile { font-size: 16px; padding: 22px 8px 18px; }
  .menu-tile .mi { width: 72px; height: 72px; font-size: 38px; }

  /* 16px inputs stop iPhones zooming in when a box is tapped */
  input, select, textarea { font-size: 16px; }

  /* wide tables scroll sideways inside their cards instead of breaking the page */
  .card { overflow-x: auto; }
  table.data th, table.data td { padding: 8px; }

  /* search & filter bars stretch to fit */
  .toolbar input[type=search] { min-width: 0; flex: 1; }
  .toolbar select { min-width: 0; flex: 1; }

  /* bigger, easier tap targets */
  .btn { padding: 12px 18px; }
  .btn-sm { padding: 9px 13px; font-size: 13.5px; }

  /* modals fit small screens */
  .modal { padding: 18px 16px; border-radius: 12px; }
  .type-picker { grid-template-columns: 1fr; }

  /* signature pads shrink to the screen (drawing stays accurate) */
  .sigpad { width: 100%; max-width: 360px; height: auto; }
  .sig-img { max-width: 100%; }

  /* calendar fits 7 days on a phone */
  .cal-grid { gap: 2px; }
  .cal-cell { min-height: 62px; padding: 3px; font-size: 10.5px; }
  .cal-job { font-size: 9.5px; padding: 1px 3px; margin-top: 2px; }

  /* dashboard stat tiles two-up */
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tile .num { font-size: 24px; }

  /* quick actions two-by-two, equal size */
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
  .quick-actions .btn { font-size: 14px; padding: 13px 6px; }

  /* forms & misc */
  .hero-actions { flex-wrap: wrap; }
  #inv-items input[data-item="desc"] { min-width: 170px; }
  .wiz-nav { bottom: calc(12px + env(safe-area-inset-bottom)); }
  .view { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}
