/* ============================================
   TIM'S PAVING 2.0 — DESIGN SYSTEM
   Industrial-utilitarian SaaS aesthetic
   Mobile-first · Touch-friendly · High-contrast
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,700&family=IBM+Plex+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --tp-black: #0f1923;
  --tp-sidebar: #131d2a;
  --tp-sidebar-hover: #1a2738;
  --tp-sidebar-active: #243447;
  --tp-surface: #f4f6f9;
  --tp-card: #ffffff;
  --tp-primary: #e67e22;
  --tp-primary-dark: #cf6d17;
  --tp-primary-light: #f5c27a;
  --tp-primary-ghost: rgba(230,126,34,0.08);
  --tp-success: #1ea85a;
  --tp-success-light: #d4f5e2;
  --tp-danger: #dc3545;
  --tp-danger-light: #fde8ea;
  --tp-warning: #f0ad4e;
  --tp-warning-light: #fef3dc;
  --tp-info: #3b82f6;
  --tp-info-light: #dbeafe;
  --tp-text: #1e293b;
  --tp-text-secondary: #475569;
  --tp-text-muted: #94a3b8;
  --tp-border: #e2e8f0;
  --tp-radius: 10px;
  --tp-radius-lg: 16px;
  --tp-radius-sm: 6px;
  --tp-shadow-sm: 0 1px 3px rgba(15,25,35,.06);
  --tp-shadow: 0 4px 12px rgba(15,25,35,.08);
  --tp-shadow-lg: 0 12px 40px rgba(15,25,35,.12);
  --tp-transition: 180ms cubic-bezier(.4,0,.2,1);
  --sidebar-w: 260px;
  --topbar-h: 60px;
  --botnav-h: 72px;
  --font-heading: 'DM Sans',system-ui,sans-serif;
  --font-body: 'IBM Plex Sans',system-ui,sans-serif;
  --font-mono: 'JetBrains Mono',monospace;
}

*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html{font-size:16px;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent;scroll-behavior:smooth;overscroll-behavior:none}
body{font-family:var(--font-body);color:var(--tp-text);background:var(--tp-surface);line-height:1.6;-webkit-font-smoothing:antialiased;overflow-x:hidden}
h1,h2,h3,h4,h5,h6{font-family:var(--font-heading);font-weight:700;line-height:1.25}
a{color:var(--tp-primary);text-decoration:none}
a:hover{color:var(--tp-primary-dark)}

/* ---- LAYOUT SHELL ---- */
.app-layout{display:flex;min-height:100vh;min-height:100dvh}

/* ---- SIDEBAR ---- */
.sidebar{width:var(--sidebar-w);background:var(--tp-sidebar);color:#cbd5e1;display:flex;flex-direction:column;position:fixed;top:0;left:0;bottom:0;z-index:100;transition:transform var(--tp-transition);overflow-y:auto;scrollbar-width:thin;scrollbar-color:#2a3a4f transparent}
.sidebar::-webkit-scrollbar{width:4px}
.sidebar::-webkit-scrollbar-thumb{background:#2a3a4f;border-radius:4px}
.sidebar-brand{padding:20px 20px 16px;border-bottom:1px solid rgba(255,255,255,.06)}
.sidebar-brand h2{color:#f8fafc;font-size:1.15rem;letter-spacing:-.02em}
.sidebar-brand .version{font-size:.7rem;color:#64748b;font-family:var(--font-mono);margin-top:2px}
.sidebar-user{padding:14px 20px;display:flex;align-items:center;gap:10px;border-bottom:1px solid rgba(255,255,255,.06)}
.sidebar-user .avatar{width:36px;height:36px;border-radius:50%;background:var(--tp-primary);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:.85rem;flex-shrink:0}
.sidebar-user .user-name{font-size:.85rem;font-weight:600;color:#f1f5f9;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sidebar-user .user-role{font-size:.7rem;color:var(--tp-primary-light);font-weight:500}
.sidebar-nav{padding:8px 0;flex:1}
.sidebar-section-label{padding:16px 20px 6px;font-size:.65rem;font-weight:700;text-transform:uppercase;letter-spacing:.1em;color:#475569}
.sidebar-link{display:flex;align-items:center;gap:10px;padding:10px 20px;color:#94a3b8;font-size:.85rem;font-weight:500;transition:all var(--tp-transition);border-left:3px solid transparent;cursor:pointer}
.sidebar-link:hover{background:var(--tp-sidebar-hover);color:#e2e8f0}
.sidebar-link.active{background:var(--tp-sidebar-active);color:var(--tp-primary-light);border-left-color:var(--tp-primary)}
.sidebar-link .icon{width:20px;text-align:center;font-size:1rem;flex-shrink:0}
.sidebar-link .badge{margin-left:auto;background:var(--tp-danger);color:#fff;font-size:.65rem;font-weight:700;padding:1px 6px;border-radius:99px}
.sidebar-footer{padding:12px 20px;border-top:1px solid rgba(255,255,255,.06)}
.sidebar-footer .credit{font-size:.65rem;color:#475569;text-align:center;line-height:1.4}

/* ---- MAIN CONTENT ---- */
.main-content{flex:1;margin-left:var(--sidebar-w);display:flex;flex-direction:column;min-height:100vh}

/* ---- TOPBAR ---- */
.topbar{height:var(--topbar-h);background:var(--tp-card);border-bottom:1px solid var(--tp-border);display:flex;align-items:center;padding:0 24px;gap:16px;position:sticky;top:0;z-index:50}
.topbar-hamburger{display:none;background:none;border:none;color:var(--tp-text);font-size:1.4rem;cursor:pointer;padding:8px;border-radius:var(--tp-radius-sm)}
.topbar-search{flex:1;max-width:400px;position:relative}
.topbar-search input{width:100%;height:38px;border:1px solid var(--tp-border);border-radius:var(--tp-radius);padding:0 14px 0 38px;font-size:.85rem;font-family:var(--font-body);background:var(--tp-surface);color:var(--tp-text);transition:all var(--tp-transition)}
.topbar-search input:focus{outline:none;border-color:var(--tp-primary);background:#fff;box-shadow:0 0 0 3px var(--tp-primary-ghost)}
.topbar-search .search-icon{position:absolute;left:12px;top:50%;transform:translateY(-50%);color:var(--tp-text-muted);font-size:.9rem}
.topbar-actions{display:flex;align-items:center;gap:6px;margin-left:auto}
.topbar-btn{width:40px;height:40px;border-radius:var(--tp-radius);border:none;background:0 0;color:var(--tp-text-secondary);cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:1.15rem;position:relative;transition:all var(--tp-transition)}
.topbar-btn:hover{background:var(--tp-surface);color:var(--tp-text)}
.topbar-btn .notif-dot{position:absolute;top:8px;right:8px;width:8px;height:8px;border-radius:50%;background:var(--tp-danger);border:2px solid var(--tp-card)}
.topbar-lang{display:flex;border:1px solid var(--tp-border);border-radius:var(--tp-radius-sm);overflow:hidden}
.topbar-lang button{padding:4px 10px;font-size:.75rem;font-weight:600;border:none;background:0 0;color:var(--tp-text-muted);cursor:pointer;transition:all var(--tp-transition)}
.topbar-lang button.active{background:var(--tp-primary);color:#fff}

/* ---- PAGE CONTENT ---- */
.page-content{flex:1;padding:24px;max-width:1400px;width:100%}
.page-header{margin-bottom:24px}
.page-title{font-size:1.6rem;letter-spacing:-.03em}
.page-subtitle{font-size:.9rem;color:var(--tp-text-secondary);margin-top:4px}

/* ---- CARDS ---- */
.card{background:var(--tp-card);border:1px solid var(--tp-border);border-radius:var(--tp-radius-lg);padding:20px;box-shadow:var(--tp-shadow-sm);transition:box-shadow var(--tp-transition)}

/* ---- METRIC CARDS ---- */
.metrics-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:16px;margin-bottom:24px}
.metric-card{background:var(--tp-card);border:1px solid var(--tp-border);border-radius:var(--tp-radius-lg);padding:18px 20px;display:flex;align-items:flex-start;gap:14px;transition:all var(--tp-transition)}
.metric-card:hover{box-shadow:var(--tp-shadow);transform:translateY(-1px)}
.metric-icon{width:44px;height:44px;border-radius:var(--tp-radius);display:flex;align-items:center;justify-content:center;font-size:1.2rem;flex-shrink:0}
.metric-icon.orange{background:var(--tp-primary-ghost);color:var(--tp-primary)}
.metric-icon.green{background:var(--tp-success-light);color:var(--tp-success)}
.metric-icon.red{background:var(--tp-danger-light);color:var(--tp-danger)}
.metric-icon.blue{background:var(--tp-info-light);color:var(--tp-info)}
.metric-icon.yellow{background:var(--tp-warning-light);color:var(--tp-warning)}
.metric-label{font-size:.75rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--tp-text-muted)}
.metric-value{font-size:1.7rem;font-weight:700;font-family:var(--font-heading);line-height:1.2;letter-spacing:-.03em}
.metric-delta{font-size:.75rem;font-weight:600;margin-top:2px}
.metric-delta.up{color:var(--tp-success)}
.metric-delta.down{color:var(--tp-danger)}

/* ---- STATUS DOTS ---- */
.status-dot{width:10px;height:10px;border-radius:50%;display:inline-block}
.status-dot.operational,.status-dot.active,.status-dot.approved,.status-dot.passed{background:var(--tp-success)}
.status-dot.warning,.status-dot.pending,.status-dot.submitted{background:var(--tp-warning)}
.status-dot.danger,.status-dot.failed,.status-dot.rejected,.status-dot.critical{background:var(--tp-danger)}
.status-dot.info,.status-dot.in-progress{background:var(--tp-info)}
.status-dot.muted,.status-dot.inactive{background:var(--tp-text-muted)}
.status-dot.pulse{animation:pulse-ring 2s ease-in-out infinite}
@keyframes pulse-ring{0%,100%{box-shadow:0 0 0 0 rgba(30,168,90,.4)}50%{box-shadow:0 0 0 6px rgba(30,168,90,0)}}

/* ---- BIG ACTION BUTTONS (field crew) ---- */
.action-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-bottom:24px}
.action-btn{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:28px 16px;min-height:120px;border-radius:var(--tp-radius-lg);border:2px solid var(--tp-border);background:var(--tp-card);color:var(--tp-text);font-family:var(--font-heading);font-weight:700;font-size:.95rem;cursor:pointer;transition:all var(--tp-transition);text-align:center;text-decoration:none;-webkit-tap-highlight-color:transparent;user-select:none}
.action-btn:hover{border-color:var(--tp-primary);box-shadow:var(--tp-shadow);transform:translateY(-2px);color:var(--tp-text)}
.action-btn:active{transform:translateY(0)}
.action-btn .action-icon{font-size:2.2rem;line-height:1}
.action-btn.primary{background:var(--tp-primary);border-color:var(--tp-primary);color:#fff}
.action-btn.primary:hover{background:var(--tp-primary-dark);border-color:var(--tp-primary-dark);color:#fff}
.action-btn.danger{background:var(--tp-danger);border-color:var(--tp-danger);color:#fff}
.action-btn.success{background:var(--tp-success);border-color:var(--tp-success);color:#fff}

/* ---- BUTTONS ---- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:10px 20px;border-radius:var(--tp-radius);font-family:var(--font-body);font-weight:600;font-size:.875rem;cursor:pointer;border:1px solid transparent;transition:all var(--tp-transition);text-decoration:none;min-height:42px;white-space:nowrap}
.btn:active{transform:scale(.97)}
.btn-primary{background:var(--tp-primary);color:#fff;border-color:var(--tp-primary)}.btn-primary:hover{background:var(--tp-primary-dark);color:#fff}
.btn-secondary{background:var(--tp-surface);color:var(--tp-text);border-color:var(--tp-border)}.btn-secondary:hover{background:var(--tp-border)}
.btn-danger{background:var(--tp-danger);color:#fff}.btn-danger:hover{background:#c82333;color:#fff}
.btn-success{background:var(--tp-success);color:#fff}.btn-success:hover{background:#178a4a;color:#fff}
.btn-ghost{background:0 0;color:var(--tp-primary)}.btn-ghost:hover{background:var(--tp-primary-ghost)}
.btn-warning{background:var(--tp-warning);color:var(--tp-text)}.btn-warning:hover{background:#e09b3d}
.btn-lg{padding:14px 28px;font-size:1rem;min-height:52px;border-radius:var(--tp-radius-lg)}
.btn-sm{padding:6px 14px;font-size:.8rem;min-height:34px}
.btn-full{width:100%}

/* ---- FORMS ---- */
.form-group{margin-bottom:18px}
.form-label{display:block;font-size:.8rem;font-weight:600;color:var(--tp-text-secondary);margin-bottom:6px}
.form-input,.form-select,.form-textarea{width:100%;padding:10px 14px;border:1px solid var(--tp-border);border-radius:var(--tp-radius);font-size:.9rem;font-family:var(--font-body);color:var(--tp-text);background:#fff;transition:all var(--tp-transition);min-height:44px}
.form-input:focus,.form-select:focus,.form-textarea:focus{outline:none;border-color:var(--tp-primary);box-shadow:0 0 0 3px var(--tp-primary-ghost)}
.form-textarea{min-height:80px;resize:vertical}

/* ---- DATA TABLES ---- */
.data-table{width:100%;border-collapse:collapse;font-size:.85rem}
.data-table thead th{text-align:left;padding:10px 14px;font-size:.75rem;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:var(--tp-text-muted);border-bottom:2px solid var(--tp-border);white-space:nowrap}
.data-table tbody td{padding:12px 14px;border-bottom:1px solid var(--tp-border);vertical-align:middle}
.data-table tbody tr:hover{background:var(--tp-primary-ghost)}
.data-table .mono{font-family:var(--font-mono);font-size:.8rem}

/* ---- TABS ---- */
.tabs{display:flex;gap:2px;border-bottom:2px solid var(--tp-border);margin-bottom:20px;overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.tabs::-webkit-scrollbar{display:none}
.tab{padding:10px 18px;font-size:.85rem;font-weight:600;color:var(--tp-text-muted);border-bottom:2px solid transparent;margin-bottom:-2px;cursor:pointer;white-space:nowrap;transition:all var(--tp-transition);background:0 0;border-top:0;border-left:0;border-right:0}
.tab:hover{color:var(--tp-text)}
.tab.active{color:var(--tp-primary);border-bottom-color:var(--tp-primary)}
.tab-content{display:none}
.tab-content.active{display:block}

/* ---- CLOCK BANNER ---- */
.clock-banner{display:flex;align-items:center;gap:14px;padding:16px 20px;border-radius:var(--tp-radius-lg);margin-bottom:20px}
.clock-banner.clocked-in{background:linear-gradient(135deg,#0d3320,#145a38);color:#bbf7d0;border:1px solid #1ea85a}
.clock-banner.clocked-out{background:linear-gradient(135deg,#1e293b,#334155);color:#cbd5e1;border:1px solid #475569}
.clock-banner .clock-dot{width:12px;height:12px;border-radius:50%;flex-shrink:0}
.clock-banner.clocked-in .clock-dot{background:#4ade80;animation:pulse-ring 2s ease-in-out infinite}
.clock-banner.clocked-out .clock-dot{background:#64748b}
.clock-banner .clock-label{font-size:.8rem;opacity:.8}
.clock-banner .clock-time{font-size:1.2rem;font-weight:700;font-family:var(--font-heading)}
.clock-banner .clock-job{font-size:.85rem;opacity:.85}

/* ---- ACTIVITY FEED ---- */
.activity-feed{list-style:none}
.activity-item{display:flex;gap:12px;padding:12px 0;border-bottom:1px solid var(--tp-border)}
.activity-item:last-child{border-bottom:none}
.activity-dot{width:8px;height:8px;border-radius:50%;margin-top:7px;flex-shrink:0}
.activity-text{font-size:.85rem;color:var(--tp-text-secondary)}
.activity-time{font-size:.75rem;color:var(--tp-text-muted);font-family:var(--font-mono)}

/* ---- HEALTH BAR ---- */
.eq-health-bar{display:flex;height:8px;border-radius:99px;overflow:hidden;background:var(--tp-border)}
.eq-health-bar .seg{transition:width .6s ease}
.eq-health-bar .seg.green{background:var(--tp-success)}
.eq-health-bar .seg.yellow{background:var(--tp-warning)}
.eq-health-bar .seg.red{background:var(--tp-danger)}

/* ---- TOAST ---- */
.toast-container{position:fixed;top:80px;right:24px;z-index:9999;display:flex;flex-direction:column;gap:8px}
.toast{padding:14px 20px;border-radius:var(--tp-radius);font-size:.85rem;font-weight:500;color:#fff;box-shadow:var(--tp-shadow-lg);animation:toast-in .3s ease-out;max-width:380px}
.toast.success{background:var(--tp-success)}.toast.error{background:var(--tp-danger)}.toast.warning{background:var(--tp-warning);color:var(--tp-text)}.toast.info{background:var(--tp-info)}
@keyframes toast-in{from{opacity:0;transform:translateX(40px)}to{opacity:1;transform:translateX(0)}}

/* ---- BOTTOM NAV (mobile) ---- */
.bottom-nav{display:none;position:fixed;bottom:0;left:0;right:0;height:var(--botnav-h);background:var(--tp-card);border-top:1px solid var(--tp-border);z-index:100;padding-bottom:env(safe-area-inset-bottom)}
.bottom-nav-inner{display:flex;height:100%;align-items:stretch}
.bottom-nav-item{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;color:var(--tp-text-muted);font-size:.65rem;font-weight:600;cursor:pointer;text-decoration:none;transition:color var(--tp-transition);-webkit-tap-highlight-color:transparent;position:relative}
.bottom-nav-item .bnav-icon{font-size:1.3rem}
.bottom-nav-item:hover,.bottom-nav-item.active{color:var(--tp-primary)}
.bottom-nav-item.active::before{content:'';position:absolute;top:0;left:20%;right:20%;height:3px;background:var(--tp-primary);border-radius:0 0 3px 3px}

/* ---- SIDEBAR OVERLAY ---- */
.sidebar-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:99;backdrop-filter:blur(2px)}

/* ---- EMPTY STATE ---- */
.empty-state{text-align:center;padding:48px 24px;color:var(--tp-text-muted)}
.empty-state .empty-icon{font-size:3rem;margin-bottom:12px}
.empty-state .empty-title{font-size:1.1rem;font-weight:600;color:var(--tp-text-secondary)}
.empty-state .empty-desc{font-size:.85rem;margin-top:4px}

/* ---- ALERTS ---- */
.alert{padding:12px 16px;border-radius:var(--tp-radius);font-size:.85rem;margin-bottom:16px;font-weight:500}
.alert-error{background:var(--tp-danger-light);color:var(--tp-danger);border:1px solid #f5c2c7}
.alert-success{background:var(--tp-success-light);color:var(--tp-success);border:1px solid #a3cfbb}

/* ---- MODAL ---- */
.modal{display:none;position:fixed;inset:0;z-index:200;align-items:center;justify-content:center}
.modal-overlay{position:absolute;inset:0;background:rgba(0,0,0,.5)}
.modal-box{background:var(--tp-card);border-radius:var(--tp-radius-lg);box-shadow:var(--tp-shadow-lg);width:90%;max-width:480px;position:relative;z-index:1}
.modal-header{padding:20px 24px;border-bottom:1px solid var(--tp-border);display:flex;justify-content:space-between;align-items:center}
.modal-body{padding:20px 24px}
.modal-close{background:none;border:none;font-size:1.3rem;cursor:pointer;color:var(--tp-text-muted)}

/* ---- SPINNER ---- */
.spinner{width:32px;height:32px;border:3px solid var(--tp-border);border-top-color:var(--tp-primary);border-radius:50%;animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

/* ---- PAGE ENTER ---- */
.page-enter{animation:page-fade .25s ease-out}
@keyframes page-fade{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}

/* ---- UTILS ---- */
.text-muted{color:var(--tp-text-muted)}.text-success{color:var(--tp-success)}.text-danger{color:var(--tp-danger)}.text-primary{color:var(--tp-primary)}
.font-mono{font-family:var(--font-mono)}.font-heading{font-family:var(--font-heading)}
.truncate{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mb-4{margin-bottom:16px}.mb-6{margin-bottom:24px}.mt-4{margin-top:16px}.mt-6{margin-top:24px}
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:16px}

/* ---- RESPONSIVE ---- */
@media(max-width:1024px){
  .sidebar{transform:translateX(-100%)}
  .sidebar.open{transform:translateX(0)}
  .sidebar-overlay.open{display:block}
  .main-content{margin-left:0}
  .topbar-hamburger{display:flex}
  .bottom-nav{display:block}
  .page-content{padding:16px;padding-bottom:calc(var(--botnav-h) + 24px)}
}
@media(max-width:640px){
  .grid-2{grid-template-columns:1fr}
}
@media(max-width:480px){
  .page-title{font-size:1.3rem}
  .metrics-grid{grid-template-columns:1fr 1fr;gap:10px}
  .metric-card{padding:14px}
  .metric-value{font-size:1.3rem}
  .action-btn{min-height:100px;padding:20px 12px}
  .action-btn .action-icon{font-size:1.8rem}
  .form-input,.form-select,.form-textarea{min-height:50px;font-size:1rem;padding:12px 16px}
}
