body { transition: background 0.3s ease; }
.glass-ui { background: rgba(255,255,255,0.65); backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.45); box-shadow: 0 8px 32px 0 rgba(9,90,132,0.12); }

/* ── TOAST SYSTEM (Stacking) TSK-154 ─────────────────── */
#gk-toast-container { position: fixed; bottom: 32px; right: 32px; display: flex; flex-direction: column-reverse; gap: 12px; z-index: 10000; pointer-events: none; }
.gk-toast { 
    min-width: 280px; max-width: 400px; padding: 14px 20px; border-radius: 18px; 
    background: rgba(2, 26, 41, 0.9); backdrop-filter: blur(16px);
    color: white; font-size: 13px; font-weight: 500;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.15);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    transform: translateY(20px); opacity: 0; pointer-events: auto;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.gk-toast.show { transform: translateY(0); opacity: 1; }
.gk-toast.error { background: rgba(185, 28, 28, 0.95); border-color: rgba(248, 113, 113, 0.3); }
.gk-toast.success { background: rgba(21, 128, 61, 0.95); border-color: rgba(34, 197, 94, 0.3); }
.gk-toast.action { min-width: 320px; }

.toast-btn { 
    flex-shrink: 0; padding: 6px 12px; border-radius: 8px; 
    background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.2);
    color: white; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em;
    transition: all 0.2s; cursor: pointer;
}
.toast-btn:hover { background: rgba(255,255,255,0.25); border-color: rgba(255,255,255,0.4); }
.toast-btn-confirm { background: #15803d; border-color: #22c55e; }
.toast-btn-undo { background: #b91c1c; border-color: #f87171; }

/* SVG UI Icons */
.ui-svg-icon { width: 22px; height: 22px; stroke-width: 2; fill: none; stroke: currentColor; }

/* Hamburger Menu Styles */
.menu-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.3); backdrop-filter: blur(4px); z-index: 100; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.menu-overlay.active { opacity: 1; pointer-events: auto; }

.menu-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 280px; background: rgba(255,255,255,0.85); backdrop-filter: blur(25px); border-left: 1px solid rgba(255,255,255,0.4); z-index: 101; transform: translateX(100%); transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); box-shadow: -10px 0 40px rgba(0,0,0,0.1); }
.menu-drawer.active { transform: translateX(0); }

.hamburger-btn { transition: transform 0.2s ease; }
.hamburger-btn:active { transform: scale(0.9); }

.menu-item { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-radius: 16px; margin: 4px 12px; transition: all 0.2s; font-weight: 600; color: #475569; text-decoration: none !important; }
.menu-item:hover { background: rgba(13,114,165,0.06); color: #0d72a5; }
.menu-item.active { background: rgba(13,114,165,0.1); color: #0d72a5; border: 1px solid rgba(13,114,165,0.1); }
.menu-item .icon { opacity: 0.7; display: flex; align-items: center; }
.menu-item.active .icon { opacity: 1; color: #0d72a5; }

/* ── TSK-086: Profile Modal ────────────────────────── */
.profile-backdrop { position: fixed; inset: 0; background: rgba(2,26,41,0.45); backdrop-filter: blur(8px); z-index: 200; opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
.profile-backdrop.open { opacity: 1; pointer-events: auto; }

.profile-panel { position: fixed; top: 0; right: 0; bottom: 0; width: 380px; max-width: 100vw; background: rgba(255,255,255,0.88); backdrop-filter: blur(28px) saturate(180%); border-left: 1px solid rgba(255,255,255,0.5); z-index: 201; transform: translateX(100%); transition: transform 0.38s cubic-bezier(0.16,1,0.3,1); box-shadow: -12px 0 48px rgba(9,90,132,0.14); display: flex; flex-direction: column; overflow: hidden; }
.profile-panel.open { transform: translateX(0); }

.profile-header { padding: 20px 20px 14px; border-bottom: 1px solid rgba(13,114,165,0.08); flex-shrink: 0; }
.profile-body { flex: 1; overflow-y: auto; padding: 16px 20px 24px; scrollbar-width: thin; scrollbar-color: #c2e3f2 transparent; }
.profile-footer { padding: 14px 20px; border-top: 1px solid rgba(13,114,165,0.08); flex-shrink: 0; }

.profile-section-title { font-size: 9px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #0d72a5; margin: 18px 0 8px; opacity: 0.8; }
.profile-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.profile-field label { font-size: 11px; font-weight: 600; color: #475569; }
@media (max-width: 640px) {
  body {
      align-items: stretch !important; /* Allow content to touch edges */
  }

  #main-content {
      width: 100%;
  }

  .sync-container {
      max-width: 900px;
      margin-left: auto;
      margin-right: auto;
      width: 100%;
      box-sizing: border-box;
  }

  @media (max-width: 640px) {
      .sync-container {
          padding-left: 0 !important;
          padding-right: 0 !important;
          padding-top: 0.5rem !important;
          max-width: 100% !important;
          margin-left: 0 !important;
          margin-right: 0 !important;
      }
  }

  #global-header-inner {
      padding-left: 12px !important;
      padding-right: 12px !important;
  }

  .glass-panel {
      padding: 1rem !important;
      border-radius: 0 !important; /* Edge-to-edge look */
      border-left: none !important;
      border-right: none !important;
      margin-bottom: 0.5rem !important;
  }
  
  .text-3xl { font-size: 1.35rem !important; }
  .text-lg { font-size: 1rem !important; }
  .text-xl { font-size: 1.1rem !important; }
  
  /* Shrink the manual/auto controls */
  .form-input, .btn-primary {
      font-size: 10px !important;
      padding: 0.6rem !important;
  }
  
  .badge { 
      font-size: 8.5px !important; 
      padding: 1.5px 5px !important; 
  }

  /* Force stack foundry cards on small mobile */
  #foundry-container {
      grid-template-columns: 1fr !important;
      gap: 0.5rem !important;
  }
}
.profile-field input, .profile-field textarea, .profile-field select {
  width: 100%; padding: 8px 12px; border-radius: 10px; border: 1.5px solid rgba(13,114,165,0.15);
  background: rgba(255,255,255,0.7); font-size: 13px; font-weight: 500; color: #1e293b;
  outline: none; transition: border-color 0.2s, box-shadow 0.2s; font-family: inherit;
}
.profile-field input:focus, .profile-field textarea:focus {
  border-color: #0d72a5; box-shadow: 0 0 0 3px rgba(13,114,165,0.1);
}
.profile-field textarea { resize: vertical; min-height: 60px; }

.pill-group { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.pill { padding: 4px 11px; border-radius: 999px; font-size: 11px; font-weight: 700; border: 1.5px solid rgba(13,114,165,0.2); color: #475569; background: rgba(255,255,255,0.7); cursor: pointer; transition: all 0.15s; user-select: none; }
.pill:hover { border-color: #0d72a5; color: #0d72a5; }
.pill.active { background: #0d72a5; border-color: #0d72a5; color: white; }
.pill.active-booked { background: #15803d; border-color: #15803d; color: white; }
.pill.active-paid   { background: #7c3aed; border-color: #7c3aed; color: white; }
.pill.active-ongoing { background: #0891b2; border-color: #0891b2; color: white; }

.profile-save-btn { width: 100%; padding: 13px; border-radius: 14px; background: linear-gradient(135deg, #0d72a5 0%, #095a84 100%); color: white; font-weight: 700; font-size: 14px; border: none; cursor: pointer; transition: all 0.2s; box-shadow: 0 4px 14px rgba(13,114,165,0.3); }
.profile-save-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(13,114,165,0.4); }
.profile-save-btn:active { transform: scale(0.98); }

.profile-toast { display: none; }

/* ── Dev Console ──────────────────────────────────────────────── */
#gk-dev-console { position: fixed; bottom: 20px; left: 20px; width: 420px; max-width: calc(100vw - 40px); background: rgba(2,26,41,0.92); backdrop-filter: blur(20px); border: 1px solid rgba(13,114,165,0.4); border-radius: 16px; z-index: 9999; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 10px; color: #80c5e6; box-shadow: 0 8px 32px rgba(0,0,0,0.4); transition: all 0.3s cubic-bezier(0.16,1,0.3,1); transform: translateY(0); }
#gk-dev-console.hidden { transform: translateY(calc(100% + 30px)); pointer-events: none; opacity: 0; }
#gk-dev-console-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px 8px; border-bottom: 1px solid rgba(13,114,165,0.2); }
#gk-dev-console-header span { font-size: 9px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #4aa8d8; }
#gk-dev-log { max-height: 180px; overflow-y: auto; padding: 8px 14px; scrollbar-width: thin; scrollbar-color: #064364 transparent; }
.gk-dev-line { padding: 2px 0; border-bottom: 1px solid rgba(13,114,165,0.1); word-break: break-all; line-height: 1.5; }
.gk-dev-line.err { color: #f87171; }
.gk-dev-line.warn { color: #fbbf24; }
.gk-dev-line.ok { color: #4ade80; }
.gk-dev-line.time { color: #c084fc; }
#gk-dev-console-footer { padding: 6px 14px 8px; display: flex; gap: 6px; justify-content: flex-end; }
.gk-dev-btn { padding: 3px 10px; border-radius: 6px; border: 1px solid rgba(13,114,165,0.3); background: rgba(13,114,165,0.15); color: #4aa8d8; font-size: 9px; font-weight: 700; cursor: pointer; transition: all 0.15s; }
.gk-dev-btn:hover { background: rgba(13,114,165,0.3); }

/* ── Global Toast ──────────────────────────────────────────────── */
#gk-global-toast { position: fixed; top: 72px; left: 50%; transform: translateX(-50%) translateY(-10px); background: #021a29; color: white; font-size: 12px; font-weight: 700; padding: 10px 20px; border-radius: 20px; opacity: 0; transition: all 0.3s cubic-bezier(0.16,1,0.3,1); pointer-events: none; max-width: 90vw; overflow-wrap: anywhere; line-height: 1.4; z-index: 10000; border: 1px solid rgba(13,114,165,0.3); box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
#gk-global-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
#gk-global-toast.error { background: #7f1d1d; border-color: rgba(248,113,113,0.3); }
#gk-global-toast.success { background: #14532d; border-color: rgba(74,222,128,0.3); }

/* Settings Sidebar Layout (TSK-142) */
.settings-layout { display: flex; gap: 0; min-height: 320px; overflow: hidden; border-radius: 10px; border: 1px solid rgba(13,114,165,0.06); background: white; margin-top: 8px; }
.settings-sidebar { width: 130px; background: rgba(13,114,165,0.02); border-right: 1px solid rgba(13,114,165,0.06); padding: 12px 4px; display: flex; flex-direction: column; gap: 2px; }
.settings-content { flex: 1; padding: 14px 18px; overflow-y: auto; max-height: 400px; }

.settings-nav-item { display: flex; align-items: center; gap: 6px; padding: 7px 9px; border-radius: 8px; transition: all 0.2s; cursor: pointer; color: #64748b; }
.settings-nav-item:hover { background: rgba(13,114,165,0.04); color: #0d72a5; }
.settings-nav-item.active { background: white; color: #0d72a5; box-shadow: 0 2px 6px rgba(9,90,132,0.04); font-weight: 700; z-index: 10; position: relative; }
.settings-nav-item .icon { opacity: 0.4; display: flex; align-items: center; scale: 0.85; }
.settings-nav-item.active .icon { opacity: 1; }
.settings-nav-item span { font-size: 9px; text-transform: uppercase; letter-spacing: 0.02em; font-family: 'Inter', sans-serif; font-weight: 600; }

/* Minimalist Model Cards */
.model-item { max-width: 220px; width: 100%; display: flex; align-items: center; justify-content: justify; padding: 4px 12px; border-radius: 8px; border: 1.5px solid rgba(13,114,165,0.06); background: white; transition: all 0.2s; cursor: pointer; text-align: left; }
.model-item:hover { border-color: rgba(13,114,165,0.12); transform: translateY(-0.5px); }
.model-item.active { border-color: #0d72a5; background: rgba(13,114,165,0.01); box-shadow: 0 3px 8px rgba(13,114,165,0.03); }
.model-item span { font-size: 10px; font-weight: 500; color: #1e293b; }
.model-item .indicator { width: 6px; height: 6px; border-radius: 50%; background: #0d72a5; opacity: 0; transition: opacity 0.2s; }
.model-item.active .indicator { opacity: 1; box-shadow: 0 0 8px rgba(13, 114, 165, 0.4); }

/* ── TSK-200: System Health Monitor ─────────────────── */
.health-dot { width: 8px; height: 8px; border-radius: 50%; transition: all 0.3s; }
.health-dot.online { background: #22c55e; box-shadow: 0 0 8px rgba(34, 197, 94, 0.4); }
.health-dot.offline { background: #f97316; box-shadow: 0 0 8px rgba(249, 115, 22, 0.4); }
.health-dot.error { background: #ef4444; box-shadow: 0 0 8px rgba(239, 68, 68, 0.4); }
.health-dot.syncing { background: #3b82f6; animation: pulse-blue 1.5s infinite; }
@keyframes pulse-blue { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(1.2); } 100% { opacity: 1; transform: scale(1); } }

.health-popover {
  position: absolute; top: 100%; right: 0; margin-top: 12px; width: 280px;
  background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5); border-radius: 20px;
  box-shadow: 0 20px 40px rgba(9, 90, 132, 0.15); padding: 18px;
  z-index: 100; transform: translateY(10px); opacity: 0; pointer-events: none;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.health-popover.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
.health-stat { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.health-stat-label { font-size: 10px; font-weight: 800; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; }
.health-stat-value { font-size: 11px; font-weight: 700; color: #1e293b; }
.health-error-box { background: #fef2f2; border: 1px solid #fee2e2; padding: 8px 12px; border-radius: 12px; margin-top: 12px; }
.health-error-text { font-size: 10px; color: #b91c1c; font-weight: 600; line-height: 1.4; word-break: break-all; }
