/* ===================================================
   SecureCRM Portal – Design System
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* --- CSS Variables --------------------------------- */
:root {
  --bg:          #F6F8FB;
  --card:        #FFFFFF;
  --primary:     #C69C3B;
  --primary-h:   #A57C26;
  --primary-l:   #FDF9F1;
  --sidebar:     #1F2127;
  --sidebar-h:   #2C2F36;
  --sidebar-act: #C69C3B;
  --success:     #16A34A;
  --success-l:   #F0FDF4;
  --warning:     #F59E0B;
  --warning-l:   #FFFBEB;
  --danger:      #DC2626;
  --danger-l:    #FEF2F2;
  --text:        #111827;
  --text-2:      #6B7280;
  --text-3:      #9CA3AF;
  --border:      #E5E7EB;
  --border-2:    #F3F4F6;
  --radius:      10px;
  --radius-lg:   14px;
  --shadow:      0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:   0 4px 12px rgba(0,0,0,.08);
  --sidebar-w:   240px;
  --sidebar-collapsed-w: 72px;
  --topbar-h:    60px;
  --font:        'Inter', 'Segoe UI', system-ui, sans-serif;
  --transition:  all .18s ease;
}

/* --- Reset ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font); }
ul, ol { list-style: none; }
input, textarea, select { font-family: var(--font); }

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

/* --- Sidebar --------------------------------------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: width .2s ease, transform .25s ease, box-shadow .2s ease;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-logo {
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.brand-lockup {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}
.brand-lockup:hover {
  text-decoration: none;
}
.brand-logo-full {
  width: 100%;
  max-width: 200px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}
.brand-logo-mark {
  display: none;
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}
.sidebar-logo .logo-text {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.3px;
}
.sidebar-logo .logo-badge {
  margin-left: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.sidebar-section {
  padding: 20px 0 0;
  flex: 1;
}
.sidebar-label {
  padding: 0 20px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
}
.sidebar-nav { padding: 0 10px; }
.sidebar-nav li { margin-bottom: 2px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,.65);
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.sidebar-nav a:hover {
  background: rgba(255,255,255,.07);
  color: #fff;
  text-decoration: none;
}
.sidebar-nav a.active {
  background: var(--primary);
  color: #fff;
}
.sidebar-nav .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: .9;
}
.sidebar-nav .badge-count {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  line-height: 1.6;
}
.sidebar-nav .nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,.07);
  margin: 14px 20px;
}
.sidebar-footer {
  padding: 16px 10px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
}
.sidebar-user:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.sidebar-user .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name {
  font-size: 13px; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user .user-role {
  font-size: 11px; color: rgba(255,255,255,.4);
}

body.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-w);
}
body.sidebar-collapsed .sidebar-logo {
  padding: 0 16px;
  justify-content: center;
}
body.sidebar-collapsed .brand-lockup {
  justify-content: center;
}
body.sidebar-collapsed .brand-logo-full {
  display: none;
}
body.sidebar-collapsed .brand-logo-mark {
  display: block;
}
body.sidebar-collapsed .sidebar-logo .logo-text,
body.sidebar-collapsed .sidebar-logo .logo-badge,
body.sidebar-collapsed .sidebar-label,
body.sidebar-collapsed .sidebar-user .user-info,
body.sidebar-collapsed .sidebar-footer form,
body.sidebar-collapsed .sidebar-company {
  display: none;
}
body.sidebar-collapsed .sidebar-nav {
  padding: 0 8px;
}
body.sidebar-collapsed .sidebar-nav a {
  justify-content: center;
  gap: 0;
  padding: 10px;
  font-size: 0;
}
body.sidebar-collapsed .sidebar-nav .icon {
  width: 20px;
  height: 20px;
}
body.sidebar-collapsed .sidebar-nav .nav-badge,
body.sidebar-collapsed .sidebar-nav .badge-count {
  display: none;
}
body.sidebar-collapsed .sidebar-user {
  justify-content: center;
  padding: 10px;
}
body.sidebar-collapsed .topbar {
  left: var(--sidebar-collapsed-w);
}
body.sidebar-collapsed .main {
  margin-left: var(--sidebar-collapsed-w);
}
body.sidebar-unpinned .sidebar {
  transform: translateX(-100%);
}
body.sidebar-unpinned .topbar {
  left: 0;
}
body.sidebar-unpinned .main {
  margin-left: 0;
}
body.sidebar-unpinned.sidebar-floating-open .sidebar {
  transform: none;
  box-shadow: var(--shadow-md);
}
body.sidebar-floating-open .sidebar-overlay {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .35);
  z-index: 99;
}

/* --- Topbar ---------------------------------------- */
.topbar {
  position: fixed;
  top: 0; left: var(--sidebar-w); right: 0;
  height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 90;
  transition: left .2s ease;
}
.topbar-sidebar-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.topbar-toggle,
.topbar-pin {
  display: flex;
  background: none; border: none;
  width: 36px; height: 36px;
  border-radius: var(--radius);
  align-items: center; justify-content: center;
  color: var(--text-2);
  transition: var(--transition);
}
.topbar-toggle:hover,
.topbar-pin:hover { background: var(--bg); }
.topbar-pin.is-pinned {
  color: var(--primary);
  background: var(--primary-l);
}
.topbar-pin .pin-off { display: none; }
.topbar-pin:not(.is-pinned) .pin-on { display: none; }
.topbar-pin:not(.is-pinned) .pin-off { display: block; }
.topbar-breadcrumb {
  display: flex; align-items: center; gap: 6px;
  color: var(--text-2); font-size: 13px;
}
.topbar-breadcrumb .sep { color: var(--border); }
.topbar-breadcrumb .current { color: var(--text); font-weight: 500; }
.topbar-brand {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.topbar-brand:hover {
  text-decoration: none;
}
.topbar-brand img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
}
.topbar-right {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
}
.topbar-icon-btn {
  position: relative;
  width: 36px; height: 36px;
  border-radius: var(--radius);
  border: none;
  background: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  transition: var(--transition);
}
.topbar-icon-btn:hover { background: var(--bg); }
.topbar-icon-btn .notif-dot {
  position: absolute; top: 7px; right: 7px;
  width: 8px; height: 8px;
  background: var(--danger);
  border: 2px solid var(--card);
  border-radius: 50%;
}
.notification-menu {
  position: relative;
}
.notification-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 13px;
  display: none;
  align-items: center;
  justify-content: center;
}
.notification-count.is-visible {
  display: flex !important;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 120;
  display: none;
  min-width: 260px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .14);
}
.dropdown-menu.open {
  display: block;
}
.notification-dropdown {
  width: 360px;
  max-height: 480px;
  overflow-y: auto;
  overflow-x: hidden;
}
.notification-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.notification-dropdown-header strong {
  font-size: 13px;
}
.notification-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}
.notification-dropdown-header button {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
}
.notification-dropdown-header button.danger {
  color: var(--danger);
}
.notification-dropdown-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: stretch;
  margin: 0;
  border-bottom: 1px solid var(--border-2);
}
.notification-dropdown-item:last-child {
  border-bottom: 0;
}
.notification-dropdown-item.is-read {
  opacity: .74;
}
.notification-dropdown-item.is-unread .notification-read-form button {
  background: rgba(198, 156, 59, .06);
}
.notification-read-form {
  min-width: 0;
}
.notification-read-form button,
.notification-local-link {
  width: 100%;
  display: block;
  border: 0;
  background: #fff;
  padding: 12px 14px;
  text-align: left;
  text-decoration: none;
}
.notification-read-form button:hover,
.notification-local-link:hover {
  background: #F8FAFC;
  text-decoration: none;
}
.notification-delete-form,
.notification-local-delete {
  display: flex;
  align-items: stretch;
}
.notification-delete-form button,
.notification-local-delete,
.notification-delete-btn {
  width: 34px;
  border: 0;
  border-left: 1px solid var(--border-2);
  background: transparent;
  color: #94A3B8;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.notification-delete-form button:hover,
.notification-delete-btn:hover {
  background: #FEF2F2;
  color: var(--danger);
}
.notification-dropdown-item strong,
.notification-dropdown-item span,
.notification-dropdown-item small {
  display: block;
}
.notification-dropdown-item strong {
  margin-bottom: 4px;
  color: #0F172A;
  font-size: 12px;
}
.notification-dropdown-item span {
  color: #475569;
  font-size: 12px;
  line-height: 1.45;
}
.notification-dropdown-item small {
  margin-top: 5px;
  color: #94A3B8;
  font-size: 10px;
}
.notification-empty {
  padding: 18px 14px;
  color: #94A3B8;
  font-size: 12px;
  text-align: center;
}
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  border: none; background: none;
  transition: var(--transition);
}
.topbar-user:hover { background: var(--bg); }
.topbar-user .avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
}
.topbar-user .u-name { font-size: 13px; font-weight: 500; color: var(--text); }
.topbar-user .u-caret { color: var(--text-3); }

/* --- Main Content ---------------------------------- */
.main {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .2s ease;
}
.content {
  padding: 28px 28px 40px;
  flex: 1;
}

/* ===================================================
   PAGE HEADER
   =================================================== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.page-header-left h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.page-header-left p {
  font-size: 13px;
  color: var(--text-2);
}
.page-header-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ===================================================
   CARDS
   =================================================== */
.card {
  background: var(--card);
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.04);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}
.card-header {
  padding: 16px 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.card-body { padding: 20px; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* --- Stat Cards ------------------------------------ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.dashboard-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
}
.user-form-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}
.stat-card {
  background: var(--card);
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.04);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
  padding: 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.stat-icon {
  display: none !important; /* Icons removed as requested */
}
.stat-icon.blue   { background: var(--primary-l); color: var(--primary); }
.stat-icon.green  { background: var(--success-l); color: var(--success); }
.stat-icon.orange { background: var(--warning-l); color: var(--warning); }
.stat-icon.red    { background: var(--danger-l);  color: var(--danger);  }
.stat-info { flex: 1; }
.stat-value {
  font-size: 26px; font-weight: 700;
  color: var(--text); line-height: 1.1;
}
.stat-label {
  font-size: 13px; color: #475569;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 3px;
}
.stat-trend {
  font-size: 11px; font-weight: 500;
  margin-top: 6px;
  display: flex; align-items: center; gap: 3px;
}

/* --- Admin Dashboard Stat Cards ------------------- */
.admin-stat-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}
.admin-stat-card {
  --stat-accent: #C69C3B;
  --stat-soft: #FDF9F1;
  position: relative;
  min-width: 0;
  min-height: 148px;
  padding: 24px;
  align-items: flex-start;
  gap: 16px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: 20px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
  transition: transform .2s ease, box-shadow .2s ease;
  background: #ffffff;
}
.admin-stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
}
.admin-stat-card.stat-green {
  --stat-accent: #16A34A;
  --stat-soft: #F0FDF4;
}
.admin-stat-card.stat-orange {
  --stat-accent: #D97706;
  --stat-soft: #FFFBEB;
}
.admin-stat-card.stat-purple {
  --stat-accent: #7C3AED;
  --stat-soft: #F5F3FF;
}
.admin-stat-card .stat-icon {
  display: none !important;
}
.admin-stat-card .stat-info {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
}
.admin-stat-card .stat-label {
  margin: 0 0 5px;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.admin-stat-card .stat-value {
  color: #0F172A;
  font-size: 30px;
  font-weight: 750;
  line-height: 1;
  letter-spacing: -.03em;
}
.admin-stat-card .stat-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 18px;
  font-size: 11px;
  white-space: nowrap;
}
.admin-stat-card .stat-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: #475569;
  font-weight: 600;
}
.admin-stat-card .stat-status.is-success { color: #15803D; }
.admin-stat-card .stat-status.is-warning { color: #B45309; }
.admin-stat-card .status-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 12%, transparent);
}
.admin-stat-card .stat-context {
  overflow: hidden;
  color: #94A3B8;
  text-overflow: ellipsis;
}
.stat-trend.up   { color: var(--success); }
.stat-trend.down { color: var(--danger);  }

/* ===================================================
   BUTTONS
   =================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-h); border-color: var(--primary-h); }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover:not(:disabled) { background: #15803D; border-color: #15803D; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #B91C1C; border-color: #B91C1C; }
.btn-ghost { background: transparent; color: var(--text-2); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }
.btn-icon { padding: 7px; }
.btn-loading .btn-spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===================================================
   FORMS
   =================================================== */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  transition: all 0.2s ease;
  outline: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37,99,235,.1);
}
.form-control::placeholder { color: var(--text-3); }
.form-control:disabled { background: var(--bg); color: var(--text-2); cursor: not-allowed; }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
.form-error { display: block; font-size: 12px; color: var(--danger); margin-top: 4px; }
.form-hint  { display: block; font-size: 12px; color: var(--text-2); margin-top: 4px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.input-group { position: relative; }
.input-group .form-control { padding-right: 40px; }
.input-icon-right {
  position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  background: none; border: none;
  display: flex; align-items: center;
  cursor: pointer;
}

.checkbox-group { display: flex; align-items: center; gap: 8px; }
.checkbox-group input[type=checkbox] {
  width: 15px; height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
}
.checkbox-group label { font-size: 13px; color: var(--text); cursor: pointer; }

.form-section {
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.form-section:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.form-section-title {
  font-size: 13px; font-weight: 600;
  color: var(--text); margin-bottom: 14px;
}

/* File Upload Area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
  background: var(--bg);
}
.upload-area:hover, .upload-area.drag-over {
  border-color: var(--primary);
  background: var(--primary-l);
}
.upload-area .upload-icon { margin: 0 auto 12px; color: var(--text-3); }
.upload-area .upload-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.upload-area .upload-sub { font-size: 12px; color: var(--text-2); }
.upload-area .upload-types { font-size: 11px; color: var(--text-3); margin-top: 8px; }
.upload-file-preview {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #F8FAFC;
}
.upload-clear-btn {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--text-3);
  font-size: 18px;
  line-height: 1;
}
.upload-done-icon {
  display: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.upload-file-preview.is-complete .upload-done-icon {
  display: inline-flex;
}
.upload-progress-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}
.upload-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #E2E8F0;
}
.upload-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--success));
  transition: width .15s ease;
}
.upload-progress-row strong {
  color: var(--text-2);
  font-size: 11px;
  text-align: right;
}

/* ===================================================
   TABLES
   =================================================== */
.show-mobile { display: none; }
.table-wrapper { overflow-x: auto; }
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-2);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-2);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg); }
.table-actions { display: flex; align-items: center; gap: 4px; }

/* ===================================================
   BADGES / STATUS
   =================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.badge-success  { background: var(--success-l); color: var(--success); }
.badge-warning  { background: var(--warning-l); color: #92400E; }
.badge-danger   { background: var(--danger-l);  color: var(--danger);  }
.badge-primary  { background: var(--primary-l); color: var(--primary); }
.badge-neutral  { background: var(--bg);        color: var(--text-2);  border: 1px solid var(--border); }
.badge-dot::before {
  content: '';
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ===================================================
   SEARCH & FILTER BAR
   =================================================== */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-box {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 360px;
}
.search-box .search-icon {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
.search-box input {
  width: 100%;
  padding: 10px 14px 10px 34px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37,99,235,.1); }
.search-box input::placeholder { color: var(--text-3); }
.filter-select {
  padding: 10px 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  outline: none;
  cursor: pointer;
  appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.filter-select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37,99,235,.1); }

select option {
  padding: 8px 12px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
}

.toolbar-right { margin-left: auto; display: flex; gap: 8px; }

/* ===================================================
   PAGINATION
   =================================================== */
.pagination {
  display: flex; align-items: center; gap: 4px;
  justify-content: center;
  padding: 4px 0;
}
.pagination a, .pagination span {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  border: 1px solid var(--border);
  background: #fff;
  transition: var(--transition);
  text-decoration: none;
}
.pagination a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.pagination .active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .disabled { opacity: .4; pointer-events: none; }
.pagination svg,
[aria-label="Pagination Navigation"] svg {
  width: 16px !important;
  height: 16px !important;
  max-width: 16px;
  max-height: 16px;
}

/* ===================================================
   EMPTY STATE
   =================================================== */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-2);
}
.empty-state svg { margin: 0 auto 16px; opacity: .35; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; margin-bottom: 20px; }

/* ===================================================
   MODAL
   =================================================== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 999;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0,0,0,.15);
  width: 100%; max-width: 480px;
  transform: translateY(8px);
  transition: transform .2s;
}
.modal-backdrop.open .modal { transform: none; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-3); cursor: pointer; padding: 2px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
  background: var(--bg);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ===================================================
   TOAST NOTIFICATIONS
   =================================================== */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 300;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  padding: 12px 16px;
  display: flex; align-items: flex-start; gap: 10px;
  min-width: 280px; max-width: 360px;
  pointer-events: all;
  animation: slideIn .25s ease;
}
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }
.toast-icon { flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.toast-msg   { font-size: 12px; color: var(--text-2); }
.toast-close { background: none; border: none; color: var(--text-3); cursor: pointer; padding: 0; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--success); }
.toast.error   .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info    .toast-icon { color: var(--primary); }

/* ===================================================
   COMPANY / FILE CARDS (LIST VARIANTS)
   =================================================== */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.info-item .info-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); margin-bottom: 4px; }
.info-item .info-value { font-size: 14px; color: var(--text); font-weight: 500; }

/* ===================================================
   TICKET THREAD
   =================================================== */
.ticket-thread { display: flex; flex-direction: column; gap: 16px; }
.thread-msg {
  display: flex; gap: 12px;
}
.thread-msg .t-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.thread-msg.staff .t-avatar { background: var(--sidebar); }
.thread-bubble {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}
.thread-msg.staff .thread-bubble { background: var(--primary-l); border-color: #BFDBFE; }
.thread-meta {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.thread-author { font-size: 13px; font-weight: 600; color: var(--text); }
.thread-time   { font-size: 11px; color: var(--text-3); }
.thread-body   { font-size: 13px; color: var(--text); line-height: 1.6; }

/* ===================================================
   NOTIFICATIONS
   =================================================== */
.notif-list { display: flex; flex-direction: column; }
.notif-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-2);
  transition: var(--transition);
  cursor: pointer;
}
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: var(--primary-l); }
.notif-item.unread:hover { background: #DBEAFE; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 5px; }
.notif-dot.read { background: transparent; border: 1.5px solid var(--border); }
.notif-body { flex: 1; }
.notif-text { font-size: 13px; color: var(--text); line-height: 1.5; }
.notif-time { font-size: 11px; color: var(--text-3); margin-top: 3px; }

/* ===================================================
   ACTIVITY LOG
   =================================================== */
.activity-list { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-2);
}
.activity-icon {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
}
.activity-body { flex: 1; }
.activity-text { font-size: 13px; color: var(--text); }
.activity-text strong { font-weight: 600; }
.activity-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ===================================================
   TABS
   =================================================== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  background: none; border-left: none; border-right: none; border-top: none;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* --- Company Detail Actions / Tabs ---------------- */
.company-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.company-actions form {
  margin: 0;
}
.company-action-btn {
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.btn-status-stop {
  color: #B45309;
  background: #FFFBEB;
  border-color: #FDE68A;
}
.btn-status-stop:hover:not(:disabled) {
  color: #92400E;
  background: #FEF3C7;
  border-color: #FCD34D;
}
.company-tabs {
  gap: 6px;
  margin: 0 0 12px;
  padding: 5px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}
.company-tabs .tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 8px 13px;
  margin: 0;
  border: 0;
  border-radius: 8px;
  color: #64748B;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.company-tabs .tab:hover {
  color: #334155;
  background: #F8FAFC;
}
.company-tabs .tab.active {
  color: #1D4ED8;
  background: #EFF6FF;
  box-shadow: inset 0 0 0 1px #DBEAFE;
}
.company-tabs .tab-count {
  display: inline-flex;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #64748B;
  background: #F1F5F9;
  font-size: 10px;
  line-height: 1;
}
.company-tabs .tab.active .tab-count {
  color: #1D4ED8;
  background: #DBEAFE;
}
.company-tab-card {
  overflow: hidden;
}
.company-panel-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 16px 16px 0;
}
.company-panel-toolbar .btn {
  min-height: 34px;
  padding: 8px 13px;
  border-radius: 8px;
  font-weight: 600;
}

/* ===================================================
   CRM JOB TRACKING
   =================================================== */
.jobs-header {
  margin-bottom: 16px;
}
.file-upload-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}
.jobs-shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  min-height: calc(100vh - var(--topbar-h) - 96px);
}
.jobs-filter-panel {
  position: sticky;
  top: calc(var(--topbar-h) + 20px);
  height: calc(100vh - var(--topbar-h) - 96px);
  max-height: none;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 14px;
}
.jobs-filter-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
}
.jobs-filter-title a {
  font-size: 11px;
  font-weight: 600;
}
.job-filter-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 9px 10px;
  border-radius: 7px;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.job-filter-tab:hover {
  background: #F8FAFC;
  text-decoration: none;
}
.job-filter-tab.active {
  color: var(--primary);
  background: var(--primary-l);
}
.job-filter-tab strong {
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: #F1F5F9;
  color: #64748B;
  font-size: 11px;
  line-height: 22px;
  text-align: center;
}
.job-filter-tab.active strong {
  background: #DBEAFE;
  color: var(--primary);
}
.jobs-filter-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.jobs-filter-form .form-label {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 700;
}
.job-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  color: #475569;
  font-size: 12px;
}
.job-radio input {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
}
.job-list-card {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.job-list-card-title {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}
.job-option-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  color: #64748B;
  font-size: 12px;
}
.job-option-row strong {
  color: #334155;
}
.jobs-main {
  min-width: 0;
}
.jobs-searchbar {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 48px;
  min-height: 50px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}
.jobs-selected {
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-right: 1px solid var(--border);
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}
.jobs-searchbar input {
  width: 100%;
  border: 0;
  outline: none;
  padding: 0 14px;
  color: var(--text);
  font-size: 13px;
}
.job-search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-left: 1px solid var(--border);
  background: #F8FAFC;
  color: #64748B;
}
.jobs-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.jobs-stats div {
  min-height: 62px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.jobs-stats strong {
  display: block;
  color: #0F172A;
  font-size: 21px;
  line-height: 1;
}
.jobs-stats span {
  display: block;
  margin-top: 5px;
  color: #64748B;
  font-size: 11px;
  font-weight: 600;
}
.job-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.job-result-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 230px;
  gap: 14px;
  align-items: center;
  min-height: 104px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.job-result-card-detailed {
  grid-template-columns: minmax(0, 1fr) 210px;
  align-items: start;
}
.job-result-card:hover {
  transform: translateY(-1px);
  border-color: #CBD5E1;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .07);
  text-decoration: none;
}
.job-logo {
  width: 42px;
  height: 42px;
  border: 1px solid #DBEAFE;
  border-radius: 8px;
  background: #EFF6FF;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
}
.job-result-body {
  min-width: 0;
}
.job-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.job-result-body h2 {
  overflow: hidden;
  margin-bottom: 5px;
  color: #111827;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-result-body p {
  overflow: hidden;
  color: #64748B;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-status-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
  padding: 9px 11px;
  border: 1px solid #BFDBFE;
  border-radius: 7px;
  background: #EFF6FF;
}
.job-status-note span {
  flex: 0 0 auto;
  color: #1D4ED8;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.job-status-note strong {
  min-width: 0;
  color: #1E3A8A;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.job-progress {
  width: 100%;
  height: 6px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #EEF2F7;
}
.job-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563EB, #16A34A);
}
.job-card-fields {
  display: grid;
  grid-template-columns: .5fr 1.05fr .9fr 1.6fr .9fr 1fr .75fr .9fr .9fr;
  gap: 0;
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid #E2E8F0;
  border-radius: 7px;
}
.job-card-fields div {
  min-width: 0;
  padding: 8px 10px;
  border-right: 1px solid #E2E8F0;
  background: #fff;
}
.job-card-fields div:last-child {
  border-right: 0;
}
.job-card-fields small {
  display: block;
  margin-bottom: 4px;
  color: #0F6F9E;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
}
.job-card-fields strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-overflow: ellipsis;
}
.job-result-meta {
  display: flex;
  min-width: 0;
  align-items: flex-end;
  flex-direction: column;
  gap: 5px;
  color: #64748B;
  font-size: 12px;
  text-align: right;
}
.job-result-meta strong {
  color: #334155;
  font-size: 13px;
}
.job-result-meta span {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-result-meta em {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--danger-l);
  color: var(--danger);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}
.jobs-pagination {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.job-detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, .48);
}
.job-detail-modal {
  width: min(1180px, 100%);
  max-height: calc(100vh - 40px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(15, 23, 42, .24);
}
.job-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
}
.job-detail-header h2 {
  margin-bottom: 5px;
  color: #0F172A;
  font-size: 18px;
}
.job-detail-header p {
  color: #64748B;
  font-size: 12px;
  font-weight: 600;
}
.job-detail-actions {
  display: flex;
  gap: 8px;
}
.job-icon-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #64748B;
  background: #fff;
}
.job-icon-btn:hover {
  color: var(--primary);
  background: var(--primary-l);
  text-decoration: none;
}
.job-detail-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 0;
  overflow: hidden;
}
.job-detail-tabs {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  margin: 14px 20px 0;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #F8FAFC;
}
.job-detail-tabs span,
.job-detail-tabs button {
  appearance: none;
  display: inline-flex;
  width: auto;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 0 !important;
  border-radius: 8px;
  background: transparent;
  color: #64748B;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  box-shadow: none;
}
.job-detail-tabs span.active,
.job-detail-tabs button.active {
  color: var(--primary);
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), inset 0 0 0 1px #DBEAFE;
}
.job-detail-content {
  flex: 1;
  min-height: 0;
  height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  touch-action: pan-y;
  min-width: 0;
  padding: 14px 20px 20px;
}
.job-detail-panel {
  display: none;
}
.job-detail-panel.active {
  display: block;
}
.job-history-list {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.job-history-item {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.job-history-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-2);
  background: #F8FAFC;
}
.job-history-meta strong {
  color: #0F172A;
  font-size: 13px;
  font-weight: 800;
}
.job-history-meta span {
  color: #64748B;
  font-size: 12px;
  font-weight: 600;
}
.job-history-meta em {
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--primary-l);
  color: var(--primary);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}
.job-history-changes {
  display: flex;
  flex-direction: column;
  padding: 4px 0;
}
.job-history-change {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 24px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-2);
  color: #475569;
  font-size: 12px;
}
.job-history-change:last-child {
  border-bottom: 0;
}
.job-history-change.is-step {
  background: linear-gradient(90deg, #F0FDF4, #fff);
}
.job-history-change span {
  color: #334155;
  font-weight: 800;
}
.job-history-change strong {
  display: block;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid #E2E8F0;
  border-radius: 7px;
  background: #fff;
  overflow-wrap: anywhere;
  font-weight: 600;
}
.job-history-change svg {
  justify-self: center;
  color: #94A3B8;
}
.job-history-empty {
  padding: 28px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: #94A3B8;
  text-align: center;
}
.job-files-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.job-files-toolbar strong,
.job-files-toolbar span {
  display: block;
}
.job-files-toolbar strong {
  color: var(--text);
  font-size: 14px;
}
.job-files-toolbar span {
  color: var(--text-3);
  font-size: 12px;
}
.job-files-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.job-file-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.job-file-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #F1F5F9;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.job-file-body {
  min-width: 0;
}
.job-file-body strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  margin-bottom: 3px;
}
.job-file-body span,
.job-file-body p {
  display: block;
  color: var(--text-3);
  font-size: 11px;
  line-height: 1.45;
}
.job-file-body p {
  margin-top: 4px;
  color: var(--text-2);
  word-break: break-word;
}
.job-file-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.job-step-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.job-step-chip {
  display: inline-flex;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 999px;
  background: #F1F5F9;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
}
.job-step-chip.status-completed {
  background: var(--success-l);
  color: var(--success);
}
.job-step-chip.status-in_progress {
  background: var(--primary-l);
  color: var(--primary);
}
.job-step-chip.status-not_needed {
  background: #F8FAFC;
  color: #94A3B8;
}
.job-detail-table {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.job-detail-table div {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  border-bottom: 1px solid var(--border-2);
}
.job-detail-table div:last-child {
  border-bottom: 0;
}
.job-detail-table strong,
.job-detail-table span {
  padding: 12px 14px;
  font-size: 12px;
}
.job-detail-table strong {
  background: #F8FAFC;
  color: #334155;
  font-weight: 800;
}
.job-detail-table span {
  min-width: 0;
  color: #475569;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-line;
}
.job-detail-table .wide {
  grid-template-columns: 260px minmax(0, 1fr);
}
.job-detail-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: #F8FAFC;
}
.job-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}
.job-step-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}
.job-form-note {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #BFDBFE;
  border-radius: 8px;
  background: var(--primary-l);
  color: #1E3A8A;
  font-size: 12px;
  font-weight: 600;
}

/* ===================================================
   CUSTOMER JOB REPORTS
   =================================================== */
.portal-job-filter { margin: 18px 0; }
.portal-job-filter-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 190px 180px auto;
  gap: 10px;
  align-items: center;
}
.portal-job-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.portal-job-card-footer {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.portal-job-card-footer div {
  padding: 10px 12px;
  border-right: 1px solid var(--border);
  background: #F8FAFC;
}
.portal-job-card-footer div:last-child { border-right: 0; }
.portal-job-card-footer small {
  display: block;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.portal-job-card-footer strong {
  display: block;
  color: var(--text);
  font-size: 12px;
}
.portal-report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 20px;
  align-items: start;
}
.portal-report-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.portal-report-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 84px;
}
.portal-report-progress > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.portal-report-progress span {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}
.portal-report-progress strong {
  color: var(--text);
  font-size: 18px;
}
.portal-report-note {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  margin: 16px 0;
  border: 1px solid #BFDBFE;
  border-radius: 8px;
  overflow: hidden;
}
.portal-report-note strong {
  padding: 12px;
  background: var(--primary-l);
  color: #1E3A8A;
  font-size: 12px;
}
.portal-report-note span {
  padding: 12px;
  font-size: 13px;
  color: var(--text);
  word-break: break-word;
}
.portal-step-grid { margin-top: 14px; }
.portal-step-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.portal-step-item span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
}
.portal-step-item strong {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: #F1F5F9;
  color: #475569;
  font-size: 11px;
}
.portal-step-item.status-completed { border-color: #BBF7D0; background: #F0FDF4; }
.portal-step-item.status-completed strong { background: #DCFCE7; color: #166534; }
.portal-step-item.status-in_progress { border-color: #BFDBFE; background: #EFF6FF; }
.portal-step-item.status-in_progress strong { background: #DBEAFE; color: #1D4ED8; }
.portal-step-item.status-not_needed { opacity: .65; }
.portal-file-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.portal-file-card {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  min-height: 120px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.portal-file-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #E2E8F0;
}
.portal-file-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F1F5F9;
  color: var(--text-3);
}
.portal-file-card-body {
  min-width: 0;
  padding: 12px;
}
.portal-file-card-body strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  margin-bottom: 4px;
}
.portal-file-card-body span {
  display: block;
  color: var(--text-3);
  font-size: 11px;
  margin-bottom: 8px;
}
.portal-file-card-body p {
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.45;
  margin-bottom: 10px;
}
.portal-history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.portal-history-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.portal-history-item > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.portal-history-item > div strong {
  font-size: 12px;
  color: var(--text);
}
.portal-history-item > div span {
  font-size: 12px;
  color: var(--text-2);
}
.portal-history-item ul {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.portal-history-item li {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 8px;
  font-size: 12px;
  color: var(--text-2);
}
.portal-history-item li span { font-weight: 700; color: var(--text); }
.portal-history-item li strong { font-weight: 600; color: var(--text-2); word-break: break-word; }
.portal-summary-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.portal-summary-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.portal-summary-list div:last-child { border-bottom: 0; }
.portal-summary-list span {
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
}
.portal-summary-list strong {
  color: var(--text);
  font-size: 12px;
  text-align: right;
}
.portal-next-action strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 6px;
}
.portal-next-action span,
.portal-description {
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.55;
}
.portal-empty-inline {
  padding: 26px;
  border: 1px dashed var(--border-2);
  border-radius: 8px;
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
  grid-column: 1 / -1;
}

/* --- Portal Progress Hero (Donut + Notes) --- */
.portal-progress-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 280px;
}
.portal-donut-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 32px 24px;
  border-right: 1px solid var(--border);
}
.portal-donut-wrap {
  position: relative;
  width: 180px;
  height: 180px;
}
.portal-donut-svg {
  width: 100%;
  height: 100%;
}
.portal-donut-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.portal-donut-label strong {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
}
.portal-donut-label span {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 600;
  margin-top: 4px;
}
.portal-donut-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  justify-content: center;
}
.portal-donut-meta > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.portal-donut-meta span {
  font-size: 10px;
  color: var(--text-3);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.portal-donut-meta strong {
  font-size: 12px;
  color: var(--text);
}
.portal-notes-section {
  display: flex;
  flex-direction: column;
}
.portal-notes-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.portal-notes-header strong {
  font-size: 14px;
}
.portal-notes-header svg {
  color: var(--primary);
  flex-shrink: 0;
}
.portal-notes-body {
  flex: 1;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}
.portal-note-item {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #FAFBFC;
}
.portal-note-item.portal-note-status {
  border-color: #FDE68A;
  background: #FFFBEB;
}
.portal-note-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: #FEF3C7;
  color: #92400E;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: 8px;
}
.portal-note-item p {
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  margin: 0;
  word-break: break-word;
}
.portal-notes-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 13px;
}

@media (max-width: 768px) {
  .portal-progress-hero {
    grid-template-columns: 1fr;
  }
  .portal-donut-section {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 24px 16px;
  }
  .portal-donut-wrap {
    width: 150px;
    height: 150px;
  }
  .portal-donut-label strong {
    font-size: 26px;
  }
}

/* ===================================================
   ALERTS
   =================================================== */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-success { background: var(--success-l); color: #14532D; border: 1px solid #BBF7D0; }
.alert-danger   { background: var(--danger-l);  color: #7F1D1D; border: 1px solid #FECACA; }
.alert-warning  { background: var(--warning-l); color: #78350F; border: 1px solid #FDE68A; }
.alert-info     { background: var(--primary-l); color: #1E3A8A; border: 1px solid #BFDBFE; }

/* ===================================================
   PROFILE
   =================================================== */
.profile-header {
  display: flex; align-items: center; gap: 20px;
  padding: 24px;
  border-bottom: 1px solid var(--border);
}
.profile-avatar-lg {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.profile-info h2 { font-size: 18px; font-weight: 700; margin-bottom: 2px; }
.profile-info .role-line { font-size: 13px; color: var(--text-2); }

/* ===================================================
   RESPONSIVE
   =================================================== */
@media (max-width: 1024px) {
  .sidebar,
  body.sidebar-collapsed .sidebar,
  body.sidebar-unpinned .sidebar {
    width: min(var(--sidebar-w), 82vw);
    transform: translateX(-100%);
  }
  .sidebar.open,
  body.sidebar-collapsed .sidebar.open,
  body.sidebar-unpinned .sidebar.open {
    transform: none;
    box-shadow: var(--shadow-md);
  }
  .main,
  body.sidebar-collapsed .main,
  body.sidebar-unpinned .main {
    margin-left: 0;
  }
  .topbar,
  body.sidebar-collapsed .topbar,
  body.sidebar-unpinned .topbar {
    left: 0;
  }
  body.sidebar-collapsed .sidebar-logo .logo-text,
  body.sidebar-collapsed .sidebar-logo .logo-badge,
  body.sidebar-collapsed .sidebar-label,
  body.sidebar-collapsed .sidebar-user .user-info,
  body.sidebar-collapsed .sidebar-footer form,
  body.sidebar-collapsed .sidebar-company {
    display: block;
  }
  body.sidebar-collapsed .brand-lockup {
    justify-content: flex-start;
  }
  body.sidebar-collapsed .brand-logo-full {
    display: block;
  }
  body.sidebar-collapsed .brand-logo-mark {
    display: none;
  }
  body.sidebar-collapsed .sidebar-nav a {
    justify-content: flex-start;
    gap: 10px;
    padding: 9px 12px;
    font-size: 13.5px;
  }
  body.sidebar-collapsed .sidebar-nav .nav-badge,
  body.sidebar-collapsed .sidebar-nav .badge-count {
    display: inline-block;
  }
  .topbar-pin { display: none; }
  .jobs-shell,
  .job-form-grid {
    grid-template-columns: 1fr;
  }
  .portal-report-grid,
  .portal-job-filter-form {
    grid-template-columns: 1fr;
  }
  .portal-report-side {
    position: static;
  }
  .jobs-filter-panel {
    position: static;
    height: auto;
    max-height: none;
  }
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 99;
  }
  .sidebar-overlay.open { display: block; }
}
@media (max-width: 768px) {
  .sidebar,
  body.sidebar-collapsed .sidebar,
  body.sidebar-unpinned .sidebar {
    width: min(230px, 78vw);
  }
  .sidebar-logo {
    height: 56px;
    padding: 0 12px;
  }
  .brand-logo-full {
    width: 124px;
    height: 38px;
  }
  .sidebar-logo .logo-text {
    font-size: 15px;
  }
  .sidebar-logo .logo-badge {
    margin-left: 6px;
    padding: 2px 5px;
    font-size: 8px;
  }
  .sidebar-section {
    padding-top: 16px;
  }
  .sidebar-label {
    padding: 0 16px 6px;
  }
  .sidebar-nav {
    padding: 0 8px;
  }
  .sidebar-nav li {
    margin-bottom: 1px;
  }
  .sidebar-nav a,
  body.sidebar-collapsed .sidebar-nav a {
    justify-content: flex-start;
    gap: 9px;
    min-height: 38px;
    padding: 8px 10px;
    font-size: 13px;
  }
  .sidebar-nav .icon,
  body.sidebar-collapsed .sidebar-nav .icon {
    width: 17px;
    height: 17px;
  }
  .sidebar-footer {
    padding: 10px 8px;
  }
  .sidebar-user {
    padding: 8px 10px;
  }
  .topbar {
    padding: 0 12px;
    gap: 8px;
  }
  .topbar-breadcrumb {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .topbar-right {
    min-width: 0;
    flex-shrink: 0;
    gap: 6px;
  }
  .topbar-user {
    width: auto;
    gap: 0;
  }
  .topbar-user .u-name {
    display: none;
  }
  .topbar-brand span {
    display: none;
  }
  .topbar-brand img {
    width: 28px;
    height: 28px;
  }
  .notification-menu {
    position: static;
  }
  .notification-dropdown {
    position: fixed;
    top: calc(var(--topbar-h) + 8px);
    left: 12px;
    right: 12px;
    width: auto;
    min-width: 0;
    max-height: min(420px, calc(100vh - var(--topbar-h) - 24px));
    overflow-y: auto;
    z-index: 180;
  }
  .content {
    width: 100%;
    max-width: 100vw;
    padding: 16px 12px 28px;
    overflow-x: hidden;
  }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-cards-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-sidebar { order: -1; }
  .dashboard-main { order: 1; }
  .user-form-grid { grid-template-columns: 1fr; }
  .admin-stat-grid { grid-template-columns: 1fr 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .page-header-left,
  .page-header-actions {
    width: 100%;
  }
  .page-header-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-right { margin-left: 0; }
  .search-box { max-width: 100%; }
  .jobs-searchbar {
    /* overridden below */
  }
  .jobs-shell,
  .jobs-main,
  .jobs-filter-panel,
  .job-results {
    width: 100%;
    min-width: 0;
  }
  .jobs-filter-panel {
    padding: 12px;
  }
  .jobs-filter-form .form-control,
  .jobs-searchbar input {
    min-width: 0;
    width: 100%;
  }
  .jobs-selected {
    display: none;
  }
  .jobs-searchbar {
    grid-template-columns: 1fr 48px;
    min-height: 42px;
  }
  .jobs-stats {
    grid-template-columns: 1fr 1fr;
  }
  .job-result-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }
  .job-result-card-detailed {
    grid-template-columns: 1fr;
  }
  .job-result-meta {
    grid-column: auto;
    align-items: flex-start;
    text-align: left;
  }
  .job-card-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .job-card-fields div {
    border-right: 1px solid #E2E8F0;
    border-bottom: 1px solid #E2E8F0;
  }
  .job-card-fields div:nth-child(2n) {
    border-right: 0;
  }
  .job-card-fields div:nth-last-child(-n+2) {
    border-bottom: 0;
  }
  .job-detail-body {
    display: block;
  }
  .job-detail-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
  }
  .job-history-change {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  .job-history-change svg {
    transform: rotate(90deg);
  }
  .job-file-item {
    grid-template-columns: 42px minmax(0, 1fr);
  }
  .job-file-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
  .job-detail-table div,
  .job-detail-table .wide {
    grid-template-columns: 1fr;
  }
  .job-detail-table strong {
    border-bottom: 1px solid var(--border-2);
  }
  .job-step-grid {
    grid-template-columns: 1fr;
  }
  .portal-file-grid {
    grid-template-columns: 1fr;
  }
  .portal-file-card {
    grid-template-columns: 96px minmax(0, 1fr);
  }
  .file-upload-grid {
    grid-template-columns: 1fr;
  }
  .portal-job-card-footer {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .portal-job-card-footer div:nth-child(2n) {
    border-right: 0;
  }
  .portal-job-card-footer div:nth-child(-n+2) {
    border-bottom: 1px solid var(--border);
  }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 14px; gap: 6px; flex-direction: column; align-items: flex-start; }
  .stat-card .stat-value { font-size: 20px; }
  .stat-card .stat-label { font-size: 11px; line-height: 1.2; }
  .dashboard-cards-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .user-form-grid { grid-template-columns: 1fr; }
  .admin-stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .admin-stat-card { 
    padding: 14px; 
    gap: 10px; 
    min-height: auto; 
    flex-direction: column; 
    align-items: center; 
    text-align: center; 
  }
  .admin-stat-card .stat-icon { width: 36px; height: 36px; }
  .admin-stat-card .stat-value { font-size: 22px; }
  .admin-stat-card .stat-meta { flex-direction: column; padding-top: 10px; gap: 4px; }
  
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; }
  .hide-mobile { display: none !important; }
  .show-mobile { display: inline !important; }
  .jobs-stats {
    grid-template-columns: 1fr 1fr;
  }
  .job-detail-backdrop {
    padding: 0;
    align-items: flex-end;
  }
  .job-detail-modal {
    width: 100%;
    max-width: 100%;
    max-height: 90dvh;
    height: auto;
    border-radius: 20px 20px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: block;
  }
  .job-detail-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #fff;
    padding: 16px 16px 14px;
  }
  .job-detail-tabs {
    position: sticky;
    top: 73px; /* Approximate height of header */
    z-index: 10;
    background: #fff;
    margin: 0;
    padding: 10px 12px 4px;
  }
  .job-detail-body {
    display: block;
    height: auto;
    overflow: visible;
  }
  .job-detail-content {
    padding: 12px 12px 16px;
    height: auto;
    overflow: visible;
    display: block;
  }
  .job-detail-footer {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: #fff;
    border-top: 1px solid var(--border);
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
  }
  .job-card-fields {
    grid-template-columns: 1fr;
  }
  .job-card-fields div,
  .job-card-fields div:nth-child(2n),
  .job-card-fields div:nth-last-child(-n+2) {
    border-right: 0;
    border-bottom: 1px solid #E2E8F0;
  }
  .job-card-fields div:last-child {
    border-bottom: 0;
  }
  .portal-report-note,
  .portal-history-item li,
  .portal-file-card,
  .portal-job-card-footer {
    grid-template-columns: 1fr;
  }
  .portal-job-card-footer div,
  .portal-job-card-footer div:nth-child(2n),
  .portal-job-card-footer div:nth-child(-n+2) {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .portal-job-card-footer div:last-child {
    border-bottom: 0;
  }
  .portal-file-card img,
  .portal-file-icon {
    min-height: 150px;
  }
}

/* ===================================================
   UTILITIES
   =================================================== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.w-full { width: 100%; }
.text-sm   { font-size: 12px; }
.text-muted { color: var(--text-2); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===================================================
   AUTH PAGES (Login / Şifre Sıfırlama)
   =================================================== */
.auth-body {
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  margin: 0;
  padding: 0;
}

.auth-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Sol panel */
.auth-left {
  width: 500px;
  flex-shrink: 0;
  background: var(--primary-l);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  position: relative;
  overflow: hidden;
}

.auth-left::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, rgba(198,156,59,0.05) 0%, rgba(198,156,59,0.15) 100%);
  pointer-events: none;
}

.auth-left-content {
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-brand-logo {
  width: 100%;
  max-width: 350px;
}
.auth-brand-logo img {
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 12px 24px rgba(198,156,59,0.25));
  transition: transform 0.3s ease;
}
.auth-brand-logo img:hover {
  transform: scale(1.02);
}

/* Sağ form paneli */
.auth-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: #fff;
}

.auth-form-box {
  width: 100%;
  max-width: 420px;
}

/* Mobil */
@media (max-width: 768px) {
  .auth-container { flex-direction: column; }
  .auth-left {
    width: 100%;
    padding: 40px 24px 20px;
    min-height: auto;
  }
  .auth-brand-logo {
    width: 100%;
    max-width: 240px;
    margin: 0 auto;
  }
  .auth-right { padding: 32px 20px; }
}
