/* ==========================================================================
   FBKami Hub - Apple Human Interface Design System (iOS & macOS Style)
   Dark Mode Glassmorphism • SF Pro Typography • Mobile-First Responsive
   ========================================================================== */

:root {
  /* Apple Dark Mode Surface Palette */
  --apple-bg: #000000;
  --apple-bg-grouped: #000000;
  --apple-bg-elevated: #1c1c1e;
  --apple-bg-secondary: #2c2c2e;
  --apple-bg-tertiary: #3a3a3c;
  
  /* Apple Glass & Surfaces */
  --bg-primary: #000000;
  --bg-secondary: #121214;
  --bg-card: rgba(28, 28, 30, 0.72);
  --bg-card-hover: rgba(44, 44, 46, 0.85);
  --border-color: rgba(255, 255, 255, 0.12);
  --border-active: rgba(10, 132, 255, 0.6);
  --hairline: 0.5px solid rgba(255, 255, 255, 0.12);

  /* Apple Text Colors */
  --text-main: #ffffff;
  --text-muted: rgba(235, 235, 245, 0.6);
  --text-tertiary: rgba(235, 235, 245, 0.38);

  /* Apple iOS System Accent Colors */
  --accent-blue: #0071e3;
  --accent-blue-vibrant: #0a84ff;
  --accent-cyan: #30b0c7;
  --accent-green: #34c759;
  --accent-green-vibrant: #30d158;
  --accent-amber: #ff9500;
  --accent-rose: #ff2d55;
  --accent-purple: #af52de;
  --accent-indigo: #5856d6;
  --accent-red: #ff3b30;

  /* Apple Typography */
  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, system-ui, sans-serif;

  /* Apple Squircle Radius Hierarchy */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --radius-full: 9999px;

  /* Apple Shadows & Ambient Glows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(0, 113, 227, 0.35);
  --glass-blur: blur(28px) saturate(190%);
}

/* Base Reset & Smooth Rendering */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  background-color: var(--apple-bg);
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background-color: var(--apple-bg);
  background-image: 
    radial-gradient(ellipse at 50% -10%, rgba(10, 132, 255, 0.12), transparent 50%),
    radial-gradient(ellipse at 85% 15%, rgba(175, 82, 222, 0.06), transparent 45%),
    radial-gradient(ellipse at 15% 35%, rgba(52, 199, 89, 0.05), transparent 45%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Invisible / Native Apple Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   1. APP HEADER (Apple Frosted Glass Navigation Bar)
   ========================================================================== */
header.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(18, 18, 20, 0.75);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: var(--hairline);
  padding: max(12px, env(safe-area-inset-top)) 24px 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: all 0.25s ease;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #0071e3 0%, #0a84ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 19px;
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}

.logo-badge:active {
  transform: scale(0.92);
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
  line-height: 1.2;
}

.brand-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: -0.01em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Status Pill (Apple Dynamic Capsule) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: var(--radius-full);
  background: rgba(52, 199, 89, 0.12);
  border: 0.5px solid rgba(52, 199, 89, 0.28);
  font-size: 12px;
  font-weight: 600;
  color: #30d158;
  letter-spacing: -0.01em;
  backdrop-filter: blur(10px);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #30d158;
  box-shadow: 0 0 8px rgba(48, 209, 88, 0.8);
  animation: applePulse 2s infinite ease-in-out;
}

@keyframes applePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

/* ==========================================================================
   2. APP NAVIGATION (Apple Segmented Control Bar)
   ========================================================================== */
.app-nav {
  position: sticky;
  top: 63px;
  z-index: 95;
  background: rgba(12, 12, 14, 0.82);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: var(--hairline);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.app-nav::-webkit-scrollbar { display: none; }

.nav-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 15px;
  border-radius: var(--radius-full);
  background: transparent;
  border: 0.5px solid transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
  min-height: 36px;
  user-select: none;
}

.nav-tab i {
  font-size: 14px;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.nav-tab:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-tab:active {
  transform: scale(0.96);
}

/* Apple Active Segment Pill */
.nav-tab.active {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.18);
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3), inset 0 0.5px 0 rgba(255, 255, 255, 0.2);
}

.nav-tab.active i {
  opacity: 1;
  color: var(--accent-blue-vibrant);
}

/* ==========================================================================
   3. MAIN CONTENT CONTAINER
   ========================================================================== */
main.app-main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 80px 20px;
}

.view-section {
  display: none;
  animation: appleFadeIn 0.28s cubic-bezier(0.25, 1, 0.5, 1);
}

.view-section.active {
  display: block;
}

@keyframes appleFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

/* Apple Large Title Style */
.section-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #ffffff;
  line-height: 1.25;
}

.section-subtitle {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  margin-top: 4px;
}

/* ==========================================================================
   4. APPLE INSET GROUPED CARDS
   ========================================================================== */
.card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--hairline);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md), inset 0 0.5px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.25s cubic-bezier(0.25, 1, 0.5, 1);
  margin-bottom: 16px;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.18);
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

/* ==========================================================================
   5. APPLE METRIC STAT CARDS
   ========================================================================== */
.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  margin-bottom: 0;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.stat-icon.blue {
  background: linear-gradient(135deg, rgba(0, 113, 227, 0.28), rgba(10, 132, 255, 0.15));
  color: #0a84ff;
  border: 0.5px solid rgba(10, 132, 255, 0.35);
}

.stat-icon.green {
  background: linear-gradient(135deg, rgba(52, 199, 89, 0.28), rgba(48, 209, 88, 0.15));
  color: #30d158;
  border: 0.5px solid rgba(48, 209, 88, 0.35);
}

.stat-icon.purple {
  background: linear-gradient(135deg, rgba(175, 82, 222, 0.28), rgba(191, 90, 242, 0.15));
  color: #bf5af2;
  border: 0.5px solid rgba(191, 90, 242, 0.35);
}

.stat-icon.amber {
  background: linear-gradient(135deg, rgba(255, 149, 0, 0.28), rgba(255, 159, 10, 0.15));
  color: #ff9f0a;
  border: 0.5px solid rgba(255, 159, 10, 0.35);
}

.stat-info {
  flex: 1;
  min-width: 0;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #ffffff;
  line-height: 1.2;
  margin: 3px 0;
}

.stat-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   6. ACCOUNT CARDS (Mom Nisa & Eca Daily)
   ========================================================================== */
.account-card {
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.account-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.account-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-avatar {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #ffffff;
  border: 0.5px solid rgba(255, 255, 255, 0.15);
}

.account-card.page .account-avatar {
  background: linear-gradient(135deg, rgba(0, 113, 227, 0.3), rgba(10, 132, 255, 0.15));
  color: #0a84ff;
  border-color: rgba(10, 132, 255, 0.3);
}

.account-card.personal .account-avatar {
  background: linear-gradient(135deg, rgba(175, 82, 222, 0.3), rgba(191, 90, 242, 0.15));
  color: #bf5af2;
  border-color: rgba(191, 90, 242, 0.3);
}

.account-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: #ffffff;
}

.account-type-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: var(--radius-full);
}

.account-type-badge.page {
  background: rgba(10, 132, 255, 0.16);
  color: #0a84ff;
  border: 0.5px solid rgba(10, 132, 255, 0.3);
}

.account-type-badge.personal {
  background: rgba(191, 90, 242, 0.16);
  color: #bf5af2;
  border: 0.5px solid rgba(191, 90, 242, 0.3);
}

.account-meta {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

.account-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: var(--hairline);
}

/* ==========================================================================
   7. APPLE iOS TOGGLE SWITCHES (Classic iPhone Switch)
   ========================================================================== */
.switch {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(120, 120, 128, 0.36);
  transition: background-color 0.25s cubic-bezier(0.25, 1, 0.5, 1);
  border-radius: 31px;
  border: 0.5px solid rgba(255, 255, 255, 0.12);
}

.slider::before {
  position: absolute;
  content: "";
  height: 27px;
  width: 27px;
  left: 1.5px;
  bottom: 1.5px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3), 0 1px 1px rgba(0, 0, 0, 0.15);
}

input:checked + .slider {
  background-color: #34c759;
  border-color: #34c759;
}

input:checked + .slider::before {
  transform: translateX(20px);
}

/* ==========================================================================
   8. APPLE BUTTONS & CONTROLS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  border: 0.5px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  min-height: 38px;
  transition: all 0.18s cubic-bezier(0.25, 1, 0.5, 1);
}

.btn:active {
  transform: scale(0.96);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  min-height: 32px;
  border-radius: var(--radius-sm);
}

/* Primary Button: Apple Blue */
.btn-primary {
  background: linear-gradient(180deg, #0a84ff 0%, #0071e3 100%);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 113, 227, 0.38), inset 0 0.5px 0 rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #1a8eff 0%, #0077ed 100%);
  box-shadow: 0 4px 14px rgba(0, 113, 227, 0.5);
}

/* Secondary Button: Apple Glass Pill */
.btn-secondary {
  background: rgba(118, 118, 128, 0.22);
  color: #ffffff;
  border: var(--hairline);
  backdrop-filter: blur(10px);
}

.btn-secondary:hover {
  background: rgba(118, 118, 128, 0.32);
  border-color: rgba(255, 255, 255, 0.22);
}

/* Success Button: Apple Green */
.btn-success {
  background: rgba(52, 199, 89, 0.16);
  color: #30d158;
  border: 0.5px solid rgba(52, 199, 89, 0.32);
}

.btn-success:hover {
  background: #34c759;
  color: #ffffff;
}

/* Danger Button: Apple Red */
.btn-danger {
  background: rgba(255, 59, 48, 0.16);
  color: #ff453a;
  border: 0.5px solid rgba(255, 59, 48, 0.32);
}

.btn-danger:hover {
  background: #ff3b30;
  color: #ffffff;
}

/* ==========================================================================
   9. APPLE FORM INPUTS & SELECTS
   ========================================================================== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: rgba(118, 118, 128, 0.18);
  border: var(--hairline);
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: -0.01em;
  transition: all 0.2s ease;
  outline: none;
}

.form-input::placeholder, .form-textarea::placeholder {
  color: rgba(235, 235, 245, 0.35);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  background: rgba(118, 118, 128, 0.26);
  border-color: var(--accent-blue-vibrant);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.25);
}

.form-select option {
  background: #1c1c1e;
  color: #ffffff;
}

/* ==========================================================================
   10. RIWAYAT & HISTORY SPECIFIC STYLING (Apple Timeline Aesthetic)
   ========================================================================== */
.history-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.history-filter-wrapper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  border: var(--hairline);
  box-shadow: var(--shadow-sm);
}

.history-filter-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 2px;
}
.history-filter-pills::-webkit-scrollbar { display: none; }

.history-filter-pills .btn {
  border-radius: var(--radius-full);
  min-height: 34px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(118, 118, 128, 0.16);
  border: 0.5px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.history-filter-pills .btn.active {
  background: #0071e3;
  color: #ffffff;
  border-color: #0071e3;
  box-shadow: 0 2px 10px rgba(0, 113, 227, 0.4);
  font-weight: 600;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* History Card */
.history-item {
  position: relative;
  display: flex;
  gap: 16px;
  padding: 18px 20px;
  background: rgba(28, 28, 30, 0.72);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--radius-lg);
  border: var(--hairline);
  box-shadow: var(--shadow-sm), inset 0 0.5px 0 rgba(255, 255, 255, 0.08);
  transition: all 0.22s cubic-bezier(0.25, 1, 0.5, 1);
  overflow: hidden;
}

.history-item:hover {
  background: rgba(44, 44, 46, 0.85);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

/* Left Tint Strip */
.history-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}

.history-item.type-like::before { background: #0a84ff; }
.history-item.type-comment::before { background: #30d158; }
.history-item.type-feed::before { background: #5856d6; }
.history-item.type-story::before { background: #ff9f0a; }
.history-item.type-reel::before { background: #ff2d55; }

/* Icon Circle */
.history-icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.history-item.type-like .history-icon-circle { background: rgba(10, 132, 255, 0.16); color: #0a84ff; border: 0.5px solid rgba(10, 132, 255, 0.3); }
.history-item.type-comment .history-icon-circle { background: rgba(48, 209, 88, 0.16); color: #30d158; border: 0.5px solid rgba(48, 209, 88, 0.3); }
.history-item.type-feed .history-icon-circle { background: rgba(88, 86, 214, 0.16); color: #5856d6; border: 0.5px solid rgba(88, 86, 214, 0.3); }
.history-item.type-story .history-icon-circle { background: rgba(255, 159, 10, 0.16); color: #ff9f0a; border: 0.5px solid rgba(255, 159, 10, 0.3); }
.history-item.type-reel .history-icon-circle { background: rgba(255, 45, 85, 0.16); color: #ff2d55; border: 0.5px solid rgba(255, 45, 85, 0.3); }

/* Badges */
.history-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-like { background: rgba(10, 132, 255, 0.16); color: #0a84ff; border: 0.5px solid rgba(10, 132, 255, 0.28); }
.badge-comment { background: rgba(48, 209, 88, 0.16); color: #30d158; border: 0.5px solid rgba(48, 209, 88, 0.28); }
.badge-feed { background: rgba(88, 86, 214, 0.16); color: #5856d6; border: 0.5px solid rgba(88, 86, 214, 0.28); }
.badge-story { background: rgba(255, 159, 10, 0.16); color: #ff9f0a; border: 0.5px solid rgba(255, 159, 10, 0.28); }
.badge-reel { background: rgba(255, 45, 85, 0.16); color: #ff2d55; border: 0.5px solid rgba(255, 45, 85, 0.28); }

/* Apple Messages Comment Bubble */
.history-comment-bubble {
  margin-top: 10px;
  padding: 12px 16px;
  background: rgba(52, 199, 89, 0.12);
  border: 0.5px solid rgba(52, 199, 89, 0.28);
  border-radius: 16px 16px 16px 4px;
  color: #e1fbe8;
  font-size: 13.5px;
  font-style: italic;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   11. DATA TABLES & SCHEDULES
   ========================================================================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.data-table th {
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
  border-bottom: var(--hairline);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* ==========================================================================
   12. LOG TERMINAL (Apple macOS Terminal Window)
   ========================================================================== */
.log-box {
  background: rgba(10, 10, 12, 0.95);
  border: var(--hairline);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  color: #38bdf8;
  overflow-y: auto;
  line-height: 1.6;
}

.log-entry {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.log-time { color: var(--text-tertiary); flex-shrink: 0; }
.log-tag { font-weight: 600; flex-shrink: 0; }
.log-tag.INFO { color: #38bdf8; }
.log-tag.SUCCESS { color: #30d158; }
.log-tag.WARN { color: #ff9f0a; }
.log-tag.ERROR { color: #ff453a; }
.log-msg { color: rgba(255, 255, 255, 0.88); word-break: break-word; }

/* ==========================================================================
   13. APPLE MODALS & BOTTOM SHEETS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: appleFadeIn 0.2s ease;
}

.modal-overlay.active {
  display: flex;
}

.modal-container {
  background: rgba(30, 30, 32, 0.92);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border: var(--hairline);
  border-radius: var(--radius-xl);
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-lg), inset 0 0.5px 0 rgba(255, 255, 255, 0.15);
  overflow: hidden;
  animation: appleScaleUp 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes appleScaleUp {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 18px 22px;
  border-bottom: var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(118, 118, 128, 0.25);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
}
.modal-close:hover { background: rgba(118, 118, 128, 0.45); }
.modal-close:active { transform: scale(0.92); }

.modal-body {
  padding: 22px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 22px;
  border-top: var(--hairline);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ==========================================================================
   14. TOAST NOTIFICATIONS (Apple Dynamic Island Capsule)
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: 90%;
  max-width: 420px;
}

.toast {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: var(--radius-full);
  background: rgba(28, 28, 30, 0.94);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--hairline);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65), inset 0 0.5px 0 rgba(255, 255, 255, 0.2);
  animation: toastPop 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  transition: all 0.25s ease;
}

.toast.success i { color: #30d158; font-size: 16px; }
.toast.error i { color: #ff453a; font-size: 16px; }

@keyframes toastPop {
  from { opacity: 0; transform: translateY(12px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   15. MOBILE-FIRST RESPONSIVE OPTIMIZATIONS (< 768px & < 480px)
   ========================================================================== */
@media (max-width: 768px) {
  header.app-header {
    padding: max(10px, env(safe-area-inset-top)) 16px 10px 16px;
  }
  
  .brand-title {
    font-size: 15px;
  }
  
  .brand-sub {
    font-size: 11px;
  }

  .app-nav {
    top: 57px;
    padding: 6px 14px;
    gap: 6px;
  }

  .nav-tab {
    padding: 7px 13px;
    font-size: 12.5px;
    min-height: 34px;
  }

  main.app-main {
    padding: 18px 14px max(80px, calc(env(safe-area-inset-bottom) + 60px)) 14px;
  }

  .section-title {
    font-size: 20px;
  }

  .section-subtitle {
    font-size: 13px;
  }

  .grid-cards {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .history-stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 14px 16px;
    gap: 12px;
  }

  .stat-icon {
    width: 38px;
    height: 38px;
    font-size: 17px;
    border-radius: 11px;
  }

  .stat-value {
    font-size: 22px;
  }

  .history-filter-wrapper {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 14px;
    gap: 10px;
  }

  .history-item {
    padding: 15px 16px;
    gap: 12px;
  }

  .history-icon-circle {
    width: 38px;
    height: 38px;
    font-size: 16px;
    border-radius: 11px;
  }

  /* Apple Bottom Sheet Modal on Mobile */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-container {
    max-width: 100%;
    border-radius: 24px 24px 0 0;
    max-height: 88vh;
    animation: appleSheetUp 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  @keyframes appleSheetUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  /* iOS Grab Handle */
  .modal-header::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 38px;
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.28);
  }

  .modal-header {
    position: relative;
    padding-top: 24px;
  }

  /* Prevent Safari Auto-Zoom on form focus */
  .form-input, .form-select, .form-textarea {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .history-stat-grid {
    grid-template-columns: 1fr;
  }

  .btn {
    padding: 7px 14px;
    font-size: 12.5px;
  }

  .logo-badge {
    width: 34px;
    height: 34px;
    font-size: 16px;
  }
}
