:root {
  --copper: #C96E2E;
  --copper-light: #E0925A;
  --copper-dark: #A8581F;
  --charcoal: #212121;
  --charcoal-card: #2B2B2B;
  --charcoal-border: #3A3A3A;
  --cobalt: #1A66A6;
  --cobalt-light: #3C84C2;
  --cream: #FAF5EA;
  --white: #FFFFFF;
  --gray-300: #C7C7C7;
  --gray-500: #8C8C8C;
  --gray-700: #5A5A5A;
  --green: #2E8B57;
  --green-bg: #1E2E25;
  --red: #C0392B;
  --red-bg: #2E1F1E;
  --amber: #C9821A;
  --amber-bg: #2E2419;
  --blue-bg: #1B2733;

  --font-display: 'Oswald', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

.hidden { display: none; }

body {
  background: var(--charcoal);
  color: var(--cream);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

/* Phone-width shell, centered on wider screens so it still reads as an app
   when this gets tested on a laptop browser. */
.phone {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--charcoal);
  position: relative;
}

/* ---------- Header ---------- */

.app-header {
  background: var(--copper);
  padding: 18px 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.app-header__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--cream);
  text-transform: uppercase;
  margin: 0;
}

.app-header__mark {
  width: 38px;
  height: 38px;
  color: rgba(250, 245, 234, 0.55);
  flex-shrink: 0;
}

/* ---------- Layout ---------- */

.app-main {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 100px;
}

.screen.hidden { display: none; }

/* ---------- Sub-tabs (Jobs screen) ---------- */

.subtabs {
  display: flex;
  border-bottom: 1px solid var(--charcoal-border);
  margin-bottom: 14px;
}

.subtab {
  flex: 1;
  background: none;
  border: none;
  color: var(--gray-500);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 10px 4px 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.subtab.active {
  color: var(--white);
  border-bottom-color: var(--cobalt);
}

/* ---------- Job cards ---------- */

.job-list.hidden { display: none; }

.job-card {
  background: var(--white);
  color: #1F1F1F;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.job-card__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.job-card__client {
  font-weight: 700;
  font-size: 0.98rem;
}

.job-card__address {
  font-size: 0.88rem;
  margin-bottom: 8px;
  color: #333;
}

.job-card__meta {
  display: flex;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--gray-700);
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.job-card__meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.job-card__link {
  display: block;
  text-align: right;
  color: var(--cobalt);
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  cursor: pointer;
}

/* Status badges */

.status-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 20px;
}

.status-pending  { background: #F4E3C8; color: var(--amber); }
.status-approved { background: #DCEFE2; color: var(--green); }
.status-declined { background: #F6DAD6; color: var(--red); }
.status-denied   { background: #F6DAD6; color: var(--red); }
.status-overdue  { background: #F6DAD6; color: var(--red); }
.status-paid     { background: #DCEFE2; color: var(--green); }
.status-sent     { background: #DCE8F2; color: var(--cobalt); }
.status-completed{ background: #DCEFE2; color: var(--green); }
.status-archived { background: #E6E6E6; color: var(--gray-700); }

/* ---------- History search ---------- */

.search-row {
  margin-bottom: 12px;
}
.search-row.hidden { display: none; }

.search-row input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--charcoal-border);
  background: var(--charcoal-card);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 0.92rem;
}
.search-row input::placeholder { color: var(--gray-500); }
.search-row input:focus {
  outline: none;
  border-color: var(--cobalt);
}

.no-results {
  color: var(--gray-500);
  text-align: center;
  font-size: 0.88rem;
  padding: 30px 0;
}

/* ---------- Calendar ---------- */

.calendar-card {
  background: var(--white);
  color: #1F1F1F;
  border-radius: var(--radius);
  padding: 14px;
}

.calendar-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.calendar-card__header button {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--cobalt);
  cursor: pointer;
  padding: 4px 10px;
  line-height: 1;
}

.calendar-card__month {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gray-700);
  text-align: center;
  padding-bottom: 6px;
  border-bottom: 1px solid #ECECEC;
  margin-bottom: 4px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-day {
  min-height: 58px;
  padding: 4px 2px;
  border-bottom: 1px solid #F1F1F1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.cal-day__num {
  font-size: 0.82rem;
  font-weight: 600;
}

.cal-day--muted .cal-day__num {
  color: #C7C7C7;
}

.cal-day--today .cal-day__num {
  color: var(--white);
  background: var(--cobalt);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
}

.cal-day__event {
  font-size: 0.58rem;
  color: var(--cobalt);
  text-align: center;
  line-height: 1.15;
}

/* ---------- Settings ---------- */

.settings-card {
  background: var(--white);
  color: #1F1F1F;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.settings-card__title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--gray-700);
  margin-bottom: 10px;
}

.settings-card__icon { margin-right: 4px; }

.profile-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #E2E2E2;
  color: #555;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-info { display: flex; flex-direction: column; }
.profile-name { font-weight: 700; font-size: 0.98rem; }
.profile-email { font-size: 0.85rem; color: var(--gray-700); }

.toggle-row, .pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  font-size: 0.9rem;
  border-top: 1px solid #F1F1F1;
}
.toggle-row:first-of-type, .pref-row:first-of-type { border-top: none; }

.toggle-row input { display: none; }

.toggle-switch {
  width: 42px;
  height: 24px;
  background: #D6D6D6;
  border-radius: 14px;
  position: relative;
  flex-shrink: 0;
  transition: background 0.15s;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--white);
  border-radius: 50%;
  transition: transform 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle-row input:checked + .toggle-switch {
  background: var(--cobalt);
}
.toggle-row input:checked + .toggle-switch::after {
  transform: translateX(18px);
}

.pref-row select {
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1.5px solid #DDD;
  background: #F7F7F7;
  color: #1F1F1F;
}

.logout-row {
  width: 100%;
  background: var(--white);
  border: none;
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--copper-dark);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  text-align: left;
  cursor: pointer;
}

/* ---------- Floating action button ---------- */

.fab {
  position: fixed;
  left: 50%;
  bottom: 78px;
  transform: translateX(-50%);
  background: var(--cobalt);
  color: var(--white);
  border: none;
  border-radius: 30px;
  padding: 13px 26px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  cursor: pointer;
  z-index: 20;
}
.fab.hidden { display: none; }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 78px;
  transform: translateX(-50%) translateY(20px);
  background: #111;
  color: var(--white);
  padding: 11px 20px;
  border-radius: 24px;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 30;
  max-width: 80%;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Bottom nav ---------- */

.bottom-nav {
  display: flex;
  background: var(--white);
  border-top: 1px solid #E5E5E5;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  position: sticky;
  bottom: 0;
  z-index: 10;
}

.nav-item {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--gray-500);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}

.nav-item__icon { font-size: 1.2rem; }

.nav-item.active { color: var(--cobalt); }

@media (max-width: 360px) {
  .app-header__title { font-size: 1.3rem; }
  .fab { font-size: 0.8rem; padding: 12px 20px; }
}

/* ---------- Home dashboard ---------- */

.home-section {
  margin-bottom: 20px;
}

.home-section__title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--gray-300);
}

.home-section__link {
  color: var(--cobalt-light);
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

.home-empty {
  background: var(--charcoal-card);
  border: 1px solid var(--charcoal-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--gray-500);
  font-size: 0.85rem;
  text-align: center;
}

.event-row {
  background: var(--white);
  color: #1F1F1F;
  border-radius: var(--radius);
  padding: 11px 14px;
  margin-bottom: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
}

.event-row__time {
  color: var(--gray-700);
  font-weight: 500;
  font-size: 0.8rem;
}

/* ---------- Job card top row + delete ---------- */

.job-card__top {
  align-items: flex-start;
}

.job-card__delete {
  background: none;
  border: none;
  color: var(--gray-500);
  font-size: 1.05rem;
  cursor: pointer;
  padding: 2px 0 2px 10px;
  line-height: 1;
  flex-shrink: 0;
}
.job-card__delete:hover,
.job-card__delete:focus-visible {
  color: var(--red);
}

.job-card__top-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ---------- Add-entry modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}
.modal-overlay.hidden { display: none; }

.modal-card {
  background: var(--white);
  color: #1F1F1F;
  width: 100%;
  max-width: 460px;
  border-radius: 16px 16px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  max-height: 80vh;
  overflow-y: auto;
}

.modal-card__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 14px;
  color: var(--charcoal);
}

.modal-field {
  margin-bottom: 12px;
}
.modal-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: #444;
}
.modal-field input,
.modal-field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1.5px solid #DDD;
  font-family: var(--font-body);
  font-size: 0.92rem;
  background: #FAFAFA;
  color: #1F1F1F;
}
.modal-field input:focus,
.modal-field select:focus {
  outline: none;
  border-color: var(--cobalt);
}

.modal-card__error {
  color: var(--red);
  font-size: 0.82rem;
  margin: 4px 0 0;
  min-height: 0;
}
.modal-card__error:empty { display: none; }

.modal-card__actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.btn-outline,
.btn-solid,
.btn-danger {
  flex: 1;
  padding: 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  border: none;
}
.btn-outline {
  background: #EFEFEF;
  color: #444;
}
.btn-solid {
  background: var(--cobalt);
  color: var(--white);
}
.btn-danger {
  background: var(--red);
  color: var(--white);
}

.modal-readonly-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  font-size: 0.88rem;
  border-bottom: 1px solid #F1F1F1;
}
.modal-readonly-row span:first-child {
  color: #777;
}
.modal-readonly-row span:last-child {
  font-weight: 600;
  text-align: right;
}

.cal-day__event {
  cursor: pointer;
}
.cal-day__event:hover {
  text-decoration: underline;
}
