/* CLS Timekeeping. Brand tokens match cirruslakesolutions.com (css/site.css). */

/* Inter Variable, self-hosted. Latin subset (64KB), same file as the website. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('/fonts/InterVariable.woff2') format('woff2');
}

:root {
  /* Brand */
  --primary: #003049;
  --primary-400: #1a7fb0;
  --primary-500: #005a87;
  --primary-600: #004567;
  --primary-800: #002336;
  --primary-900: #001c2b;
  --accent: #50c878;
  --accent-dark: #3aaa5a;
  --accent-light: #72d994;
  --secondary: #87ceeb;
  --secondary-dark: #5ab4e0;
  --brand-gradient: linear-gradient(125deg, var(--secondary) 0%, var(--accent) 100%);

  /* Neutrals (slate) */
  --white: #ffffff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Status (app-specific; not on the website) */
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --warning: #b54708;
  --warning-bg: #fffaeb;
  --warning-border: #fedf89;
  --danger-border: #fecdca;
  --success: #1f7a44;
  --success-bg: #ecfdf3;
  --info-bg: #eaf6fc;
  --tabbar-height: 64px;

  /* Shape */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.07), 0 8px 28px rgba(0,0,0,0.05);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);

  --font: Inter, -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--gray-800);
  background: var(--gray-50);
}

a { color: var(--primary-500); }
a:hover { color: var(--primary-400); }

:focus-visible { outline: 3px solid var(--secondary-dark); outline-offset: 2px; }

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--primary);
  color: var(--white);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--white); text-decoration: none; }
.brand:hover .brand-mark { opacity: 0.82; }
/* The mark is navy on transparent; render it white on the navy header, as the website does. */
.brand-mark { height: 32px; width: auto; display: block; filter: brightness(0) invert(1); transition: opacity 0.2s ease; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 700; font-size: 1rem; }
.brand-app {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.site-header .who { font-size: 0.875rem; color: rgba(255,255,255,0.75); text-align: right; }

/* Layout */
main { max-width: 960px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.5rem; line-height: 1.25; color: var(--gray-900); margin: 8px 0 16px; }
h2 { font-size: 1.125rem; color: var(--gray-900); margin: 0 0 8px; }
.muted { color: var(--gray-500); }

.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin-bottom: 16px;
}

/* Buttons: min 44px tall for touch */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition-fast);
}
.btn-primary { background: var(--accent); color: var(--primary); }
.btn-primary:hover { background: var(--accent-light); }
.btn-secondary { background: var(--white); color: var(--primary); border-color: var(--gray-300); }
.btn-secondary:hover { border-color: var(--primary-500); }
.btn-ghost { background: rgba(255,255,255,0.1); color: var(--white); border-color: rgba(255,255,255,0.25); }
.btn-ghost:hover { background: rgba(255,255,255,0.18); }
.btn-block { width: 100%; justify-content: space-between; gap: 12px; text-align: left; }
.btn-block > .muted { text-align: right; font-weight: 500; font-size: 0.875rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--gray-100);
  color: var(--primary-600);
  border: 1px solid var(--gray-200);
}

.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); }

.logo-full { display: block; width: 100%; max-width: 240px; height: auto; margin: 8px auto 24px; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { margin-top: 8px; }



/* ===== App shell: navigation ========================================== */

.site-header { position: sticky; top: 0; z-index: 20; }
.user-menu { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.btn-sm { min-height: 44px; padding: 6px 12px; font-size: 0.875rem; }

/* Phones: bottom tab bar. */
.app-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around;
  height: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--white); border-top: 1px solid var(--gray-200);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.04);
}
.app-nav-link {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 44px; color: var(--gray-500); text-decoration: none; font-size: 0.75rem; font-weight: 600;
}
.app-nav-icon { font-size: 1.25rem; line-height: 1; }
.app-nav-link[aria-current="page"] { color: var(--primary); }
.app-nav-link[aria-current="page"] .app-nav-icon { color: var(--accent-dark); }
body.has-nav { padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom)); }
.site-header .who { display: none; }

/* Desktop: navigation in the header. */
@media (min-width: 768px) {
  .app-nav {
    position: static; height: auto; padding: 0; margin-left: 24px; gap: 4px;
    background: none; border: 0; box-shadow: none; justify-content: flex-start;
  }
  .app-nav-link {
    flex: none; flex-direction: row; gap: 8px; padding: 8px 14px; border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.75); font-size: 0.9375rem;
  }
  .app-nav-link:hover { color: var(--white); background: rgba(255,255,255,0.08); }
  .app-nav-link[aria-current="page"] { color: var(--white); background: rgba(255,255,255,0.12); }
  .app-nav-link[aria-current="page"] .app-nav-icon { color: var(--accent); }
  .app-nav-icon { font-size: 1rem; }
  body.has-nav { padding-bottom: 0; }
  .site-header .who { display: inline; }
  main.wide { max-width: 1280px; }
}

/* ===== Layout helpers ================================================= */

.stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h1 { margin: 0; }
.subtitle { margin: 4px 0 0; color: var(--gray-500); }
.section-title { display: flex; align-items: center; gap: 8px; font-size: 1.125rem; margin: 24px 0 8px; }
.count { display: inline-flex; min-width: 24px; height: 24px; padding: 0 8px; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--gray-100); color: var(--gray-700); font-size: 0.8125rem; font-weight: 700; }
.empty { padding: 16px; text-align: center; color: var(--gray-500); background: var(--white);
  border: 1px dashed var(--gray-300); border-radius: var(--radius-md); }
.big-number { font-size: 2rem; font-weight: 700; color: var(--primary); line-height: 1; }

/* ===== Forms ========================================================== */

.label { display: block; font-weight: 600; font-size: 0.9375rem; color: var(--gray-800); margin-bottom: 6px; }
.input, select.input, textarea.input {
  display: block; width: 100%; min-height: 44px; padding: 10px 12px;
  font: inherit; color: var(--gray-900); background: var(--white);
  border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
}
.input:focus { outline: 3px solid var(--secondary); outline-offset: 0; border-color: var(--primary-400); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.hint { margin: 4px 0 0; font-size: 0.8125rem; color: var(--gray-500); }
.field-error { margin: 4px 0 0; font-size: 0.8125rem; color: var(--danger); font-weight: 600; }
.checkbox { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 8px 0; cursor: pointer; }
.checkbox input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }
.form-grid { display: grid; gap: 12px; }
@media (min-width: 640px) { .form-grid.cols-2 { grid-template-columns: 1fr 1fr; } }

.hours-input { display: flex; align-items: stretch; gap: 8px; }
.hours-input .input { text-align: center; font-size: 1.25rem; font-weight: 700; max-width: 120px; }
.hours-input .btn { min-width: 48px; font-size: 1.25rem; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.chip { min-height: 44px; min-width: 52px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--gray-300);
  background: var(--white); color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; }
.chip:hover, .chip[aria-pressed="true"] { border-color: var(--primary-500); background: var(--info-bg); }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { filter: brightness(1.08); }
.btn-link { background: none; border: 0; color: var(--primary-500); padding: 10px 4px; font-weight: 600; text-decoration: underline; }
.btn-icon { background: none; border: 0; color: var(--gray-500); min-width: 44px; font-size: 1.125rem; }
.btn-block.center { justify-content: center; }

/* ===== Badges and banners ============================================= */

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700; line-height: 1.5; border: 1px solid transparent; white-space: nowrap; }
.badge-correction { background: var(--info-bg); color: var(--primary-600); border-color: var(--secondary); }
.badge-proxy { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-300); }
.badge-info { background: var(--info-bg); color: var(--primary-600); }
.badge-missing { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.badge-status-draft { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-300); }
.badge-status-certified { background: var(--info-bg); color: var(--primary-600); border-color: var(--secondary); }
.badge-status-approved { background: var(--success-bg); color: var(--success); border-color: var(--accent-light); }
.badge-status-missing { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }

.banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 12px; border: 1px solid; }
.banner-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.banner-info { background: var(--info-bg); color: var(--primary-600); border-color: var(--secondary); }
.banner a { color: inherit; font-weight: 700; }

/* ===== Toasts and dialogs ============================================= */

.toast-region { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabbar-height) + 16px + env(safe-area-inset-bottom));
  z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: var(--primary); color: var(--white); padding: 10px 16px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); font-weight: 600; }
@media (min-width: 768px) { .toast-region { bottom: 24px; } }

.dialog { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0;
  border-radius: var(--radius-md); box-shadow: var(--shadow-md); color: var(--gray-800); }
.dialog::backdrop { background: rgba(0, 28, 43, 0.5); }
.dialog > :not(.dialog-head) { padding: 16px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 16px;
  border-bottom: 1px solid var(--gray-200); }
.dialog-head h2 { margin: 0; }

/* ===== Entries, days and timesheet ==================================== */

.entry { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 12px;
  background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
  font: inherit; color: inherit; text-align: left; cursor: pointer; }
button.entry:hover { border-color: var(--primary-400); }
.entry-main { flex: 1; min-width: 0; }
.entry-title { font-weight: 600; }
.entry-sub { font-size: 0.8125rem; color: var(--gray-500); }
.entry-hours { font-size: 1.125rem; font-weight: 700; color: var(--primary); white-space: nowrap; }
.entry .badge { margin: 4px 4px 0 0; }

.day-group + .day-group { margin-top: 16px; }
.day-head { display: flex; justify-content: space-between; font-weight: 700; color: var(--gray-700); margin-bottom: 6px; }

.strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.strip-day { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 56px;
  padding: 4px 0; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); background: var(--white);
  font: inherit; color: var(--gray-700); cursor: pointer; }
.strip-day .dow { font-size: 0.6875rem; text-transform: uppercase; color: var(--gray-500); font-weight: 700; }
.strip-day .num { font-weight: 700; }
.strip-day .hrs { font-size: 0.75rem; color: var(--primary-500); font-weight: 700; min-height: 1em; }
.strip-day[aria-pressed="true"] { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: var(--info-bg); }
.strip-day[aria-pressed="true"] .dow { color: var(--gray-700); }
.strip-day.is-today .num { color: var(--success); text-decoration: underline; text-underline-offset: 3px; }
.strip-day:disabled { opacity: 0.4; cursor: default; }
.strip-week { font-size: 0.75rem; font-weight: 700; color: var(--gray-500); margin: 8px 0 4px; }

.summary-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: baseline; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 16px 20px; border-left: 2px solid var(--gray-200); margin-left: 6px; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--white); border: 2px solid var(--primary-400); }
.timeline li:last-child { border-left-color: transparent; }

/* Tables (approvals, admin) */
.table { width: 100%; border-collapse: collapse; background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius-md); overflow: hidden; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--gray-200); vertical-align: middle; }
.table th { background: var(--gray-50); font-size: 0.8125rem; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.03em; }
.table tr.inactive td { color: var(--gray-500); background: var(--gray-50); }
.table-wrap { overflow-x: auto; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tbody th, .table tfoot th { background: none; text-transform: none; letter-spacing: normal; font-size: inherit; color: inherit; }
.table tfoot td, .table tfoot th { font-weight: 700; border-top: 2px solid var(--primary); }

.queue-card { display: block; padding: 14px 16px; background: var(--white); border: 1px solid var(--gray-200);
  border-left: 4px solid var(--accent); border-radius: var(--radius-sm); color: inherit; text-decoration: none; }
.queue-card:hover { border-color: var(--primary-400); border-left-color: var(--accent-dark); }
.queue-card.not-certified { border-left-color: var(--warning); }
.queue-card + .queue-card { margin-top: 8px; }

.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 16px; border-bottom: 1px solid var(--gray-200); }
.tabs a { padding: 10px 14px; min-height: 44px; display: inline-flex; align-items: center; white-space: nowrap;
  color: var(--gray-600); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; }
.tabs a[aria-current="page"] { color: var(--primary); border-bottom-color: var(--accent); }

.attestation { padding: 16px; background: var(--gray-50); border-left: 4px solid var(--primary); border-radius: var(--radius-sm);
  font-size: 1rem; line-height: 1.6; }

[hidden] { display: none !important; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.actions-bar { margin: 12px 0 16px; }

/* Scroll containers clip their visually-hidden (absolutely positioned) children. */
.table-wrap, .tabs { position: relative; }

/* Non-production environments: impossible to mistake for the real system. */
.env-banner { padding: 6px 16px; text-align: center; font-size: 0.8125rem; background: var(--secondary); color: var(--primary-900); }
.sign-in-card { max-width: 440px; margin: 0 auto; text-align: center; }
.day-entries { margin-top: 16px; }
.day-head { align-items: center; }
.day-head .day-link { padding: 0; min-height: 44px; font-size: 1rem; font-weight: 700; color: var(--primary-500); }
.proxy-select { max-width: 360px; }
