/* ── Renelec App — Shared Styles ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --primary:       #1e293b;
  --primary-dark:  #0f172a;
  --primary-mid:   #334155;
  --primary-pale:  #f8fafc;

  --accent:        #475569;
  --accent-pale:   #f1f5f9;

  --highlight:     #2563eb;
  --highlight-pale:#eff6ff;

  --red:           #dc2626;
  --red-pale:      #fff5f5;

  --grey-50:       #ffffff;
  --grey-100:      #f8fafc;
  --grey-200:      #f1f5f9;
  --grey-300:      #e2e8f0;
  --grey-400:      #cbd5e1;
  --grey-500:      #94a3b8;
  --grey-600:      #64748b;
  --grey-700:      #475569;
  --grey-800:      #334155;
  --grey-900:      #1e293b;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg:  0 16px 48px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  /* Legacy aliases */
  --green:       var(--primary);
  --green-light: var(--primary-mid);
  --green-pale:  var(--primary-pale);
  --orange:      var(--accent);
  --orange-pale: var(--accent-pale);
  --blue:        var(--highlight);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', Segoe UI, sans-serif;
  background: var(--grey-200);
  color: var(--grey-900);
  -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════
   AUTH PAGES
══════════════════════════════════ */
body.auth,
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--grey-200);
}

.auth-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--grey-300);
}

.auth-card h2 {
  color: var(--grey-900);
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 6px;
}

.auth-card .auth-hint {
  color: var(--grey-500);
  font-size: 14px;
  text-align: center;
  margin-bottom: 28px;
}

/* ══════════════════════════════════
   PIN DOTS
══════════════════════════════════ */
.pin-display {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 28px;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--grey-400);
  background: white;
  transition: all 0.2s;
}

.pin-dot.filled {
  background: var(--grey-900);
  border-color: var(--grey-900);
  transform: scale(1.1);
}

/* ══════════════════════════════════
   PIN PAD
══════════════════════════════════ */
.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.pin-btn {
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--grey-300);
  background: var(--grey-100);
  font-size: 20px;
  font-weight: 600;
  font-family: inherit;
  color: var(--grey-900);
  cursor: pointer;
  transition: all 0.12s;
  user-select: none;
}

.pin-btn:hover  { background: var(--grey-200); border-color: var(--grey-400); }
.pin-btn:active { background: var(--grey-900); color: white; border-color: var(--grey-900); transform: scale(0.95); }
.pin-btn.clr, .pin-clr { background: var(--red-pale); color: var(--red); border-color: #fecaca !important; font-size: 13px !important; font-weight: 700; }
.pin-btn.back, .pin-back { background: white !important; border-color: var(--grey-300) !important; font-size: 16px !important; }

.pin-error, .error {
  color: var(--red);
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  margin-top: 14px;
  min-height: 20px;
}

@keyframes shake {
  0%,100%{ transform: translateX(0); }
  20%,60%{ transform: translateX(-8px); }
  40%,80%{ transform: translateX(8px); }
}
.shake { animation: shake 0.4s ease; }

/* ══════════════════════════════════
   SEARCH BOX
══════════════════════════════════ */
.search-box {
  width: 100%;
  padding: 13px 16px 13px 44px;
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: inherit;
  background: var(--grey-100) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 14px center;
  transition: all 0.2s;
  color: var(--grey-900);
  margin-bottom: 10px;
}
.search-box:focus { border-color: var(--grey-700); outline: none; background-color: white; box-shadow: 0 0 0 3px rgba(30,41,59,0.08); }

/* ══════════════════════════════════
   WORKER LIST
══════════════════════════════════ */
.worker-list  { max-height: 340px; overflow-y: auto; border: 1px solid var(--grey-300); border-radius: var(--radius-md); background: white; }
.worker-item  { padding: 14px 18px; border-bottom: 1px solid var(--grey-200); cursor: pointer; display: flex; align-items: center; gap: 12px; transition: background 0.12s; }
.worker-item:last-child { border-bottom: none; }
.worker-item:hover { background: var(--grey-100); }
.worker-item .name { font-size: 15px; font-weight: 500; color: var(--grey-900); }
.worker-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--grey-800); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.list-empty { padding: 28px; text-align: center; color: var(--grey-500); font-size: 14px; }

/* ══════════════════════════════════
   APP HEADER
══════════════════════════════════ */
.app-header, .header {
  background: white;
  padding: 0 20px;
  height: 60px;
  border-bottom: 1px solid var(--grey-300);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand { display: flex; align-items: center; }
.worker-name  { font-size: 13px; color: var(--grey-600); text-align: right; }
.sign-out     { color: var(--red); font-size: 12px; text-decoration: none; display: block; margin-top: 2px; }

/* ══════════════════════════════════
   TABS
══════════════════════════════════ */
.tabs, .app-tabs {
  display: flex;
  background: white;
  border-bottom: 1px solid var(--grey-300);
}

.tab, .app-tab {
  flex: 1; padding: 14px 8px; text-align: center; cursor: pointer;
  font-weight: 600; font-size: 14px; color: var(--grey-500);
  border-bottom: 2px solid transparent; transition: all 0.2s; user-select: none;
}
.tab.qa-active, .app-tab.active-qa { color: var(--grey-900); border-bottom-color: var(--grey-900); }
.tab.hs-active, .app-tab.active-hs { color: var(--grey-700); border-bottom-color: var(--grey-700); }

/* ══════════════════════════════════
   DASHBOARD & MENU TILES (Professional Navy Theme)
══════════════════════════════════ */
.grid, .tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}

.tile, .big-tile {
  background: #1e293b; /* Professional Dark Navy */
  color: white;
  border-radius: 18px; /* Smooth rounded corners */
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 16px;
  min-height: 95px;
  /* Soft layered drop shadow for professional depth */
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.15), 0 2px 6px rgba(15, 23, 42, 0.1);
  transition: all 0.2s ease;
  line-height: 1.4;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.tile:hover, .big-tile:hover {
  transform: translateY(-3px); /* Subtle lift on hover */
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.25), 0 4px 10px rgba(15, 23, 42, 0.15);
  background: #27354f; /* Slightly lighter navy on hover */
}

.tile:active, .big-tile:active {
  transform: translateY(0); /* Press effect */
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

/* ══════════════════════════════════
   DRAFT BANNER
══════════════════════════════════ */
.draft-banner {
  background: white;
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  cursor: pointer;
  transition: background 0.15s;
  box-shadow: var(--shadow-sm);
}
.draft-banner:hover { background: var(--grey-100); }
.draft-banner .label, .draft-text { font-weight: 700; color: var(--grey-800); font-size: 14px; }
.draft-badge {
  background: var(--grey-800);
  color: white;
  border-radius: 20px;
  padding: 4px 14px;
  font-weight: 800;
  font-size: 13px;
}

/* ══════════════════════════════════
   SECTION LABEL
══════════════════════════════════ */
.section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--grey-500);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
  padding-left: 2px;
}

/* ══════════════════════════════════
   BUTTONS
══════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 12px 20px; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; border: none; transition: all 0.15s; text-decoration: none;
}
.btn-primary   { background: var(--grey-900); color: white; }
.btn-primary:hover  { background: var(--grey-800); }
.btn-secondary { background: var(--grey-100); color: var(--grey-800); border: 1px solid var(--grey-300); }
.btn-secondary:hover { background: var(--grey-200); }
.btn-danger    { background: var(--red-pale); color: var(--red); border: 1px solid #fecaca; }
.btn-danger:hover   { background: #fee2e2; }
.btn-orange    { background: var(--grey-700); color: white; }
.btn-full      { width: 100%; }
.btn-sm        { padding: 7px 14px; font-size: 12px; border-radius: var(--radius-sm); }

/* ══════════════════════════════════
   FORM ELEMENTS
══════════════════════════════════ */
.form-group  { margin-bottom: 16px; }
.form-label  { display: block; font-size: 13px; font-weight: 600; color: var(--grey-700); margin-bottom: 6px; }
.form-label .req { color: var(--red); }
.form-control {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--grey-300); border-radius: var(--radius-md);
  font-size: 15px; font-family: inherit;
  background: var(--grey-100); color: var(--grey-900);
  transition: all 0.2s; appearance: none;
}
.form-control:focus { border-color: var(--grey-700); outline: none; background: white; box-shadow: 0 0 0 3px rgba(30,41,59,0.08); }
textarea.form-control { min-height: 90px; resize: vertical; }

/* ══════════════════════════════════
   TOGGLE
══════════════════════════════════ */
.toggle-row  { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--grey-200); }
.toggle-row:last-child { border-bottom: none; }
.toggle-label { font-size: 14px; font-weight: 500; color: var(--grey-800); flex: 1; padding-right: 16px; }
.toggle       { position: relative; width: 50px; height: 26px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--grey-300); border-radius: 26px; cursor: pointer; transition: 0.3s; }
.toggle-slider:before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s; box-shadow: 0 1px 4px rgba(0,0,0,0.15); }
input:checked + .toggle-slider { background: var(--grey-800); }
input:checked + .toggle-slider:before { transform: translateX(24px); }
.toggle-status { font-size: 12px; font-weight: 600; min-width: 28px; text-align: right; }
.toggle-status.yes { color: var(--grey-800); }
.toggle-status.no  { color: var(--grey-400); }

/* ══════════════════════════════════
   CARD
══════════════════════════════════ */
.card { background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 14px; border: 1px solid var(--grey-200); }
.card-head { background: var(--grey-100); padding: 12px 18px; font-weight: 700; font-size: 11px; color: var(--grey-700); letter-spacing: 1px; text-transform: uppercase; border-bottom: 1px solid var(--grey-200); }
.card-body { padding: 16px 18px; }

/* ══════════════════════════════════
   PHOTO GRID
══════════════════════════════════ */
.photo-grid  { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-thumb { width: 88px; height: 88px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--grey-300); }
.photo-add   { width: 88px; height: 88px; border: 2px dashed var(--grey-300); border-radius: var(--radius-sm); background: var(--grey-100); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; color: var(--grey-500); font-size: 11px; gap: 4px; transition: all 0.15s; }
.photo-add:hover { border-color: var(--grey-700); color: var(--grey-700); background: var(--grey-200); }
.photo-add span { font-size: 22px; }
.photo-count { font-size: 12px; color: var(--grey-500); margin-top: 8px; }

/* ══════════════════════════════════
   BOTTOM BAR
══════════════════════════════════ */
.bottom-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; gap: 10px; padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: white; border-top: 1px solid var(--grey-200);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
}

/* ══════════════════════════════════
   SUCCESS OVERLAY
══════════════════════════════════ */
.success-overlay {
  position: fixed; inset: 0;
  background: var(--grey-900);
  display: none; flex-direction: column; align-items: center;
  justify-content: center; color: white; z-index: 999; padding: 32px;
}
.success-tick  { font-size: 80px; margin-bottom: 16px; }
.success-title { font-size: 28px; font-weight: 800; margin-bottom: 8px; }
.success-ref   { font-size: 15px; opacity: 0.6; margin-bottom: 36px; }

/* ══════════════════════════════════
   ADMIN LAYOUT
══════════════════════════════════ */
.admin-layout  { display: flex; min-height: 100vh; }
.admin-sidebar { width: 240px; background: var(--grey-900); color: white; flex-shrink: 0; display: flex; flex-direction: column; }
.admin-main    { flex: 1; overflow-y: auto; background: var(--grey-100); }

.sidebar-brand { padding: 22px 20px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-brand .sub { font-size: 11px; opacity: 0.4; margin-top: 8px; letter-spacing: 1px; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 10px 0; }
.nav-item    { display: flex; align-items: center; gap: 12px; padding: 11px 20px; font-size: 14px; font-weight: 500; cursor: pointer; transition: background 0.15s; color: rgba(255,255,255,0.6); text-decoration: none; }
.nav-item:hover  { background: rgba(255,255,255,0.07); color: white; }
.nav-item.active { background: rgba(255,255,255,0.10); color: white; border-left: 3px solid white; padding-left: 17px; }
.nav-item .icon  { font-size: 17px; width: 22px; }
.nav-section     { font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: rgba(255,255,255,0.25); padding: 16px 20px 6px; }

.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08); font-size: 12px; opacity: 0.4; }

/* ══════════════════════════════════
   ADMIN TOP BAR
══════════════════════════════════ */
.admin-topbar {
  background: white; padding: 0 28px; height: 60px;
  border-bottom: 1px solid var(--grey-200);
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow-sm);
}
.admin-topbar h1 { font-size: 18px; font-weight: 800; color: var(--grey-900); }
.topbar-actions  { display: flex; gap: 10px; align-items: center; }

/* ══════════════════════════════════
   KPI CARDS
══════════════════════════════════ */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; padding: 24px 28px 0; }
.kpi-card { background: white; border-radius: var(--radius-lg); padding: 20px 22px; box-shadow: var(--shadow-sm); border: 1px solid var(--grey-200); }
.kpi-label { font-size: 11px; font-weight: 700; color: var(--grey-500); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.kpi-value { font-size: 32px; font-weight: 800; color: var(--grey-900); line-height: 1; }
.kpi-sub   { font-size: 12px; color: var(--grey-400); margin-top: 4px; }
.kpi-card.green  { border-top: 3px solid var(--grey-700); }
.kpi-card.orange { border-top: 3px solid var(--grey-500); }
.kpi-card.red    { border-top: 3px solid var(--red); }
.kpi-card.blue   { border-top: 3px solid var(--grey-400); }

/* ══════════════════════════════════
   ADMIN CONTENT
══════════════════════════════════ */
.admin-content { padding: 24px 28px; }

/* ══════════════════════════════════
   FILTER BAR
══════════════════════════════════ */
.filter-bar { background: white; border-radius: var(--radius-lg); padding: 16px 20px; margin-bottom: 16px; box-shadow: var(--shadow-sm); border: 1px solid var(--grey-200); display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filter-group { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.filter-label { font-size: 11px; font-weight: 600; color: var(--grey-500); text-transform: uppercase; letter-spacing: 0.5px; }
.filter-control { padding: 9px 12px; border: 1px solid var(--grey-300); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; background: var(--grey-100); color: var(--grey-900); appearance: none; cursor: pointer; }
.filter-control:focus { border-color: var(--grey-700); outline: none; }

/* ══════════════════════════════════
   TABLE
══════════════════════════════════ */
.table-wrap  { background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); border: 1px solid var(--grey-200); overflow: hidden; }
.data-table  { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { background: var(--grey-50); padding: 12px 16px; text-align: left; font-size: 11px; font-weight: 700; color: var(--grey-500); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--grey-200); white-space: nowrap; }
.data-table td { padding: 13px 16px; border-bottom: 1px solid var(--grey-100); vertical-align: middle; color: var(--grey-800); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--grey-50); }

/* ══════════════════════════════════
   BADGES
══════════════════════════════════ */
.badge         { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; }
.badge-green   { background: #f0fdf4; color: #166534; }
.badge-orange  { background: var(--grey-200); color: var(--grey-700); }
.badge-red     { background: #fee2e2; color: #991b1b; }
.badge-grey    { background: var(--grey-200); color: var(--grey-600); }
.badge-blue    { background: var(--grey-100); color: var(--grey-700); }

/* ══════════════════════════════════
   MODAL
══════════════════════════════════ */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.5); z-index: 200; display: none; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(3px); }
.modal-overlay.open { display: flex; }
.modal { background: white; border-radius: var(--radius-xl); padding: 28px; width: 100%; max-width: 480px; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-head h3 { font-size: 18px; font-weight: 800; color: var(--grey-900); }
.modal-close { background: var(--grey-100); border: none; width: 32px; height: 32px; border-radius: 50%; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--grey-600); }
.modal-close:hover { background: var(--grey-200); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ══════════════════════════════════
   TOAST
══════════════════════════════════ */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--grey-900); color: white; padding: 12px 20px; border-radius: var(--radius-md); font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); z-index: 999; transform: translateY(80px); opacity: 0; transition: all 0.3s; }
.toast.show    { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--grey-800); }
.toast.error   { background: var(--red); }

/* ══════════════════════════════════
   RESPONSIVE
══════════════════════════════════ */
@media (max-width: 768px) {
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; }
  .kpi-grid { grid-template-columns: 1fr 1fr; padding: 16px; }
  .admin-content { padding: 16px; }
}