/* ============================================================
   Foothill Capital Solutions — Employee Time Clock
   Theme matches the company Employee Time Log PDF
   ============================================================ */

:root {
  --green-darkest: #143d1c;
  --green-dark:     #1f5c2e;
  --green:          #3f9142;
  --green-bright:   #5fbf46;
  --green-tint:     #eaf6ea;
  --green-tint-2:   #f4fbf3;
  --ink:            #1f2d23;
  --muted:          #5d6b60;
  --line:           #d6e3d6;
  --white:          #ffffff;
  --bg:             #f2f6f1;
  --danger:         #b3261e;
  --danger-tint:    #fbeae9;
  --warn:           #b9770b;
  --shadow:         0 2px 10px rgba(20, 61, 28, 0.08);
  --radius:         10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
a { color: var(--green-dark); }

.hidden { display: none !important; }

/* ---------- Top app bar ---------- */
.appbar {
  background: var(--green-darkest);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 20;
}
.appbar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  letter-spacing: .3px;
}
.appbar .brand img { height: 40px; display: block; background: #fff; border-radius: 8px; padding: 4px 8px; }
.appbar .brand .title { font-size: 16px; line-height: 1.1; }
.appbar .brand .title small { display: block; font-size: 11px; opacity: .8; font-weight: 400; }
.appbar .spacer { flex: 1; }

.appbar nav { display: flex; gap: 4px; }
.appbar nav button {
  background: transparent;
  color: #dff0df;
  border: 0;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
}
.appbar nav button:hover { background: rgba(255,255,255,.12); color: #fff; }
.appbar nav button.active { background: var(--green); color: #fff; }

.appbar .userchip {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.1);
  padding: 6px 10px; border-radius: 999px; font-size: 13px;
}
.appbar .userchip .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--green-bright); color: #0c2e14;
  display: grid; place-items: center; font-weight: 700; font-size: 12px;
}
.appbar .userchip button {
  background: transparent; border: 1px solid rgba(255,255,255,.35);
  color: #fff; border-radius: 6px; padding: 4px 10px; font-size: 12px;
}
.appbar .userchip button:hover { background: rgba(255,255,255,.15); }

/* ---------- Layout ---------- */
.page { max-width: 1080px; margin: 0 auto; padding: 24px 20px 60px; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 20px;
}
.card > .card-head {
  background: var(--green-darkest);
  color: #fff;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .3px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.card > .card-body { padding: 18px; }

h1, h2, h3 { color: var(--green-darkest); margin: 0 0 .4em; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  background: #eef2ee;
  color: var(--ink);
  transition: transform .04s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--green-dark); }
.btn-dark { background: var(--green-darkest); color:#fff; }
.btn-outline { background: #fff; border-color: var(--green); color: var(--green-dark); }
.btn-outline:hover:not(:disabled) { background: var(--green-tint); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #8f1d17; }
.btn-ghost { background: transparent; color: var(--green-dark); }
.btn-ghost:hover { background: var(--green-tint); }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 16px 22px; font-size: 17px; border-radius: 12px; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
label.field { display:block; margin-bottom: 12px; font-size: 13px; font-weight:600; color: var(--muted); }
label.field span { display:block; margin-bottom: 4px; }
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green-bright); border-color: var(--green-bright); }
.row { display:flex; gap: 14px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }

/* ---------- Dashboard / overview ---------- */
.page-head { display:flex; align-items:flex-end; justify-content:space-between; gap:14px; flex-wrap:wrap; margin-bottom:18px; }
.page-head h1 { margin:0; font-size:24px; }
.page-head .sub { color:var(--muted); font-size:13px; margin-top:2px; }

.kpi-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:16px; margin-bottom:22px; }
.kpi {
  background:#fff; border:1px solid var(--line); border-top:3px solid var(--green);
  border-radius:12px; padding:16px 18px; box-shadow:var(--shadow); position:relative; overflow:hidden;
}
.kpi.live    { border-top-color:var(--green-bright); }
.kpi.warn-k  { border-top-color:var(--warn); }
.kpi.neutral { border-top-color:#9aa6ad; }
.kpi .kpi-ico { position:absolute; right:14px; top:12px; font-size:22px; opacity:.22; }
.kpi .kpi-v { font-size:34px; font-weight:800; color:var(--green-darkest); line-height:1; font-variant-numeric:tabular-nums; }
.kpi .kpi-v small { font-size:15px; font-weight:600; color:var(--muted); }
.kpi .kpi-k { font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:.5px; margin-top:8px; }

.dash-cols { display:grid; grid-template-columns:1fr 1fr; gap:20px; }
@media (max-width:780px){ .dash-cols{ grid-template-columns:1fr; } }

.who-list, .activity-list { list-style:none; margin:0; padding:0; }
.who-list li, .activity-list li {
  display:flex; align-items:center; gap:12px; padding:11px 0; border-bottom:1px solid var(--line);
}
.who-list li:last-child, .activity-list li:last-child { border-bottom:0; }
.who-list .avatar, .activity-list .avatar {
  width:36px; height:36px; border-radius:50%; background:var(--green-tint); color:var(--green-dark);
  display:grid; place-items:center; font-weight:700; font-size:13px; flex:none;
}
.who-list .meta, .activity-list .meta { flex:1; min-width:0; }
.who-list .meta b, .activity-list .meta b { display:block; font-size:14px; }
.who-list .meta small, .activity-list .meta small { color:var(--muted); font-size:12px; }

.quick-actions { display:flex; gap:10px; flex-wrap:wrap; }
.attn { display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:8px; background:var(--green-tint-2); border:1px solid var(--line); margin-bottom:8px; }
.attn.warn { background:#fff7e8; border-color:#f0dcae; }
.attn .spacer { flex:1; }
.appbar .brand { cursor:pointer; }
.appbar .brand:hover { opacity:.92; }

/* ---------- Dark mode (per-user toggle, off by default) ---------- */
body.dark {
  --bg: #0f1713; --ink: #e7efe7; --muted: #9bad9e; --line: #2b3a2f;
  --green-tint: #19271e; --green-tint-2: #15201a;
  background: var(--bg); color: var(--ink);
}
body.dark .card, body.dark .kpi, body.dark .modal, body.dark .preset,
body.dark input, body.dark select, body.dark textarea { background:#16211a; color:var(--ink); border-color:var(--line); }
body.dark .btn { background:#233329; color:var(--ink); }
body.dark .btn-outline { background:#16211a; color:#cfe6cf; border-color:var(--green); }
body.dark .btn-ghost { background:transparent; color:#cfe6cf; }
body.dark .btn-primary { background:var(--green); color:#fff; }
body.dark .btn-dark { background:#0c2e14; color:#fff; }
body.dark .btn-danger { background:var(--danger); color:#fff; }
body.dark .stat, body.dark .attn { background:#16211a; border-color:var(--line); }
body.dark .attn.warn { background:#2a2410; border-color:#5b4d1d; color:#f0d99a; }
body.dark table.grid tbody tr:nth-child(even) { background:#16211a; }
body.dark table.grid tbody tr:hover { background:#1d2c22; }
body.dark table.grid tbody td { border-color:var(--line); }
body.dark .who-list li, body.dark .activity-list li, body.dark .timeline li { border-color:var(--line); }
body.dark h1, body.dark h2, body.dark h3,
body.dark .now, body.dark .stat .v, body.dark .kpi-v, body.dark .page-head h1 { color:#dcefdc; }
body.dark .muted, body.dark .page-head .sub, body.dark .clock-hero .greet,
body.dark .kpi-k, body.dark .stat .k, body.dark .empty { color:var(--muted); }
body.dark .avatar, body.dark .who-list .avatar, body.dark .activity-list .avatar { background:#233329; color:#cfe6cf; }
body.dark .pill { background:#233329; color:#cfe6cf; }
/* the printed report sheet stays light even in dark mode (it's a document) */
body.dark .report.preview { background:#fff; color:#1f2d23; }
.appbar .userchip button[data-act="theme"] { font-size:14px; padding:4px 9px; }

/* ---------- Reports (sortable table + presets + filters) ---------- */
.preset-row { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:16px; }
.preset {
  background:#fff; border:1px solid var(--green); color:var(--green-dark);
  padding:8px 14px; border-radius:999px; font-size:13px; font-weight:600; cursor:pointer;
  transition:background .12s ease;
}
.preset:hover { background:var(--green-tint); }
.preset.active { background:var(--green); color:#fff; }
.filters { display:flex; gap:14px; flex-wrap:wrap; align-items:flex-end; }
.filters .field { margin:0; min-width:150px; }
table.grid thead th.sortable { cursor:pointer; user-select:none; white-space:nowrap; }
table.grid thead th.sortable:hover { background:var(--green-dark); }
table.grid thead th .arr { font-size:11px; margin-left:2px; }

/* ---------- Tables (PDF-style) ---------- */
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid thead th {
  background: var(--green);
  color: #fff;
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 13px;
  border-right: 1px solid rgba(255,255,255,.2);
}
table.grid tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
table.grid tbody tr:nth-child(even) { background: var(--green-tint); }
table.grid tbody tr:hover { background: #e2f1e1; }
table.grid tfoot td {
  background: var(--green-darkest);
  color: #fff;
  font-weight: 700;
  padding: 10px 12px;
}
table.grid .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Status badges ---------- */
.badge {
  display: inline-flex; align-items:center; gap:6px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; }
.badge.out    { background:#eceff0; color:#54606a; }
.badge.out .dot { background:#9aa6ad; }
.badge.in     { background:#e3f5e1; color:#1f6b2a; }
.badge.in .dot { background:#3fb53f; }
.badge.break  { background:#fff2d6; color:#8a5b00; }
.badge.break .dot { background:#e0a008; }
.badge.lunch  { background:#e0ecfb; color:#1d4e89; }
.badge.lunch .dot { background:#3f7fd0; }
.badge.approved { background:#dff0df; color:#1f5c2e; }

/* ---------- Login screen ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid; place-items: center;
  background:
    radial-gradient(1200px 500px at 50% -10%, #2c7a38 0%, rgba(44,122,56,0) 60%),
    linear-gradient(180deg, #143d1c, #0d2b13);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 420px;
  background: #fff; border-radius: 16px; padding: 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  text-align: center;
}
.login-card img.logo { height: 120px; margin-bottom: 8px; }
.login-card h1 { font-size: 22px; margin: 4px 0 2px; }
.login-card p.sub { color: var(--muted); margin: 0 0 24px; font-size: 14px; }

.ms-btn {
  width: 100%;
  display:flex; align-items:center; justify-content:center; gap: 12px;
  background:#2f2f2f; color:#fff; border:0;
  padding: 13px 16px; border-radius: 8px; font-size: 15px; font-weight: 600;
}
.ms-btn:hover { background:#1f1f1f; }
.ms-btn .ms-logo { width: 20px; height: 20px; display:grid; grid-template-columns:1fr 1fr; gap:2px; }
.ms-btn .ms-logo i { display:block; }
.ms-btn .ms-logo i:nth-child(1){ background:#f25022; }
.ms-btn .ms-logo i:nth-child(2){ background:#7fba00; }
.ms-btn .ms-logo i:nth-child(3){ background:#00a4ef; }
.ms-btn .ms-logo i:nth-child(4){ background:#ffb900; }

.demo-note {
  margin-top: 22px; padding: 12px; border-radius: 10px;
  background: var(--green-tint); border: 1px dashed var(--green);
  font-size: 12.5px; color: var(--green-dark); text-align:left;
}
.demo-note strong { display:block; margin-bottom: 4px; }

/* ---------- Punch screen ---------- */
.clock-hero { text-align:center; padding: 8px 0 4px; }
.clock-hero .greet { font-size: 18px; color: var(--muted); }
.clock-hero .now { font-size: 56px; font-weight: 700; color: var(--green-darkest); line-height: 1; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.clock-hero .today { color: var(--muted); margin-top: 4px; }
.clock-hero .status-line { margin-top: 14px; }

.punch-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-top: 8px; }
.punch-grid .btn { padding: 22px; font-size: 18px; flex-direction: column; gap: 6px; }
.punch-grid .btn .ico { font-size: 26px; }

.stat-row { display:grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 14px; }
.stat {
  background: var(--green-tint-2); border:1px solid var(--line); border-radius: 10px; padding: 14px;
}
.stat .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing:.5px; }
.stat .v { font-size: 24px; font-weight: 700; color: var(--green-darkest); font-variant-numeric: tabular-nums; }

.timeline { list-style:none; margin:0; padding:0; }
.timeline li { display:flex; align-items:center; gap:12px; padding:9px 0; border-bottom:1px dashed var(--line); }
.timeline li:last-child { border-bottom:0; }
.timeline .t-ico { width:30px; height:30px; border-radius:50%; display:grid; place-items:center; color:#fff; font-size:14px; flex:none; }

/* ---------- Misc ---------- */
.toolbar { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-bottom: 16px; }
.toolbar .spacer { flex:1; }
.muted { color: var(--muted); }
.empty { text-align:center; color: var(--muted); padding: 40px 20px; }
.pill { font-size:12px; background:var(--green-tint); color:var(--green-dark); padding:3px 9px; border-radius:999px; font-weight:600; }

/* Modal */
.modal-back {
  position: fixed; inset: 0; background: rgba(13,43,19,.5);
  display:grid; place-items:center; z-index: 50; padding: 20px;
}
.modal {
  background:#fff; border-radius: 14px; width:100%; max-width: 460px;
  box-shadow: 0 24px 70px rgba(0,0,0,.4); overflow:hidden;
}
.modal .modal-head { background: var(--green-darkest); color:#fff; padding: 14px 18px; font-weight:600; }
.modal .modal-body { padding: 18px; }
.modal .modal-foot { padding: 14px 18px; display:flex; gap:10px; justify-content:flex-end; border-top:1px solid var(--line); }

/* Toast */
#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--green-darkest); color:#fff; padding: 12px 20px; border-radius: 10px;
  box-shadow: var(--shadow); font-size: 14px; z-index: 60; opacity:0; pointer-events:none;
  transition: opacity .2s ease, transform .2s ease;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
#toast.err { background: var(--danger); }

/* ============================================================
   PRINT — recreates the Foothill Employee Time Log PDF
   ============================================================ */
.report { display:none; }

@media screen {
  .report.preview { display:block; background:#fff; margin: 0 auto; max-width: 820px; padding: 40px; box-shadow: var(--shadow); border-radius: 10px; }
}

@media print {
  body { background:#fff; }
  .appbar, .toolbar, .no-print, #toast, .modal-back { display: none !important; }
  .page { padding: 0; max-width: none; }
  .card { box-shadow:none; border:none; }
  .report { display:block; }
  .screen-only { display: none !important; }
}

/* The report sheet itself (shared by screen-preview + print) */
.report .rpt-logo { display:block; height: 120px; margin: 0 auto 6px; }
.report h1.rpt-title { text-align:center; font-size: 30px; margin: 6px 0 2px; color:#143d1c; }
.report .rpt-sub { text-align:center; color: var(--green); font-weight:600; margin: 0 0 16px; }
.report hr.rule { border:0; border-top: 3px solid var(--green-bright); margin: 6px 0 16px; }
.report .sec-bar { background: var(--green-darkest); color:#fff; padding: 7px 12px; font-weight:700; font-size: 14px; }
.report .info-grid { display:grid; grid-template-columns: 1fr 1fr; gap: 6px 30px; padding: 14px 4px 18px; }
.report .info-grid .lbl { font-weight:700; color:#143d1c; font-size: 13px; }
.report .info-grid .val { border-bottom: 1px solid #888; min-height: 20px; padding: 0 4px; font-size: 13px; }
.report table.rpt { width:100%; border-collapse: collapse; margin-top: 10px; font-size: 12.5px; }
.report table.rpt th { background: var(--green); color:#fff; padding: 7px 8px; text-align:left; border:1px solid #2f7a33; }
.report table.rpt td { padding: 6px 8px; border:1px solid #bcd3bc; }
.report table.rpt tbody tr:nth-child(even){ background: var(--green-tint); }
.report table.rpt tfoot td { background: var(--green-darkest); color:#fff; font-weight:700; text-align:right; }
.report .cert { font-size: 12px; color:#333; line-height:1.5; padding: 12px 4px; }
.report .sign-grid { display:grid; grid-template-columns: 1fr 1fr; gap: 10px 30px; padding: 10px 4px; }
.report .sign-grid .lbl { font-weight:700; color:#143d1c; font-size:13px; margin-bottom: 18px; }
.report .sign-grid .line { border-bottom:1px solid #555; }
.report .rpt-foot { text-align:center; color: var(--green); font-size: 11px; margin-top: 18px; border-top: 3px solid var(--green-bright); padding-top: 8px; }

/* Responsive */
@media (max-width: 640px) {
  .appbar { flex-wrap: wrap; }
  .appbar .brand .title { font-size: 14px; }
  .clock-hero .now { font-size: 42px; }
}
