/* ============================================
   HAYNIE ELECTRIC — "PANEL" DESIGN SYSTEM
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@500;600;700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #0B0E12;
  --surface: #151920;
  --surface-raised: #1B2029;
  --border: #262B33;
  --border-soft: #1E232B;

  --copper: #C6752E;
  --copper-bright: #E2924A;
  --copper-dim: #8C5626;

  --current: #2FD3C4;
  --current-bright: #57E8DA;

  --hazard: #F2B705;
  --danger: #E1524B;
  --success: #38C172;

  --text: #EDEFF2;
  --text-muted: #8A93A0;
  --text-dim: #5B6472;

  --radius: 8px;
  --radius-lg: 12px;

  --font-display: 'Oswald', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(circle at 12% 92%, rgba(198,117,46,0.07), transparent 42%),
    radial-gradient(circle at 88% 8%, rgba(47,211,196,0.05), transparent 42%);
}

h1, h2, h3 { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.02em; font-weight: 600; margin: 0; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 0.95rem; }
p { line-height: 1.55; }
a { color: var(--current); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(47,211,196,0.25); border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ===== APP SHELL ===== */
.app-shell { display: flex; min-height: 100vh; position: relative; }
.app-shell::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* ===== SIDEBAR / PANEL DIRECTORY ===== */
.sidebar {
  width: 250px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); position: relative; z-index: 1;
}
.sidebar-brand { padding: 1.6rem 1.25rem 1.3rem; border-bottom: 1px solid var(--border-soft); }
.brand-mark { width: 30px; height: 30px; margin-bottom: 0.7rem; display: block; }
.brand-name { font-family: var(--font-display); font-size: 1rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text); line-height: 1.25; }
.brand-sub { font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.18em; color: var(--copper-bright); text-transform: uppercase; margin-top: 0.35rem; }

.sidebar-nav { padding: 0.4rem 0; }
.circuit-row {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.68rem 1.1rem; border-bottom: 1px solid var(--border-soft);
  text-decoration: none; color: var(--text-muted); position: relative;
  transition: background 0.15s ease, color 0.15s ease;
}
.circuit-row:hover { background: var(--surface-raised); color: var(--text); }
.circuit-row.active { background: var(--surface-raised); color: var(--text); }
.circuit-row.active::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--copper-bright); box-shadow: 0 0 8px var(--copper-bright);
}
.circuit-num { font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-dim); width: 1.3rem; flex-shrink: 0; }
.circuit-row.active .circuit-num { color: var(--copper-bright); }
.circuit-label { flex: 1; font-size: 0.87rem; font-weight: 500; }
.rocker { width: 22px; height: 12px; border-radius: 6px; background: #20262e; border: 1px solid var(--border); position: relative; flex-shrink: 0; }
.rocker-knob { position: absolute; top: 1px; left: 1px; width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); transition: transform 0.15s ease, background 0.15s ease; }
.circuit-row.active .rocker { border-color: var(--copper-dim); }
.circuit-row.active .rocker-knob { transform: translateX(10px); background: var(--copper-bright); box-shadow: 0 0 6px var(--copper-bright); }

/* ===== MAIN ===== */
.main { flex: 1; padding: 2.25rem 2.75rem; position: relative; z-index: 1; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; padding-bottom: 1.1rem; border-bottom: 1px solid var(--border-soft); }
.user-placard { display: flex; align-items: center; gap: 0.7rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--copper-bright), var(--copper-dim)); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 600; font-size: 0.82rem; color: #0B0E12; flex-shrink: 0; }
.user-name { font-size: 0.87rem; font-weight: 600; color: var(--text); }
.role-badge { font-family: var(--font-mono); font-size: 0.63rem; letter-spacing: 0.08em; text-transform: uppercase; background: var(--surface-raised); border: 1px solid var(--border); color: var(--current); padding: 0.15rem 0.5rem; border-radius: 4px; margin-left: 0.5rem; }
.logout-link { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-dim); text-decoration: none; letter-spacing: 0.03em; }
.logout-link:hover { color: var(--danger); }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; gap: 1rem; flex-wrap: wrap; }
.eyebrow { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--current); display: block; margin-bottom: 0.4rem; }

/* ===== CARDS ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1.5rem; position: relative; }
.card::before { content: ''; position: absolute; top: 0; left: 12px; right: 12px; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent); }
.card h3 { color: var(--current); font-size: 0.85rem; margin-bottom: 1rem; }

/* ===== STATS ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem 1.4rem; }
.stat-value { font-family: var(--font-mono); font-size: 1.9rem; font-weight: 600; color: var(--text); margin-top: 0.35rem; }
.stat-value.copper { color: var(--copper-bright); }
.stat-value.current { color: var(--current); }

/* ===== BUTTONS ===== */
.btn {
  font-family: var(--font-body); font-weight: 600; font-size: 0.82rem; letter-spacing: 0.01em;
  padding: 0.65rem 1.15rem; border-radius: 6px; border: 1px solid transparent; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.4rem; text-decoration: none;
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.btn-primary { background: linear-gradient(135deg, var(--copper-bright), var(--copper)); color: #0B0E12; box-shadow: 0 2px 12px rgba(198,117,46,0.25); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 18px rgba(198,117,46,0.4); }
.btn-ghost { background: var(--surface-raised); color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-dim); }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(225,82,75,0.4); }
.btn-danger:hover { background: rgba(225,82,75,0.08); }
.btn-link { background: none; border: none; color: var(--current); cursor: pointer; font-size: 0.84rem; padding: 0; font-family: var(--font-body); font-weight: 600; }

/* ===== FORMS ===== */
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; padding: 0.65rem 0.8rem; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-family: var(--font-body); font-size: 0.89rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease; margin-bottom: 0.9rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--current); box-shadow: 0 0 0 3px rgba(47,211,196,0.15); }
label { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); display: block; margin-bottom: 0.35rem; }

/* ===== TABLES ===== */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table.data-table { min-width: 640px; }
table.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface-raised); }
.data-table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-soft); font-size: 0.87rem; color: var(--text); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.015); }

/* ===== PILLS / BADGES ===== */
.pill { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.6rem; border-radius: 20px; font-size: 0.7rem; font-weight: 600; font-family: var(--font-mono); letter-spacing: 0.02em; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-scheduled { background: rgba(47,211,196,0.12); color: var(--current); }
.pill-in_progress { background: rgba(198,117,46,0.15); color: var(--copper-bright); }
.pill-complete { background: rgba(56,193,114,0.12); color: var(--success); }
.pill-invoiced { background: rgba(139,147,160,0.12); color: var(--text-muted); }
.pill-active { background: rgba(56,193,114,0.12); color: var(--success); }
.pill-inactive { background: rgba(225,82,75,0.12); color: var(--danger); }
.pill-approved { background: rgba(56,193,114,0.12); color: var(--success); }
.pill-pending { background: rgba(47,211,196,0.12); color: var(--current); }
.priority-high { color: var(--danger); font-weight: 700; }
.priority-normal { color: var(--text-muted); }
.priority-low { color: var(--text-dim); }

/* ===== ALERTS ===== */
.flash { padding: 0.85rem 1.1rem; border-radius: 8px; margin-bottom: 1.25rem; font-size: 0.87rem; border: 1px solid transparent; }
.flash-success { background: rgba(56,193,114,0.08); border-color: rgba(56,193,114,0.3); color: #8fe3b2; }
.flash-error { background: rgba(225,82,75,0.08); border-color: rgba(225,82,75,0.3); color: #f3a29e; }

.alert-hazard { position: relative; padding: 0.9rem 1.1rem 1rem 1.4rem; border-radius: 8px; background: rgba(242,183,5,0.06); border: 1px solid rgba(242,183,5,0.35); color: #f2d488; margin-bottom: 1.25rem; overflow: hidden; }
.alert-hazard::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: repeating-linear-gradient(135deg, var(--hazard) 0 6px, #1a1508 6px 12px); }

/* ===== EMPTY STATES ===== */
.empty-state { padding: 2.5rem 1.5rem; text-align: center; color: var(--text-dim); }
.empty-state svg { margin-bottom: 0.75rem; opacity: 0.45; }
.empty-state p { font-size: 0.88rem; margin: 0 0 0.25rem; color: var(--text-muted); }
.empty-state .btn { margin-top: 0.9rem; }

/* ===== MODALS ===== */
.modal-bg { display: none; position: fixed; inset: 0; background: rgba(6,8,10,0.72); backdrop-filter: blur(2px); align-items: center; justify-content: center; z-index: 50; padding: 1rem; }
.modal-bg.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.75rem; width: 100%; max-width: 460px; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1rem; }

/* ===== LOGIN PAGE ===== */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; position: relative; z-index: 1; padding: 1rem; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2.25rem; width: 100%; max-width: 340px; box-shadow: 0 20px 60px rgba(0,0,0,0.4); }
.login-mark { width: 36px; height: 36px; margin-bottom: 1rem; }
.login-title { font-family: var(--font-display); font-size: 1.1rem; text-transform: uppercase; letter-spacing: 0.02em; color: var(--text); }
.login-sub { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.16em; color: var(--copper-bright); text-transform: uppercase; margin: 0.35rem 0 1.5rem; }
.tab-toggle { display: flex; gap: 0.4rem; margin-bottom: 1.25rem; background: var(--bg); border: 1px solid var(--border); border-radius: 7px; padding: 3px; }
.tab-toggle button { flex: 1; background: none; border: none; color: var(--text-muted); padding: 0.5rem; border-radius: 5px; cursor: pointer; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase; transition: background 0.15s ease, color 0.15s ease; }
.tab-toggle button.active { background: var(--surface-raised); color: var(--copper-bright); }

/* ===== CLOCK PAGE / POWER SWITCH ===== */
.clock-shell { max-width: 400px; margin: 0 auto; }
.digital-readout { font-family: var(--font-mono); font-size: 2.2rem; font-weight: 600; color: var(--current-bright); text-align: center; letter-spacing: 0.04em; background: #05070a; border: 1px solid var(--border); border-radius: 10px; padding: 0.9rem; margin-bottom: 1.1rem; text-shadow: 0 0 12px rgba(47,211,196,0.35); }
.clock-status { text-align: center; color: var(--text-muted); font-size: 0.87rem; margin-bottom: 1rem; }
.clock-status strong { color: var(--text); }

.power-switch { background: #05070a; border: 1px solid var(--border); border-radius: 16px; padding: 1rem; box-shadow: inset 0 2px 8px rgba(0,0,0,0.5); margin-bottom: 1rem; }
.power-switch-track {
  position: relative; width: 100%; height: 76px; border-radius: 12px;
  background: #0d1116; border: 1px solid var(--border); cursor: pointer; overflow: hidden;
  display: block; padding: 0; font: inherit;
}
.power-switch-labels { display: flex; justify-content: space-between; position: absolute; inset: 0; align-items: center; padding: 0 1.3rem; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; pointer-events: none; }
.power-switch-labels .label-out, .power-switch-labels .label-in { transition: color 0.2s ease, text-shadow 0.2s ease; color: var(--text-dim); }
.power-switch-track.state-out .label-out { color: var(--copper-bright); text-shadow: 0 0 8px rgba(226,146,74,0.6); }
.power-switch-track.state-in .label-in { color: var(--current-bright); text-shadow: 0 0 8px rgba(87,232,218,0.6); }
.power-switch-knob {
  position: absolute; top: 6px; bottom: 6px; width: calc(50% - 10px); border-radius: 9px;
  background: linear-gradient(160deg, #232a33, #161b21); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  transition: left 0.3s cubic-bezier(.4,1.6,.6,1), box-shadow 0.3s ease, border-color 0.3s ease;
}
.power-switch-track.state-out .power-switch-knob { left: 6px; box-shadow: 0 0 18px 2px rgba(226,146,74,0.35); border-color: var(--copper); }
.power-switch-track.state-in .power-switch-knob { left: calc(50% + 4px); box-shadow: 0 0 18px 2px rgba(87,232,218,0.35); border-color: var(--current); }
.power-switch-dot { width: 10px; height: 10px; border-radius: 50%; }
.power-switch-track.state-out .power-switch-dot { background: var(--copper-bright); box-shadow: 0 0 8px var(--copper-bright); }
.power-switch-track.state-in .power-switch-dot { background: var(--current-bright); box-shadow: 0 0 8px var(--current-bright); }

.gps-led { display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); justify-content: center; width: 100%; margin-top: 0.5rem; }
.gps-led .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); }
.gps-led.acquiring .dot { background: var(--hazard); box-shadow: 0 0 6px var(--hazard); animation: pulse 1.2s infinite; }
.gps-led.locked .dot { background: var(--success); box-shadow: 0 0 6px var(--success); }
.gps-led.unavailable .dot { background: var(--danger); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.error-box { background: rgba(225,82,75,0.08); border: 1px solid rgba(225,82,75,0.3); color: #f3a29e; padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.87rem; }

/* ===== MOBILE ===== */
@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
  .sidebar-brand { padding: 1rem 1.25rem; }
  .sidebar-nav { display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .circuit-row { flex-direction: column; gap: 0.3rem; padding: 0.6rem 0.9rem; border-bottom: none; border-right: 1px solid var(--border-soft); white-space: nowrap; min-width: 80px; text-align: center; }
  .circuit-row.active::before { left: 0; right: 0; top: auto; bottom: 0; height: 3px; width: auto; }
  .rocker { display: none; }
  .circuit-label { font-size: 0.7rem; }
  .main { padding: 1.25rem 1.1rem; }
  .digital-readout { font-size: 1.7rem; }
}
/* ===== JOB DETAIL: PHOTOS, SIGNATURE, MISC ===== */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.75rem; margin-top: 1rem; }
.photo-grid img { width: 100%; height: 140px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 1px solid var(--border); }
.photo-caption { font-size: 0.72rem; color: var(--text-dim); margin-top: 0.3rem; font-family: var(--font-mono); }
.mic-btn { background: var(--surface-raised); color: var(--current); border: 1px solid var(--current); padding: 0.55rem 0.75rem; border-radius: 6px; cursor: pointer; }
.mic-btn.recording { background: rgba(225,82,75,0.15); color: var(--danger); border-color: var(--danger); }
.sig-canvas { background: #fff; border-radius: 8px; touch-action: none; width: 100%; max-width: 400px; height: 150px; border: 1px solid var(--border); }
.sig-img { max-width: 250px; border-radius: 8px; margin-top: 0.5rem; border: 1px solid var(--border); }
.crew-tag { display: inline-flex; align-items: center; gap: 0.4rem; background: var(--surface-raised); border: 1px solid var(--border); padding: 0.3rem 0.6rem; border-radius: 20px; margin: 0.2rem 0.3rem 0.2rem 0; font-size: 0.83rem; }
.crew-tag button { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 0.95rem; line-height: 1; }
.total-row { color: var(--current); font-weight: 600; margin-top: 0.6rem; font-family: var(--font-mono); }
.inline-form { display: flex; gap: 0.5rem; align-items: flex-start; flex-wrap: wrap; margin-bottom: 1rem; }
.inline-form > * { margin-bottom: 0; }

/* ===== BUDGET PROGRESS ===== */
.budget-block { margin-bottom: 1.1rem; }
.budget-track { width: 100%; height: 10px; background: var(--surface-raised); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; margin-top: 0.4rem; }
.budget-fill { height: 100%; border-radius: 5px; transition: width 0.3s ease; }
.budget-fill.ok { background: linear-gradient(90deg, var(--current), var(--current-bright)); }
.budget-fill.warning { background: linear-gradient(90deg, var(--hazard), #f7c948); }
.budget-fill.over { background: linear-gradient(90deg, var(--danger), #f07068); }
.budget-meta { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); margin-top: 0.35rem; }
.budget-status-label { font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; font-family: var(--font-mono); }
.budget-status-label.ok { color: var(--current); }
.budget-status-label.warning { color: var(--hazard); }
.budget-status-label.over { color: var(--danger); }

.pill-billable { background: rgba(56,193,114,0.12); color: var(--success); }
.pill-nonbillable { background: rgba(139,147,160,0.12); color: var(--text-muted); }

/* ===== PRINTABLE INVOICE ===== */
.invoice-paper { background: #FBFAF8; color: #1a1a1a; border-radius: 12px; padding: 3rem; max-width: 760px; margin: 0 auto; box-shadow: 0 20px 60px rgba(0,0,0,0.4); position: relative; overflow: hidden; }
.invoice-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 2px solid #e5e0d8; }
.invoice-brand { font-family: var(--font-display); font-size: 1.15rem; text-transform: uppercase; letter-spacing: 0.02em; color: #1a1a1a; }
.invoice-brand-sub { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em; color: var(--copper); text-transform: uppercase; margin-top: 0.25rem; }
.invoice-number { font-family: var(--font-mono); font-weight: 600; font-size: 1rem; color: #1a1a1a; }
.invoice-meta { font-family: var(--font-mono); font-size: 0.78rem; color: #777; margin-top: 0.2rem; }
.invoice-billto { margin-bottom: 1.75rem; font-size: 0.92rem; }
.invoice-label { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: #999; margin-bottom: 0.4rem; }
.invoice-table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; }
.invoice-table th { text-align: left; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: #777; padding: 0.6rem 0.5rem; border-bottom: 2px solid #e5e0d8; }
.invoice-table td { padding: 0.65rem 0.5rem; border-bottom: 1px solid #ece7de; font-size: 0.9rem; }
.invoice-totals { max-width: 280px; margin-left: auto; }
.invoice-totals > div { display: flex; justify-content: space-between; padding: 0.35rem 0; font-size: 0.9rem; color: #555; }
.invoice-total-final { border-top: 2px solid #1a1a1a; margin-top: 0.4rem; padding-top: 0.6rem !important; font-weight: 700; font-size: 1.1rem !important; color: #1a1a1a !important; }
.invoice-terms { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid #e5e0d8; font-size: 0.8rem; color: #888; }
.invoice-stamp { position: absolute; top: 2.5rem; right: -2.5rem; transform: rotate(30deg); font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; letter-spacing: 0.1em; padding: 0.3rem 3rem; border: 3px solid; opacity: 0.75; }
.invoice-stamp.paid { color: #38C172; border-color: #38C172; }
.invoice-stamp.void { color: #E1524B; border-color: #E1524B; }

@media print {
  .app-shell::before { display: none !important; }
  html, body { background: #fff !important; background-image: none !important; }
  .sidebar, .topbar, .no-print, .flash, .error-box { display: none !important; }
  .main { padding: 0 !important; }
  .invoice-paper { box-shadow: none !important; margin: 0 auto !important; max-width: 100% !important; border-radius: 0 !important; }
  .invoice-table tr, .invoice-totals, .invoice-billto { page-break-inside: avoid; }
  @page { margin: 0.6in; }
}

.pill-manual { background: rgba(198,117,46,0.15); color: var(--copper-bright); }
.pill-clock { background: rgba(47,211,196,0.12); color: var(--current); }

.pill-inactive.contract-paused { opacity: 0.7; }

@media (max-width: 600px) {
  .invoice-paper { padding: 1.5rem 1.25rem; }
  .invoice-header { flex-direction: column; gap: 1rem; }
  .invoice-header > div:last-child { text-align: left; }
  .invoice-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .invoice-table, .invoice-table tr { white-space: nowrap; }
}

.pill-partial { background: rgba(242,183,5,0.12); color: var(--hazard); }
.invoice-stamp.partial { color: var(--hazard); border-color: var(--hazard); }

/* ===== CLOCK PAGE: TWO-COLUMN LAYOUT ===== */
.clock-layout { display: flex; gap: 2rem; flex-wrap: wrap; justify-content: center; align-items: flex-start; }
.manual-punch-panel { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; }
.manual-punch-panel h3 { color: var(--current); font-size: 0.95rem; margin: 0 0 0.3rem; }
.manual-punch-panel .sub { color: var(--text-muted); font-size: 0.82rem; margin: 0 0 1.1rem; }
@media (max-width: 860px) {
  .clock-layout { flex-direction: column; align-items: stretch; }
  .clock-shell, .manual-punch-panel { max-width: 100%; }
}

/* ===== TOPBAR SEARCH ===== */
.topbar { flex-wrap: wrap; gap: 0.75rem; }
.topbar-search { flex: 1; max-width: 420px; margin: 0 1.5rem; }
.topbar-search input { width: 100%; margin-bottom: 0; padding: 0.55rem 1rem; background: var(--bg); border: 1px solid var(--border); border-radius: 20px; color: var(--text); font-size: 0.85rem; }
.topbar-search input:focus { border-color: var(--current); }
@media (max-width: 860px) {
  .topbar-search { order: 3; flex: 1 1 100%; max-width: 100%; margin: 0.6rem 0 0; }
}
.search-result-row { display: block; padding: 0.7rem 0; border-top: 1px solid var(--border-soft); text-decoration: none; }
.search-result-row:first-child { border-top: none; }
.search-result-title { color: var(--text); font-weight: 600; font-size: 0.92rem; }
.search-result-sub { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.15rem; }