/* ════════════════════════════════════════
   FastTask — Design System Premium
   ════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');

:root {
  --blue: #0066FF;
  --blue-light: #3385FF;
  --blue-dim: rgba(0,102,255,0.10);
  --dark: #060810;
  --dark2: #0D1117;
  --dark3: #161B22;
  --surface: #F7F8FA;
  --surface2: #EEF0F4;
  --card: #FFFFFF;
  --border: rgba(0,0,0,0.07);
  --border-dark: rgba(255,255,255,0.08);
  --text: #0A0D14;
  --text2: #6B7280;
  --text3: #9CA3AF;
  --success: #10B981;
  --warning: #F59E0B;
  --error: #EF4444;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 100px;
  --shadow: 0 4px 24px rgba(0,0,0,0.07);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.10);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.13);
  --transition: all 0.22s cubic-bezier(0.4,0,0.2,1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--surface);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 10px; }

/* ── APP LAYOUT ── */
.app-layout { display: flex; height: 100vh; overflow: hidden; }
.main-content { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }

/* ── SIDEBAR ── */
.sidebar {
  width: 248px; min-width: 248px;
  background: var(--dark2);
  display: flex; flex-direction: column;
  padding: 24px 14px;
  border-right: 1px solid var(--border-dark);
  z-index: 10; overflow-y: auto;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 24px;
  border-bottom: 1px solid var(--border-dark);
  margin-bottom: 20px;
}
.logo-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 13px; color: #fff;
  flex-shrink: 0;
}
.logo-text { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 18px; color: #fff; }
.logo-text span { color: var(--blue); }
.role-badge {
  font-size: 10px; font-weight: 600; letter-spacing: .05em;
  padding: 3px 8px; border-radius: var(--radius-pill); margin-left: auto;
}
.badge-admin  { background: rgba(239,68,68,.15); color: #EF4444; }
.badge-client { background: var(--blue-dim); color: var(--blue); }
.nav-label {
  font-size: 10px; font-weight: 600; letter-spacing: .1em;
  color: rgba(255,255,255,.2); text-transform: uppercase;
  padding: 0 8px; margin: 14px 0 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 11px; border-radius: var(--radius-sm);
  color: rgba(255,255,255,.4); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: var(--transition); margin-bottom: 1px;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: rgba(255,255,255,.8); }
.nav-item.active { background: rgba(0,102,255,.18); color: #60A5FA; }
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-count {
  margin-left: auto; font-size: 11px; font-weight: 700;
  background: var(--blue); color: #fff;
  padding: 2px 7px; border-radius: var(--radius-pill); min-width: 22px; text-align: center;
}
.nav-count.red { background: var(--error); }
.sidebar-bottom {
  margin-top: auto; padding-top: 18px;
  border-top: 1px solid var(--border-dark);
}
.user-block {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 8px; border-radius: var(--radius-sm);
  cursor: pointer; transition: var(--transition);
}
.user-block:hover { background: rgba(255,255,255,.05); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--blue); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; color: #fff; flex-shrink: 0; letter-spacing: -.01em;
}
.user-name  { font-size: 13px; font-weight: 600; color: #fff; }
.user-role  { font-size: 11px; color: rgba(255,255,255,.3); }
.btn-logout {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.25); transition: var(--transition); padding: 4px; border-radius: 6px;
}
.btn-logout:hover { color: var(--error); background: rgba(239,68,68,.1); }

/* ── TOPBAR ── */
.topbar {
  padding: 18px 28px; background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 5;
  min-height: 68px;
}
.topbar-left .page-title { font-family: 'Syne', sans-serif; font-size: 19px; font-weight: 700; }
.topbar-left .page-sub   { font-size: 13px; color: var(--text2); margin-top: 1px; }
.topbar-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-pill);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: var(--transition); border: none; font-family: 'DM Sans', sans-serif;
  text-decoration: none; white-space: nowrap; letter-spacing: -.01em;
}
.btn-primary  { background: var(--blue); color: #fff; }
.btn-primary:hover  { background: var(--blue-light); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,102,255,.35); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface2); }
.btn-ghost  { background: transparent; color: var(--text2); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-danger { background: rgba(239,68,68,.08); color: var(--error); border: 1px solid rgba(239,68,68,.15); }
.btn-danger:hover { background: rgba(239,68,68,.15); }
.btn-sm     { padding: 7px 14px; font-size: 13px; }
.btn-xs     { padding: 5px 11px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ── CONTENT AREA ── */
.content { padding: 24px 28px; flex: 1; }
.section { display: none; flex-direction: column; flex: 1; }
.section.active { display: flex; flex-direction: column; }

/* ── STATS GRID ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: #fff; border-radius: var(--radius);
  padding: 20px 22px; border: 1px solid var(--border);
  position: relative; overflow: hidden; transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-label { font-size: 11px; font-weight: 600; color: var(--text2); letter-spacing: .05em; text-transform: uppercase; margin-bottom: 8px; }
.stat-value { font-family: 'Syne', sans-serif; font-size: 30px; font-weight: 700; line-height: 1; }
.stat-sub   { font-size: 12px; margin-top: 5px; }
.stat-up    { color: var(--success); }
.stat-down  { color: var(--error); }
.stat-icon {
  position: absolute; right: 18px; top: 18px;
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 18px; height: 18px; }
.ic-blue   { background: var(--blue-dim); color: var(--blue); }
.ic-green  { background: rgba(16,185,129,.1); color: var(--success); }
.ic-orange { background: rgba(245,158,11,.1); color: var(--warning); }
.ic-red    { background: rgba(239,68,68,.1); color: var(--error); }

/* ── CARD ── */
.card { background: #fff; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.card-header {
  padding: 16px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-title { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; }
.card-body  { padding: 20px 22px; }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.badge-active   { background: rgba(16,185,129,.1); color: var(--success); }
.badge-active .badge-dot { background: var(--success); animation: pulse 2s infinite; }
.badge-paused   { background: rgba(245,158,11,.1); color: var(--warning); }
.badge-paused .badge-dot { background: var(--warning); }
.badge-error    { background: rgba(239,68,68,.1); color: var(--error); }
.badge-error .badge-dot { background: var(--error); }
.badge-inactive { background: var(--surface); color: var(--text2); }
.badge-inactive .badge-dot { background: var(--text3); }
.badge-running  { background: rgba(0,102,255,.1); color: var(--blue); }
.badge-running .badge-dot { background: var(--blue); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ── TABLE ── */
table { width: 100%; border-collapse: collapse; }
thead { background: var(--surface); }
th { padding: 11px 18px; text-align: left; font-size: 11px; font-weight: 600; color: var(--text2); letter-spacing: .06em; text-transform: uppercase; border-bottom: 1px solid var(--border); }
td { padding: 13px 18px; font-size: 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(0,0,0,.012); }
.td-bold { font-weight: 500; }
.td-mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; background: var(--surface); padding: 3px 7px; border-radius: 5px; color: var(--text2); }

/* ── AUTOMATION CARD ── */
.auto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.auto-card {
  background: #fff; border-radius: var(--radius); border: 1px solid var(--border);
  padding: 22px; transition: var(--transition); position: relative; overflow: hidden;
}
.auto-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--blue); transform: scaleX(0); transform-origin: left; transition: var(--transition);
}
.auto-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.auto-card:hover::before { transform: scaleX(1); }
.auto-card-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.auto-icon { width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.auto-name { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.auto-desc { font-size: 13px; color: var(--text2); line-height: 1.5; margin-bottom: 16px; }
.auto-metrics { display: flex; gap: 16px; margin-bottom: 14px; }
.auto-metric-val { font-family: 'Syne', sans-serif; font-size: 22px; font-weight: 700; }
.auto-metric-lbl { font-size: 11px; color: var(--text2); margin-top: 1px; }
.auto-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; border-top: 1px solid var(--border);
}
.auto-last { font-size: 12px; color: var(--text3); }

/* ── PROGRESS ── */
.progress-bar { background: var(--surface); border-radius: var(--radius-pill); height: 5px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: var(--radius-pill); background: var(--blue); transition: width .8s ease; }
.progress-fill.green  { background: var(--success); }
.progress-fill.orange { background: var(--warning); }

/* ── ALERT ── */
.alert-item {
  display: flex; align-items: flex-start; gap: 13px;
  padding: 14px 16px; border-radius: var(--radius-sm); margin-bottom: 10px;
}
.alert-error   { background: rgba(239,68,68,.05); border: 1px solid rgba(239,68,68,.15); }
.alert-warning { background: rgba(245,158,11,.05); border: 1px solid rgba(245,158,11,.15); }
.alert-info    { background: var(--blue-dim); border: 1px solid rgba(0,102,255,.12); }
.alert-success { background: rgba(16,185,129,.06); border: 1px solid rgba(16,185,129,.18); }
.alert-icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 16px; }
.alert-content .alert-title { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.alert-content .alert-sub   { font-size: 12px; color: var(--text2); line-height: 1.5; }
.alert-time { margin-left: auto; font-size: 11px; color: var(--text3); white-space: nowrap; padding-top: 2px; }

/* ── FORM ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-field { margin-bottom: 16px; }
.form-field:last-child { margin-bottom: 0; }
.field-label { display: block; font-size: 13px; font-weight: 500; color: var(--text2); margin-bottom: 6px; }
.field-input, .field-select, .field-textarea {
  width: 100%; padding: 10px 13px;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px; font-family: 'DM Sans', sans-serif; color: var(--text);
  outline: none; transition: var(--transition);
}
.field-input:focus, .field-select:focus, .field-textarea:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,102,255,.09);
}
.field-textarea { resize: vertical; min-height: 80px; }
.field-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 15px; padding-right: 34px;
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(6,8,16,.75); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: #fff; border-radius: 20px; width: 100%; max-width: 540px;
  padding: 30px; max-height: 90vh; overflow-y: auto;
  transform: translateY(16px) scale(.97); transition: var(--transition);
  box-shadow: var(--shadow-lg);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.modal-title  { font-family: 'Syne', sans-serif; font-size: 19px; font-weight: 700; }
.modal-close  {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--surface); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text2); font-size: 16px; transition: var(--transition);
}
.modal-close:hover { background: var(--surface2); }
.modal-body { margin-bottom: 18px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }

/* ── SEARCH ── */
.search-wrap { position: relative; }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text3); width: 15px; pointer-events: none; }
.search-input {
  padding: 9px 13px 9px 33px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-pill); font-size: 13px; font-family: 'DM Sans', sans-serif;
  outline: none; width: 220px; transition: var(--transition); color: var(--text);
}
.search-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,102,255,.09); background: #fff; }

/* ── TOGGLE ── */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle { position: relative; width: 42px; height: 23px; cursor: pointer; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: #D1D5DB; border-radius: 12px; transition: var(--transition); }
.toggle-slider::before { content: ''; position: absolute; width: 17px; height: 17px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: var(--transition); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle input:checked + .toggle-slider { background: var(--blue); }
.toggle input:checked + .toggle-slider::before { transform: translateX(19px); }
.toggle-label { font-size: 14px; font-weight: 500; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 22px; right: 22px; z-index: 999;
  background: var(--dark); color: #fff;
  padding: 13px 18px; border-radius: 11px;
  font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  transform: translateY(80px); opacity: 0;
  transition: all .3s cubic-bezier(0.4,0,0.2,1);
  box-shadow: var(--shadow-lg); max-width: 320px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast-icon { width: 18px; height: 18px; flex-shrink: 0; }

/* ── LOADING ── */
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── LIVE INDICATOR ── */
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); display: inline-block; animation: pulse 2s infinite; }

/* ── MISC ── */
.two-col   { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.three-col { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.empty-state { text-align: center; padding: 56px 20px; color: var(--text2); }
.empty-icon  { font-size: 44px; margin-bottom: 14px; opacity: .3; }
.empty-title { font-family: 'Syne', sans-serif; font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-sub   { font-size: 13px; max-width: 260px; margin: 0 auto; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title  { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; }

/* ── TABS ── */
.tabs { display: flex; gap: 3px; padding: 3px; background: var(--surface); border-radius: var(--radius-pill); width: fit-content; margin-bottom: 20px; }
.tab { padding: 8px 16px; border-radius: var(--radius-pill); cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text2); transition: var(--transition); }
.tab.active { background: #fff; color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.07); }

/* ── N8N BLOCK ── */
.n8n-block {
  background: linear-gradient(135deg, var(--dark2) 0%, #1a1d2e 100%);
  border-radius: var(--radius); padding: 22px; border: 1px solid var(--border-dark); color: #fff;
}
.n8n-block .n8n-title { font-family: 'Syne',sans-serif; font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.n8n-block .n8n-sub   { font-size: 12px; color: rgba(255,255,255,.35); margin-bottom: 16px; }
.n8n-input {
  width: 100%; padding: 10px 13px; margin-bottom: 10px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-sm); color: #fff; font-size: 13px;
  font-family: 'DM Sans',sans-serif; outline: none; transition: var(--transition);
}
.n8n-input:focus { border-color: var(--blue); }
.n8n-label  { font-size: 11px; color: rgba(255,255,255,.35); display: block; margin-bottom: 5px; }
.n8n-status { display: flex; align-items: center; gap: 8px; padding: 10px 13px; background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.2); border-radius: var(--radius-sm); font-size: 13px; color: var(--success); }

/* ── COMPANY CARD ── */
.company-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 22px; transition: var(--transition);
  display: flex; align-items: center; gap: 14px;
}
.company-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.company-logo { width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center; font-family: 'Syne',sans-serif; font-weight: 800; font-size: 16px; color: #fff; flex-shrink: 0; }
.company-info   { flex: 1; min-width: 0; }
.company-name   { font-family: 'Syne',sans-serif; font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.company-meta   { font-size: 12px; color: var(--text2); }
.company-stats  { display: flex; gap: 18px; flex-shrink: 0; }
.cstat-val      { font-family: 'Syne',sans-serif; font-size: 17px; font-weight: 700; text-align: center; }
.cstat-lbl      { font-size: 10px; color: var(--text2); text-align: center; }
.company-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── ACTIVITY FEED ── */
.activity-item { display: flex; gap: 12px; align-items: flex-start; padding: 11px 22px; transition: var(--transition); }
.activity-item:hover { background: var(--surface); }
.act-dot-col { display: flex; flex-direction: column; align-items: center; padding-top: 4px; }
.act-dot  { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.act-line { width: 1px; background: var(--border); flex: 1; min-height: 22px; margin-top: 3px; }
.act-title  { font-size: 14px; font-weight: 500; margin-bottom: 2px; }
.act-meta   { font-size: 12px; color: var(--text2); }
.act-time   { font-size: 11px; color: var(--text3); margin-top: 1px; }

@media (max-width: 1100px) { .stats-grid { grid-template-columns: repeat(2,1fr); } .two-col { grid-template-columns: 1fr; } }
@media (max-width: 780px)  { .sidebar { width: 54px; min-width: 54px; } .nav-item span, .nav-label, .user-name, .user-role, .logo-text, .role-badge { display: none; } .content { padding: 16px; } .stats-grid { grid-template-columns: 1fr 1fr; } }

/* ════════════════════════════════════════
   MOBILE DESIGN — OPTIMIZED FOR PHONES
   ════════════════════════════════════════ */

@media (max-width: 640px) {
  /* Main layout - full vertical */
  .app-layout { 
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }
  
  /* Sidebar becomes BOTTOM navigation (Apple style) */
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: auto;
    border-right: none;
    border-top: 1px solid var(--border-dark);
    border-bottom: none;
    padding: 0;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    gap: 0;
    background: var(--dark);
    z-index: 100;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    padding-top: 8px;
  }
  
  /* Logo section - hidden on mobile */
  .sidebar-logo {
    display: none;
  }
  .logo-mark { 
    display: none;
  }
  .logo-text { 
    display: none !important;
  }
  .role-badge { 
    display: none !important;
  }
  
  /* Hide nav labels on mobile */
  .nav-label { display: none !important; }
  
  /* Nav items - Apple style bottom tab bar */
  .nav-item {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 4px;
    margin: 0;
    border: none;
    border-radius: 0;
    font-size: 10px;
    white-space: nowrap;
    transition: var(--transition);
    color: var(--text2);
    flex: 1;
    position: relative;
  }
  .nav-item:hover {
    color: var(--text);
  }
  .nav-item.active {
    color: var(--blue);
    background: transparent;
  }
  .nav-item svg {
    width: 24px;
    height: 24px;
    stroke-width: 2;
  }
  .nav-item span {
    display: block !important;
    font-size: 10px;
    font-weight: 500;
  }
  .nav-count { 
    display: flex !important;
    background: #EF4444;
    color: #fff;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 700;
    position: absolute;
    top: 0;
    right: 0;
    transform: rotate(-10deg);
  }
  
  /* Main content with space for bottom nav */
  .main-content {
    flex: 1;
    overflow-y: auto;
    height: auto;
    padding-bottom: 80px;
  }
  
  /* Section styling */
  .section {
    display: none;
  }
  .section.active {
    display: flex;
    flex-direction: column;
  }
  
  /* Content padding - less cramped */
  .content {
    padding: 16px;
    padding-left: 12px;
    gap: 16px;
    display: flex;
    flex-direction: column;
  }
  
  /* Topbar - clean Apple style - STICKY */
  .topbar {
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    padding-left: 12px;
    padding-right: 16px;
    background: var(--surface);
    border-radius: 0;
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--border);
    margin-left: 0;
    margin-right: 0;
    width: 100%;
  }
  .topbar-left, .topbar-right {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .page-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
  }
  .page-sub {
    font-size: 13px;
    color: var(--text2);
    margin-top: 0;
    font-weight: 500;
  }
  
  /* Stats grid - minimal */
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 16px;
  }
  .stat-card {
    padding: 16px;
    border-radius: 14px;
    position: relative;
    border: 1px solid var(--border);
    background: var(--surface2);
  }
  .stat-label {
    font-size: 11px;
    letter-spacing: 0.04em;
    color: var(--text2);
    margin-bottom: 6px;
    font-weight: 600;
    text-transform: uppercase;
  }
  .stat-value {
    font-size: 28px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
    color: var(--text);
  }
  .stat-sub {
    font-size: 12px;
    color: var(--text2);
    font-weight: 500;
  }
  .stat-icon {
    position: absolute;
    right: 16px;
    top: 16px;
    width: 44px;
    height: 44px;
    opacity: 0.12;
  }
  
  /* Cards */
  .card {
    padding: 16px;
    border-radius: 14px;
    margin-bottom: 12px;
    border: 1px solid var(--border-dark);
  }
  .card-header {
    padding: 0 0 14px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
  }
  .card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
  }
  .card-body {
    padding: 0;
  }
  
  /* Tables converted to cards */
  table {
    width: 100%;
  }
  table thead {
    display: none;
  }
  table tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  table tr {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
  }
  table td {
    padding: 6px 0;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  table td:first-child {
    font-weight: 600;
    color: var(--text);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
  }
  table .btn {
    display: inline-block;
    padding: 8px 12px;
    font-size: 11px;
    margin-top: 8px;
  }
  
  /* Forms - Apple style */
  .form-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .field-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.2px;
  }
  .field-input, .field-select, .field-textarea {
    padding: 14px;
    font-size: 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    min-height: 48px;
    background: var(--card);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  }
  .field-input::placeholder {
    color: var(--text3);
  }
  .field-input:focus,
  .field-select:focus,
  .field-textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-dim);
  }
  
  /* Buttons - Apple system style */
  .btn {
    padding: 14px 18px;
    font-size: 14px;
    min-height: 48px;
    border-radius: 12px;
    font-weight: 600;
    transition: var(--transition);
    border: none;
    cursor: pointer;
  }
  .btn-primary {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--blue);
    color: #fff;
  }
  .btn-primary:active {
    opacity: 0.8;
  }
  .btn-secondary {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
  }
  .btn-secondary:hover {
    background: var(--surface2);
  }
  .btn-xs {
    padding: 8px 14px;
    font-size: 12px;
    min-height: 36px;
    display: inline-flex;
    width: auto;
  }
  
  /* Modals - Apple sheet style */
  .modal-overlay {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    background: rgba(0, 0, 0, 0.3);
  }
  .modal {
    width: 100% !important;
    max-height: 90vh;
    border-radius: 24px 24px 0 0;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
  }
  @keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  .modal-header {
    padding: 18px 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--card);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .modal-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.4px;
  }
  .modal-close {
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
  }
  .modal-body {
    padding: 16px;
  }
  .modal-footer {
    padding: 14px 16px;
    gap: 10px;
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border);
  }
  .modal-footer .btn {
    width: 100%;
  }
  
  /* Company cards */
  .company-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
    gap: 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--card);
  }
  .company-logo {
    width: 44px;
    height: 44px;
    font-size: 16px;
    border-radius: 12px;
  }
  .company-info {
    width: 100%;
  }
  .company-stats {
    width: 100%;
    justify-content: space-around;
  }
  .company-actions {
    width: 100%;
    gap: 10px;
  }
  
  /* Alert items */
  .alert-item {
    padding: 14px;
    border-radius: 12px;
    margin-bottom: 12px;
    display: flex;
    gap: 12px;
    border: 1px solid var(--border);
    background: var(--surface2);
  }
  .alert-icon {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 2px;
  }
  .alert-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
  }
  .alert-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
  }
  .alert-sub {
    font-size: 12px;
    color: var(--text2);
    line-height: 1.4;
  }
  .alert-time {
    font-size: 11px;
    color: var(--text3);
  }
  
  /* Toast */
  #toast {
    left: 12px !important;
    right: 12px !important;
    bottom: 20px !important;
    max-width: none;
    border-radius: 10px;
  }
  
  /* Empty state */
  .empty-state {
    padding: 40px 16px;
    text-align: center;
  }
  .empty-icon {
    font-size: 48px;
    margin-bottom: 14px;
  }
  .empty-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
  }
  .empty-sub {
    font-size: 13px;
    color: var(--text2);
    line-height: 1.5;
  }
  
  /* Badges */
  .badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 6px;
  }
  
  /* Hide bottom sidebar on mobile */
  .sidebar-bottom {
    display: none;
  }
  
  /* Hide user info in sidebar */
  .user-name, .user-role {
    display: none;
  }
  
  /* Search wrap */
  .search-wrap {
    width: 100%;
    display: flex;
    align-items: center;
    position: relative;
  }
  .search-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  }
  .search-input::placeholder {
    color: var(--text3);
  }
  .search-icon {
    display: none;
  }
  
  /* Two column to one */
  .two-col {
    grid-template-columns: 1fr;
  }
  
  /* MB utilities */
  .mb-6 { margin-bottom: 16px; }
  
  /* Section header */
  .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 0;
  }
  .section-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.3px;
  }
}
