/* Advanceworx Hours — dashboard styling */

:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1c2430;
  --muted: #6b7686;
  --line: #e3e7ee;
  --accent: #1b4f72;
  --under: #4a90d9;   /* needs more time */
  --ok: #3e8e5a;      /* on track */
  --over: #cc4b37;    /* over retainer */
  --radius: 14px;
  --shadow: 0 1px 3px rgba(20, 30, 50, .07), 0 6px 18px rgba(20, 30, 50, .05);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}
main { max-width: 1280px; margin: 0 auto; padding: 24px 28px 64px; }
h1 { font-size: 26px; margin: 8px 0 16px; }
h2 { font-size: 17px; margin: 0 0 14px; }
h3 { font-size: 15px; margin: 20px 0 10px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.num { text-align: right; }
.inline { display: inline; }

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; gap: 28px;
  background: #16212e; color: #fff;
  padding: 0 28px; height: 58px;
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand-logo { height: 40px; width: auto; display: block; }
.brand-suffix {
  font-size: 12px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase;
  color: #b8dfde; border: 1px solid rgba(184, 223, 222, .45);
  padding: 2px 8px; border-radius: 99px;
}
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  color: #c8d2de; text-decoration: none; padding: 8px 14px;
  border-radius: 8px; font-size: 14px;
}
.topbar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.topbar nav a.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.whoami { font-size: 13px; color: #9fb0c3; }

.logout-link { color: #9fb0c3; font-size: 13px; text-decoration: none; }
.logout-link:hover { color: #fff; text-decoration: underline; }

/* ---- login ---- */
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-wrap { width: 100%; max-width: 440px; padding: 20px; }
.login-card { text-align: left; padding: 30px 32px; }
.login-card h1 { font-size: 22px; margin: 18px 0 8px; }
.login-logo { display: block; width: 210px; max-width: 70%; margin: 6px auto 2px; }
.login-subtitle {
  text-align: center; font-size: 12px; font-weight: 600; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--muted); margin-bottom: 10px;
}
.login-error {
  background: #fae5e1; border: 1px solid #eec4bc; color: #a53a29;
  padding: 9px 13px; border-radius: 9px; font-size: 14px;
}
.check-label { flex-direction: row !important; align-items: center; gap: 8px !important; }
.check-label input { width: auto; }

/* ---- flash ---- */
.flash {
  max-width: 1280px; margin: 14px auto -6px; padding: 10px 16px;
  background: #e7f4ec; border: 1px solid #bfe3cd; color: #22643c;
  border-radius: 10px; font-size: 14px;
  margin-left: 28px; margin-right: 28px;
}
@media (min-width: 1340px) { .flash { margin-left: auto; margin-right: auto; } }

/* ---- cards ---- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 22px;
}

/* ---- quick log ---- */
.quicklog h2 { margin-bottom: 12px; }
.quicklog-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.quicklog-form label, .settings-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 500; }
.quicklog-form .grow { flex: 1; min-width: 220px; }
input, select, textarea {
  font: inherit; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 9px; background: #fbfcfe; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #b9d3ea; border-color: #7fb0d8; }
input[type="color"] { padding: 3px; height: 40px; width: 60px; }
.btn {
  display: inline-block; padding: 9px 16px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; font-size: 14px;
}
.btn:hover { border-color: #c4cedb; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #163f5c; }

/* ---- dashboard head ---- */
.dash-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.legend { font-size: 13px; color: var(--muted); display: flex; gap: 14px; align-items: center; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.dot.under { background: var(--under); }
.dot.ok { background: var(--ok); }
.dot.over { background: var(--over); }

/* ---- client grid ---- */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
.client-card {
  display: block; text-decoration: none; color: inherit;
  border-top: 4px solid var(--client, var(--accent));
  transition: transform .12s ease, box-shadow .12s ease;
}
.client-card:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(20,30,50,.1), 0 10px 28px rgba(20,30,50,.08); }
.client-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.client-card-head h3 { margin: 0; font-size: 16px; flex: 1; }

.client-logo { height: 34px; max-width: 90px; object-fit: contain; }
.client-logo.big { height: 52px; max-width: 140px; }
.client-logo.small { height: 24px; max-width: 60px; }
.client-monogram {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  background: var(--client, var(--accent)); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.client-monogram.big { width: 54px; height: 54px; font-size: 20px; border-radius: 14px; }
.client-monogram.small { width: 26px; height: 26px; font-size: 11px; border-radius: 7px; display: inline-grid; }

.status-pill {
  font-size: 11.5px; font-weight: 600; padding: 4px 9px; border-radius: 99px; white-space: nowrap;
}
.status-pill.under { background: #e3eefb; color: #2864a8; }
.status-pill.ok { background: #e4f2ea; color: #2c6e47; }
.status-pill.over { background: #fae5e1; color: #a53a29; }
.status-pill.none { background: #eef0f4; color: var(--muted); }

.due-chip {
  display: inline-block; margin-bottom: 12px;
  font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 99px;
  background: #fdf3dd; color: #8a6116; border: 1px solid #f0dcae;
}
.due-chip.linked { text-decoration: none; margin-bottom: 0; }
.due-chip.linked:hover { background: #fbe9c2; }

.meter-block { margin-bottom: 10px; }
.meter-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.meter-label strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.meter { height: 8px; border-radius: 99px; background: #edf0f5; overflow: hidden; }
.meter .fill { display: block; height: 100%; border-radius: 99px; }
.meter .fill.under { background: var(--under); }
.meter .fill.ok { background: var(--ok); }
.meter .fill.over { background: var(--over); }
.meter .fill.none { background: #c9d2de; }

.mini-months { display: flex; gap: 8px; margin-top: 14px; }
.mini-month {
  flex: 1; text-align: center; font-size: 12px; color: var(--muted);
  background: #f4f6f9; border-radius: 8px; padding: 6px 4px;
}
.mini-month strong { display: block; color: var(--ink); font-size: 13px; }
.mini-month.current { background: #e9eff6; outline: 1px solid #d4e0ec; }

/* ---- client page ---- */
.client-hero { display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap; border-top: 5px solid var(--client, var(--accent)); }
.client-hero-id { display: flex; align-items: center; gap: 16px; }
.client-hero h1 { margin: 0 0 2px; }
.client-hero p { margin: 0; }
.quarter-picker { display: flex; gap: 8px; align-items: center; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { display: flex; flex-direction: column; gap: 6px; margin-bottom: 0; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.stat-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.two-col.align-top { align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ---- bar charts ---- */
.bars { display: flex; gap: 6px; align-items: flex-end; height: 170px; position: relative; margin-bottom: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; height: 100%; position: relative; }
.bar-wrap { position: relative; flex: 1; display: flex; align-items: flex-end; justify-content: center; }
.bar { display: block; width: 70%; min-height: 2px; border-radius: 4px 4px 0 0; opacity: .85; }
.bar-label { font-size: 10.5px; color: var(--muted); text-align: center; margin-top: 5px; height: 15px; }
.bar-value { font-size: 10.5px; color: var(--muted); text-align: center; height: 15px; font-variant-numeric: tabular-nums; }
.hover-values .bar-value { opacity: 0; transition: opacity .12s; }
.hover-values .bar-col:hover .bar-value { opacity: 1; color: var(--ink); font-weight: 600; }
.bar-col:hover .bar { opacity: 1; }

/* gridlines: the plot area excludes the value row (top 15px) and label row (bottom 20px) */
.chart-grid { position: absolute; left: 0; right: 0; top: 15px; bottom: 20px; pointer-events: none; }
.grid-line { position: absolute; left: 0; right: 0; border-top: 1px solid #e8ecf2; }
.grid-line span {
  position: absolute; left: 0; top: -14px; font-size: 10px; color: #a6b0bf;
  background: var(--card); padding-right: 4px; line-height: 1;
}
.grid-line.retainer { border-top: 2px dashed #9aa7b8; }

/* ---- dashboard view picker ---- */
.dash-controls { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.view-picker select { padding: 7px 10px; }

/* ---- tables ---- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line);
}
.table th.num { text-align: right; }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: none; }
.total-row td { border-top: 2px solid var(--line); }
.inactive-row { opacity: .5; }

.client-chip {
  display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 13px;
  background: color-mix(in srgb, var(--client) 14%, white);
  color: color-mix(in srgb, var(--client) 80%, black);
  border: 1px solid color-mix(in srgb, var(--client) 30%, white);
}
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -1px; margin-right: 4px; }

.mini-link { background: none; border: none; font: inherit; font-size: 13px; color: var(--accent); cursor: pointer; text-decoration: underline; padding: 0; }
.mini-link.danger { color: var(--over); }

/* ---- forms / filters ---- */
.log-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.log-head h1 { margin: 0; }
.filters { display: flex; gap: 8px; }
.edit-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.edit-form .grow { flex: 1; min-width: 200px; }
.edit-row td { background: #f2f6fb; }
.settings-form { display: flex; flex-direction: column; gap: 12px; max-width: 460px; }
.field-row { display: flex; gap: 12px; }
.field-row label { flex: 1; }
.hint { margin-top: 24px; padding-top: 4px; border-top: 1px solid var(--line); }

@media (max-width: 720px) {
  main { padding: 16px 14px 48px; }
  .topbar { padding: 0 14px; gap: 12px; overflow-x: auto; }
  .client-grid { grid-template-columns: 1fr; }
}
