/* ============================================================
   TSMS Global Design System — BOLD EDITION
   Distinctive mission-control aesthetic. NO generic purple-blue.
   Unified across all modules: service-calls, billing, payroll,
   finance, employees, reports, and gatepass.
   ============================================================ */

:root {
  --nexus-midnight: #0f172a;
  --nexus-slate: #1e293b;
  --nexus-indigo: #3730a3;
  --nexus-amber: #f59e0b;
  --nexus-amber-glow: rgba(245, 158, 11, 0.25);
  --nexus-teal: #14b8a6;
  --nexus-teal-glow: rgba(20, 184, 166, 0.25);
  --nexus-rose: #f43f5e;
  --nexus-rose-glow: rgba(244, 63, 94, 0.25);
  --nexus-emerald: #10b981;
  --nexus-surface: #ffffff;
  --nexus-muted: #64748b;
  --nexus-border: #e2e8f0;
  --nexus-radius: 16px;
  --nexus-radius-sm: 10px;
  --nexus-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -1px rgba(15, 23, 42, 0.04);
  --nexus-shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.12), 0 10px 10px -5px rgba(15, 23, 42, 0.08);
  --nexus-shadow-xl: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes tsmsFadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes tsmsPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  50%      { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
}
@keyframes tsmsSlideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

.nexus-animate {
  animation: tsmsFadeInUp 0.5s ease-out forwards;
  opacity: 0;
}
.nexus-animate-1 { animation-delay: 0.05s; }
.nexus-animate-2 { animation-delay: 0.12s; }
.nexus-animate-3 { animation-delay: 0.20s; }
.nexus-animate-4 { animation-delay: 0.28s; }
.nexus-animate-5 { animation-delay: 0.36s; }

/* ============================================================
   HERO HEADER
   ============================================================ */
.nexus-hero-header {
  background: linear-gradient(135deg, var(--nexus-midnight) 0%, var(--nexus-indigo) 55%, #312e81 100%);
  border-radius: var(--nexus-radius);
  padding: 2rem 2.25rem;
  color: #fff;
  margin-bottom: 1.5rem;
  box-shadow: var(--nexus-shadow-lg);
  position: relative;
  overflow: hidden;
}
.nexus-hero-header::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -5%;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(245,158,11,0.12) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.nexus-hero-header::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -8%;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(20,184,166,0.10) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.nexus-hero-header h1,
.nexus-hero-header h2,
.nexus-hero-header h3 {
  color: #fff;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
  position: relative;
  z-index: 1;
}
.nexus-hero-header .nexus-hero-sub {
  opacity: 0.65;
  font-size: 0.88rem;
  margin-top: 0.35rem;
  position: relative;
  z-index: 1;
}
.nexus-hero-header .nexus-hero-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.nexus-hero-header .btn-light {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  font-weight: 600;
  font-size: 0.82rem;
  border-radius: var(--nexus-radius-sm);
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
}
.nexus-hero-header .btn-light:hover {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.35);
  color: #fff;
  transform: translateY(-1px);
}
.nexus-hero-icon {
  color: var(--nexus-amber);
  margin-right: .5rem;
}
.nexus-hero-header .btn-warning {
  background: var(--nexus-amber);
  border: none;
  color: var(--nexus-midnight);
  font-weight: 700;
  font-size: 0.82rem;
  border-radius: var(--nexus-radius-sm);
  box-shadow: 0 4px 14px rgba(245,158,11,0.35);
  transition: all 0.2s ease;
}
.nexus-hero-header .btn-warning:hover {
  background: #fbbf24;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(245,158,11,0.45);
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.nexus-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.nexus-stat-card {
  background: var(--nexus-surface);
  border: 1px solid var(--nexus-border);
  border-radius: var(--nexus-radius-sm);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.nexus-stat-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--nexus-amber);
  border-radius: var(--nexus-radius-sm) 0 0 var(--nexus-radius-sm);
}
.nexus-stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--nexus-shadow-lg);
  border-color: #cbd5e1;
}
.nexus-stat-card.nexus-stat-teal::before   { background: var(--nexus-teal); }
.nexus-stat-card.nexus-stat-rose::before   { background: var(--nexus-rose); }
.nexus-stat-card.nexus-stat-emerald::before{ background: var(--nexus-emerald); }
.nexus-stat-card.nexus-stat-indigo::before { background: var(--nexus-indigo); }

.nexus-stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
  background: var(--nexus-amber-glow);
  color: #b45309;
}
.nexus-stat-teal   .nexus-stat-icon { background: var(--nexus-teal-glow);   color: #0f766e; }
.nexus-stat-rose   .nexus-stat-icon { background: var(--nexus-rose-glow);   color: #be123c; }
.nexus-stat-emerald .nexus-stat-icon { background: rgba(16,185,129,0.18); color: #047857; }
.nexus-stat-indigo .nexus-stat-icon { background: rgba(55,48,163,0.12);  color: #3730a3; }

.nexus-stat-val {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--nexus-midnight);
  letter-spacing: -0.03em;
}
.nexus-stat-val.zero { color: var(--nexus-muted); }
.nexus-stat-lbl {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--nexus-muted);
  margin-top: 0.25rem;
}

/* ============================================================
   DATA CARDS & TABLES
   ============================================================ */
.nexus-data-card {
  background: var(--nexus-surface);
  border: 1px solid var(--nexus-border);
  border-radius: var(--nexus-radius);
  box-shadow: var(--nexus-shadow);
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}
.nexus-data-card:hover {
  box-shadow: var(--nexus-shadow-lg);
}
.nexus-data-card-header {
  background: linear-gradient(90deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid var(--nexus-border);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nexus-data-card-header h5 {
  font-weight: 700;
  color: var(--nexus-slate);
  margin: 0;
  font-size: 1rem;
}

.nexus-table-wrap { overflow-x: auto; }
.nexus-table-wrap .table {
  font-size: 0.82rem;
  margin: 0;
}
.nexus-table-wrap .table thead th {
  background: #f8fafc;
  font-weight: 700;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #475569;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
  padding: 0.6rem 0.75rem;
}
.nexus-table-wrap .table td {
  padding: 0.55rem 0.75rem;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
}
.nexus-table-wrap .table tbody tr:hover td {
  background: #f8fafc;
}
.nexus-table-wrap .table tbody tr {
  transition: background 0.15s ease;
}

/* ============================================================
   STATUS BADGES
   ============================================================ */
.nexus-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.nexus-badge-pending    { background: #fef3c7; color: #92400e; }
.nexus-badge-enroute    { background: #dbeafe; color: #1e40af; }
.nexus-badge-working    { background: #e0f2fe; color: #0369a1; }
.nexus-badge-onsite     { background: #ede9fe; color: #5b21b6; }
.nexus-badge-completed  { background: #d1fae5; color: #065f46; }
.nexus-badge-open       { background: #dbeafe; color: #1e40af; }
.nexus-badge-resolved   { background: #d1fae5; color: #065f46; }
.nexus-badge-closed     { background: #f3f4f6; color: #374151; }
.nexus-badge-cancelled  { background: #fee2e2; color: #991b1b; }

/* ============================================================
   BUTTONS
   ============================================================ */
.nexus-btn-primary {
  background: linear-gradient(135deg, var(--nexus-indigo) 0%, #4338ca 100%);
  border: none;
  color: #fff;
  font-weight: 600;
  border-radius: var(--nexus-radius-sm);
  box-shadow: 0 4px 12px rgba(55,48,163,0.25);
  transition: all 0.2s ease;
}
.nexus-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(55,48,163,0.35);
  color: #fff;
}
.nexus-btn-success {
  background: linear-gradient(135deg, var(--nexus-emerald) 0%, #059669 100%);
  border: none;
  color: #fff;
  font-weight: 600;
  border-radius: var(--nexus-radius-sm);
  box-shadow: 0 4px 12px rgba(16,185,129,0.25);
  transition: all 0.2s ease;
}
.nexus-btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(16,185,129,0.35);
  color: #fff;
}

/* ============================================================
   FORM CARDS
   ============================================================ */
.nexus-form-hero {
  background: linear-gradient(135deg, var(--nexus-midnight) 0%, var(--nexus-indigo) 100%);
  border-radius: var(--nexus-radius);
  padding: 1.75rem 2rem;
  color: #fff;
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
}
.nexus-form-hero::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -5%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(245,158,11,0.15) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.nexus-form-hero h2 {
  color: #fff;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.02em;
  position: relative;
  z-index: 1;
}
.nexus-form-hero p {
  opacity: 0.65;
  margin: 0.3rem 0 0;
  position: relative;
  z-index: 1;
}

.nexus-form-card {
  background: var(--nexus-surface);
  border: 1px solid var(--nexus-border);
  border-radius: var(--nexus-radius);
  box-shadow: var(--nexus-shadow);
  overflow: hidden;
}
.nexus-form-card-header {
  background: #f8fafc;
  border-bottom: 1px solid var(--nexus-border);
  padding: 1rem 1.5rem;
  font-weight: 700;
  color: var(--nexus-slate);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nexus-form-card-body {
  padding: 1.5rem;
}

/* ============================================================
   TOOLBAR
   ============================================================ */
.nexus-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-radius: var(--nexus-radius-sm);
  border: 1px solid var(--nexus-border);
}

/* ============================================================
   LEGACY INDEX.PHP STYLES (retained for compatibility)
   ============================================================ */
.service-calls-shell .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.service-calls-shell .card-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.service-calls-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-bottom: 10px;
}
.service-calls-toolbar .btn { white-space: nowrap; }
.service-calls-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.service-calls-stat {
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  padding: 10px 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
  cursor: pointer;
  transition: all .2s ease;
}
.service-calls-stat:hover {
  border-color: #3b82f6;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}
.service-calls-shell .card-header .d-flex { gap: .5rem; }
.service-calls-shell .card-header-actions { gap: .5rem; }
.service-calls-stat .label {
  font-size: 0.73rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #516173;
}
.service-calls-stat .value {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.2;
  color: #1f2937;
}
.service-calls-grid-wrap { overflow-x: auto; }
#index_table .table td,
#index_table .table th {
  padding: 0.32rem 0.4rem;
  vertical-align: middle;
}
#index_table .table td > div {
  width: auto;
  min-width: 90px;
}

/* --- itss-index.php styles --- */
.itss-index .content-header { display: none; }
.itss-toolbar {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}
.itss-summary {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 12px;
  text-align: center;
}
.itss-summary .count {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.1;
}
.itss-summary .label {
  color: #64748b;
  font-size: 0.78rem;
  margin-bottom: 0;
}
.itss-status-badge {
  font-size: 0.75rem;
  border-radius: 999px;
  padding: 4px 8px;
  font-weight: 600;
}
#itss-index-grid .table { margin-bottom: 0; }
#itss-index-grid .table td,
#itss-index-grid .table th {
  white-space: nowrap;
  vertical-align: middle;
}
.itss-datetime { font-size: 0.82rem; }
.itss-datetime .date { font-weight: 600; color: #1f2937; }
.itss-datetime .time { color: #6b7280; }

/* --- view.php styles --- */
.view_table table {
  overflow: auto;
  word-wrap: break-word;
  width: 100%;
}

/* --- _form.php styles --- */
.nexus-flow-card {
  border: 1px solid #dee2e6;
  border-radius: .5rem;
  padding: 1.25rem;
  margin: 0 0 1.5rem 0;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.nexus-flow-title {
  font-weight: 600;
  margin-bottom: 1rem;
  color: #495057;
  text-transform: uppercase;
  letter-spacing: .5px;
  font-size: .85rem;
  border-bottom: 1px solid #e9ecef;
  padding-bottom: .5rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1023px) and (min-width: 769px) {
  .service-calls-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .itss-toolbar { padding: 10px; }
}

@media (max-width: 768px) {
  .nexus-hero-header { padding: 1.25rem 1.5rem; }
  .nexus-hero-header h2 { font-size: 1.4rem; }
  .nexus-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .nexus-stat-val { font-size: 1.5rem; }
  .nexus-stat-card { padding: 1rem; }
  .nexus-data-card-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }

  .service-calls-shell .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .service-calls-shell .card-title { font-size: 1.1rem; }
  .service-calls-toolbar { grid-template-columns: 1fr; gap: 8px; }
  .service-calls-toolbar .btn {
    width: 100%;
    white-space: normal;
    min-height: 44px;
  }
  .service-calls-stats { grid-template-columns: 1fr; gap: 8px; }
  .service-calls-stat { padding: 8px 10px; }
  .service-calls-stat .value { font-size: 1.1rem; }

  .itss-toolbar { padding: 8px; margin-bottom: 8px; }
  .itss-summary { padding: 8px; margin-bottom: 8px; }
  .itss-summary .count { font-size: 1rem; }
  .itss-status-badge { font-size: 0.7rem; padding: 3px 6px; }

  .view_table .table td,
  .view_table .table th {
    white-space: nowrap;
    font-size: 0.85rem;
    padding: 0.25rem 0.35rem;
  }
  .service-calls-grid-wrap,
  #itss-index-grid { -webkit-overflow-scrolling: touch; }
  .view_table .btn-sm { min-height: 36px; min-width: 44px; padding: 6px 10px; font-size: 0.85rem; }
  .chat-popup {
    width: 100% !important;
    max-width: 320px;
    left: auto !important;
    right: 10px !important;
  }
  .nexus-flow-card { padding: 10px !important; }
  .select2-container { max-width: 100%; }
}


/* --- index.php styles --- */
.service-calls-shell .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.service-calls-shell .card-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.service-calls-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-bottom: 10px;
}

.service-calls-toolbar .btn {
  white-space: nowrap;
}

.service-calls-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.service-calls-stat {
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  padding: 10px 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
  cursor: pointer;
  transition: all .2s ease;
}

.service-calls-stat:hover {
  border-color: #3b82f6;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.service-calls-shell .card-header .d-flex {
  gap: .5rem;
}

.service-calls-shell .card-header-actions {
  gap: .5rem;
}

.service-calls-stat .label {
  font-size: 0.73rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #516173;
}

.service-calls-stat .value {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.2;
  color: #1f2937;
}

.service-calls-grid-wrap {
  overflow-x: auto;
}

#index_table .table td,
#index_table .table th {
  padding: 0.32rem 0.4rem;
  vertical-align: middle;
}

#index_table .table td > div {
  width: auto;
  min-width: 90px;
}

@media (max-width: 991.98px) {
  .service-calls-toolbar {
    grid-template-columns: 1fr;
  }

  .service-calls-toolbar .btn {
    width: 100%;
  }

  .service-calls-stats {
    grid-template-columns: 1fr;
  }
}

/* --- itss-index.php styles --- */
.itss-index .content-header {
  display: none;
}

.itss-toolbar {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.itss-summary {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 12px;
  text-align: center;
}

.itss-summary .count {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.1;
}

.itss-summary .label {
  color: #64748b;
  font-size: 0.78rem;
  margin-bottom: 0;
}

.itss-status-badge {
  font-size: 0.75rem;
  border-radius: 999px;
  padding: 4px 8px;
  font-weight: 600;
}

#itss-index-grid .table {
  margin-bottom: 0;
}

#itss-index-grid .table td,
#itss-index-grid .table th {
  white-space: nowrap;
  vertical-align: middle;
}

.itss-datetime {
  font-size: 0.82rem;
}

.itss-datetime .date {
  font-weight: 600;
  color: #1f2937;
}

.itss-datetime .time {
  color: #6b7280;
}

/* --- view.php styles --- */
.view_table table {
  overflow: auto;
  word-wrap: break-word;
  width: 100%;
}

/* --- _form.php styles (extracted from inline) --- */
.nexus-flow-card {
  border: 1px solid #dee2e6;
  border-radius: .5rem;
  padding: 1.25rem;
  margin: 0 0 1.5rem 0;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.nexus-flow-title {
  font-weight: 600;
  margin-bottom: 1rem;
  color: #495057;
  text-transform: uppercase;
  letter-spacing: .5px;
  font-size: .85rem;
  border-bottom: 1px solid #e9ecef;
  padding-bottom: .5rem;
}

/* ============================================================
   KINTONE HUB STYLES
   ============================================================ */
.kintone-hub-header {
  background: linear-gradient(135deg, #1e3a5f 0%, #1d4ed8 100%);
  border-radius: 14px;
  padding: 1.5rem 1.75rem;
  color: #fff;
  margin-bottom: 1.25rem;
}
.kintone-hub-header h2 {
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0;
}
.kintone-nav-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.kintone-nav-bar .btn {
  border-radius: 8px;
  font-weight: 500;
}
.kintone-info-box {
  background: #fff;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  text-align: center;
  border-left: 4px solid transparent;
}
.kintone-info-box.border-danger { border-left-color: #ef4444; }
.kintone-info-box.border-success { border-left-color: #10b981; }
.kintone-info-box .number {
  font-size: 2rem;
  font-weight: 700;
  color: #1d4ed8;
}
.kintone-info-box .label {
  font-size: 0.875rem;
  color: #6b7280;
}
.badge-success { background: #10b981; color: #fff; }
.badge-danger  { background: #ef4444; color: #fff; }
.badge-warning { background: #f59e0b; color: #fff; }

/* ============================================================
   KINTONE LOCAL DB STYLES
   ============================================================ */
.kintone-local { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }

.kintone-header {
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
  border-radius: 12px;
  padding: 24px;
  color: white;
  margin-bottom: 20px;
}
.kintone-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
}
.kintone-header p {
  margin: 8px 0 0 0;
  opacity: 0.9;
  font-size: 14px;
}

.kintone-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 12px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.kintone-nav .btn {
  border-radius: 6px;
  font-size: 13px;
  padding: 8px 16px;
}

.kintone-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid #e5e7eb;
}
.kintone-tab {
  padding: 12px 20px;
  color: #6b7280;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.kintone-tab:hover {
  color: #374151;
  text-decoration: none;
}
.kintone-tab.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

.kintone-stats { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.stat-card {
  background: white;
  border-radius: 10px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  flex: 1;
  min-width: 200px;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  text-decoration: none;
}
.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
}
.stat-content { flex: 1; }
.stat-number {
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}
.stat-label {
  font-size: 13px;
  color: #6b7280;
  margin-top: 4px;
}

.kintone-search {
  background: white;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.kintone-table-container {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.kintone-table {
  width: 100%;
  border-collapse: collapse;
}
.kintone-table th {
  background-color: #f3f4f6;
  color: #111827;
  font-weight: 600;
  text-align: left;
  padding: 12px;
  border-bottom: 2px solid #d1d5db;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.kintone-table td {
  background-color: #ffffff;
  color: #1f2937;
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 14px;
}
.kintone-table tr:nth-child(even) td { background-color: #fafafa; }
.kintone-table tr:hover td { background-color: #eff6ff; }
.kintone-table a {
  color: #2563eb;
  text-decoration: none;
}
.kintone-table a:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

.ticket-counter {
  background: #f3f4f6;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  color: #374151;
  display: inline-block;
}

.table-summary {
  text-align: right;
  color: #6b7280;
  font-size: 13px;
  margin-top: 12px;
}

/* ============================================================
   GATEPASS HUB STYLES
   ============================================================ */
:root {
  --gp-indigo: #6366f1;
  --gp-orange: #f97316;
  --gp-purple: #8b5cf6;
  --gp-teal: #14b8a6;
}

@keyframes gpPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

.gp-hub-header {
  background: linear-gradient(135deg, #1e3a5f 0%, #1d4ed8 100%);
  border-radius: 14px;
  padding: 1.5rem 1.75rem;
  color: #fff;
  margin-bottom: 1.25rem;
}
.gp-hub-header h2 {
  font-weight: 800;
  letter-spacing: -.5px;
  margin: 0;
}
.gp-hub-sub {
  opacity: .75;
  font-size: .85rem;
  margin-top: .25rem;
}

.gp-pipeline-strip {
  display: flex;
  align-items: stretch;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  margin-bottom: 1.25rem;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.gp-pl-lane {
  flex: 1;
  padding: .6rem .75rem;
  border-right: 1px solid #e2e8f0;
  cursor: pointer;
  transition: background .15s;
  text-decoration: none !important;
}
.gp-pl-lane:last-child { border-right: none; }
.gp-pl-lane:hover { background: #f8fafc; }
.gp-pl-lane.gp-active { background: #eff6ff; border-bottom: 3px solid #2563eb; }
.gp-pl-lane.gp-exc.gp-active { background: #fff7ed; border-bottom-color: #f97316; }
.gp-pl-icon { font-size: .9rem; margin-bottom: 2px; }
.gp-pl-label {
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #64748b;
  white-space: nowrap;
}
.gp-pl-count {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1;
  color: #1e293b;
}
.gp-pl-count.zero { color: #cbd5e1; }
.gp-pl-sub { font-size: .58rem; color: #94a3b8; margin-top: 1px; }

.gp-tabs .nav-link {
  font-size: .78rem;
  font-weight: 600;
  padding: .45rem .85rem;
  color: #64748b;
  border-bottom: 3px solid transparent;
}
.gp-tabs .nav-link.active {
  color: #1d4ed8;
  background: #eff6ff;
  border-bottom-color: #1d4ed8;
}
.gp-tabs .nav-link.gp-wh.active  { color: #6366f1; border-bottom-color: #6366f1; background: #ede9fe15; }
.gp-tabs .nav-link.gp-pa.active  { color: #334155; border-bottom-color: #334155; background: #f1f5f920; }
.gp-tabs .nav-link.gp-gsd.active { color: #0ea5e9; border-bottom-color: #0ea5e9; background: #e0f2fe20; }
.gp-tabs .nav-link.gp-hd.active  { color: #d97706; border-bottom-color: #d97706; background: #fef9c320; }
.gp-tabs .nav-link.gp-exc.active { color: #ea580c; border-bottom-color: #ea580c; background: #fff7ed20; }
.gp-tabs .nav-link.gp-bil.active { color: #8b5cf6; border-bottom-color: #8b5cf6; background: #f5f3ff20; }
.gp-tabs .nav-link.gp-af.active  { color: #059669; border-bottom-color: #059669; background: #ecfdf520; }
.gp-tabs .nav-link .badge { font-size: .6rem; padding: 2px 5px; margin-left: 3px; vertical-align: middle; }
.gp-tabs .nav-link.gp-single-link { color: #475569; border-bottom-color: transparent; }
.gp-tabs .nav-link.gp-single-link:hover { background: #f8fafc; color: #1d4ed8; }

.gp-metric-card {
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: .9rem 1.1rem;
  background: #fff;
  display: flex;
  align-items: center;
  gap: .8rem;
  transition: border-color .15s, box-shadow .15s;
}
.gp-metric-card:hover { border-color: #93c5fd; box-shadow: 0 2px 8px rgba(37,99,235,.08); }
.gp-metric-card.gp-active-card { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.gp-metric-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.gp-metric-val {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1;
  color: #1e293b;
}
.gp-metric-val.zero { color: #94a3b8; }
.gp-metric-lbl {
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #64748b;
}

.gp-grid-wrap { border-radius: 0 0 12px 12px; overflow: hidden; }
.gp-grid-wrap .table { font-size: .78rem; margin: 0; }
.gp-grid-wrap thead th {
  background: #f8fafc;
  font-weight: 700;
  font-size: .67rem;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: #475569;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
  padding: .5rem .6rem;
}
.gp-grid-wrap td { padding: .42rem .6rem; vertical-align: middle; }
.gp-grid-wrap tr:hover td { background: #f8fafc; }

.gp-dr-link { font-weight: 700; color: #1d4ed8; font-size: .8rem; }
.btn-xs { padding: .18rem .42rem; font-size: .7rem; }
.gp-quick-btn { font-size: .65rem !important; padding: 2px 7px !important; border-radius: 6px; white-space: nowrap; margin: 1px; }

.gp-lane-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: .75rem;
  padding: .6rem;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}
.gp-lane-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .7rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid currentColor;
}

.gp-filter-bar {
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  padding: .55rem .8rem;
  margin-bottom: .65rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem;
}
.gp-filter-bar select,
.gp-filter-bar input[type=text] {
  font-size: .75rem;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  padding: 0 .45rem;
  color: #334155;
}
.gp-filter-bar .btn { font-size: .73rem; padding: .22rem .6rem; border-radius: 6px; }

.badge-urgency-normal   { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.badge-urgency-urgent   { background: #fef3c7; color: #92400e; }
.badge-urgency-critical { background: #fee2e2; color: #991b1b; animation: gpPulse 1s infinite; }

.wh-merge-ready-row td { background: #effcf3; }
.wh-merge-row-selected td { background: #e8f2ff !important; }
.wh-merge-row-ineligible td { opacity: .58; background: #f8f9fa; }
.wh-merge-badge { font-weight: 700; letter-spacing: .2px; }
.wh-merge-hint { margin-top: .55rem; font-size: .78rem; color: #5b6470; }

.gp-scroll { overflow-x: auto; }
.gp-empty { text-align: center; padding: 3rem; color: #94a3b8; }
.gp-empty i { font-size: 2.5rem; margin-bottom: .75rem; display: block; }
.gp-admin-bar {
  background: linear-gradient(135deg, #78350f, #b45309);
  border-radius: 10px;
  padding: .6rem 1rem;
  margin-top: 1rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem;
}

.gp-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.gp-pipeline-strip { overflow-x: auto; }
.gp-pl-lane { flex-shrink: 0; min-width: 100px; }

/* ============================================================
   SERVICE PROVIDERS UTILITIES
   ============================================================ */
.scx-nexus-nexus-hero-card {
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}
.btn-white {
  background: #fff;
  color: #1e3a8a;
}
.btn-white:hover {
  background: #f0f7ff;
  color: #1e3a8a;
}
.border-left-primary { border-left: 4px solid #007bff !important; }
.border-left-info    { border-left: 4px solid #17a2b8 !important; }
.border-left-danger  { border-left: 4px solid #dc3545 !important; }
.border-left-success { border-left: 0.25rem solid #1cc88a !important; }
.border-left-warning { border-left: 0.25rem solid #f6c23e !important; }
.text-gray-300 { color: #dddfeb !important; }
.text-gray-800 { color: #5a5c69 !important; }
.bg-primary-soft { background-color: rgba(0, 123, 255, 0.08); }
.border-dashed { border-style: dashed !important; border-width: 2px !important; }
.opacity-50 { opacity: 0.5; }
.bg-black-50 { background-color: rgba(0,0,0,0.2); }
.dashed { border: 2px dashed #dee2e6 !important; }

.nexus-bg-primary {
  background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
}
.letter-spacing-2 { letter-spacing: 2px; }
.pulse-button {
  animation: nexusPulse 2s infinite;
}
@keyframes nexusPulse {
  0%   { transform: scale(1); box-shadow: 0 0 0 0 rgba(78, 115, 223, 0.7); }
  70%  { transform: scale(1.02); box-shadow: 0 0 0 10px rgba(78, 115, 223, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(78, 115, 223, 0); }
}

/* ============================================================
   KINTONE IMPORT STYLES
   ============================================================ */
:root {
  --ki-primary: #2563eb;
  --ki-success: #10b981;
  --ki-warning: #f59e0b;
  --ki-danger: #ef4444;
  --ki-info: #06b6d4;
}

.ki-dashboard { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

.ki-header {
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
  border-radius: 16px;
  padding: 28px;
  color: #fff;
  margin-bottom: 24px;
}
.ki-header h1 { font-size: 32px; font-weight: 800; margin: 0; }
.ki-header p { opacity: .9; margin: 8px 0 0; font-size: 15px; }

.ki-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.ki-stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  transition: all .2s;
}
.ki-stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,.12); }
.ki-stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
}
.ki-stat-content { flex: 1; }
.ki-stat-number { font-size: 28px; font-weight: 700; line-height: 1; color: #1f2937; }
.ki-stat-label { font-size: 13px; color: #6b7280; margin-top: 4px; }
.ki-stat-delta { font-size: 12px; margin-top: 4px; }
.ki-stat-delta.up { color: var(--ki-success); }
.ki-stat-delta.down { color: var(--ki-danger); }

.ki-panel {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.ki-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.ki-panel-title {
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ki-panel-title i { color: var(--ki-primary); }

.ki-toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.ki-toggle-switch {
  width: 48px;
  height: 26px;
  background: #e5e7eb;
  border-radius: 13px;
  position: relative;
  transition: all .3s;
}
.ki-toggle-switch::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: all .3s;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.ki-toggle.active .ki-toggle-switch { background: var(--ki-success); }
.ki-toggle.active .ki-toggle-switch::after { left: 24px; }
.ki-toggle-label { font-size: 14px; font-weight: 500; color: #374151; }
.ki-toggle-status { font-size: 12px; color: #9ca3af; }

.ki-apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.ki-app-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.ki-app-card:hover { border-color: #d1d5db; box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.ki-app-card.syncing { border-color: var(--ki-primary); background: #eff6ff; }
.ki-app-card.error { border-color: var(--ki-danger); background: #fef2f2; }

.ki-app-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.ki-app-info { display: flex; align-items: center; gap: 12px; }
.ki-app-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
}
.ki-app-icon.primary { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.ki-app-icon.success { background: linear-gradient(135deg, #10b981, #059669); }
.ki-app-icon.warning { background: linear-gradient(135deg, #f59e0b, #d97706); }
.ki-app-icon.info { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.ki-app-icon.secondary { background: linear-gradient(135deg, #6b7280, #4b5563); }
.ki-app-icon.dark { background: linear-gradient(135deg, #1f2937, #111827); }

.ki-app-meta h4 { font-size: 15px; font-weight: 600; color: #1f2937; margin: 0; }
.ki-app-meta span { font-size: 12px; color: #9ca3af; }

.ki-app-badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.ki-app-badge.scheduled { background: #ecfdf5; color: #059669; }
.ki-app-badge.running { background: #eff6ff; color: #2563eb; animation: kiPulse 2s infinite; }
.ki-app-badge.error { background: #fef2f2; color: #dc2626; }

@keyframes kiPulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

.ki-counts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
}
.ki-count { text-align: center; }
.ki-count-value { font-size: 20px; font-weight: 700; color: #1f2937; }
.ki-count-label { font-size: 11px; color: #6b7280; text-transform: uppercase; letter-spacing: .5px; }
.ki-count-delta { font-size: 12px; margin-top: 2px; }
.ki-count-delta.match { color: var(--ki-success); }
.ki-count-delta.diff { color: var(--ki-warning); }

.ki-actions { display: flex; gap: 8px; margin-top: 12px; }
.ki-btn {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ki-btn-primary { background: var(--ki-primary); color: #fff; }
.ki-btn-primary:hover { background: #1d4ed8; }
.ki-btn-outline { background: #fff; color: #374151; border: 1px solid #d1d5db; }
.ki-btn-outline:hover { background: #f9fafb; }
.ki-btn:disabled { opacity: .5; cursor: not-allowed; }

.ki-log-panel {
  background: #1f2937;
  border-radius: 12px;
  padding: 16px;
  font-family: "SF Mono", Monaco, monospace;
  font-size: 13px;
  color: #e5e7eb;
  max-height: 300px;
  overflow-y: auto;
}
.ki-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #374151;
}
.ki-log-title { font-size: 14px; font-weight: 600; color: #fff; display: flex; align-items: center; gap: 8px; }
.ki-log-live { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #10b981; }
.ki-log-live::before { content: ""; width: 8px; height: 8px; background: #10b981; border-radius: 50%; animation: kiBlink 1s infinite; }
@keyframes kiBlink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.ki-log-entry { padding: 4px 0; border-bottom: 1px solid #374151; display: flex; gap: 12px; }
.ki-log-entry:last-child { border-bottom: none; }
.ki-log-time { color: #9ca3af; font-size: 11px; min-width: 60px; }
.ki-log-level { font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 600; text-transform: uppercase; }
.ki-log-level.info { background: #dbeafe; color: #1e40af; }
.ki-log-level.success { background: #d1fae5; color: #065f46; }
.ki-log-level.error { background: #fee2e2; color: #991b1b; }
.ki-log-level.warn { background: #fef3c7; color: #92400e; }
.ki-log-msg { flex: 1; color: #e5e7eb; }

.ki-refresh-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f3f4f6;
  border-radius: 8px;
  margin-top: 16px;
}
.ki-refresh-info { font-size: 13px; color: #6b7280; }

.ki-quick-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; padding-top: 20px; border-top: 1px solid #e5e7eb; }

.ki-bg-sync-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0;
  padding: 8px 0;
  border-top: 1px dashed #e5e7eb;
}
.ki-next-sync { font-size: 11px; color: #6b7280; }

.ki-toggle-sm { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.ki-toggle-switch-sm {
  width: 36px;
  height: 20px;
  background: #d1d5db;
  border-radius: 20px;
  position: relative;
  transition: all .2s;
}
.ki-toggle-switch-sm::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: all .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.ki-toggle-sm.active .ki-toggle-switch-sm { background: #10b981; }
.ki-toggle-sm.active .ki-toggle-switch-sm::before { left: 18px; }
.ki-toggle-label-sm { font-size: 11px; font-weight: 500; color: #374151; }
.ki-toggle-status-sm { font-size: 10px; color: #6b7280; }

/* Sync Status Styles */
:root {
  --ks-primary: #2563eb;
  --ks-success: #10b981;
  --ks-warning: #f59e0b;
  --ks-danger: #ef4444;
}

.ks-dashboard { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.ks-header {
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
  border-radius: 16px;
  padding: 24px;
  color: #fff;
  margin-bottom: 24px;
}
.ks-header h1 { font-size: 28px; font-weight: 700; margin: 0; }
.ks-header p { opacity: .9; margin: 8px 0 0; }

.ks-panel {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.ks-panel-title { font-size: 18px; font-weight: 700; color: #1f2937; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }

.ks-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.ks-table th {
  background: #f8fafc;
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 2px solid #e5e7eb;
}
.ks-table td { padding: 16px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.ks-table tr:hover td { background: #f9fafb; }
.ks-table tr.syncing td { background: #eff6ff; }
.ks-table tr.error td { background: #fef2f2; }

.ks-app-cell { display: flex; align-items: center; gap: 12px; }
.ks-app-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
}
.ks-app-info h4 { font-size: 14px; font-weight: 600; color: #1f2937; margin: 0; }
.ks-app-info span { font-size: 12px; color: #9ca3af; }

.ks-status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.ks-status-badge.success { background: #d1fae5; color: #065f46; }
.ks-status-badge.primary { background: #dbeafe; color: #1e40af; }
.ks-status-badge.warning { background: #fef3c7; color: #92400e; }
.ks-status-badge.danger { background: #fee2e2; color: #991b1b; }

.ks-counts { display: flex; gap: 16px; }
.ks-count { text-align: center; min-width: 80px; }
.ks-count-value { font-size: 18px; font-weight: 700; color: #1f2937; }
.ks-count-value.mismatch { color: var(--ks-warning); }
.ks-count-value.synced { color: var(--ks-success); }
.ks-count-label { font-size: 10px; color: #6b7280; text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }
.ks-count-bar { height: 4px; background: #e5e7eb; border-radius: 2px; margin-top: 6px; overflow: hidden; }
.ks-count-bar-fill { height: 100%; background: var(--ks-success); border-radius: 2px; transition: width .3s; }
.ks-count-bar-fill.partial { background: var(--ks-warning); }

.ks-delta { font-size: 11px; margin-top: 4px; }
.ks-delta.synced { color: var(--ks-success); }
.ks-delta.pending { color: var(--ks-warning); }
.ks-delta.error { color: var(--ks-danger); }

.ks-progress { display: flex; align-items: center; gap: 12px; }
.ks-progress-bar { flex: 1; height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
.ks-progress-fill { height: 100%; border-radius: 4px; transition: width .3s; }
.ks-progress-fill.success { background: var(--ks-success); }
.ks-progress-fill.warning { background: var(--ks-warning); }
.ks-progress-fill.danger { background: var(--ks-danger); }
.ks-progress-text { font-size: 12px; font-weight: 600; min-width: 40px; text-align: right; }

.ks-btn { padding: 8px 14px; border-radius: 8px; font-size: 12px; font-weight: 500; border: none; cursor: pointer; transition: all .2s; }
.ks-btn-primary { background: var(--ks-primary); color: #fff; }
.ks-btn-primary:hover { background: #1d4ed8; }
.ks-btn-outline { background: #fff; color: #374151; border: 1px solid #d1d5db; }
.ks-btn-outline:hover { background: #f9fafb; }

.ks-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.ks-summary-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  display: flex;
  align-items: center;
  gap: 16px;
}
.ks-summary-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.ks-summary-content { flex: 1; }
.ks-summary-value { font-size: 24px; font-weight: 700; color: #1f2937; }
.ks-summary-label { font-size: 13px; color: #6b7280; }

.ks-legend { display: flex; gap: 24px; flex-wrap: wrap; padding: 16px; background: #f8fafc; border-radius: 8px; margin-top: 16px; }
.ks-legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #6b7280; }
.ks-legend-dot { width: 12px; height: 12px; border-radius: 50%; }

/* ============================================================
   SITE MODULE STYLES
   ============================================================ */

/* --- Login & Auth --- */
body.login-page {
  background: #0c1220;
  position: relative;
  overflow-x: hidden;
}
body.login-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(15, 118, 110, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse 60% 60% at 80% 80%, rgba(180, 83, 9, 0.08) 0%, transparent 50%);
  z-index: 0;
  pointer-events: none;
}

.login-bg-ring {
  position: fixed;
  width: 600px; height: 600px;
  border-radius: 50%;
  border: 1px solid rgba(251, 191, 36, 0.06);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 0;
  pointer-events: none;
}
.login-bg-ring::before {
  content: '';
  position: absolute;
  inset: 40px;
  border-radius: 50%;
  border: 1px solid rgba(251, 191, 36, 0.04);
}

.login-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  position: relative;
  z-index: 1;
}

.login-card {
  max-width: 440px;
  width: 100%;
  background: #faf8f5;
  border-radius: 16px;
  box-shadow:
    0 2px 4px rgba(0,0,0,0.15),
    0 8px 24px rgba(0,0,0,0.2),
    0 24px 64px rgba(0,0,0,0.25);
  overflow: hidden;
  animation: slideUp .6s cubic-bezier(0.22, 1, 0.36, 1);
}

.login-header {
  background: #0f172a;
  padding: 40px 32px 36px;
  text-align: center;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.login-header-accent {
  position: absolute;
  top: -60px; right: -60px;
  width: 160px; height: 160px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.25) 0%, transparent 60%);
  border-radius: 50%;
}
.login-header img { height: 52px; margin-bottom: 16px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.3)); }
.login-header h4 {
  margin: 0;
  font-weight: 800;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
  color: #fff;
}
.login-header p {
  margin: 8px 0 0;
  color: rgba(251, 191, 36, 0.85);
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-body { padding: 32px; }

/* Spacing system: tight 8, normal 16, generous 24, section 32 */
.login-form-fields { display: flex; flex-direction: column; gap: 16px; }
.login-form-fields .form-group { margin-bottom: 0; }
.login-form-fields .form-group label {
  font-weight: 600;
  font-size: .8rem;
  color: #1e293b;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.login-form-fields .form-control {
  border-radius: 8px;
  padding: 11px 14px;
  border: 1.5px solid #d1d5db;
  background: #fff;
  font-size: .95rem;
  transition: border-color .2s, box-shadow .2s;
}
.login-form-fields .form-control:focus {
  border-color: #d97706;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, .12);
  outline: none;
}
.login-form-fields .form-control::placeholder { color: #9ca3af; }

.login-primary-action { margin-top: 28px; }

.btn-login {
  background: #d97706;
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-weight: 700;
  font-size: .9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fff;
  box-shadow: 0 4px 12px rgba(217, 119, 6, .35);
  transition: .2s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  overflow: hidden;
}
.btn-login:hover {
  background: #b45309;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(217, 119, 6, .4);
}
.btn-login:active { transform: translateY(0); }

.login-dynamic-actions { margin-top: 24px; }
.login-dynamic-actions .face-actions,
.login-dynamic-actions .mfa-actions { display: flex; flex-direction: column; gap: 8px; }
.login-dynamic-actions .mfa-actions {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #d6d3d1;
}

.btn-face-action { width: 100%; }

.login-status { margin-top: 12px; padding: 8px; min-height: 32px; }

.login-separator {
  margin-top: 24px;
  height: 1px;
  background: #e7e5e4;
}

.login-links {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.login-links a {
  color: #b45309;
  text-decoration: none;
  font-size: .85rem;
  font-weight: 500;
  transition: .2s;
  white-space: nowrap;
  flex: 0 0 auto;
}
.login-links a:hover { color: #92400e; text-decoration: underline; }
.login-links span { font-size: .8rem; line-height: 1.35; color: #78716c; margin-left: auto; text-align: right; flex: 1 1 auto; }

.login-footer { text-align: center; margin-top: 20px; color: rgba(255,255,255,.45); font-size: .8rem; }
.login-footer a { color: rgba(251, 191, 36, .7); }

/* Password toggle */
#toggle-password {
  border-color: #d1d5db;
  background: #fff;
  color: #78716c;
  transition: all 0.2s;
  padding: 10px 14px;
  position: relative;
}
#toggle-password:hover { background: #f5f5f4; color: #44403c; }
#toggle-password:focus { box-shadow: none; border-color: #d97706; }
#toggle-password::before {
  content: '';
  position: absolute;
  inset: -8px;
}

.auth-note {
  margin-bottom: 20px;
  padding: .875rem 1rem;
  border-radius: 10px;
  background: #fef3c7;
  color: #78350f;
  font-size: .875rem;
  line-height: 1.5;
  border: 1px solid #fde68a;
  font-weight: 500;
}

/* --- MPTNS Dashboard --- */
.dashboard-container {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f8f9fa;
  min-height: 100vh;
}

.kpi-card {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border-left: 4px solid transparent;
  transition: transform 0.2s;
  height: 100%;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.kpi-card.teal-border { border-left-color: #008eb4; }
.kpi-card.green-border { border-left-color: #28a745; }
.kpi-card.purple-border { border-left-color: #6f42c1; }
.kpi-card.orange-border { border-left-color: #fd7e14; }
.kpi-card.red-border { border-left-color: #dc3545; }

.kpi-icon {
  width: 40px; height: 40px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; margin-bottom: 15px;
}
.bg-icon-teal { background: #e0f7fa; color: #008eb4; }
.bg-icon-green { background: #e8f5e9; color: #28a745; }
.bg-icon-purple { background: #f3e5f5; color: #6f42c1; }
.bg-icon-orange { background: #fff3e0; color: #fd7e14; }
.bg-icon-red { background: #ffebee; color: #dc3545; }

.kpi-value { font-size: 1.8rem; font-weight: 700; color: #2c3e50; margin-bottom: 5px; }
.kpi-label { font-size: 0.85rem; color: #5f6368; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.kpi-subtext { font-size: 0.75rem; color: #95a5a6; margin-top: 5px; }

.insight-section { background: white; border-radius: 8px; padding: 15px; margin-bottom: 20px; border: 1px solid #dee2e6; }
.insight-title { color: #6f42c1; font-weight: 600; font-size: 0.95rem; display: flex; align-items: center; margin-bottom: 10px; }
.insight-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; }
.insight-item { font-size: 0.8rem; color: #555; border-left: 2px solid #ddd; padding-left: 10px; }
.insight-item strong { color: #333; display: block; margin-bottom: 3px; }

.chart-panel { background: white; border-radius: 8px; padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.chart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.chart-title { font-size: 1rem; font-weight: 600; color: #1f505c; display: flex; align-items: center; }

/* --- Finance --- */
.finance-card { transition: transform 0.2s ease-in-out; }
.finance-card:hover { transform: translateY(-3px); }

.expense-card { transition: transform 0.2s ease-in-out; border-left: 4px solid; }
.expense-card:hover { transform: translateY(-3px); box-shadow: 0 4px 15px rgba(0,0,0,0.1); }

/* --- Security --- */
.device-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 15px;
  background: #fff;
  transition: all 0.2s ease;
}
.device-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

.device-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1.3rem;
}
.device-name { font-weight: 600; font-size: 1.1rem; color: #1f2937; }
.device-meta { color: #6b7280; font-size: 0.85rem; }

.btn-delete-device { color: #ef4444; background: none; border: none; padding: 5px 10px; cursor: pointer; transition: all 0.2s; }
.btn-delete-device:hover { color: #dc2626; background: #fee2e2; border-radius: 6px; }

.section-title { font-size: 1.25rem; font-weight: 600; color: #374151; margin-bottom: 20px; padding-bottom: 10px; border-bottom: 2px solid #e5e7eb; }

.register-type-btn {
  flex: 1; padding: 15px; border: 2px solid #e5e7eb;
  background: #fff; border-radius: 10px; cursor: pointer;
  transition: all 0.2s; text-align: center;
}
.register-type-btn:hover { border-color: #667eea; background: #f8f9ff; }
.register-type-btn.active { border-color: #667eea; background: #eef2ff; }
.register-type-btn i { font-size: 2rem; margin-bottom: 10px; display: block; }
.register-type-btn .label { font-weight: 600; font-size: 1rem; }
.register-type-btn .hint { font-size: 0.8rem; color: #6b7280; margin-top: 5px; }

.security-setup .form-check-input { min-width: 1.125rem; min-height: 1.125rem; cursor: pointer; }
.security-setup .form-check-label { cursor: pointer; padding-left: 0.25rem; user-select: none; }

@media (max-width: 767.98px) {
  .security-setup { padding-top: 1rem !important; padding-bottom: 1rem !important; }
  .security-setup .card-body { padding: 1rem; }
  .security-setup .form-inline { display: flex; flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .security-setup .form-inline .form-check { margin-right: 0 !important; min-height: 44px; display: flex; align-items: center; }
  .security-setup .form-inline .form-check-input { width: 1.25rem; height: 1.25rem; margin-top: 0; }
  .security-setup .form-inline #save-pref { margin-left: 0 !important; min-height: 44px; padding: 0.5rem 1.25rem; }
  .security-setup .btn-block { min-height: 48px; font-size: 1rem; }
  .security-setup .btn-sm { min-height: 40px; padding: 0.5rem 1rem; }
  .security-setup .col-lg-6 { margin-bottom: 1rem !important; }
  .security-setup .badge { font-size: 0.85rem; padding: 0.5em 0.75em; }
  .security-setup .card .d-flex.justify-content-between { flex-direction: column !important; gap: 1rem; }
  .security-setup .card .d-flex.justify-content-between > div:last-child { align-self: stretch; }
  .security-setup .card .d-flex.justify-content-between .btn { width: 100%; min-height: 48px; }
  #faceEnrollModal .modal-dialog { margin: 0.5rem; max-width: calc(100% - 1rem); }
  #faceEnrollModal .modal-body { padding: 0.75rem; }
  #faceEnrollModal .modal-footer { flex-direction: column; gap: 0.5rem; }
  #faceEnrollModal .modal-footer .btn { width: 100%; min-height: 48px; }
  .security-setup .alert { padding: 0.875rem; }
  .face-enroll-container .camera-preview { max-width: 100% !important; }
}

@media (min-width: 768px) and (max-width: 1023.98px) {
  .security-setup .col-lg-6 { margin-bottom: 1.5rem; }
}

/* --- Face Enrollment --- */
.face-enroll-container {
  max-width: 500px; margin: 50px auto; background: #fff;
  border-radius: 20px; padding: 30px 25px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  font-family: 'Inter', Arial, sans-serif;
}

.camera-preview { position: relative; overflow: hidden; border-radius: 15px; background: #1f2937; }
.face-enroll-container .camera-preview { max-width: 350px; margin: 0 auto 25px; padding-top: 100%; }
.face-enroll-container .camera-preview video,
.face-enroll-container .camera-preview canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }

.status-message {
  margin-top: 18px; padding: 12px; border-radius: 10px;
  text-align: center; font-weight: 500; font-size: 1.05rem; display: none;
}
.status-message.success { background: #d1fae5; color: #065f46; }
.status-message.error { background: #fee2e2; color: #991b1b; }
.status-message.info { background: #dbeafe; color: #1e40af; }

/* --- Error Page --- */
.error-container { min-height: 70vh; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.error-card { background: white; border-radius: 24px; box-shadow: 0 20px 60px rgba(0,0,0,0.1); max-width: 600px; width: 100%; overflow: hidden; text-align: center; }
.error-header { padding: 48px 40px 32px; position: relative; }
.error-header.warning-gradient { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.error-header.danger-gradient { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }
.error-header::before { content: ''; position: absolute; top: -50px; right: -50px; width: 200px; height: 200px; background: rgba(255,255,255,0.1); border-radius: 50%; }

.error-icon { width: 80px; height: 80px; background: rgba(255,255,255,0.2); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; }
.error-icon i { font-size: 2.5rem; color: white; }
.error-code { font-size: 4rem; font-weight: 800; color: white; line-height: 1; margin-bottom: 8px; }
.error-title { color: rgba(255,255,255,0.95); font-size: 1.25rem; font-weight: 500; margin: 0; }
.error-body { padding: 32px 40px 40px; }
.error-message { color: #4b5563; font-size: 1rem; line-height: 1.6; margin-bottom: 24px; }
.error-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.error-actions .btn { padding: 12px 28px; border-radius: 10px; font-weight: 600; transition: all 0.2s ease; }
.btn-back-home { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border: none; }
.btn-back-home:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4); color: white; }
.btn-go-back { background: #f3f4f6; color: #374151; border: none; }
.btn-go-back:hover { background: #e5e7eb; }
.error-help { margin-top: 24px; padding-top: 24px; border-top: 1px solid #f3f4f6; color: #9ca3af; font-size: 0.85rem; }
.error-help a { color: #667eea; }

/* --- Navbar --- */
#btn_logout:hover::before { content: 'Logout  '; }
.main-header.navbar { background-color: #ffffff !important; border-bottom: 1px solid #dee2e6; }
.main-header.navbar .nav-link { color: #495057 !important; }
.main-header.navbar .nav-link:hover { color: #007bff !important; }
body.dark-mode .main-header.navbar { background-color: #2d2d30 !important; border-bottom: 1px solid #3e3e42; }
body.dark-mode .main-header.navbar .nav-link { color: #cccccc !important; }
body.dark-mode .main-header.navbar .nav-link:hover { color: #ffffff !important; }
.flash-danger { animation: alertFlash 1s ease-in-out infinite; }
.navbar-nav .dropdown-menu { min-width: 220px; }
.navbar-nav .dropdown-item { padding: 0.5rem 1rem; }
.navbar-nav .dropdown-item i { width: 20px; margin-right: 8px; }

/* --- Dashboard Stats Grid --- */
.dashboard-stat-card {
  background: white; border-radius: 12px; padding: 1.5rem;
  position: relative; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
  border: 1px solid #e2e8f0; transition: all 0.3s ease;
  height: 100%; cursor: pointer; overflow: hidden;
}
.dashboard-stat-card:hover { box-shadow: 0 12px 20px -5px rgba(0,0,0,0.1); border-color: #3b82f6; }

.stat-icon-circle { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; margin-bottom: 1rem; }
.stat-val-big { font-size: 2rem; font-weight: 800; color: #1e293b; line-height: 1; margin-bottom: 0.25rem; }
.stat-label-text { color: #64748b; font-weight: 600; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.5px; }
.stat-footer { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid #f1f5f9; font-size: 0.85rem; color: #94a3b8; display: flex; justify-content: space-between; align-items: center; }

.trend-badge { padding: 2px 8px; border-radius: 99px; font-size: 0.75rem; font-weight: 700; }
.trend-up { background: #dcfce7; color: #166534; }
.trend-neutral { background: #f1f5f9; color: #64748b; }

.theme-blue .stat-icon-circle { background: #eff6ff; color: #3b82f6; }
.theme-orange .stat-icon-circle { background: #fff7ed; color: #f97316; }
.theme-red .stat-icon-circle { background: #fef2f2; color: #ef4444; }
.theme-green .stat-icon-circle { background: #f0fdf4; color: #22c55e; }
.theme-teal .stat-icon-circle { background: #f0fdfa; color: #14b8a6; }
.theme-purple .stat-icon-circle { background: #f5f3ff; color: #8b5cf6; }
.theme-indigo .stat-icon-circle { background: #eef2ff; color: #6366f1; }
.theme-gray .stat-icon-circle { background: #f8fafc; color: #64748b; }

@media (max-width: 576px) {
  .login-card { max-width: 95%; border-radius: 15px; }
  .login-body { padding: 25px; }
  .dashboard-stat-card { padding: 1rem; }
  .stat-val-big { font-size: 1.5rem; }
  .stat-icon-circle { width: 40px; height: 40px; font-size: 1.25rem; }
}

/* --- Kintone --- */
.status-badge { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 20px; font-weight: 600; font-size: 13px; }
.push-status-card { border-radius: 10px; border: none; box-shadow: 0 2px 12px rgba(0,0,0,0.08); margin-bottom: 20px; }

/* --- Two-Factor Verify --- */
.btn-user { padding: 0.75rem 1rem; border-radius: 10rem; font-size: 1rem; }
.form-control-user { border-radius: 10rem; padding: 1.5rem 1rem; border: 1px solid #d1d3e2; }
.form-control-user:focus { border-color: #bac8f3; box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25); }

/* --- Login Particles & Toggle --- */
#particles-bg {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  z-index: -1; overflow: hidden; pointer-events: none;
}
#particles-bg::before,
#particles-bg::after {
  content: ''; position: absolute; border-radius: 50%;
  animation: float 15s infinite ease-in-out;
}
#particles-bg::before {
  width: 300px; height: 300px; background: rgba(102, 126, 234, 0.15);
  top: -100px; right: -100px;
}
#particles-bg::after {
  width: 400px; height: 400px; background: rgba(118, 75, 162, 0.1);
  bottom: -150px; left: -150px; animation-delay: -7s;
}

.floating-shape {
  position: fixed; border-radius: 50%; opacity: 0.1; z-index: -1;
  animation: floatShape 20s infinite ease-in-out;
}
.floating-shape:nth-child(1) { width: 80px; height: 80px; background: #667eea; top: 20%; left: 10%; animation-duration: 18s; }
.floating-shape:nth-child(2) { width: 120px; height: 120px; background: #764ba2; top: 60%; right: 15%; animation-duration: 22s; animation-delay: -5s; }
.floating-shape:nth-child(3) { width: 60px; height: 60px; background: #f59e0b; bottom: 20%; left: 20%; animation-duration: 16s; animation-delay: -10s; }

/* --- Keyframes --- */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes alertFlash { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
@keyframes float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(30px, 30px) rotate(5deg); }
  50% { transform: translate(0, 50px) rotate(0deg); }
  75% { transform: translate(-30px, 30px) rotate(-5deg); }
}
@keyframes floatShape {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-40px) scale(1.1); }
}

/* ============================================================
   SECURITY LAYOUT (security.php)
   ============================================================ */

.nexus-security-body {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--nexus-midnight) 0%, var(--nexus-slate) 50%, #203a43 100%);
  background-attachment: fixed;
  color: #0f1f2f;
}

.nexus-security-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 48px 16px;
}

.nexus-security-brand {
  text-align: center;
  margin-bottom: 32px;
  color: #f5f7fb;
}

.nexus-security-brand img {
  height: 48px;
  margin-bottom: 12px;
}

.nexus-security-container {
  width: 100%;
  max-width: 1200px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: var(--nexus-radius);
  box-shadow: var(--nexus-shadow-xl);
  padding: 32px;
}

/* ============================================================
   Responsive Adaptations
   ============================================================ */

/* Tablet (768px - 1023px) */
@media (max-width: 1023px) and (min-width: 769px) {
  .service-calls-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .itss-toolbar {
    padding: 10px;
  }
}

/* Mobile (768px and below) */
@media (max-width: 768px) {
  .service-calls-shell .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .service-calls-shell .card-title {
    font-size: 1.1rem;
  }

  .service-calls-toolbar {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .service-calls-toolbar .btn {
    width: 100%;
    white-space: normal;
    min-height: 44px;
  }

  .service-calls-stats {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .service-calls-stat {
    padding: 8px 10px;
  }

  .service-calls-stat .value {
    font-size: 1.1rem;
  }

  /* ITSS index mobile */
  .itss-toolbar {
    padding: 8px;
    margin-bottom: 8px;
  }

  .itss-summary {
    padding: 8px;
    margin-bottom: 8px;
  }

  .itss-summary .count {
    font-size: 1rem;
  }

  .itss-status-badge {
    font-size: 0.7rem;
    padding: 3px 6px;
  }

  /* View page mobile */
  .view_table .table td,
  .view_table .table th {
    white-space: nowrap;
    font-size: 0.85rem;
    padding: 0.25rem 0.35rem;
  }

  /* Ensure grids scroll horizontally on mobile */
  .service-calls-grid-wrap,
  #itss-index-grid {
    -webkit-overflow-scrolling: touch;
  }

  /* Touch-friendly buttons in action columns */
  .view_table .btn-sm {
    min-height: 36px;
    min-width: 44px;
    padding: 6px 10px;
    font-size: 0.85rem;
  }

  /* Chat popup: position within viewport on mobile */
  .chat-popup {
    width: 100% !important;
    max-width: 320px;
    left: auto !important;
    right: 10px !important;
  }

  /* Security layout mobile */
  .nexus-security-container {
    padding: 20px;
  }

  .nexus-security-wrapper {
    padding: 24px 12px;
  }

  /* Form flow card padding reduction */
  .nexus-flow-card {
    padding: 10px !important;
  }

  /* Ensure select2 dropdowns don't overflow */
  .select2-container {
    max-width: 100%;
  }
}

/* ============================================================
   HARDENING UTILITIES
   ============================================================ */

/* Text overflow: single-line ellipsis */
.nexus-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* Text overflow: multi-line clamp */
.nexus-line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.nexus-line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Force word break for long strings (URLs, IDs, hashes) */
.nexus-wrap {
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Extra small text utility */
.text-xs { font-size: 0.75rem; }

/* Detail view label widths */
.detail-label-sm { width: 20%; }
.detail-label-md { width: 35%; }
.detail-label-lg { width: 65%; }
.detail-label-md-40 { width: 40%; }
.detail-label-lg-60 { width: 60%; }
.detail-label-sm-30 { width: 30%; }
.detail-label-lg-70 { width: 70%; }

/* Dimension utilities */
.nexus-icon-32 { width: 32px; height: 32px; }
.nexus-icon-38 { width: 38px; height: 38px; }
.nexus-icon-40 { width: 40px; height: 40px; }
.nexus-icon-48 { width: 48px; height: 48px; }
.nexus-min-w-180 { min-width: 180px; }

/* Object fit */
.nexus-object-cover { object-fit: cover; }

/* Scrollable containers */
.nexus-scroll-y-300 { max-height: 300px; overflow-y: auto; }
.nexus-scroll-y-400 { max-height: 400px; overflow-y: auto; }

/* Card transition */
.nexus-card-trans { transition: all 0.2s ease; }

/* Flex gap (Bootstrap 3 compat) */
.nexus-gap-2 { gap: 0.5rem; }
.nexus-gap-3 { gap: 0.75rem; }
.nexus-gap-4 { gap: 1rem; }

/* Letter spacing */
.nexus-tracking-wide { letter-spacing: 0.025em; }

/* Border bottom light gray */
.nexus-border-bottom-light { border-bottom: 1px solid #e9ecef; }

/* Border radius top only */
.nexus-rounded-t-12 { border-radius: 12px 12px 0 0; }

/* Gradient backgrounds */
.nexus-gradient-primary { background: linear-gradient(135deg, #667eea, #764ba2); }
.nexus-gradient-header { background: linear-gradient(to right, #f8f9fa, #e9ecef); }
.nexus-gradient-success { background: linear-gradient(135deg, #11998e, #38ef7d); }
.nexus-gradient-danger { background: linear-gradient(135deg, #eb3349, #f45c43); }
.nexus-gradient-info { background: linear-gradient(135deg, #4facfe, #00f2fe); }
.nexus-gradient-cyan { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.nexus-bg-cyan-soft { background: linear-gradient(145deg, #ffffff, #f0f9ff); }

/* Soft backgrounds */
.nexus-bg-light-soft { background: linear-gradient(145deg, #ffffff, #f5f7fa); }
.nexus-bg-warm-soft { background: linear-gradient(145deg, #fff9e6, #fff5d1); }
.nexus-bg-gray-200 { background: #e9ecef; }

/* Tab transition */
.nexus-tab-trans { transition: all 0.3s ease; }

/* Font size utilities */
.nexus-text-lg { font-size: 1.1rem; }
.nexus-text-xl { font-size: 1.25rem; }
.nexus-text-sm { font-size: 0.9rem; }
.nexus-text-2xs { font-size: 0.65rem; }
.nexus-text-1_2 { font-size: 1.2em; }

/* Table column widths */
.nexus-w-7 { width: 7%; }
.nexus-w-10 { width: 10%; }
.nexus-w-12 { width: 12%; }
.nexus-w-15 { width: 15%; }
.nexus-w-20 { width: 20%; }

/* Fixed widths */
.nexus-w-28 { width: 28px; }
.nexus-w-40 { width: 40px; }
.nexus-w-50 { width: 50px; }
.nexus-w-60 { width: 60px; }
.nexus-w-100 { width: 100px; }
.nexus-w-110 { width: 110px; }
.nexus-w-120 { width: 120px; }
.nexus-w-130 { width: 130px; }
.nexus-w-140 { width: 140px; }
.nexus-w-150 { width: 150px; }
.nexus-w-220 { width: 220px; }

/* Cursor */
.nexus-cursor-pointer { cursor: pointer; }

/* White space */
.nexus-nowrap { white-space: nowrap; }

/* Signature line for print reports */
.nexus-signature-line { width: 80%; margin: 0 auto; }

/* Subtotal row background */
.nexus-bg-subtotal { background-color: #f0f0f5; }

/* Custom badge colors */
.nexus-badge-purple { background-color: #6f42c1; color: #fff; }

/* Font size utilities */
.nexus-text-75 { font-size: 75%; }
.nexus-text-2xs { font-size: 0.5rem; }
.nexus-text-1_05 { font-size: 1.05rem; }

/* Opacity */
.opacity-85 { opacity: 0.85; }

/* Outline badge purple */
.badge-outline-purple { border: 1px solid #6f42c1; color: #6f42c1; background: none; }

/* Spacing utilities */
.nexus-ml-1 { margin-left: 5px; }
.nexus-mr-2 { margin-right: 10px; }
.nexus-mt-0 { margin-top: 0; }
.nexus-mt-1 { margin-top: 5px; }
.nexus-mt-2 { margin-top: 10px; }
.nexus-mt-3 { margin-top: 13px; }
.nexus-mr-1 { margin-right: 5px; }
.nexus-mb-1 { margin-bottom: 5px; }
.nexus-mb-2 { margin-bottom: 10px; }
.nexus-mb-3 { margin-bottom: 15px; }
.nexus-pr-1 { padding-right: 5px; }
.nexus-pr-2 { padding-right: 10px; }
.nexus-pl-1 { padding-left: 5px; }
.nexus-p-1 { padding: 5px; }
.nexus-p-2 { padding: 8px 10px; }

/* Display */
.nexus-d-block { display: block; }

/* Text alignment */
.nexus-text-center { text-align: center; }

/* Font weights */
.nexus-font-bold { font-weight: bold; }

/* Font sizes */
.nexus-text-11px { font-size: 11px; }

/* Sizing */
.nexus-h-34 { height: 34px; }
.nexus-h-59 { height: 59px; }
.nexus-w-100 { width: 100%; }
.nexus-max-h-200 { max-height: 200px; }
.nexus-min-h-34 { min-height: 34px; }

/* Backgrounds */
.nexus-bg-black { background: #000; }

/* Resize */
.nexus-resize-v { resize: vertical; }

/* Auto margins */
.nexus-mx-auto { margin-left: auto; margin-right: auto; }

/* Max widths */
.nexus-max-w-150 { max-width: 150px; }
.nexus-max-w-180 { max-width: 180px; }
.nexus-max-w-200 { max-width: 200px; }
.nexus-max-w-220 { max-width: 220px; }
.nexus-max-w-270 { max-width: 270px; }
.nexus-max-w-280 { max-width: 280px; }
.nexus-max-w-300 { max-width: 300px; }
.nexus-max-w-320 { max-width: 320px; }
.nexus-max-w-460 { max-width: 460px; }

/* Min widths */
.nexus-min-w-170 { min-width: 170px; }
.nexus-min-w-220 { min-width: 220px; }

/* Extra large decorative font sizes */
.nexus-text-12rem { font-size: 12rem; }

/* Avatar sizes */
.nexus-avatar-sm { width: 35px; height: 35px; }

/* Border radius utilities */
.nexus-rounded-xl { border-radius: 16px; }
.nexus-rounded-t-xl { border-radius: 16px 16px 0 0; }
.nexus-rounded-b-xl { border-radius: 0 0 16px 16px; }

/* Scroll containers with max-height */
.nexus-scroll-y-400 { max-height: 400px; overflow-y: auto; }
.nexus-scroll-y-450 { max-height: 450px; overflow-y: auto; }
.nexus-scroll-y-500 { max-height: 500px; overflow-y: auto; }

/* Progress bar sizing */
.nexus-progress-thin { width: 60px; height: 6px; border-radius: 10px; }
.nexus-progress-thick { height: 20px; }
.nexus-progress-30 { height: 30px; }

/* Custom progress bar children */
.nexus-progress-thin .nexus-progress-bar-info { height: 100%; background: #17a2b8; border-radius: 3px; }

/* Light background utility */
.nexus-bg-light { background-color: #f8f9fa; }

/* Gray soft background */
.nexus-bg-gray-soft { background: linear-gradient(145deg, #f8f9fa, #e9ecef); }

/* Line height */
.nexus-leading-relaxed { line-height: 1.7; }
.nexus-leading-snug { line-height: 1.4; }

/* Overflow auto max-height */
.nexus-scroll-auto-300 { overflow: auto; max-height: 300px; }

/* Visibility */
.nexus-invisible { visibility: hidden; }

/* ------------------------------------------------------------------
   Legacy stat card component (curved, indented)
   ------------------------------------------------------------------ */
.nexus-stat-legacy {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 155px;
  margin-bottom: 1rem;
}

.nexus-stat-legacy .inner {
  flex: 1 1 auto;
  padding: 1.25rem 1.5rem;
  padding-right: 4.5rem;
}

.nexus-stat-legacy .inner h3 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.nexus-stat-legacy .inner p {
  font-size: 0.9375rem;
  margin-bottom: 0.5rem;
}

.nexus-stat-legacy .icon {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  font-size: 2.25rem;
  opacity: 0.35;
  line-height: 1;
}

.nexus-stat-legacy .nexus-stat-legacy-footer {
  flex-shrink: 0;
  padding: 0.5rem 1.5rem;
  font-size: 0.8125rem;
  background: rgba(0, 0, 0, 0.08);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

/* Skeleton loader sizing */
.nexus-skeleton-md { width: 50%; height: 2rem; }

/* Border radius */
.nexus-rounded-12 { border-radius: 12px; }
.nexus-rounded-16 { border-radius: 16px; }

/* Badge position offset (requires position-relative/absolute) */
.nexus-badge-offset { top: -5px; right: -5px; }

/* Prevent flex/grid items from overflowing their container */
.nexus-min-w-0 { min-width: 0; }
.nexus-min-h-0 { min-height: 0; }

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .nexus-animate,
  .nexus-animate-1,
  .nexus-animate-2,
  .nexus-animate-3,
  .nexus-animate-4,
  .nexus-animate-5 {
    animation: none;
    opacity: 1;
  }
  .nexus-hero-header,
  .nexus-hero-header::before,
  .nexus-hero-header::after {
    transition: none;
  }
  .nexus-stat-card,
  .nexus-stat-card:hover,
  .nexus-btn,
  .nexus-btn:hover {
    transition: none;
    transform: none;
  }
  .nexus-tab-link { transition: none; }
  .nexus-table-row { transition: none; }
  .nexus-timeline-item { transition: none; }
}

/* Focus-visible for keyboard navigation */
.nexus-btn:focus-visible,
.nexus-tab-link:focus-visible,
.nexus-table-row a:focus-visible {
  outline: 2px solid var(--nexus-amber);
  outline-offset: 2px;
}

/* Loading skeleton for async content */
.nexus-skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: nexusSkeletonShimmer 1.5s infinite;
  border-radius: var(--nexus-radius-sm);
}
@keyframes nexusSkeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .nexus-skeleton { animation: none; background: #e2e8f0; }
}
