/* ==========================================================================
   Radhey Immigration Consultancy Portal - Modern Enterprise Stylesheet
   ========================================================================== */

:root {
  --primary: #0284c7;         /* Sky 600 */
  --primary-dark: #0369a1;    /* Sky 700 */
  --primary-light: #e0f2fe;   /* Sky 100 */
  --primary-subtle: #f0f9ff;  /* Sky 50 */
  --secondary: #0f172a;       /* Slate 900 */
  --accent: #38bdf8;          /* Sky 400 */
  --accent-gold: #d97706;     /* Amber 600 */
  --success: #16a34a;         /* Emerald 600 */
  --success-light: #dcfce7;
  --warning: #f59e0b;         /* Amber 500 */
  --warning-light: #fef3c7;
  --danger: #dc2626;          /* Red 600 */
  --danger-light: #fee2e2;
  --info: #2563eb;            /* Blue 600 */
  --info-light: #dbeafe;
  --bg-body: #f8fafc;         /* Slate 50 */
  --bg-surface: #ffffff;
  --border-color: #e2e8f0;    /* Slate 200 */
  --text-main: #0f172a;       /* Slate 900 */
  --text-muted: #64748b;      /* Slate 500 */
  --text-light: #94a3b8;      /* Slate 400 */
  --sidebar-w: 260px;
  --header-h: 70px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ==========================================================================
   Typography & Utility Classes
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  color: var(--secondary);
  font-weight: 600;
  line-height: 1.25;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--primary-dark);
}

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.bg-white { background-color: #ffffff; }
.bg-sky { background-color: var(--primary-subtle); }
.bg-emerald { background-color: var(--success-light); }
.bg-rose { background-color: var(--danger-light); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.flex-1 { flex: 1 1 0%; }
.flex-wrap { flex-wrap: wrap; }

.hidden { display: none !important; }
.w-full { width: 100%; }

/* Grid System */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 768px) {
  .grid-cols-2, .grid-cols-3, .grid-cols-4 {
    grid-template-columns: 1fr !important;
  }
}

/* Spacing & Alignment Helpers */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }

.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-5 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }

.border { border: 1px solid var(--border-color); }
.border-b { border-bottom: 1px solid var(--border-color); }
.border-t { border-top: 1px solid var(--border-color); }
.rounded { border-radius: var(--radius-sm); }
.block { display: block; }
.inline-block { display: inline-block; }
.cursor-pointer { cursor: pointer; }

.bg-slate-50 { background-color: #f8fafc; }
.bg-amber-50 { background-color: #fffbeb; }
.border-amber-200 { border-color: #fde68a; }
.border-sky-200 { border-color: #bae6fd; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.25);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #0369a1, #075985);
  box-shadow: 0 4px 8px rgba(2, 132, 199, 0.35);
}

.btn-secondary {
  background-color: #ffffff;
  border-color: var(--border-color);
  color: var(--text-main);
}
.btn-secondary:hover:not(:disabled) {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
}

.btn-success {
  background-color: var(--success);
  color: #ffffff;
}
.btn-success:hover:not(:disabled) {
  background-color: #15803d;
}

.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
}
.btn-danger:hover:not(:disabled) {
  background-color: #b91c1c;
}

.btn-outline-primary {
  background-color: transparent;
  border-color: var(--primary);
  color: var(--primary);
}
.btn-outline-primary:hover:not(:disabled) {
  background-color: var(--primary-light);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.775rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: capitalize;
}

.badge-primary { background-color: var(--primary-light); color: var(--primary-dark); }
.badge-success { background-color: var(--success-light); color: var(--success); }
.badge-warning { background-color: var(--warning-light); color: #b45309; }
.badge-danger { background-color: var(--danger-light); color: var(--danger); }
.badge-secondary { background-color: #e2e8f0; color: #475569; }
.badge-info { background-color: var(--info-light); color: var(--info); }

/* Form Controls */
.form-group {
  margin-bottom: 1.1rem;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.35rem;
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-control, .form-select {
  width: 100%;
  padding: 0.6rem 0.85rem;
  font-size: 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: #ffffff;
  color: var(--text-main);
  transition: all 0.15s ease;
  font-family: inherit;
}

.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

textarea.form-control {
  min-height: 80px;
  resize: vertical;
}

/* ==========================================================================
   Login Screen with Flight & Passport theme
   ========================================================================== */
#login-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 1.5rem;
  overflow-y: auto;
}

/* Overlay gradient for flight/passport background */
.login-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 30%, rgba(2, 132, 199, 0.45) 0%, rgba(15, 23, 42, 0.88) 100%);
  backdrop-filter: blur(4px);
  z-index: 1;
}

.login-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  padding: 2.25rem;
  border: 1px solid rgba(255, 255, 255, 0.5);
  animation: slideUpFade 0.4s ease-out;
}

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

.login-brand {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-logo {
  max-width: 130px;
  max-height: 70px;
  object-fit: contain;
  margin: 0 auto 0.75rem auto;
  display: block;
}

.login-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--secondary);
  letter-spacing: -0.02em;
}

.login-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Time notice badge on login */
.login-time-notice {
  background-color: var(--primary-subtle);
  border: 1px dashed var(--primary);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  font-size: 0.775rem;
  color: #0369a1;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Out of hours approval banner */
.login-approval-box {
  background: var(--warning-light);
  border: 1px solid #f59e0b;
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  margin-bottom: 1.25rem;
  font-size: 0.825rem;
  color: #92400e;
}

/* Quick Role Switcher for Testing/Demo */
.demo-role-quickbar {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-muted);
}
.demo-role-quickbar .role-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}
.demo-role-chip {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.7rem;
  color: #334155;
  transition: all 0.15s;
}
.demo-role-chip:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* ==========================================================================
   Main Application Layout
   ========================================================================== */
#app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-w);
  background-color: #ffffff;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(to right, #ffffff, var(--primary-subtle));
}

.sidebar-logo {
  max-width: 42px;
  max-height: 42px;
  object-fit: contain;
}

.brand-text h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--secondary);
  line-height: 1.15;
}

.brand-text p {
  font-size: 0.675rem;
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-section-title {
  font-size: 0.675rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-light);
  padding: 0.5rem 0.75rem 0.25rem;
  letter-spacing: 0.05em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.845rem;
  font-weight: 500;
  color: #475569;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.nav-item:hover {
  background-color: #f1f5f9;
  color: var(--primary-dark);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.28);
}

.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-item .nav-badge {
  margin-left: auto;
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  background-color: var(--danger);
  color: #ffffff;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border-color);
  background-color: #f8fafc;
}

.user-mini-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-badge {
  font-size: 0.675rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: capitalize;
}

/* ==========================================================================
   Main Content Area & Top Header
   ========================================================================== */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-header {
  height: var(--header-h);
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 90;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-page-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--secondary);
}

.header-page-sub {
  font-size: 0.775rem;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.15rem;
}

/* Live Active Time Counter Ticker */
.active-time-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--success-light);
  border: 1px solid #86efac;
  color: #14532d;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

.clock-display {
  font-size: 0.825rem;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
}

/* Live Cloud Sync Pill (Firebase Realtime Database) */
.cloud-sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  background-color: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}
.cloud-sync-pill:hover {
  filter: brightness(0.96);
}
.cloud-sync-pill.syncing {
  background-color: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}
.cloud-sync-pill.offline {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}
.cloud-sync-pill.error {
  background-color: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-sync 2s infinite;
}
.cloud-sync-pill.syncing .sync-dot {
  background-color: #f59e0b;
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
}
.cloud-sync-pill.offline .sync-dot {
  background-color: #94a3b8;
  box-shadow: none;
  animation: none;
}
.cloud-sync-pill.error .sync-dot {
  background-color: #ef4444;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
}

@keyframes pulse-sync {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Content Container */
.content-wrapper {
  flex: 1;
  padding: 1.5rem 1.75rem;
}

/* ==========================================================================
   Dashboard Cards & Grid
   ========================================================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.metric-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

.metric-card.clickable {
  cursor: pointer;
}

.metric-card.clickable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.metric-card.accent-today {
  border-left: 4px solid var(--primary);
  background: linear-gradient(135deg, #ffffff 60%, var(--primary-subtle) 100%);
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.metric-title {
  font-size: 0.775rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.metric-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--secondary);
  line-height: 1;
}

.metric-sub {
  font-size: 0.725rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* ==========================================================================
   Section Containers & Data Tables
   ========================================================================== */
.card-section {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.75rem;
  overflow: hidden;
}

.card-section-header {
  padding: 1rem 1.35rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #fafbfd;
}

.card-section-title {
  font-size: 0.975rem;
  font-weight: 700;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.portal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.835rem;
  text-align: left;
}

.portal-table th {
  background-color: #f8fafc;
  color: #475569;
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.portal-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: #334155;
  vertical-align: middle;
}

.portal-table tbody tr {
  transition: background-color 0.15s ease;
}

.portal-table tbody tr:hover {
  background-color: #f8fafc;
}

.portal-table .ric-tag {
  font-family: monospace;
  font-weight: 700;
  color: var(--primary-dark);
  background-color: var(--primary-light);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-block;
}

.portal-table .ric-tag:hover {
  background-color: #bae6fd;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(3px);
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-container {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlide 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-container.modal-lg {
  max-width: 860px;
}

.modal-container.modal-xl {
  max-width: 1020px;
}

@keyframes modalSlide {
  from { transform: scale(0.96) translateY(10px); }
  to { transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #fafbfd;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--secondary);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background-color: #fafbfd;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.35rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
}

.modal-close-btn:hover {
  color: var(--danger);
  background-color: #fee2e2;
}

/* ==========================================================================
   Tabs
   ========================================================================== */
.portal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.tab-btn {
  padding: 0.65rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--primary);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background-color: var(--primary-subtle);
}

/* ==========================================================================
   Print / Export Templates (PDF styling for Step One & Invoice)
   ========================================================================== */
.printable-document {
  background-color: #ffffff;
  color: #0f172a;
  padding: 2.25rem;
  border-radius: var(--radius-md);
  border: 1px solid #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  font-size: 0.875rem;
  line-height: 1.5;
}

.doc-header-sky {
  border-bottom: 3px solid var(--primary);
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.doc-brand-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.doc-brand-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.doc-meta-badge {
  background-color: var(--primary-light);
  border: 1px solid #bae6fd;
  color: var(--primary-dark);
  font-weight: 700;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
}

.doc-table th, .doc-table td {
  padding: 0.65rem 0.85rem;
  border: 1px solid #e2e8f0;
}

.doc-table th {
  background-color: #f0f9ff;
  color: #0369a1;
  font-weight: 600;
}

.doc-terms-box {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--primary);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.775rem;
  color: #475569;
  margin-top: 1.5rem;
}

.doc-terms-box ol {
  padding-left: 1.25rem;
  margin-top: 0.5rem;
}

.doc-terms-box li {
  margin-bottom: 0.35rem;
}

/* ==========================================================================
   Responsive Utilities & Cross-Device Optimization (Mobile, Tablet, Desktop)
   ========================================================================== */
.mobile-menu-btn {
  display: none;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  z-index: 99;
  transition: opacity 0.25s ease;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 992px) {
  .mobile-menu-btn {
    display: inline-flex;
    margin-right: 0.5rem;
  }

  .app-sidebar {
    transform: translateX(-100%);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 105;
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .app-main {
    margin-left: 0;
  }

  .content-wrapper {
    padding: 1rem 1.25rem;
  }

  .app-header {
    padding: 0 1.25rem;
  }
}

@media (max-width: 768px) {
  .app-header {
    height: auto;
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 0.65rem;
  }

  .header-left {
    flex: 1;
    min-width: 0;
  }

  .header-page-title {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-page-sub {
    font-size: 0.7rem;
  }

  .header-right {
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .clock-display {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }

  .active-time-pill {
    padding: 0.25rem 0.55rem;
    font-size: 0.75rem;
  }

  .content-wrapper {
    padding: 0.85rem 0.75rem;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .metric-card {
    padding: 0.85rem;
  }

  .metric-value {
    font-size: 1.35rem;
  }

  .card-section-header {
    padding: 0.75rem 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .modal-container {
    width: 96%;
    max-height: 94vh;
    border-radius: var(--radius-md);
  }

  .modal-header, .modal-footer {
    padding: 0.85rem 1rem;
  }

  .modal-body {
    padding: 1rem;
  }

  .login-card {
    padding: 1.75rem 1.25rem;
    margin: 1rem;
  }
}

@media (max-width: 480px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .clock-display {
    display: none; /* Hide date-clock on small screens to prevent header clutter */
  }

  .cloud-sync-pill span:not(.sync-dot) {
    display: none;
  }
  .cloud-sync-pill {
    padding: 0.35rem 0.5rem;
  }

  .login-card {
    padding: 1.5rem 1rem;
  }
}

@media print {
  body {
    background-color: #ffffff;
  }
  .app-sidebar, .app-header, .btn, .no-print, .mobile-menu-btn {
    display: none !important;
  }
  .app-main {
    margin-left: 0;
  }
  .content-wrapper {
    padding: 0;
  }
  .printable-document {
    border: none;
    box-shadow: none;
    padding: 0;
  }
}
