:root {
  --bg: #f0f3f8;
  --card: #ffffff;
  --ink: #152033;
  --muted: #5c6b80;
  --line: #d5dde8;
  --brand: #1f4b7a;
  --brand-dark: #163a5f;
  --brand-soft: #e8f0f8;
  --accent: #2f7d57;
  --accent-soft: #e6f5ed;
  --warn-bg: #fff8e8;
  --warn-border: #e0b84a;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --ok: #1a6b3c;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 12px rgba(16, 24, 40, 0.04);
  --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 960px; margin: 0 auto; padding: 1.25rem; }
.wrap-wide { max-width: 1120px; margin: 0 auto; padding: 1.25rem 1.5rem 2.5rem; }

/* Public landing */
.landing {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(ellipse 80% 60% at 10% 0%, #dce8f5 0%, transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 100%, #d8eee4 0%, transparent 50%),
    var(--bg);
}
.landing-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 2.4rem 2.1rem;
  max-width: 440px;
  width: 100%;
}
.landing-card .eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  margin: 0 0 0.6rem;
}
.landing h1 {
  margin: 0 0 0.5rem;
  font-size: 1.65rem;
  color: var(--brand-dark);
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.landing .blurb { color: var(--muted); font-size: 0.98rem; margin: 0.9rem 0 1.4rem; }
.contact { list-style: none; padding: 0; margin: 0; font-size: 0.95rem; }
.contact li {
  margin: 0.55rem 0;
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
}
.contact span {
  flex: 0 0 4.5rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.landing-foot {
  margin-top: 1.75rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

/* App chrome */
.topbar {
  background: linear-gradient(180deg, var(--brand-dark) 0%, #12304f 100%);
  color: #fff;
  padding: 0.85rem 0;
  border-bottom: 3px solid #2a6aad;
}
.topbar .inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  justify-content: space-between;
}
.topbar .brand {
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
  text-decoration: none;
  font-size: 1.02rem;
}
.topbar .brand:hover { text-decoration: none; opacity: 0.95; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 0.35rem 0.15rem; }
.topbar nav a {
  color: #d7e4f5;
  font-size: 0.88rem;
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-weight: 500;
}
.topbar nav a:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
  text-decoration: none;
}
.user-chip {
  font-size: 0.82rem;
  color: #b9cce4;
  background: rgba(0,0,0,0.18);
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.45rem;
  margin: 1rem 0;
}
h1.page-title {
  font-size: 1.45rem;
  margin: 0.5rem 0 0.35rem;
  color: var(--brand-dark);
  letter-spacing: -0.02em;
}
.page-sub {
  color: var(--muted);
  margin: 0 0 1rem;
  font-size: 0.95rem;
}
h2 {
  font-size: 1.05rem;
  margin: 0 0 0.85rem;
  color: var(--brand-dark);
}

.banner-cui {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 8px;
  padding: 0.7rem 1rem;
  margin: 0 0 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #6b5300;
  text-align: center;
}
.flash-ok {
  background: var(--accent-soft);
  border: 1px solid #b7dfc8;
  color: var(--ok);
  padding: 0.65rem 0.95rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}
.flash-err {
  background: var(--danger-soft);
  border: 1px solid #f0b4b4;
  color: var(--danger);
  padding: 0.65rem 0.95rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0.55rem 0 0.28rem;
  letter-spacing: 0.01em;
}
input[type="text"], input[type="password"], input[type="email"], input[type="number"],
input[type="date"], select, textarea {
  width: 100%;
  max-width: 420px;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #6a9fd4;
  box-shadow: 0 0 0 3px rgba(31, 75, 122, 0.12);
}
textarea { max-width: 100%; min-height: 72px; resize: vertical; }
.form-row { margin-bottom: 0.35rem; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.55rem 1rem;
}
.form-grid input, .form-grid select { max-width: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1.05rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  line-height: 1.2;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; color: #fff; }
.btn-secondary { background: #5b6777; }
.btn-secondary:hover { background: #455060; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #912018; }
.btn-ghost {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--brand-soft); color: var(--brand-dark); }
.btn-sm { padding: 0.32rem 0.65rem; font-size: 0.84rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 1rem; align-items: center; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.data th, table.data td {
  border-bottom: 1px solid var(--line);
  padding: 0.55rem 0.45rem;
  text-align: left;
  vertical-align: top;
}
table.data th {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f7f9fc;
}
table.data tbody tr:hover td { background: #f5f8fc; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .actions { white-space: nowrap; }

.badge {
  display: inline-block;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--brand-soft);
  color: var(--brand-dark);
  letter-spacing: 0.02em;
}
.badge.approved { background: var(--accent-soft); color: var(--ok); }
.badge.submitted { background: #fff3d6; color: #8a6200; }
.badge.draft { background: #eee; color: #555; }
.badge.rejected { background: var(--danger-soft); color: var(--danger); }
.badge.inactive { background: #eee; color: #666; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.85rem;
  margin: 1rem 0 1.25rem;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
}
.stat .n {
  font-size: 1.65rem;
  font-weight: 750;
  color: var(--brand-dark);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat .l { font-size: 0.84rem; color: var(--muted); margin-top: 0.2rem; line-height: 1.35; }

.login-wrap { max-width: 420px; margin: 2.5rem auto; padding: 0 1rem; }
.muted { color: var(--muted); font-size: 0.9rem; }
.code-list {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  background: #fafbfc;
}
.code-list label {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  margin: 0.3rem 0;
  font-size: 0.9rem;
  color: var(--ink);
  font-weight: 500;
}
.code-list input { width: auto; max-width: none; }

.week-nav {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
  padding: 0.75rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.week-nav strong { color: var(--brand-dark); font-size: 1.02rem; }
.week-meta { margin-left: auto; color: var(--muted); font-size: 0.9rem; }

.day-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0 1rem;
}
.day-chip {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 4.5rem;
  text-align: center;
}
.day-chip .hrs {
  display: block;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}
.day-chip.zero { background: #f0f2f5; color: var(--muted); font-weight: 500; }

.form-panel-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}
.form-panel-title h2 { margin: 0; }

footer.site {
  margin-top: 2rem;
  padding: 1.1rem 1rem 1.6rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

/* Timesheet edit link as button-ish */
a.edit-link {
  font-weight: 600;
  font-size: 0.85rem;
  margin-right: 0.4rem;
}

/* Week grid timesheet */
.day-card { padding: 1rem 1.1rem 1.15rem; }
.day-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}
.day-card-head h2 {
  margin: 0;
  font-size: 1.05rem;
}
.day-card.day-locked {
  background: #f7f8fa;
}
.table-scroll { overflow-x: auto; }
.ts-table { min-width: 960px; }
.ts-table .js-tron { min-width: 11rem; }
.ts-table th { white-space: nowrap; }
.ts-table select,
.ts-table input[type="number"],
.ts-table input[type="text"] {
  max-width: none;
  width: 100%;
  min-width: 0;
  padding: 0.4rem 0.45rem;
  font-size: 0.88rem;
}
.ts-hrs { width: 4.5rem; }
.ts-hrs input { text-align: right; }
.ts-actions { width: 2.5rem; text-align: center; }
.ts-row.row-locked td { opacity: 0.85; }
.ts-row.row-locked select,
.ts-row.row-locked input {
  background: #f0f2f5;
}
.save-bar {
  position: sticky;
  bottom: 0.5rem;
  z-index: 5;
  border: 2px solid var(--brand);
  box-shadow: 0 8px 24px rgba(22, 58, 95, 0.12);
}
.inline-emp-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: end;
}

/* Codes management */
.codes-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0 1rem;
}
.codes-tab {
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  background: #e8eef5;
  color: var(--brand-dark);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}
.codes-tab:hover { background: #d5e3f2; text-decoration: none; }
.codes-tab.active {
  background: var(--brand);
  color: #fff;
}
tr.row-inactive td { opacity: 0.65; background: #f7f7f8; }
.create-code-form { margin-top: 0.5rem; }

/* Inline create charge code on timesheet */
.ts-inline-create {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: #f3f7fc;
  border: 1px dashed #9bb8d9;
  border-radius: 8px;
}
.ts-inline-create summary {
  cursor: pointer;
  font-weight: 650;
  color: var(--brand-dark);
}
.ts-inline-create .inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
  margin-top: 0.65rem;
  align-items: end;
}
@media (max-width: 720px) {
  .ts-inline-create .inline-fields { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .topbar .inner { padding: 0 1rem; }
  .wrap-wide { padding: 1rem; }
  .week-meta { margin-left: 0; width: 100%; }
  table.data { font-size: 0.84rem; }
  .stat .n { font-size: 1.35rem; }
  .ts-table { min-width: 680px; }
}
