/* ============================================================
   WorkerHub.OS — Global Design System
   Dark Professional SaaS — Built for clarity and speed
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Background */
  --bg-base:       #0d0f12;
  --bg-surface:    #13161b;
  --bg-elevated:   #1a1e26;
  --bg-overlay:    #21262f;
  --bg-hover:      #272d38;

  /* Brand */
  --brand:         #f97316;
  --brand-dim:     rgba(249,115,22,.12);
  --brand-hover:   #ea580c;
  --brand-glow:    0 0 20px rgba(249,115,22,.25);

  /* Text */
  --txt-primary:   #f1f5f9;
  --txt-secondary: #94a3b8;
  --txt-muted:     #475569;
  --txt-disabled:  #2d3748;

  /* Border */
  --border:        #1e2530;
  --border-strong: #2a3244;

  /* Semantic */
  --green:         #10b981;
  --green-dim:     rgba(16,185,129,.12);
  --green-border:  rgba(16,185,129,.25);
  --yellow:        #f59e0b;
  --yellow-dim:    rgba(245,158,11,.12);
  --yellow-border: rgba(245,158,11,.25);
  --red:           #ef4444;
  --red-dim:       rgba(239,68,68,.12);
  --red-border:    rgba(239,68,68,.25);
  --blue:          #3b82f6;
  --blue-dim:      rgba(59,130,246,.12);
  --blue-border:   rgba(59,130,246,.25);
  --cyan:          #06b6d4;
  --cyan-dim:      rgba(6,182,212,.12);

  /* Shape */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Shadow */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow-md:  0 4px 16px rgba(0,0,0,.4);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.5);
  --shadow-card:0 2px 8px rgba(0,0,0,.35);

  /* Motion */
  --ease: cubic-bezier(.4,0,.2,1);
  --t-fast:  0.15s;
  --t-base:  0.25s;

  /* Font */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg-base);
  color: var(--txt-primary);
  font-family: var(--font);
  font-size: .9375rem;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: var(--font); }
img, svg { display: block; max-width: 100%; }
ul, ol { list-style: none; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--txt-muted); }

/* ══════════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 16px;
  font-size: .875rem;
  font-weight: 500;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: 0 2px 8px rgba(249,115,22,.2);
}
.btn-primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  box-shadow: 0 4px 16px rgba(249,115,22,.3);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--txt-secondary);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--txt-primary);
  border-color: var(--txt-muted);
}

.btn-ghost {
  background: transparent;
  color: var(--txt-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--txt-primary);
}

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border-color: var(--red-border);
}
.btn-danger:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.btn-success {
  background: var(--green-dim);
  color: var(--green);
  border-color: var(--green-border);
}
.btn-success:hover {
  background: var(--green);
  color: #fff;
}

/* Sizes */
.btn-sm {
  height: 30px;
  padding: 0 12px;
  font-size: .8rem;
  border-radius: var(--r-sm);
}
.btn-lg {
  height: 44px;
  padding: 0 24px;
  font-size: 1rem;
  border-radius: var(--r-lg);
}
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--r-md);
}
.btn-icon-sm {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: var(--r-sm);
}

/* ══════════════════════════════════════════════════════════
   BADGES
══════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  font-size: .75rem;
  font-weight: 600;
  border-radius: 99px;
  border: 1px solid;
  white-space: nowrap;
}
.badge-success { background: var(--green-dim);  color: var(--green);  border-color: var(--green-border); }
.badge-warning { background: var(--yellow-dim); color: var(--yellow); border-color: var(--yellow-border); }
.badge-danger  { background: var(--red-dim);    color: var(--red);    border-color: var(--red-border); }
.badge-info    { background: var(--blue-dim);   color: var(--blue);   border-color: var(--blue-border); }
.badge-brand   { background: var(--brand-dim);  color: var(--brand);  border-color: rgba(249,115,22,.25); }
.badge-neutral { background: var(--bg-elevated); color: var(--txt-secondary); border-color: var(--border-strong); }

/* ══════════════════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════════════════ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}
.form-label {
  font-size: .8125rem;
  font-weight: 500;
  color: var(--txt-secondary);
  letter-spacing: .01em;
}
.form-control {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--txt-primary);
  padding: 0 14px;
  height: 38px;
  font-size: .9rem;
  border-radius: var(--r-md);
  transition: border-color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
  outline: none;
  appearance: none;
}
.form-control:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(249,115,22,.15);
}
.form-control::placeholder { color: var(--txt-muted); }
.form-control:disabled     { opacity: .5; cursor: not-allowed; }

textarea.form-control {
  height: auto;
  min-height: 96px;
  padding: 10px 14px;
  resize: vertical;
}
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 36px;
  cursor: pointer;
}
.form-hint {
  font-size: .78rem;
  color: var(--txt-muted);
}
.form-error {
  font-size: .78rem;
  color: var(--red);
}

/* ── Two column form grid ──────────────────────────────────── */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}
@media (max-width: 600px) {
  .form-grid-2 { grid-template-columns: 1fr; }
}

/* ── Three column form grid ────────────────────────────────── */
.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px 20px;
}
@media (max-width: 768px) {
  .form-grid-3 { grid-template-columns: 1fr; }
}

/* ── Form action row ───────────────────────────────────────── */
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 8px;
}

/* ══════════════════════════════════════════════════════════
   ALERTS / FLASH MESSAGES
══════════════════════════════════════════════════════════ */
.alert-wrap { margin-bottom: 20px; display: flex; flex-direction: column; gap: 8px; }

.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: var(--r-md);
  border: 1px solid;
  font-size: .875rem;
  animation: alertIn .25s var(--ease);
}

.alert-icon { flex-shrink: 0; width: 18px; height: 18px; }
.alert-body { flex: 1; }
.alert-close {
  background: none; border: none; cursor: pointer;
  color: inherit; opacity: .6; padding: 2px;
  display: flex; align-items: center;
  transition: opacity var(--t-fast);
}
.alert-close:hover { opacity: 1; }

.alert-success { background: var(--green-dim); color: #6ee7b7; border-color: var(--green-border); }
.alert-danger  { background: var(--red-dim);   color: #fca5a5; border-color: var(--red-border); }
.alert-warning { background: var(--yellow-dim);color: #fcd34d; border-color: var(--yellow-border); }
.alert-info    { background: var(--blue-dim);  color: #93c5fd; border-color: var(--blue-border); }

@keyframes alertIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════
   CARD
══════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--txt-primary);
}
.card-subtitle {
  font-size: .8rem;
  color: var(--txt-muted);
  margin-top: 2px;
}
.card-body { padding: 20px; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════════
   TABLE
══════════════════════════════════════════════════════════ */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.table-scroll { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.table thead tr {
  background: var(--bg-elevated);
}
.table th {
  padding: 11px 16px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--txt-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.table td {
  padding: 13px 16px;
  color: var(--txt-secondary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  background: var(--bg-surface);
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td {
  background: var(--bg-elevated);
  color: var(--txt-primary);
}
.table td.td-main {
  color: var(--txt-primary);
  font-weight: 500;
}

/* ══════════════════════════════════════════════════════════
   PROGRESS BAR
══════════════════════════════════════════════════════════ */
.progress {
  display: flex;
  align-items: center;
  gap: 10px;
}
.progress-track {
  flex: 1;
  height: 6px;
  background: var(--bg-hover);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--brand);
  transition: width .5s var(--ease);
}
.progress-fill.fill-green  { background: var(--green); }
.progress-fill.fill-yellow { background: var(--yellow); }
.progress-fill.fill-red    { background: var(--red); }
.progress-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--txt-secondary);
  min-width: 36px;
  text-align: right;
}

/* ══════════════════════════════════════════════════════════
   TABS
══════════════════════════════════════════════════════════ */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 10px 16px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--txt-muted);
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.tab-btn:hover  { color: var(--txt-secondary); }
.tab-btn.active { color: var(--brand); border-color: var(--brand); }

.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeUp .2s var(--ease); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  gap: 12px;
}
.empty-icon {
  width: 48px;
  height: 48px;
  color: var(--txt-disabled);
  flex-shrink: 0;
}
.empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--txt-secondary);
}
.empty-desc {
  font-size: .85rem;
  color: var(--txt-muted);
  max-width: 300px;
}

/* ══════════════════════════════════════════════════════════
   UTILITY
══════════════════════════════════════════════════════════ */
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center{ align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.text-muted   { color: var(--txt-muted); }
.text-brand   { color: var(--brand); }
.text-green   { color: var(--green); }
.text-red     { color: var(--red); }
.text-yellow  { color: var(--yellow); }
.text-sm      { font-size: .8rem; }
.text-xs      { font-size: .72rem; }
.fw-600       { font-weight: 600; }
.fw-700       { font-weight: 700; }
.truncate     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* Icon sizing helpers */
.icon-16 { width: 16px; height: 16px; flex-shrink: 0; }
.icon-18 { width: 18px; height: 18px; flex-shrink: 0; }
.icon-20 { width: 20px; height: 20px; flex-shrink: 0; }

/* ── Notification Bell ───────────────────────────────────────── */
.notif-wrap { position: relative; }

.notif-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--txt-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s, color .15s;
}
.notif-btn svg { width: 17px; height: 17px; }
.notif-btn:hover { background: var(--bg-hover); border-color: var(--border-strong); color: var(--txt-primary); }
.notif-btn.active { border-color: var(--brand); color: var(--brand); background: var(--brand-dim); }

.notif-badge {
  position: absolute;
  top: -5px; right: -5px;
  min-width: 18px; height: 18px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-base);
  pointer-events: none;
}

.notif-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  overflow: hidden;
}
.notif-dropdown.open { display: block; }

.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.notif-head-title { font-weight: 700; font-size: .9rem; color: var(--txt-primary); }

.notif-list { max-height: 380px; overflow-y: auto; }

.notif-item {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
  text-decoration: none;
}
.notif-item:hover { background: var(--bg-elevated); }
.notif-item.unread { background: var(--brand-dim); border-left: 3px solid var(--brand); }
.notif-item.unread:hover { background: rgba(249,115,22,.18); }

.notif-icon {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.notif-icon svg { width: 16px; height: 16px; }
.notif-icon-low_stock   { background: var(--yellow-dim); color: var(--yellow); }
.notif-icon-deadline    { background: var(--blue-dim);   color: var(--blue); }
.notif-icon-overdue     { background: var(--red-dim);    color: var(--red); }
.notif-icon-invoice_due { background: var(--brand-dim);  color: var(--brand); }
.notif-icon-info        { background: var(--green-dim);  color: var(--green); }

.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: .825rem; font-weight: 600; color: var(--txt-primary); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-msg   { font-size: .775rem; color: var(--txt-muted); line-height: 1.4; }
.notif-time  { font-size: .7rem; color: var(--txt-disabled); margin-top: 3px; }

.notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  color: var(--txt-muted);
  font-size: .85rem;
  text-align: center;
}

/* ── Invoice / Mobile card extras ───────────────────────────── */
.mobile-card {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  margin-bottom: 10px;
}

@media (max-width: 768px) {
  .desktop-only-table { display: none !important; }
  .mobile-card        { display: block; }
}

