/* Jenny Terminal — glass-dark design tokens + base styles.
   Mirrors dashboard.html's aesthetic so every page inherits the same look. */

:root {
  --text: #f4f4f5;
  --muted: rgba(244,244,245,0.50);
  --faint: rgba(244,244,245,0.26);
  --hint:  rgba(244,244,245,0.13);
  --glass: rgba(255,255,255,0.035);
  --glass-strong: rgba(255,255,255,0.075);
  --border: rgba(255,255,255,0.09);
  --border-strong: rgba(255,255,255,0.22);
  --up: #86efac;
  --down: #fda4af;
  --silver-start: #ffffff;
  --silver-end: #6a6a70;
  --sidebar-w: 240px;
  --sidebar-w-collapsed: 64px;
  --font: -apple-system, "SF Pro Display", "Inter", system-ui, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace;

  /* Per-terminal accent overrides (kept subtle in glass-dark) */
  --accent-jenny: #ffffff;
  --accent-hermes: #86efac;
  --accent-claude: #c4b5fd;
  --accent-vx: #fca5a5;

  /* Backward compat mappings for legacy admin/projects pages */
  --green: #86efac;
  --red: #fda4af;
  --orange: #f4f4f5;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
  background: linear-gradient(135deg, #050505 0%, #0c0c0e 45%, #060606 100%);
  position: relative;
}

/* Ambient blobs + grain — injected once into body by nav.js */
.gd-blob { position: fixed; border-radius: 50%; filter: blur(90px); pointer-events: none; z-index: 0; will-change: transform; }
.gd-blob.b1 { width: 540px; height: 540px; background: radial-gradient(circle, rgba(220,220,230,0.18), transparent 70%); top: -140px; left: -140px; animation: gd-float1 22s ease-in-out infinite alternate; }
.gd-blob.b2 { width: 480px; height: 480px; background: radial-gradient(circle, rgba(180,190,210,0.14), transparent 70%); bottom: -160px; right: -120px; animation: gd-float2 28s ease-in-out infinite alternate; }
.gd-blob.b3 { width: 360px; height: 360px; background: radial-gradient(circle, rgba(255,255,255,0.10), transparent 70%); top: 35%; right: 22%; animation: gd-float3 34s ease-in-out infinite alternate; }
@keyframes gd-float1 { 0% { transform: translate(0,0); } 100% { transform: translate(180px, 120px); } }
@keyframes gd-float2 { 0% { transform: translate(0,0); } 100% { transform: translate(-200px, -160px); } }
@keyframes gd-float3 { 0% { transform: translate(0,0) scale(1); } 100% { transform: translate(-120px, 100px) scale(1.15); } }
.gd-grain { position: fixed; inset: 0; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100' height='100' filter='url(%23n)' opacity='0.4'/></svg>"); opacity: 0.045; pointer-events: none; z-index: 1; mix-blend-mode: overlay; }

/* Generic content shell — pages wrap their content in <main class="gd-shell"> */
main.gd-shell {
  position: relative; z-index: 2;
  margin-left: var(--sidebar-w);
  padding: 28px 36px 80px;
  transition: margin-left 280ms cubic-bezier(0.4, 0, 0.2, 1);
}
body.sidebar-collapsed main.gd-shell { margin-left: var(--sidebar-w-collapsed); }

/* Tile container — reusable glass card */
.gd-tile {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px 24px;
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  box-shadow: 0 8px 32px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.05);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform 360ms cubic-bezier(.2,.7,.2,1), border-color 240ms ease, box-shadow 240ms ease;
}
.gd-tile:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: 0 16px 50px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.09); }

.gd-tile-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.gd-tile-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; }
.gd-tile-tag { font-family: var(--mono); font-size: 11px; color: var(--faint); padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,0.05); border: 1px solid var(--border); }
.gd-tile-tag.ok { color: var(--up); border-color: rgba(134,239,172,0.28); background: rgba(134,239,172,0.06); }
.gd-tile-tag.alert { color: var(--down); border-color: rgba(253,164,175,0.3); background: rgba(253,164,175,0.07); }

/* Buttons */
.gd-btn { background: transparent; border: 1px solid var(--border); border-radius: 6px; font: 11px var(--mono); letter-spacing: 0.05em; color: var(--muted); padding: 5px 12px; cursor: pointer; transition: all 180ms ease; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.gd-btn:hover { color: var(--text); border-color: var(--border-strong); background: rgba(255,255,255,0.04); }
.gd-btn.primary { color: var(--text); border-color: var(--border-strong); background: rgba(255,255,255,0.05); }
.gd-btn.danger { color: #ffb4b4; border-color: rgba(253,164,175,0.35); }
.gd-btn.danger:hover { background: rgba(253,164,175,0.07); }

/* Inputs */
.gd-input, .gd-textarea, .gd-select {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: 13px var(--font);
  padding: 8px 12px;
  transition: border-color 180ms ease, background 180ms ease;
}
.gd-input:focus, .gd-textarea:focus, .gd-select:focus { outline: none; border-color: var(--border-strong); background: rgba(255,255,255,0.05); }

/* Page header */
.gd-page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
}
.gd-greeting { font-size: 28px; font-weight: 300; letter-spacing: -0.02em; margin: 0 0 6px; }
.gd-greeting em { font-style: normal; background: linear-gradient(90deg, var(--silver-start), #9c9ca0); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 500; }
.gd-subhead { color: var(--muted); font-size: 13px; margin: 0; }
.gd-meta { display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: 12px; font-family: var(--mono); flex-shrink: 0; padding-top: 4px; }
.gd-meta .gd-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--up); display: inline-block; margin-right: 6px; box-shadow: 0 0 12px var(--up); animation: gd-pulse 2.4s ease-in-out infinite; }
@keyframes gd-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Generic table */
.gd-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.gd-table th { text-align: left; font-family: var(--mono); font-size: 10.5px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.gd-table td { padding: 10px; border-bottom: 1px solid var(--border); color: var(--text); }
.gd-table tr:hover td { background: rgba(255,255,255,0.02); }

/* Links inside content */
.gd-shell a { color: var(--text); text-decoration: underline; text-decoration-color: rgba(255,255,255,0.2); text-underline-offset: 2px; transition: text-decoration-color 180ms ease; }
.gd-shell a:hover { text-decoration-color: var(--text); }

/* Mobile shell */
@media (max-width: 760px) {
  main.gd-shell { margin-left: 0; padding: 64px 18px 80px; }
  body.sidebar-collapsed main.gd-shell { margin-left: 0; }
}

/* Sidebar — injected by nav.js */
aside.gd-sidebar {
  position: fixed;
  left: 0; top: 0;
  width: var(--sidebar-w);
  height: 100vh;
  z-index: 50;
  border-right: 1px solid var(--border);
  background: rgba(255,255,255,0.025);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.03), 8px 0 28px rgba(0,0,0,0.35);
  display: flex; flex-direction: column;
  padding: 16px 12px 14px;
  transition: width 280ms cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
body.sidebar-collapsed aside.gd-sidebar { width: var(--sidebar-w-collapsed); }

.gd-sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 14px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.gd-brand-mini { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: inherit; }
.gd-logo-cube { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, #e5e5e7 0%, #9c9ca0 45%, #2c2c2e 100%); box-shadow: 0 0 14px rgba(255,255,255,0.18), inset 0 1px 0 rgba(255,255,255,0.5); flex: 0 0 28px; }
.gd-brand-text { min-width: 0; }
.gd-brand-text h1 { font-size: 14px; font-weight: 500; letter-spacing: -0.005em; margin: 0; line-height: 1.1; }
.gd-brand-text span { font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: 0.15em; text-transform: uppercase; }
.gd-collapse-btn { flex: 0 0 24px; width: 24px; height: 24px; background: transparent; border: 1px solid var(--border); color: var(--muted); border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: color 200ms ease, border-color 200ms ease, background 200ms ease, transform 200ms ease; padding: 0; }
.gd-collapse-btn:hover { color: var(--text); border-color: var(--border-strong); background: rgba(255,255,255,0.04); }
body.sidebar-collapsed .gd-collapse-btn svg { transform: rotate(180deg); }
.gd-collapse-btn svg { transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1); }

.gd-mode-switch { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; padding: 12px 4px 8px; transition: opacity 200ms ease; }
.gd-mode-switch a { text-align: center; text-decoration: none; font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 6px 0; border: 1px solid var(--border); border-radius: 6px; transition: color 180ms ease, border-color 180ms ease, background 180ms ease; }
.gd-mode-switch a:hover { color: var(--text); border-color: var(--border-strong); }
.gd-mode-switch a.active { color: var(--text); background: rgba(255,255,255,0.06); border-color: var(--border-strong); }

.gd-vx-button { display: block; text-align: center; text-decoration: none; font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 6px 0; border: 1px solid var(--border); border-radius: 6px; margin: 0 4px 14px; transition: color 180ms ease, border-color 180ms ease, background 180ms ease; }
.gd-vx-button:hover { color: var(--text); border-color: var(--border-strong); background: rgba(255,255,255,0.04); }
.gd-vx-button.active { color: var(--text); background: rgba(255,255,255,0.06); border-color: var(--border-strong); }

nav.gd-sidebar-nav { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; padding: 4px 0; }
nav.gd-sidebar-nav::-webkit-scrollbar { width: 6px; }
nav.gd-sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 3px; }
.gd-nav-section { display: flex; flex-direction: column; gap: 1px; padding: 6px 0 4px; }
.gd-nav-section + .gd-nav-section { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 10px; }
.gd-section-label { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint); padding: 2px 12px 6px; transition: opacity 200ms ease, height 200ms ease, padding 200ms ease; overflow: hidden; }
body.sidebar-collapsed .gd-section-label { height: 0; padding: 0; opacity: 0; pointer-events: none; }
.gd-nav-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 400; letter-spacing: -0.005em; position: relative; transition: color 180ms ease, background 180ms ease; white-space: nowrap; }
.gd-nav-item:hover { color: var(--text); background: rgba(255,255,255,0.035); }
.gd-nav-item.active { color: var(--text); background: rgba(255,255,255,0.055); }
.gd-nav-item.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(180deg, var(--silver-start), var(--silver-end)); border-radius: 2px; box-shadow: 0 0 8px rgba(255,255,255,0.4); }
.gd-nav-item .icon { flex: 0 0 18px; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; }
.gd-nav-item .icon svg { width: 16px; height: 16px; }
.gd-nav-item .label { transition: opacity 200ms ease; min-width: 0; }
body.sidebar-collapsed .gd-nav-item .label,
body.sidebar-collapsed .gd-mode-switch,
body.sidebar-collapsed .gd-vx-button,
body.sidebar-collapsed .gd-brand-text,
body.sidebar-collapsed .gd-sidebar-foot .email,
body.sidebar-collapsed .gd-sidebar-foot .logout .label { opacity: 0; pointer-events: none; }
body.sidebar-collapsed .gd-nav-item { justify-content: center; padding: 9px 0; }
body.sidebar-collapsed .gd-mode-switch,
body.sidebar-collapsed .gd-vx-button { height: 0; padding-top: 0; padding-bottom: 0; margin: 0; border-color: transparent; pointer-events: none; }

.gd-sidebar-foot { padding-top: 12px; margin-top: 6px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.gd-sidebar-foot .email { font-family: var(--mono); font-size: 10px; color: var(--faint); padding: 0 8px; word-break: break-all; line-height: 1.4; transition: opacity 200ms ease; }
.gd-sidebar-foot .logout { display: flex; align-items: center; gap: 12px; background: transparent; border: 1px solid var(--border); color: var(--muted); border-radius: 8px; font: 12px var(--mono); letter-spacing: 0.05em; text-transform: uppercase; padding: 8px 10px; cursor: pointer; transition: color 180ms ease, border-color 180ms ease, background 180ms ease; }
.gd-sidebar-foot .logout:hover { color: #ffb4b4; border-color: rgba(253,164,175,0.4); background: rgba(253,164,175,0.06); }
body.sidebar-collapsed .gd-sidebar-foot .logout { justify-content: center; padding: 9px 0; }

/* Collapsed-mode tooltips */
.gd-nav-item[data-tip], .gd-sidebar-foot .logout[data-tip] { position: relative; }
body.sidebar-collapsed .gd-nav-item[data-tip]:hover::after,
body.sidebar-collapsed .gd-sidebar-foot .logout[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; left: calc(100% + 14px); top: 50%; transform: translateY(-50%);
  background: rgba(10,10,12,0.95);
  color: var(--text); font-family: var(--mono); font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 6px 10px; border-radius: 6px;
  border: 1px solid var(--border-strong);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  white-space: nowrap; z-index: 100; pointer-events: none;
}

/* Mobile topbar + scrim (base styles — overridden by @media below) */
.gd-mobile-topbar {
  display: none;
  position: fixed; top: 0; left: 0; right: 0;
  height: 48px;
  background: rgba(8,8,10,0.85);
  backdrop-filter: blur(24px) saturate(140%);
  border-bottom: 1px solid var(--border);
  z-index: 40;
  padding: 0 14px;
  align-items: center; justify-content: space-between;
}
.gd-mobile-topbar .brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.gd-mobile-topbar .gd-logo-cube { width: 22px; height: 22px; border-radius: 6px; }
.gd-hamburger {
  background: transparent; border: 1px solid var(--border); border-radius: 8px;
  padding: 0; color: var(--text); cursor: pointer;
  font-size: 20px; line-height: 1;
  min-width: 44px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
}
.gd-mobile-scrim {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}
.gd-mobile-scrim.active { opacity: 1; pointer-events: auto; }

/* Mobile breakpoint — overrides base rules above (source order matters) */
@media (max-width: 760px) {
  aside.gd-sidebar { transform: translateX(-100%); transition: transform 260ms cubic-bezier(0.4, 0, 0.2, 1); width: var(--sidebar-w); }
  aside.gd-sidebar.mobile-open { transform: translateX(0); }
  /* Ignore desktop-collapsed state at mobile widths so the drawer always
     opens full-width with labels visible. */
  body.sidebar-collapsed aside.gd-sidebar { width: var(--sidebar-w); }
  body.sidebar-collapsed .gd-nav-item .label,
  body.sidebar-collapsed .gd-mode-switch,
  body.sidebar-collapsed .gd-vx-button,
  body.sidebar-collapsed .gd-brand-text,
  body.sidebar-collapsed .gd-sidebar-foot .email,
  body.sidebar-collapsed .gd-sidebar-foot .logout .label { opacity: 1; pointer-events: auto; }
  body.sidebar-collapsed .gd-nav-item { justify-content: flex-start; padding: 9px 10px; }
  body.sidebar-collapsed .gd-mode-switch { height: auto; padding: 12px 4px 8px; margin: 0; border-color: transparent; pointer-events: auto; display: grid; }
  body.sidebar-collapsed .gd-vx-button { height: auto; padding: 6px 0; margin: 0 4px 14px; border-color: var(--border); pointer-events: auto; display: block; }
  body.sidebar-collapsed .gd-section-label { height: auto; padding: 2px 12px 6px; opacity: 1; pointer-events: auto; }
  body.sidebar-collapsed .gd-sidebar-foot .logout { justify-content: flex-start; padding: 8px 10px; }
  .gd-collapse-btn { display: none; }
  .gd-mobile-topbar { display: flex; }
}

/* Session timeout warning — re-styled in glass-dark */
#jt-session-warning {
  position: fixed;
  top: 12px; right: 12px;
  z-index: 99999;
  background: rgba(10,10,12,0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 14px;
  font: 12px var(--mono);
  line-height: 1.4;
  border-radius: 8px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
#jt-session-warning-close { background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 0; margin-left: 4px; flex-shrink: 0; }
#jt-session-warning-close:hover { color: var(--text); }

/* Welcome banner — re-styled */
.gd-welcome-banner {
  margin: 0 0 24px;
  padding: 14px 40px 14px 16px;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: 12px;
  font: 13px/1.5 var(--font);
  color: var(--text);
  position: relative;
}
.gd-welcome-banner strong { font-weight: 500; background: linear-gradient(90deg, var(--silver-start), #9c9ca0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.gd-welcome-banner-close { position: absolute; top: 8px; right: 10px; background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 2px 6px; line-height: 1; }
.gd-welcome-banner-close:hover { color: var(--text); }
