/* Staffing ERP — design tokens & components (Bootstrap 5 base) */
:root {
  --brand: #0f766e;
  --brand-600: #0d6560;
  --brand-50: #ecfdf8;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --sidebar: #0b1f2a;
  --sidebar-ink: #c8d3dc;
  --sidebar-active: #13303f;
  --radius: 10px;
  --bs-primary: var(--brand);
  --bs-primary-rgb: 15, 118, 110;
  --bs-link-color: var(--brand);
  --bs-link-hover-color: var(--brand-600);
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--bg);
  --bs-border-color: var(--line);
}

body { font-size: .925rem; }
a { text-decoration: none; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600); --bs-btn-active-bg: var(--brand-600); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand); }
.text-bg-primary { background-color: var(--brand) !important; }
.form-control:focus, .form-select:focus { border-color: #5eb7ae; box-shadow: 0 0 0 .2rem rgba(15,118,110,.15); }
.form-label { font-weight: 500; font-size: .85rem; margin-bottom: .3rem; }
.form-text { font-size: .78rem; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 248px; flex: 0 0 248px; background: var(--sidebar); color: var(--sidebar-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; transition: width .15s ease, flex-basis .15s ease; }
.sidebar .brand { display: flex; align-items: center; gap: .6rem; padding: 1rem 1.1rem; color: #fff; font-weight: 600; border-bottom: 1px solid rgba(255,255,255,.06); min-height: 60px; }
.sidebar .brand .mark { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; font-size: .8rem; font-weight: 700; color: #fff; flex: 0 0 30px; }
.sidebar .brand img { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; background: #fff; }
.sidebar .brand .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .section { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #6f8796; padding: 1rem 1.1rem .35rem; white-space: nowrap; }
.sidebar .nav-link { color: var(--sidebar-ink); display: flex; align-items: center; gap: .7rem; padding: .5rem 1.1rem; border-left: 3px solid transparent; white-space: nowrap; font-size: .88rem; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.04); color: #fff; }
.sidebar .nav-link.active { background: var(--sidebar-active); color: #fff; border-left-color: #2dd4bf; }
.sidebar .nav-link.disabled { color: #4f6573; pointer-events: none; }
.sidebar .nav-link .ico { width: 18px; text-align: center; opacity: .85; flex: 0 0 18px; }
.sidebar .nav-link .soon { margin-left: auto; font-size: .62rem; border: 1px solid #36505f; border-radius: 4px; padding: 0 .3rem; color: #6f8796; }
.sidebar-collapsed .sidebar { width: 64px; flex-basis: 64px; }
.sidebar-collapsed .sidebar .name, .sidebar-collapsed .sidebar .section, .sidebar-collapsed .sidebar .label, .sidebar-collapsed .sidebar .soon { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 60px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: .75rem; padding: 0 1.25rem; position: sticky; top: 0; z-index: 10; }
.topbar .search { max-width: 360px; }
.topbar .icon-btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; width: 36px; height: 36px; display: grid; place-items: center; color: var(--muted); position: relative; }
.topbar .icon-btn .dot { position: absolute; top: 6px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: #ef4444; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; font-weight: 600; font-size: .8rem; }
.content { padding: 1.25rem 1.5rem 2.5rem; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.35rem; font-weight: 650; margin: 0; }
.breadcrumb { font-size: .78rem; margin-bottom: .2rem; --bs-breadcrumb-divider-color: var(--muted); }
.breadcrumb a { color: var(--muted); }

/* ---------- surfaces ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(15,23,42,.03); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); font-weight: 600; padding: .8rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.stat { padding: .9rem 1rem; }
.stat .label { color: var(--muted); font-size: .78rem; }
.stat .value { font-size: 1.35rem; font-weight: 650; line-height: 1.2; margin-top: .15rem; }
.stat .sub { font-size: .75rem; color: var(--muted); }
.table { --bs-table-hover-bg: #f8fafc; margin: 0; }
.table > thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #f8fafc; border-bottom-width: 1px; white-space: nowrap; }
.table td { vertical-align: middle; }
.status-badge { font-weight: 500; letter-spacing: .01em; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty .ico { font-size: 1.6rem; margin-bottom: .4rem; opacity: .6; }
.meter { height: 6px; background: #eef2f6; border-radius: 3px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--brand); }
.meter.warn > span { background: #f59e0b; }
.meter.over > span { background: #ef4444; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: .35rem .75rem; font-size: .88rem; }
.kv dt { color: var(--muted); font-weight: 400; }
.kv dd { margin: 0; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 2rem 1rem; background: radial-gradient(1200px 500px at 10% -10%, #d7f3ee 0%, transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card.wide { max-width: 860px; }
.auth-brand { display: flex; align-items: center; gap: .6rem; font-weight: 650; font-size: 1.05rem; margin-bottom: 1.25rem; justify-content: center; }
.auth-brand .mark { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; }
.plan-option { border: 1.5px solid var(--line); border-radius: var(--radius); padding: .9rem; cursor: pointer; height: 100%; display: block; }
.plan-option:hover { border-color: #9fd6cf; }
.btn-check:checked + .plan-option { border-color: var(--brand); background: var(--brand-50); }
.plan-option .price { font-size: 1.2rem; font-weight: 650; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- wizard ---------- */
.steps { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.steps .step { display: flex; align-items: center; gap: .45rem; font-size: .82rem; color: var(--muted); padding: .35rem .7rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; }
.steps .step .n { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: #eef2f6; font-size: .72rem; font-weight: 600; }
.steps .step.done .n { background: var(--brand); color: #fff; }
.steps .step.current { border-color: var(--brand); color: var(--ink); font-weight: 500; }
.steps .step.current .n { background: var(--brand-50); color: var(--brand); }

/* ---------- print ---------- */
.print-page { max-width: 820px; margin: 1.5rem auto; background: #fff; padding: 2.25rem; border: 1px solid var(--line); border-radius: var(--radius); }
.print-page h2 { font-size: 1.3rem; }
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .print-page { border: none; margin: 0; padding: 0; max-width: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 1040; transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar-open .sidebar { transform: none; }
  .sidebar-open .backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 1030; }
  .sidebar-collapsed .sidebar { width: 248px; flex-basis: 248px; }
  .sidebar-collapsed .sidebar .name, .sidebar-collapsed .sidebar .section, .sidebar-collapsed .sidebar .label { display: initial; }
  .content { padding: 1rem; }
  .kv { grid-template-columns: 1fr; }
  .topbar .search { display: none; }
}

/* ---------- Phase 2 ---------- */
.page-head h1 .badge { font-size: .55em; vertical-align: middle; font-weight: 500; }
.nav-tabs .nav-link { color: var(--muted); }
.nav-tabs .nav-link.active { color: var(--ink); font-weight: 500; }
details > summary { cursor: pointer; }
a.card.stat:hover { border-color: #9fd6cf; }

/* ---------- Phase 3: Kanban ---------- */
.kanban { display: flex; gap: .75rem; overflow-x: auto; padding-bottom: .75rem; align-items: flex-start; }
.kanban-col { flex: 0 0 240px; background: #eef2f6; border-radius: var(--radius); padding: .5rem; min-height: 120px; }
.kanban-col.drop-target { outline: 2px dashed var(--brand); outline-offset: -2px; background: var(--brand-50); }
.kanban-head { display: flex; justify-content: space-between; align-items: center; padding: .15rem .25rem .5rem; }
.kanban-head .count { font-size: .75rem; color: var(--muted); }
.kanban-cards { display: flex; flex-direction: column; gap: .5rem; min-height: 40px; }
.kanban-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .55rem .6rem; font-size: .85rem; }
.kanban-card[draggable="true"] { cursor: grab; }
.kanban-card.dragging { opacity: .5; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 .9rem 1.1rem; border-left: 2px solid var(--line); margin-left: .35rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: .3rem; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.checklist-row.done { background: #f3fbf6; }
.letter { font-size: .95rem; line-height: 1.55; }
.letter .head { border-bottom: 2px solid var(--ink); padding-bottom: .6rem; margin-bottom: 1.2rem; }

/* ---------- Phase 4: attendance chips, grids ---------- */
.att { display: inline-block; min-width: 26px; padding: 1px 4px; border-radius: 4px; font-size: .72rem; font-weight: 600; text-align: center; line-height: 1.5; }
.att-present { background: #dcfce7; color: #166534; }
.att-half_day { background: #fef9c3; color: #854d0e; }
.att-absent { background: #fee2e2; color: #991b1b; }
.att-leave { background: #e0e7ff; color: #3730a3; }
.att-weekly_off { background: #f1f5f9; color: #475569; }
.att-holiday { background: #f3e8ff; color: #6b21a8; }
.att-none { color: #cbd5e1; }
.grid-table { font-size: .8rem; }
.grid-table th, .grid-table td { padding: .25rem .3rem; text-align: center; white-space: nowrap; }
.grid-table th.sticky, .grid-table td.sticky { position: sticky; left: 0; background: #fff; text-align: left; z-index: 1; }
.grid-table .we { background: #f8fafc; }
.att-row.locked { background: #f8fafc; }
.att-row select, .att-row input { min-width: 0; }
.headcount { font-variant-numeric: tabular-nums; }
.headcount.short { color: #b45309; font-weight: 600; }

/* ---------- Phase 6: portals & careers ---------- */
body.portal { background: var(--bg); }
.portal-logo { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; background: #fff; }
.portal-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: .8rem; font-weight: 700; }
.portal .navbar .nav-link { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.portal .navbar .nav-link.active { color: var(--brand); font-weight: 600; }
.job-card { transition: border-color .15s; }
.job-card:hover { border-color: #9fd6cf; }
.job-meta { display: flex; flex-wrap: wrap; gap: .35rem 1rem; font-size: .82rem; color: var(--muted); }
.token-box { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; word-break: break-all; background: #0b1f2a; color: #d1fae5; border-radius: 8px; padding: .75rem 1rem; }
.tpl-preview { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 1rem; }
.code-sample { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: .75rem; white-space: pre-wrap; word-break: break-all; }

/* ---------- Phase 6 ---------- */
.daily-bars { display: flex; align-items: flex-end; gap: 2px; height: 140px; }
.daily-bars .bar-col { flex: 1 1 0; min-width: 2px; height: 100%; display: flex; align-items: flex-end; }
.daily-bars .bar { width: 100%; background: var(--brand); border-radius: 2px 2px 0 0; min-height: 1px; opacity: .85; }
.label-sheet { width: 4in; min-height: 6in; font-size: 12px; background: #fff; }
.slip-page { page-break-after: always; }
.barcode { max-width: 100%; height: auto; }
.scan-input { font-size: 1.25rem; }

/* Phone widths: keep form controls inside their column. */
@media (max-width: 767.98px) {
  .form-select, .form-control { max-width: 100%; }
  .card { min-width: 0; }
}
