:root {
  --navy:    #1B2A4A;
  --gold:    #C9A84C;
  --gold-dk: #a8882e;
  --grey-bg: #F4F6F9;
  --border:  #DDE1E9;
  --text:    #2D3748;
  --muted:   #718096;
  --white:   #FFFFFF;
  --green:   #2d7a4f;
  --red:     #c0392b;
  --radius:  6px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--grey-bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* NAV */
.navbar {
  background: var(--navy);
  padding: 0 2rem;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid var(--gold);
  position: sticky; top: 0; z-index: 100;
}
.nav-brand { color: #fff; font-weight: 600; font-size: 15px; letter-spacing: .3px; }
.nav-links  { display: flex; align-items: center; gap: 1.5rem; }
.nav-links a { color: rgba(255,255,255,.8); text-decoration: none; font-size: 13px; transition: color .15s; }
.nav-links a:hover { color: var(--gold); }

/* CONTAINER */
.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }

/* PAGE HEADER */
.page-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.page-header h2 { font-size: 1.4rem; color: var(--navy); }
.month-label { background: var(--navy); color: var(--gold); padding: .25rem .75rem; border-radius: 20px; font-size: 12px; font-weight: 600; }

/* CARDS */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.card h3 { margin-bottom: 1rem; color: var(--navy); font-size: 1rem; }

/* STATS */
.stats-row { display: flex; gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; flex: 1; border-top: 3px solid var(--navy); }
.stat-num   { font-size: 2rem; font-weight: 700; color: var(--navy); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: .25rem; }

/* TABLE */
h3 { color: var(--navy); margin-bottom: .75rem; font-size: 1rem; }
.data-table { width: 100%; border-collapse: collapse; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 1rem; }
.data-table th { background: var(--navy); color: #fff; padding: .6rem .9rem; text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .3px; }
.data-table td { padding: .55rem .9rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table tbody tr:hover { background: #f8f9fc; }
.data-table tfoot td { background: var(--grey-bg); font-weight: 600; }
.row-inactive td { opacity: .5; }

/* FORMS */
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.form-group { display: flex; flex-direction: column; gap: .35rem; flex: 1; min-width: 180px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--navy); text-transform: uppercase; letter-spacing: .4px; }
.form-group input,
.form-group select,
.form-group textarea {
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  background: var(--white);
  transition: border-color .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(27,42,74,.08);
}
.form-group textarea { resize: vertical; }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center;
  padding: .45rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--grey-bg); }
.btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-primary:hover { background: #253d6a; }
.btn-danger { background: #fff0ef; color: var(--red); border-color: #fcc; }
.btn-danger:hover { background: #ffe0de; }
.btn-sm { padding: .3rem .65rem; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; padding: .65rem; }

/* BADGES */
.badge { display: inline-block; padding: .2rem .55rem; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-reg   { background: #e8f0fe; color: var(--navy); }
.badge-ctx   { background: #fff3cd; color: #856404; }
.badge-green { background: #d4edda; color: var(--green); }
.badge-grey  { background: #e2e8f0; color: var(--muted); }

/* ALERTS */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 13px; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* FILTER BAR */
.filter-bar   { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.filter-form  { display: flex; gap: 1rem; flex-wrap: wrap; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 3rem; color: var(--muted); background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); }

/* MUTED */
.muted { color: var(--muted); font-size: 12px; }

/* LOGIN PAGE */
.login-page { background: var(--navy); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box  { background: var(--white); border-radius: 10px; padding: 2.5rem; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo h1 { color: var(--navy); font-size: 1.3rem; }
.login-logo p  { color: var(--muted); font-size: 13px; margin-top: .3rem; }
.login-box .form-group { margin-bottom: 1rem; }

/* RoundedRect polyfill for FPDF — no CSS needed, just ensure nothing breaks */

/* Month picker pill in page header */
.month-picker {
  appearance: none;
  -webkit-appearance: none;
  background: var(--navy);
  color: var(--gold);
  border: none;
  padding: .28rem .9rem;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}
.month-picker:hover { background: #253d6a; }

/* ── LOG PAGE LAYOUT ─────────────────────────────────────── */
.log-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 2rem;
}

.form-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.form-card-header {
  background: var(--navy);
  color: #fff;
  padding: .85rem 1.5rem;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .3px;
}

.form-card-body { padding: 1.5rem; }

/* 3-col field row: client (wider) | date | hours */
.field-trio {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* "X hrs this month" tag under client dropdown */
.client-hrs-tag {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: #e8f4fd;
  color: #1B2A4A;
  border-radius: 4px;
  padding: .25rem .6rem;
  font-size: 11px;
  font-weight: 600;
  margin-top: .4rem;
}

/* Bigger save button */
.btn-lg { padding: .6rem 1.5rem; font-size: 14px; }

/* ── MONTH PANEL (right side) ────────────────────────────── */
.month-panel {
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1rem;
  position: sticky;
  top: 70px;
}

.mp-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: rgba(255,255,255,.5);
  margin-bottom: .4rem;
}

.mp-total {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}

.mp-sub {
  font-size: 11px;
  color: rgba(255,255,255,.4);
  margin-top: .3rem;
  margin-bottom: .75rem;
}

.mp-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,.12);
  margin: .75rem 0;
}

.mp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .3rem .4rem;
  border-radius: 4px;
  transition: background .12s;
}

.mp-row-active {
  background: rgba(201,168,76,.22);
}

.mp-name {
  font-size: 12px;
  color: rgba(255,255,255,.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 68%;
}

.mp-hrs {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
}

.mp-empty {
  font-size: 12px;
  color: rgba(255,255,255,.3);
}

/* Service badge in table */
.svc-badge {
  display: inline-block;
  background: #f0f4ff;
  color: var(--navy);
  border-radius: 4px;
  padding: .15rem .5rem;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* Responsive */
@media (max-width: 780px) {
  .log-layout { grid-template-columns: 1fr; }
  .month-panel { position: static; }
  .field-trio { grid-template-columns: 1fr 1fr; }
  .field-trio .form-group:first-child { grid-column: 1 / -1; }
}
