:root {
  --card: rgba(255,255,255,.75);
  --border: rgba(15,23,42,.10);

  --ink: #0f172a;
  --muted: #64748b;
  --brand: #059669;
  --brand-dark: #065f46;
  --brand-soft: rgba(209,250,229,.7);
  --focus: rgba(16,185,129,.35);
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color: var(--ink);
}

/* Page shell */
.page {
  min-height: 100vh;
  padding: 18px;
  background: linear-gradient(135deg,#f8fafc,#d1fae5,#f1f5f9);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(2,6,23,.06);
  backdrop-filter: blur(8px);
}

/* Inputs */
.input,
input,
select,
textarea {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(15,23,42,.14);
  background: rgba(255,255,255,.85);
  line-height: 1.25;
}

/* Buttons */
.btn,
button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(16,185,129,.25);
  background: linear-gradient(180deg,#10b981,#059669);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

/* Focus */
input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: none;
  box-shadow: 0 0 0 4px var(--focus);
}

/* Header */
.topbar {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px;
}

.nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.navlink {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.6);
  font-weight: 800;
  text-decoration: none;
  color: var(--ink);
}

.navlink--active {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

/* ===== Header Upgrade ===== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px;
  flex-wrap: wrap;
}

.userchip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(180deg,#10b981,#059669);
  color: #fff;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.userchip__meta {
  line-height: 1.2;
}

.userchip__label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

.userchip__email {
  font-size: 13px;
  font-weight: 900;
  color: var(--ink);
}


/* Make nav behave on iOS/tablet widths */
.nav{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

@media (max-width: 820px){
  .topbar__right{ width: 100%; justify-content: space-between; }
  .nav{ width: 100%; }
}

/* Forms */
.form-grid {
  display: grid;
  gap: 12px;
}

.form-row-2 {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0,1fr));
}

/* iOS Safari hardening for date/time fields in grid rows */
.form-row-2 > * {
  min-width: 0;          /* allow grid children to shrink */
  overflow: hidden;      /* prevent native controls from bleeding into neighbor column */
}

input[type="date"],
input[type="time"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* iOS-specific: native date/time controls behave better at 16px+ */
@supports (-webkit-touch-callout: none) {
  input[type="date"],
  input[type="time"] {
    font-size: 16px;
  }
}

@media (max-width: 520px) {
  .form-row-2 {
    grid-template-columns: 1fr;
  }
}

.filterbar {
  display: grid;
  gap: 10px;
  align-items: end;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.filterbar button {
  width: 100%;
}

/* ==========================
   iOS date/time hardening
   ========================== */
.form-row-2 > *,
.filterbar > * {
  min-width: 0;
  overflow: hidden; /* prevents iOS native controls from painting outside the cell */
}

input[type="date"],
input[type="time"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* iOS Safari: prevents weird zoom + layout bugs */
@supports (-webkit-touch-callout: none) {
  input[type="date"],
  input[type="time"],
  select,
  input,
  textarea {
    font-size: 16px;
  }
}

/* Filter bar layout: Jobs + Reports */
.filterbar{
  display: grid;
  gap: 10px;
  align-items: end;

  /* Desktop / wide tablet: 4 items in a row */
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* Button should fill its grid cell */
.filterbar button,
.filterbar .btn{
  width: 100%;
}

/* Medium screens: 2 columns */
@media (max-width: 900px){
  .filterbar{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Phones: 1 column */
@media (max-width: 520px){
  .filterbar{
    grid-template-columns: 1fr;
  }
}