/* ─── Default Theme Variables (Dark Theme) ───────────────────────────── */
:root {
  --primary-color: #ff6600;
  --secondary-color: #ffffff;

  --background-color: #111;
  --surface-color: rgba(40, 40, 40, 0.9);
  --text-color: #e0e0e0;
  --border-color: rgba(255, 102, 0, 0.6);
  --input-bg: rgba(20, 20, 20, 0.8);
  --placeholder-color: rgba(224, 224, 224, 0.7);

  --dark-grey: #2c2c2c;
  --light-grey: #d3d3d3;
  --background-light: #e0e0e0;
  --background-dark: #1c1c1c;
  --text-light: #fff;
  --text-dark: #e0e0e0;

  --shadow-orange-strong: rgba(255, 102, 0, 0.6);
  --shadow-orange-soft: rgba(255, 102, 0, 0.3);

  /* keep these in :root too */
  --shadow-orange-inset: inset 0 -2px 6px var(--shadow-orange-strong);
  --shadow-orange-glow: 0 2px 8px var(--shadow-orange-soft);
  --text-glow-orange: 0 0 8px var(--shadow-orange-strong);
  --shadow-orange-inner: rgba(255, 102, 0, 0.4);
  --shadow-orange-outer: rgba(255, 102, 0, 0.3);

  --sidebar-width: 200px;
  --top-bar-height: 2.5px;
  --content-gap: 0.25rem;

  --panel-bg: rgba(40, 40, 40, 0.9);
  --toggle-bg: rgba(60, 60, 60, 0.8);
  --accent-orange: #ff6600;
  --accent-border: 2px solid #ff6600;
  --shadow-toggle: inset 0 0 4px var(--shadow-orange-strong);
  --text-subtle: #ccc;
}

/* ─── Light Theme Variables ─────────────────────────────────────────── */
body.light-theme {
  --background-color: #e0e0e0;
  --surface-color: #ffffff;
  --text-color: #1c1c1c;
  --border-color: rgba(0, 0, 0, 0.2);
  --input-bg: rgba(255, 150, 70, 0.25);
  --placeholder-color: rgba(28, 28, 28, 0.7);

  /* keep grid borders readable in light mode */
  --gw-border1: rgba(0, 0, 0, 0.08);
  --gw-border2: rgba(0, 0, 0, 0.16);
}

/* ← now put #button-wrapper, media queries, etc. after this brace */

#button-wrapper::-webkit-scrollbar { display: none; } /* Chrome/Safari */

/* ─── Base Styling ───────────────────────────────────────────────────── */
body {
  margin: 0;
  font-family: 'Orbitron', sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  height: 100vh;
  overflow-x: hidden;
}

/* ✅ Normalize images so they never overflow on small screens */
img { max-width: 100%; height: auto; }

.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.left-menu {
  width: var(--sidebar-width);
  background-color: var(--surface-color);
  color: var(--text-color);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  box-shadow:
    inset -14px 0 20px -14px var(--shadow-orange-inner),
    0 4px 12px var(--shadow-orange-outer);
  z-index: 10;
}

.left-menu .login-btn {
  margin: 12px 0;
  padding: 10px;
  font-size: 14px;
  width: 80%;
  background-color: var(--accent-orange);
  color: #fff;
  border: none;
  border-radius: 6px;
  box-shadow: 0 0 6px var(--shadow-orange-soft);
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.sidebar-actions {
  list-style: none;
  padding: 2px;
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-error {
  color: #e74c3c;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  min-height: 1.2em; /* reserve space even when empty */
}

.tool-btn {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.5rem;
  background-color: rgba(255, 102, 0, 0.1);
  border: 1px solid var(--accent-orange);
  border-radius: 6px;
  color: var(--text-light);
  box-shadow: 0 0 4px rgba(255, 102, 0, 0.2);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}
/* Something like this should exist */
#login-overlay.overlay-hidden { display: none; }

.tool-btn:hover {
  background-color: rgba(255, 102, 0, 0.3);
  box-shadow: 0 0 6px var(--shadow-orange-soft);
  transform: scale(1.02);
}

.login-btn:hover::after { display: block; }
.left-menu .login-btn:hover { background-color: #ff8533; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 6px;
  padding-bottom: 20px; /* Prevent cutoff */
  font-size: 12px;
  color: var(--text-subtle);
  border-top: 1px solid rgba(255, 102, 0, 0.2);
  text-align: center;
  display: block;
}

.sidebar-footer-mobile { display: none; }

.main-column {
  position: relative;
  width: 100vw; /* Force full viewport width */
  height: 100vh;
  overflow: hidden;
  overflow-y: auto;     /* <-- enable scrolling */
}

.top-info-box {
  position: fixed;
  top: 0;
  width: 75%;
  margin: 0 auto;
  max-width: calc(75% - var(--sidebar-width));
  height: var(--top-bar-height);
  background-color: var(--surface-color);
  color: var(--text-color);
  padding: 0.10rem 1rem;
  border-bottom-left-radius: 24px;
  border-bottom-right-radius: 24px;
  box-shadow:
    inset 0 -4px 12px -4px var(--shadow-orange-inner),
    0 4px 12px var(--shadow-orange-outer);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  z-index: 20;
}

.app-window {
  position: absolute;
  top: 100px;
  left: 150px;
  width: 400px;
  height: 300px;
  min-width: 400px;
  min-height: 200px;
  background: #333;
  border-radius: 6px;
  box-shadow:
    0 0 8px rgba(255, 102, 0, 0.6),
    0 0 16px rgba(255, 102, 0, 0.4),
    0 0 32px rgba(255, 102, 0, 0.2);
  overflow: hidden;
  z-index: 10;
}

.app-title-bar {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  background: linear-gradient(to right, #1a1a1a, #444);
  color: white;
  cursor: move;
  box-shadow:
    inset 0 -1px 0 rgba(255, 102, 0, 0.3),
    inset 0 1px 0 rgba(0, 0, 0, 0.5);
  user-select: none;
}

.app-icon { margin-right: 8px; }

.app-title { flex: 1; }

.app-controls button {
  background: none;
  border: none;
  color: white;
  font-size: 1rem;
  margin-left: 8px;
  cursor: pointer;
}

.app-content { padding: 10px; color: white; }

.app-window.minimized { display: none; }

.resize-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  right: 4px;
  bottom: 4px;
  background: transparent;
  cursor: nwse-resize;
}

.resize-handle::before,
.resize-handle::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.resize-handle::before {
  top: 0;
  right: -1px;
  width: 2px;
  height: 100%;
  background: linear-gradient(to bottom, transparent, rgba(255, 102, 0, 0.6));
}

.resize-handle::after {
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(to right, transparent, rgba(255, 102, 0, 0.6));
}

/* ─── Glowing Tabs for Time Tracker ───────────────────────────── */
.tab-bar {
  display: flex;
  gap: 20px;
  padding: 10px 16px;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--shadow-orange-soft);
  box-shadow: var(--shadow-orange-inset);
}

.tab-bar .tab {
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text-subtle);
  font-weight: bold;
  transition: color 0.3s ease;
  position: relative;
}

.tab-bar .tab:hover { color: var(--accent-orange); }

.tab-bar .tab.active {
  color: var(--accent-orange);
  text-shadow: var(--text-glow-orange);
}

.tab-bar .tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--accent-orange);
  box-shadow: 0 0 8px var(--shadow-orange-soft);
}

.tab-content { display: none; padding: 16px; }
.tab-content:first-child { display: block; }

.error-popup {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(255, 60, 60, 0.95);
  color: white;
  padding: 12px 18px;
  border-radius: 6px;
  box-shadow: 0 0 12px rgba(255, 0, 0, 0.6);
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.error-popup.visible { opacity: 1; transform: translateY(0); }

/* ------------------------------------------------------------- */
/* NEW/UPDATED: Login Overlay and Panel Positioning */
/* ------------------------------------------------------------- */
#login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.5); /* dimming effect */
  /* backdrop-filter: blur(6px);  <-- intentionally off */
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease-in-out;
}

#login-overlay.overlay-visible {
  opacity: 1;
  pointer-events: auto;
}

.input-container {
  position: relative;
  background-color: var(--panel-bg);
  border-radius: 20px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-orange-inset), var(--shadow-orange-glow);
  width: 100%;
  max-width: 360px;
  transform: translateY(0);
  transition: opacity 0.6s ease 0.8s, transform 0.6s ease 0.8s;
  margin-left: auto;
  margin-right: auto;
}

#login-overlay.overlay-visible .input-container {
  opacity: 1;
  transform: translateY(0);
}

/* --- Existing Styles Continue Below --- */
.login-btn {
  background-color: var(--primary-color);
  color: var(--secondary-color);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
}

.header-text {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-color);
  text-align: center;
  margin-bottom: 10px;
}

.panel-title {
  font-size: 22px;
  color: var(--accent-orange);
  text-shadow: 0 0 8px var(--shadow-orange-strong);
  margin-bottom: 6px;
  animation: fadeInUp 0.6s ease 1s forwards;
  opacity: 0;
}

.login-form input,
.login-form button {
  background-color: var(--input-bg);
  color: var(--text-color);
  border: 2px solid var(--primary-color);
  font-weight: bold;
  text-shadow: 0 0 2px var(--primary-color);
  box-shadow: inset 0 -2px 6px var(--shadow-orange-soft);
}

.login-input {
  background-color: var(--input-bg);
  border: none;
  border-bottom: var(--accent-border);
  padding: 12px;
  color: var(--text-light);
  font-size: 16px;
  border-radius: 6px;
  box-shadow: inset 0 -2px 6px var(--shadow-orange-soft);
  box-sizing: border-box;
  width: 100%;
  margin: 0 auto;
  display: block;
  animation: fadeInUp 0.8s ease 1.2s forwards;
  opacity: 0;
}

.login-form input::placeholder,
.login-input::placeholder { color: var(--placeholder-color); }

.login-button {
  padding: 10px 30px;
  font-size: 16px;
  color: var(--text-light);
  background-color: var(--accent-orange);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 0 10px var(--shadow-orange-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: fadeInUp 0.8s ease 1.6s forwards;
  opacity: 0;
}

.login-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 12px var(--shadow-orange-strong);
}

.remember-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-subtle);
  user-select: none;
  animation: fadeInUp 0.8s ease 1.4s forwards;
  opacity: 0;
}

.remember-toggle input { display: none; }

.toggle-slider {
  position: relative;
  width: 40px;
  height: 20px;
  background-color: var(--toggle-bg);
  border-radius: 20px;
  box-shadow: var(--shadow-toggle);
  transition: background-color 0.3s ease;
}

.toggle-slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background-color: var(--accent-orange);
  border-radius: 50%;
  transition: transform 0.3s ease;
  box-shadow: 0 0 6px var(--shadow-orange-strong);
}

.remember-toggle input:checked + .toggle-slider::after { transform: translateX(20px); }
.remember-toggle input:checked + .toggle-slider { background-color: var(--shadow-orange-soft); }

.register-link {
  font-size: 14px;
  color: var(--text-subtle);
  text-decoration: none;
  transition: color 0.3s ease;
  animation: fadeInUp 0.8s ease 1.8s forwards;
  opacity: 0;
}

.register-link:hover { color: var(--text-light); }

.loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: none;
  justify-content: center;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.loader-ring {
  position: absolute;
  border: 4px solid transparent;
  border-top: 4px solid var(--accent-orange);
  border-radius: 50%;
  animation: spin 1.6s linear infinite;
  background: linear-gradient(to right, var(--shadow-orange-strong), transparent);
}

.inner-ring { width: 30px; height: 30px; animation-duration: 1s; }
.middle-ring { width: 50px; height: 30px; animation-direction: reverse; animation-duration: 1.4s; }
.outer-ring { width: 70px; height: 40px; animation-direction: alternate; animation-duration: 2s; }
.ring-four  { width: 90px; height: 50px; animation-direction: reverse; animation-duration: 2.4s; opacity: 0.6; }
.ring-five  { width: 110px; height: 60px; animation-direction: alternate; animation-duration: 3s; opacity: 0.4; }

@keyframes spin { 0% { transform: rotate(0deg); opacity: 1; } 100% { transform: rotate(360deg); opacity: 0.2; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ─── Responsive Styles ───────────────────────────────────────────── */

/* ─── Mobile Overrides ───────────────────────────────────────────── */
@media (max-width: 600px) {
  html, body, .main-column {
    -ms-overflow-style: none;  /* old Edge/IE */
    scrollbar-width: none;     /* Firefox */
  }
  html::-webkit-scrollbar,
  body::-webkit-scrollbar,
  .main-column::-webkit-scrollbar {
    display: none;             /* Chrome/Safari */
  }
  .hamburger { display: block; }
  .layout { flex-direction: column; }
  /* closed state */
  .left-menu {
    position: fixed;
    top: 50px; /* height of mobile top bar */
    left: 0;
    width: 250px;
    height: calc(100vh - 50px);
    display: flex;
    flex-direction: column;
    background-color: var(--sidebar-bg);
    z-index: 1000;
    overflow: hidden;
	box-shadow: none;                           /* no glow while hidden */
    transition: transform 0.3s ease, box-shadow 0.15s ease;
  }
  /* open state */
  .left-menu.open {
    transform: translateX(0);
    box-shadow:
      inset -14px 0 20px -14px var(--shadow-orange-inner),
      0 4px 12px var(--shadow-orange-outer);
  }
}
  #button-wrapper { flex: 1; overflow-y: auto; padding-bottom: 20px; }

  .sidebar-footer,
  .sidebar-footer-mobile {
    padding: 6px 0 20px;
    font-size: 12px;
    color: var(--text-subtle);
    border-top: 1px solid rgba(255, 102, 0, 0.2);
    text-align: center;
  }

  .left-menu img { max-width: 180px; margin: 0 auto; }
  .left-menu.open { display: flex; }

  .top-info-box {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0.5rem 1rem;
    border-radius: 0;
    box-sizing: border-box;
  }

  .main-column { padding-top: var(--top-bar-height); align-items: stretch; }
  .info { display: none; }
  .title-display { display: block; }
  .mobile-info { display: block; }

  /* ✅ Mobile hero/logo fix (first option) */
  .main-column > img {
    max-width: 92vw;
    height: auto;
    margin: 8px auto;
    display: block;
  }
}

/* ─── Tablet Overrides ───────────────────────────────────────────── */
@media (min-width: 601px) and (max-width: 1024px) {
  .hamburger { display: none; }
  .left-menu { width: 180px; }
  .top-info-box { width: 75%; max-width: calc(75% - 180px); }
  .main-content { width: calc(100% - 40px); }
}

/* ─── Desktop Overrides ──────────────────────────────────────────── */
@media (min-width: 1025px) {
  .hamburger { display: none; }
  .left-menu { width: var(--sidebar-width); }
  .top-info-box { width: 75%; max-width: calc(75% - var(--sidebar-width)); }
  .main-content {
    width: calc(100% - 40px);
    max-width: 2000px;
    min-width: 602px;
    margin: 0.25rem auto;
  }
  .title-display { display: none; }
  .mobile-info { display: none; }
}

.top-info-box .ip-display,
.top-info-box .version-display { font-size: clamp(0.75rem, 1.8vw, 1rem); }

.title-display { display: none; font-weight: bold; font-size: clamp(1rem, 3vw, 1.25rem); }

.hamburger { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; }

.mobile-info { display: none; font-size: 0.85rem; margin-top: 1rem; color: var(--text-color); }
body.light-theme .mobile-info { color: var(--text-color); }

#button-wrapper {
  max-height: calc(100vh - 240px); /* Adjust based on header + footer */
  overflow-y: auto;
  padding-right: 10px;
  -ms-overflow-style: none;  /* IE/Edge */
  scrollbar-width: none;     /* Firefox */
}

/* Hide mobile top bar by default */
.mobile-top-bar { display: none; }

@media (min-width: 1921px) {
  .main-content { max-width: 2400px; font-size: 1.1rem; }
  .tool-btn { font-size: 16px; padding: 12px 16px; }
  .left-menu { width: 240px; }
  .top-info-box { max-width: calc(75% - 240px); }
}

/* 📌 Layout adjustments (mobile) */
@media (max-width: 600px) {
  .main-content { padding: 10px; font-size: 0.9rem; }
  .tool-btn { display: block; width: 100%; font-size: 14px; padding: 10px; margin-bottom: 8px; }
  .top-info-box { flex-direction: column; align-items: flex-start; padding: 10px; }
  #button-wrapper { max-height: calc(100vh - 200px); }

  /* 🧱 Sidebar becomes slide-in panel */
  .left-menu {
    position: fixed;
    top: 70px; /* Match the height of .mobile-top-bar */
    left: 0;
    width: 240px;
    height: 100%;
    background-color: #222;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1000;
  }
  .left-menu.open { transform: translateX(0); }

  /* Hide logo and IP info in sidebar */
  .left-menu .logo, .left-menu .sidebar-footer { display: none; }

  /* 📱 Mobile top bar */
  .mobile-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #333;
    color: white;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 1001;
    box-shadow:
      inset 0 -8px 12px -8px var(--shadow-orange-inner),
      0 4px 12px var(--shadow-orange-outer);
  }

  #hamburger-btn { background: none; border: none; font-size: 24px; color: white; cursor: pointer; }

  /* Remove old title */
  .app-title { display: none; }

  /* Centered logo */
  .mobile-logo { flex: 1; text-align: center; }

  /* ✅ Keep mobile logo tidy */
  .mobile-logo img {
    max-height: 45px;
    max-width: 60vw;
    height: auto;
  }

  /* Right-aligned IP */
  .mobile-ip { font-size: 0.75rem; color: var(--text-light); white-space: nowrap; }
}

/* 📲 Tablet: 601px–1024px */
@media (min-width: 601px) and (max-width: 1024px) {
  .main-content { padding: 20px; font-size: 1rem; }
  .tool-btn { font-size: 15px; padding: 10px 14px; }
  .left-menu { width: 160px; }
  .top-info-box { max-width: calc(100% - 160px); }
  #button-wrapper { max-height: calc(100vh - 220px); }
}

/* 💻 HD: 1025px–1920px */
@media (min-width: 1025px) and (max-width: 1920px) {
  .main-content { max-width: 1600px; font-size: 1rem; }
  .tool-btn { font-size: 15px; padding: 12px 16px; }
  .left-menu { width: 200px; }
  .top-info-box { max-width: calc(75% - 200px); }
  #button-wrapper { max-height: calc(100vh - 240px); }
}

/* ---------- Grid Workspace (scoped with gw-) ---------- */
.gw-workspace {
  padding: var(--gw-gap, 12px);
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: var(--gw-rowsize, 140px);
  gap: var(--gw-gap, 12px);
}
@media (max-width: 900px) {
  .gw-workspace { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* Buttons (used inside FAB menu) */
.gw-btn {
  border: 1px solid var(--gw-border2, #2a3346);
  background: #1a1f2b;
  color: var(--gw-text, #e7e9ee);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
}
.gw-btn:hover { background: #222a3a; }

/* FAB (always visible on all breakpoints) */
.gw-fab {
  position: fixed; right: 14px; bottom: 14px; z-index: 6;
  background: #1f2a44; border: 1px solid var(--gw-border2, #2a3346);
  color: var(--gw-text, #e7e9ee);
  padding: 12px 14px; border-radius: 999px; cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,.08); font-size: 14px;
}
.gw-fab-menu {
  position: fixed; right: 14px; bottom: 70px; z-index: 6;
  display: none; flex-direction: column; gap: 8px;
}
.gw-fab-menu.show { display: flex; }

.theme-toggle{
  display:inline-block; margin-top:8px;
  background: var(--accent-orange);
  color: #fff; border: none; border-radius: 6px;
  padding: 8px 12px; font-size: 13px; cursor: pointer;
  box-shadow: 0 0 6px var(--shadow-orange-soft);
}
.theme-toggle:hover{ filter: brightness(1.05); }

/* Grid card chrome */
.gw-card-header {
  position: relative;
  z-index: 1;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: var(--surface-color);
  border-bottom: 1px solid var(--gw-border1, rgba(0,0,0,0.08));
}

.gw-card-title { 
  font-weight: 600; font-size: 14px; flex: 1; 
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.gw-card-actions { display: flex; gap: 6px; }

.gw-icon-btn {
  border: 1px solid var(--border-color);
  background: rgba(255, 102, 0, 0.12);
  color: var(--text-color);
  padding: 4px 8px; border-radius: 8px; cursor: pointer; font-size: 12px;
}
.gw-icon-btn:hover { background: rgba(255, 102, 0, 0.22); }

.gw-card.selected { outline: 2px solid var(--primary-color); outline-offset: 0; }

/* Content area fills; iframe fills it absolutely */
.gw-card-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;           /* no double scrollbars in the host */
  padding: 0;
}
.gw-card-body iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: var(--panel-bg);
}

/* Make the card the positioning context for the resizers */
.gw-card {
  position: relative;          /* <-- this is the key */
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;            /* keeps rounded corners working */
  border-radius: 14px;
}

/* Resizers anchored to the card’s edges (inside edges) */
.gw-resizer { position: absolute; z-index: 50; background: transparent; }
.gw-resizer.r  { top: 0; right: 0;  width: 12px; height: 100%; cursor: ew-resize; }
.gw-resizer.b  { left: 0; bottom: 0; width: 100%; height: 12px; cursor: ns-resize; }
.gw-resizer.rb { right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; }

/* --- TEMP NORMALIZATION PATCH (safe to remove after cleanup) --- */
.gw-card { position: relative; overflow: hidden; border-radius: 14px; }


/* ============================================================
   THEME + FORMS OVERRIDES (append at end of main.css)
   - Purge navy tones
   - Unify FAB + buttons to login/theme scheme
   - Global input styling like login fields (strong glow on focus)
   ============================================================ */

/* ---- Tokens (dark) ---- */
:root {
  /* Primary button (login / theme / FAB) */
  --btn-primary-bg: var(--accent-orange);
  --btn-primary-fg: #fff;
  --btn-primary-hover: color-mix(in srgb, var(--accent-orange) 90%, white);
  --btn-primary-shadow: 0 0 10px var(--shadow-orange-soft);

  /* Ghost/tinted buttons (tool/menu/icon) */
  --btn-ghost-bg: rgba(255, 102, 0, 0.10);
  --btn-ghost-hover-bg: rgba(255, 102, 0, 0.22);
  --btn-ghost-fg: var(--text-light);
  --btn-ghost-border: var(--accent-orange);
}

/* ---- Tokens (light) ---- */
body.light-theme {
  /* Keep main brand orange */
  --btn-primary-bg: var(--accent-orange);
  --btn-primary-fg: #fff;
  --btn-primary-hover: color-mix(in srgb, var(--accent-orange) 85%, white);

  /* Softer ghost fill on light backgrounds; darker text for contrast */
  --btn-ghost-bg: rgba(255, 150, 70, 0.18);
  --btn-ghost-hover-bg: rgba(255, 150, 70, 0.30);
  --btn-ghost-fg: var(--text-color);
}

/* ---- Primary buttons: login + theme toggle + FAB ---- */
.left-menu .login-btn,
.theme-toggle,
.gw-fab {
  background: var(--btn-primary-bg) !important;
  color: var(--btn-primary-fg) !important;
  border: 0 !important;
  box-shadow: var(--btn-primary-shadow);
  transition: filter .2s ease, transform .15s ease, box-shadow .2s ease;
}
.left-menu .login-btn:hover,
.theme-toggle:hover,
.gw-fab:hover {
  background: var(--btn-primary-hover) !important;
  filter: brightness(1.02);
}

/* ---- Ghost/tinted buttons: sidebar tools + grid/menu/icon buttons ---- */
.tool-btn,
.gw-btn,
.gw-icon-btn {
  background: var(--btn-ghost-bg) !important;
  color: var(--btn-ghost-fg) !important;
  border: 1px solid var(--btn-ghost-border) !important;
  box-shadow: 0 0 4px var(--shadow-orange-soft);
  transition: background-color .2s ease, transform .15s ease, filter .2s ease;
}
.tool-btn:hover,
.gw-btn:hover,
.gw-icon-btn:hover {
  background: var(--btn-ghost-hover-bg) !important;
  transform: translateY(-1px);
}

/* ---- Global form controls like the login inputs ---- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
select,
textarea {
  background-color: var(--input-bg) !important;
  color: var(--text-light) !important;
  border: none !important;
  border-bottom: var(--accent-border) !important;
  border-radius: 6px !important;
  padding: 12px !important;
  box-shadow: inset 0 -2px 6px var(--shadow-orange-soft) !important;
  transition: box-shadow .2s ease, background-color .2s ease, color .2s ease, border-color .2s ease;
}
input::placeholder,
textarea::placeholder {
  color: var(--placeholder-color);
}

/* Strong orange glow only when focused */
input:focus,
select:focus,
textarea:focus {
  outline: none;
  box-shadow: inset 0 -3px 8px var(--shadow-orange-strong) !important;
}

/* Optional: disabled state */
input:disabled,
select:disabled,
textarea:disabled,
button:disabled {
  opacity: .65;
  cursor: not-allowed;
}

/* ---- Remove leftover navy colors from older rules (specific overrides) ---- */
/* If any old declarations remain in your sheet, these will win by cascade */
.gw-fab       { background: var(--btn-primary-bg) !important; color: var(--btn-primary-fg) !important; border: 0 !important; }
.gw-btn       { background: var(--btn-ghost-bg) !important;   color: var(--btn-ghost-fg) !important;   border-color: var(--btn-ghost-border) !important; }
.gw-icon-btn  { background: var(--btn-ghost-bg) !important;   color: var(--btn-ghost-fg) !important;   border-color: var(--btn-ghost-border) !important; }

/* Keep your special “Clear” and quick math pill buttons unchanged by NOT targeting their classes here. */
/* === Input normalization: login look everywhere, no glow unless focused === */

/* Catch most text-like fields + your login-input */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="url"],
input[type="tel"],
input[type="time"],
input[type="date"],
input[type="datetime-local"],
select,
textarea,
.login-input {
  background-color: var(--input-bg);
  color: var(--text-color);
  border: none;                 /* no visible border */
  border-radius: 8px;
  padding: 12px;
  outline: none;

  /* keep a tiny hairline so shapes are visible against very dark bg */
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.03),  /* subtle outer hairline */
    inset 0 -2px 0 0 transparent;      /* bottom line OFF by default */
  transition: box-shadow .18s ease, background-color .18s ease, color .18s ease;
}

/* Focus: only a sharp bright orange bottom line, no fuzzy glow */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="tel"]:focus,
input[type="time"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
select:focus,
textarea:focus,
.login-input:focus {
  box-shadow:
    0 0 0 1px rgba(255, 102, 0, 0.15), /* very subtle outer accent */
    inset 0 -3px 0 0 var(--accent-orange); /* <-- crisp orange bottom only */
}

/* Placeholder color unified */
input::placeholder,
textarea::placeholder,
.login-input::placeholder { color: var(--placeholder-color); }

/* Disabled state */
input:disabled,
select:disabled,
textarea:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* Remove any legacy orange glow that may linger on .login-input default */
.login-input {
  /* ensure we don't carry over prior inset blur glows */
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.03),
    inset 0 -2px 0 0 transparent !important;
  border-bottom: none !important;
}

/* Date/time pickers' icons should remain visible on dark bg */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
  color-scheme: dark; /* helps native pickers pick light glyphs on dark bg */
}
/* ===========================================================
   Login Overlay & Panel — Smooth, unified fade (override)
   Paste this block at the very end of /css/main.css
   =========================================================== */

/* Base overlay behavior (keep dim, no clicks when hidden) */
#login-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgba(0,0,0,.5);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity .20s ease-in-out;
}

#login-overlay.overlay-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Panel: remove long delays; fade/slide quickly with overlay */
#login-panel,
#login-overlay .input-container {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .22s ease, transform .22s ease;
  will-change: opacity, transform;
}

#login-overlay.overlay-visible #login-panel,
#login-overlay.overlay-visible .input-container {
  opacity: 1;
  transform: none;
}

/* Make the injected X button + Dev options fade with the panel */
.login-close-btn,
.login-dev-controls {
  opacity: 0;
  transition: opacity .22s ease .02s; /* tiny stagger so text doesn’t pop harshly */
}

#login-overlay.overlay-visible .login-close-btn,
#login-overlay.overlay-visible .login-dev-controls {
  opacity: 1;
}

/* The title had its own delayed animation; disable so it follows the panel timing */
.panel-title {
  animation: none !important;
  opacity: 1 !important; /* visibility driven by panel now */
}

/* Optional: consistent styling for the injected close button (X) */
.login-close-btn {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: inherit;
}

/* Safety: if you use overlay-hidden class anywhere, ensure it truly hides */
#login-overlay.overlay-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
}
/* === LOGIN OVERLAY INSTANT-FEEL FIX (place at END of main.css) === */

/* Ensure the overlay is truly hidden when not in use */
#login-overlay.overlay-hidden { display: none !important; }

/* Panel: quick fade/slide with NO delay */
#login-overlay .input-container {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .22s ease, transform .22s ease;
  transition-delay: 0s !important; /* neutralize the earlier 0.8s delay */
}
#login-overlay.overlay-visible .input-container {
  opacity: 1;
  transform: translateY(0);
}

/* Kill staggered keyframe delays on children & replace with a small, uniform fade */
#login-overlay .panel-title,
#login-overlay .login-input,
#login-overlay .remember-toggle,
#login-overlay .login-button,
#login-overlay .register-link {
  animation: none !important;      /* override fadeInUp + long delays */
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .22s ease .06s, transform .22s ease .06s;
}
#login-overlay.overlay-visible .panel-title,
#login-overlay.overlay-visible .login-input,
#login-overlay.overlay-visible .remember-toggle,
#login-overlay.overlay-visible .login-button,
#login-overlay.overlay-visible .register-link {
  opacity: 1;
  transform: translateY(0);
}

/* Make the X and the Dev controls participate in the same fade */
#login-overlay .login-close-btn,
#login-overlay .login-dev-controls {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .22s ease .06s, transform .22s ease .06s;
}
#login-overlay.overlay-visible .login-close-btn,
#login-overlay.overlay-visible .login-dev-controls {
  opacity: 1;
  transform: translateY(0);
}

/* Slightly snappier overlay backdrop so background + panel feel in sync */
#login-overlay { transition: opacity .18s ease !important; }
/* ===========================================================
   LOGIN OVERLAY — unified fade/slide with proper first paint
   (override block; place at END of main.css)
   =========================================================== */

/* Overlay stays in DOM so it can animate. Hidden via opacity/visibility. */
#login-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgba(0,0,0,.5);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .22s ease, visibility 0s linear .22s;
}

/* Visible state */
#login-overlay.overlay-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .22s ease;
}

/* If your code still toggles overlay-hidden, make it play nice with transitions */
#login-overlay.overlay-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Panel and helpers start hidden so they can animate in */
#login-panel,
#login-overlay .input-container { /* support either id/class */
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .24s ease, transform .24s ease;
  will-change: opacity, transform;
}

/* Close button + Dev controls participate in same fade */
#login-overlay .login-close-btn,
#login-overlay .login-dev-controls {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .24s ease .02s, transform .24s ease .02s; /* tiny stagger */
}

/* Reveal when overlay is visible */
#login-overlay.overlay-visible #login-panel,
#login-overlay.overlay-visible .input-container,
#login-overlay.overlay-visible .login-close-btn,
#login-overlay.overlay-visible .login-dev-controls {
  opacity: 1;
  transform: none;
}

/* Neutralize old staggered keyframes that caused late pop-ins */
#login-overlay .panel-title,
#login-overlay .login-input,
#login-overlay .remember-toggle,
#login-overlay .login-button,
#login-overlay .register-link {
  animation: none !important;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  #login-overlay { transition: none !important; }
  #login-panel,
  #login-overlay .input-container,
  #login-overlay .login-close-btn,
  #login-overlay .login-dev-controls { transition: none !important; transform: none !important; }
}
/* ===========================================================
   Dev Options Panel — grouped, light grey card
   =========================================================== */

/* Make the whole Dev options block look like a card */
.login-dev-controls {
  /* participates in the same fade we already wired */
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .24s ease .02s, transform .24s ease .02s;

  /* card look */
  background: #f5f7fa;                 /* light grey panel */
  border: 1px solid #e5e7eb;           /* subtle border */
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 12px;
  box-shadow: 0 1px 0 rgba(17,24,39,.04), 0 1px 2px rgba(0,0,0,.04);
  font-size: 12px;                     /* matches your inline style intent */
}

/* Reveal with the rest when overlay is visible */
#login-overlay.overlay-visible .login-dev-controls {
  opacity: 1;
  transform: none;
}

/* Style the summary header as a card header */
.login-dev-controls > summary {
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  background: #eef1f4;                 /* slightly darker than panel bg */
  margin: -10px -12px 10px -12px;      /* bleed to card edges */
  padding: 8px 12px;
  border-bottom: 1px solid #e5e7eb;
  border-radius: 10px 10px 0 0;
  list-style: none;                     /* hide default marker in some browsers */
}

/* Replace default disclosure marker with a chevron */
.login-dev-controls > summary::-webkit-details-marker { display: none; }
.login-dev-controls > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  transition: transform .2s ease;
}
.login-dev-controls[open] > summary::before {
  transform: rotate(90deg);
}

/* Inputs inside the panel (selects/text) */
.login-dev-controls select,
.login-dev-controls input[type="text"] {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #ffffff;
}

/* Checkbox + tooltip row spacing */
.login-dev-controls label {
  display: inline-flex;
  align-items: center;
}

/* Preview text (the "Content-Type sent" line) */
#login-dev-preview {
  font-family: monospace;
  opacity: .85;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .login-dev-controls { transition: none !important; transform: none !important; }
}
/* ===========================================================
   Dev options: separate subtle card (only after click)
   =========================================================== */

/* Keep <summary> simple; not part of the card */
.login-dev-controls {
  margin-top: 10px;
}
.login-dev-controls > summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  /* optional tiny indicator */
}
.login-dev-controls > summary::-webkit-details-marker { display: none; }
.login-dev-controls > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  transition: transform .2s ease;
}
.login-dev-controls[open] > summary::before { transform: rotate(90deg); }

/* The card lives INSIDE details and shows only when open */
.login-dev-card {
  /* “a few shades lighter than the form background”:
     use a very subtle translucent layer to work on both light and dark panels */
  background: rgba(255,255,255,0.08);  /* not white; just a gentle lift */
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 10px;

  /* fade/slide in (only when details is open & overlay visible) */
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .24s ease, transform .24s ease;
}

/* Reveal the card with the rest of the login UI */
#login-overlay.overlay-visible .login-dev-controls[open] .login-dev-card {
  opacity: 1;
  transform: none;
}

/* Rows use “label line” + “controls line” layout */
.login-dev-row { margin-top: 8px; }
.login-dev-label {
  font-weight: 600;
  margin-bottom: 4px;
}
.login-dev-controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Inputs inside the card */
.login-dev-card select,
.login-dev-card input[type="text"] {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #fff;
}

/* Tooltip icon */
.login-dev-tip { cursor: help; opacity: .8; }
.login-dev-tip:hover { opacity: 1; }

/* Preview line */
.login-dev-preview-label {
  margin-top: 8px;
}
#login-dev-preview {
  font-family: monospace;
  opacity: .85;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .login-dev-card { transition: none !important; transform: none !important; }
}
/* ===========================================================
   Dev Options — collapsed = plain text, open = dark card
   (override block; place at END of main.css)
   =========================================================== */

/* 1) Reset any previous card styling on the <details> itself */
.login-dev-controls {
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
  margin-top: 10px;
}

/* Collapsed summary should be just text (no background bar) */
.login-dev-controls > summary {
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  color: inherit;
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  list-style: none;
}

/* Keep the chevron but no pill background */
.login-dev-controls > summary::-webkit-details-marker { display: none; }
.login-dev-controls > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  transition: transform .2s ease;
  opacity: .9;
}
.login-dev-controls[open] > summary::before { transform: rotate(90deg); }

/* 2) The actual card only appears when details is open */
.login-dev-card {
  /* MUCH darker grey panel */
  background: #1f1f1f;                 /* dark, not black */
  border: 1px solid #2c2c2c;           /* subtle edge */
  border-radius: 10px;
  padding: 12px;
  margin-top: 8px;

  /* fade/slide in with the rest */
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .22s ease, transform .22s ease;
}

/* Reveal the card only when Dev options is open AND overlay is visible */
#login-overlay.overlay-visible .login-dev-controls[open] .login-dev-card {
  opacity: 1;
  transform: none;
}

/* Rows: label on its own line; controls below */
.login-dev-row { margin-top: 8px; }
.login-dev-label {
  font-weight: 600;
  margin-bottom: 4px;
  color: #e4e4e4;
}
.login-dev-controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Dark-theme fields inside the card */
.login-dev-card select,
.login-dev-card input[type="text"] {
  color: #eaeaea;
  background: #141414;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  padding: 6px 8px;
}
.login-dev-card select:focus,
.login-dev-card input[type="text"]:focus {
  outline: none;
  border-color: #ff7a1a;               /* matches your orange accent */
  box-shadow: 0 0 0 2px rgba(255,122,26,.15);
}
.login-dev-card ::placeholder { color: #9aa3ab; }

/* Tooltip icon */
.login-dev-tip { cursor: help; opacity: .8; }
.login-dev-tip:hover { opacity: 1; }

/* Preview line */
.login-dev-preview-label { margin-top: 8px; color: #c7c7c7; }
#login-dev-preview { font-family: monospace; opacity: .9; color: #f0f0f0; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .login-dev-card { transition: none !important; transform: none !important; }
}
/* ===== Login overlay fade/slide (unified, no flash) ===== */
#login-overlay{
  position:fixed; inset:0; display:flex; justify-content:center; align-items:center;
  background:rgba(0,0,0,.5); z-index:100;
  opacity:0; visibility:hidden; pointer-events:none;
  transition:opacity .22s ease, visibility 0s linear .22s;
}
#login-overlay.overlay-visible{
  opacity:1; visibility:visible; pointer-events:auto; transition:opacity .22s ease;
}
#login-overlay.overlay-hidden{
  opacity:0 !important; visibility:hidden !important; pointer-events:none !important;
}

#login-panel, #login-overlay .input-container{
  opacity:0; transform:translateY(10px);
  transition:opacity .24s ease, transform .24s ease; will-change:opacity, transform;
}
#login-overlay.overlay-visible #login-panel,
#login-overlay.overlay-visible .input-container{
  opacity:1; transform:none;
}

/* Helpers fade with panel */
#login-overlay .login-close-btn,
#login-overlay .login-dev-controls{
  opacity:0; transform:translateY(4px);
  transition:opacity .24s ease .02s, transform .24s ease .02s;
}
#login-overlay.overlay-visible .login-close-btn,
#login-overlay.overlay-visible .login-dev-controls{
  opacity:1; transform:none;
}

/* Neutralize any old staggered keyframes */
#login-overlay .panel-title,
#login-overlay .login-input,
#login-overlay .remember-toggle,
#login-overlay .login-button,
#login-overlay .register-link{ animation:none !important; }
/* ============================================================
   Standalone Registration Panel (no tools.php)
   ------------------------------------------------------------
   Classes used by openRegistrationPanel() in utils.js
   ============================================================ */
.auth-scrim {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 20, 0.65);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
  z-index: 10000;
}
.auth-scrim.visible {
  opacity: 1;
  pointer-events: auto;
}

.auth-card {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 10001;
  pointer-events: none; /* inner handles events */
}

.auth-card-inner {
  width: min(520px, calc(100vw - 32px));
  background: #141a27;                /* dark slate */
  color: #e6ebf5;
  border: 1px solid #283246;          /* subtle edge */
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.02) inset;
  transform: translateY(18px);
  opacity: 0;
  transition: transform .20s ease, opacity .20s ease;
  pointer-events: auto;
}

.auth-card.visible .auth-card-inner {
  transform: translateY(0);
  opacity: 1;
}

.auth-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 6px 16px;
}

.auth-card-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .2px;
}

.auth-card-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: #9fb0c8;
  font-size: 22px;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 10px;
  cursor: pointer;
}
.auth-card-close:hover {
  color: #ffffff;
  background: rgba(255,255,255,.06);
}

.auth-card-body {
  padding: 8px 16px 16px 16px;
}

.auth-row {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}
.auth-row label {
  flex: 1;
  display: block;
}

.auth-label {
  font-size: 12px;
  color: #9fb0c8;
  margin-bottom: 6px;
}

.auth-input {
  width: 100%;
  background: #0f1522;
  color: #e6ebf5;
  border: 1px solid #263149;
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}
.auth-input::placeholder {
  color: #7d8cab;
}
.auth-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.25);
}

.auth-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}
.auth-btn {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  background: linear-gradient(180deg, #ff8a39, #ff6a00);
  color: #0b0f1a;
  font-weight: 600;
}
.auth-btn[disabled] {
  opacity: .6;
  cursor: not-allowed;
}

.auth-msg {
  margin-top: 8px;
  font-size: 13px;
  min-height: 18px;
}
.auth-msg.error { color: #ff6b6b; }
.auth-msg.ok    { color: #1ad487; }

@media (max-width: 420px) {
  .auth-card-inner { border-radius: 12px; }
  .auth-card-title { font-size: 16px; }
  .auth-input { padding: 9px 10px; }
}

/* ============================================================
   Login Developer Options (tester UI)
   ------------------------------------------------------------
   Classes used by ensureLoginDevControls() in utils.js
   Closed state shows only the "Dev options" summary text.
   Opening reveals a subtly lighter panel with the controls.
   ============================================================ */
.login-dev-controls {
  margin-top: 10px;
  color: #cdd7ea;
}
.login-dev-controls > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  position: relative;
  padding: 6px 0;
  font-weight: 600;
  color: #cbd6ee;
}
.login-dev-controls > summary::marker { display: none; }
.login-dev-controls > summary::-webkit-details-marker { display: none; }
.login-dev-controls > summary::after {
  content: '›';
  position: absolute;
  right: 0;
  transform: rotate(90deg);
  opacity: .7;
  transition: transform .15s ease;
}
.login-dev-controls[open] > summary::after {
  transform: rotate(270deg);
  opacity: 1;
}

/* The card only shows when details is open */
.login-dev-card {
  display: none;
  margin-top: 8px;
  padding: 12px;
  border-radius: 12px;
  background: #1f1f1f;         /* a few shades lighter than the form bg */
  border: 1px solid #2c2c2c;   /* darker grey edge as requested */
  box-shadow: 0 0 0 1px rgba(255,255,255,.02) inset;
}
.login-dev-controls[open] .login-dev-card { display: block; }

/* Rows + labels */
.login-dev-row { margin-top: 10px; }
.login-dev-label {
  font-size: 12px;
  color: #9fb0c8;
  margin-bottom: 6px;
}
.login-dev-controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.login-dev-card select,
.login-dev-card input[type="text"] {
  background: #0f1522;
  color: #e6ebf5;
  border: 1px solid #263149;
  border-radius: 8px;
  padding: 8px 10px;
  outline: none;
}
.login-dev-card select:focus,
.login-dev-card input[type="text"]:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.25);
}

/* Force override + tooltip */
.login-dev-unsafe-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: rgba(255, 106, 0, .08);
  border: 1px dashed rgba(255, 106, 0, .45);
  border-radius: 8px;
}
.login-dev-tip {
  display: inline-block;
  font-weight: 700;
  cursor: help;
  opacity: .85;
}

/* Preview text */
.login-dev-preview-label {
  margin-top: 12px;
  font-size: 12px;
  color: #9fb0c8;
}
#login-dev-preview {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  opacity: .9;
}

/* Optional polish for the small error popup you already use */
.error-popup {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #141a27;
  color: #e6ebf5;
  border: 1px solid #283246;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .18s ease, transform .18s ease;
  z-index: 10050;
}
.error-popup.visible {
  opacity: 1;
  transform: translateY(0);
}
/* somewhere in your main.css */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(160px,1fr)); gap: 10px; }
.tool-btn { display:flex; align-items:center; gap:8px; padding:10px 12px; border-radius:10px; border:1px solid #263149; background:#0b1120; color:#e8eefb; cursor:pointer; }
.tool-btn .icon { font-size:18px; line-height:1; }
.tool-btn.protected::after { content: "🔒"; margin-left:auto; opacity:.7; }
.tool-btn:hover { border-color:#ff7a18; box-shadow:0 0 0 3px rgba(255,122,24,.25) }
.empty { opacity:.7; padding:12px; }
/* ===========================
   App Base (shared across apps)
   =========================== */

/* Theme tokens used by legacy tools */
:root{
  /* Keep these separate from your site vars to avoid collisions */
  --panel:#0b1120;       /* panel / textarea background */
  --fg:#e8eefb;          /* primary text */
  --muted:#9fb0c8;       /* secondary text */
  --line:#263149;        /* borders */
  --accent:#ff7a18;      /* focus + CTA hue */

  /* Layout */
  --radius:12px;
  --space-1:8px; --space-2:12px; --space-3:16px;

  /* Default max width for app content; apps can override */
  --app-max: 100%;
}

/* Basic page surface inside app iframes */
html, body {
  background: var(--bg);
  color: var(--fg);
}

/* Universal container used by Base64/JSON/Unicode/etc. */
.wrap{
  max-width: var(--app-max);
  margin: var(--space-1) auto calc(var(--space-3) + 6px);
  padding-inline: 12px;
}

/* Titles & utilities */
.wrap > h1, .app-title{ font-size:18px; margin:8px 0 12px; }
.mt8{ margin-top:8px; } .mt12{ margin-top:12px; } .mt16{ margin-top:16px; }

.row{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; }

/* Controls (inputs / selects / textareas) */
input[type="text"], input[type="number"], input[type="time"],
input[type="date"], input[type="search"], select, textarea,
.app-input, .app-textarea{
  width: 100%;
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  outline: none;
}
textarea{ min-height: 140px; resize: vertical; }
input:focus, select:focus, textarea:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,122,24,.25);
}

/* Buttons */
.btn, .app-btn{
  appearance:none; border:0; border-radius:10px;
  padding:10px 12px; cursor:pointer; font-weight:700;
  background:linear-gradient(180deg,#ff8a39,#ff6a00);
  color:#0b0f1a;
}
.btn.secondary{ background:linear-gradient(180deg,#2e3a55,#202a44); color:var(--fg); }
.btn.ghost{ background:transparent; border:1px solid var(--line); color:var(--fg); }
.btn:disabled{ opacity:.6; cursor:not-allowed; }

/* Messages / helpers / output */
.err{ color:#ff6b6b; }
.muted{ color:var(--muted); }

.out, .output, pre.output{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius: var(--radius);
  padding:10px 12px;
  color:var(--fg);
  white-space:pre-wrap;
}

/* Small “card grid” used by epoch/diff style tools */
.grid2, .grid-2{ display:grid; gap:12px; grid-template-columns:1fr 1fr; }
@media (max-width: 900px){ .grid2, .grid-2{ grid-template-columns: 1fr; } }

.card{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:12px;
}
.card .title{ font-weight:600; margin-bottom:8px; }
.unit{ display:inline-block; min-width:90px; color:var(--muted); }
.kv{ display:flex; gap:8px; align-items:center; }
.badge{ display:inline-block; font-size:12px; color:var(--muted); }
/* Universal code/table styles for all apps */
pre, code, kbd, samp, .code, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.table, table.app-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.table th, .table td,
table.app-table th, table.app-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.table tr:last-child td,
table.app-table tr:last-child td { border-bottom: 0; }
.table th { color: var(--muted); font-weight: 600; }
/* ==== Workspace vs Card contrast fix (drop at end of main.css) ==== */

/* Page / workspace background (dark) */
:root {
  /* keep your existing tokens if defined; these are just safe defaults */
  --panel:  #151c2a;   /* card surface */
  --line:   #263149;   /* hairline/borders */
  --radius: 12px;
}

/* Ensure the column & workspace use the darker bg */
.main-column,
#workspace {
  background: var(--bg) !important;
}

/* Cards get the lighter panel surface, border & shadow so they "stick out" */
.t-card,
.gw-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

/* Headers stay clean; optional subtle header tint if you want a bit more separation */
/*
.t-head,
.gw-card-header {
  background: rgba(255,255,255,0.02);
}
*/

/* Card bodies should not override the panel */
.t-body,
.gw-card-body {
  background: transparent;
}

/* App content wrapper should fill the card but not change the surface */
.t-body .wrap,
.gw-card-body .wrap {
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
  background: transparent;
}

/* Make sure embedded iframes don't force weird backgrounds */
.t-iframe,
.gw-card-body iframe {
  background: transparent;
}

/* Minor polish for icon+label titles if you're cloning them in JS */
.t-title .icon,
.gw-card-title .icon {
  margin-right: 8px;
  display: inline-flex;
  align-items: center;
}
/* Ensure 100% width includes padding and borders */
*, *::before, *::after { box-sizing: border-box; }

/* Belt & suspenders for form controls inside apps */
.wrap input,
.wrap select,
.wrap textarea,
.tt-input,
.tt-textarea {
  box-sizing: border-box;
  max-width: 100%;
}

/* Let flex items shrink instead of overflowing in rows */
.row > * { min-width: 0; }
.fld { min-width: 0; } /* your field wrapper class */
.gw-card-body, .t-body { padding: 10px; }
/* === Cards: match login panel surface + orange inner/outer glow === */
/* Login panel uses var(--panel-bg) + [--shadow-orange-inset, --shadow-orange-glow] */
.t-card,
.gw-card {
  background: var(--panel-bg) !important;
  border: 1px solid rgba(255, 102, 0, 0.22);           /* subtle orange hairline */
  border-radius: var(--radius);                         /* keep your global 12px */
  box-shadow: var(--shadow-orange-inset),               /* inner orange */
              var(--shadow-orange-glow) !important;     /* outer orange */
}

/* Optional: slightly tinted header + accent divider like the login panel vibe */
.t-head,
.gw-card-header {
  background: linear-gradient(180deg, rgba(255,102,0,0.06), transparent 40%);
  border-bottom: 1px solid rgba(255,102,0,0.25);
}

/* Keep bodies neutral so app content sits on the same panel color */
.t-body,
.gw-card-body { background: transparent !important; }

/* (nice touch) a tiny lift on hover/focus-within */
.t-card:hover, .gw-card:hover,
.t-card:focus-within, .gw-card:focus-within {
  box-shadow: inset 0 -2px 8px rgba(255,102,0,0.6),
              0 6px 18px rgba(255,102,0,0.28);
}
/* Global dark card surface matching login panel */
:root{
  --panel: #1a1a1a;              /* charcoal, not navy */
  --line:  rgba(255,102,0,.18);  /* subtle orange hairline */
  --radius: 12px;
  --input-bg: #131313;           /* input surface */
}

/* Card styling: orange outer glow + faint inner glow */
.card{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow:
    0 0 0 1px rgba(255,102,0,.22),   /* crisp orange edge */
    0 12px 28px rgba(0,0,0,.45),     /* drop */
    inset 0 0 0 1px rgba(255,102,0,.08); /* slight inner line */
}

/* Inputs & textareas: one style everywhere */
input, select, textarea {
  background: var(--input-bg);
  color: var(--text-color, #e0e0e0);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  box-shadow:
    0 0 0 1px rgba(255,102,0,.15),
    inset 0 -3px 0 0 #ff6600; /* crisp orange bottom */
}

/* Buttons use your global .btn; avoid per-app gradients */
/* Modal card treatment for special tools like Register */
.t-card.is-modal {
  position: fixed;
  top: 6vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(920px, calc(100vw - 48px));
  max-height: 86vh;
  z-index: 9999;
  /* you already unified card styling—this just constrains layout */
}
.t-card.is-modal .t-body { overflow: auto; }
.t-card.is-modal .t-head .window-controls { display: none; } /* hide ½, ⅓, close/min controls if desired */

/* optional: dim the background when a modal is present */
body:has(.t-card.is-modal)::after {
  content: "";
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 9998;
  pointer-events: none;
}
.text-ok { color: #8ee18e; }
.text-error { color: #ff7a7a; }
/* Admin tables: keep inside card and scroll horizontally on small screens */
.admin-table-wrap {
  overflow: auto;
  max-width: 100%;
}

.admin-table {
  width: 100%;
  min-width: 720px;                 /* gives table a baseline width; can tweak */
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--tt-border, #2a3346);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.admin-email {
  max-width: 320px;                 /* long emails truncated but scrollable overall */
  word-break: break-all;
}

/* Ensure card body itself can scroll if content exceeds height */
.gw-card .gw-card-body {
  overflow: auto;
}

/* Optional: keep header pinned, tweak as desired */
.admin-table thead th {
  position: sticky;
  top: 0;
  background: var(--panel-2, #0e1320);
  z-index: 1;
}
.admin-table-wrap { overflow: auto; max-width: 100%; }
.admin-table { width: 100%; min-width: 720px; border-collapse: collapse; }
.admin-table th, .admin-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--tt-border, #2a3346);
  white-space: nowrap; text-overflow: ellipsis; overflow: hidden;
}
.admin-email { max-width: 320px; word-break: break-all; }
.gw-card .gw-card-body { overflow: auto; }
.admin-table thead th { position: sticky; top: 0; background: var(--panel-2, #0e1320); z-index: 1; }
/* Row that holds Login/Logout and the theme icon */
.auth-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 1px 0;
}

/* Make the login button narrower and flexible next to the icon */
.left-menu .login-btn {
  flex: 1;            /* take remaining width */
  width: auto;        /* override old fixed width */
  padding: 8px 10px;  /* a touch smaller */
  font-size: 13px;
}

/* New compact theme icon button (sun/moon) */
.theme-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 0 6px var(--shadow-orange-soft);
  cursor: pointer;
  user-select: none;
  transition: background .2s ease, box-shadow .2s ease, transform .08s ease;
  font-size: 18px;      /* size of emoji icon */
  line-height: 1;
}
.theme-icon:hover,
.theme-icon:focus-visible {
  background: rgba(255, 102, 0, 0.12);
  box-shadow: 0 0 0 2px rgba(255, 102, 0, 0.25);
  outline: none;
}

/* Shorter, tighter footer: only IP + Version */
.sidebar-footer {
  padding: 3px 0 1px;       /* was 6px 0 20px */
  font-size: 12px;
  color: var(--text-subtle);
  border-top: 1px solid rgba(255, 102, 0, 0.2);
  text-align: center;
}
.sidebar-footer p { margin: 0; }
/* ── Left rail spacing tune-ups ─────────────────────────────── */
/* Reduce the extra space under the footer (overrides padding: 1rem) */
.left-menu{ padding-bottom:8px; } /* was 1rem overall in base rule */

/* Cut the gap above the first tool button list */
.sidebar-actions{ margin:10px 0 12px; } /* was 20px 0 */

/* Nudge spacing around the auth row so the first button sits closer */
.left-menu .login-btn{ margin:8px 0 6px; } /* was 12px 0 */

/* Footer: keep it short, and add a clearer gap between IP and Version */
.sidebar-footer{ padding:8px 0 0px; } /* trims bottom space further */
.sidebar-footer p{ margin:0; line-height:1.25; }
.sidebar-footer p + p{ margin-top:6px; } /* adds space between IP & Version */
/* kill the extra top margin that was scrolling away */
.sidebar-actions { margin: 0; }                /* was 20px 0 */
/* Smaller buttons in the left rail */
.left-menu .sidebar-actions { gap: 6px; }                 /* was 10px */        /* :contentReference[oaicite:0]{index=0} */
.left-menu .tool-btn{
  padding: 6px 10px;                                      /* was 8px 12px */    /* :contentReference[oaicite:1]{index=1} */
  border-radius: 5px;                                     /* was 6px */         /* :contentReference[oaicite:2]{index=2} */
}

/* tighten icon + label */
.left-menu .tool-btn .icon,
.left-menu .tool-btn svg,
.left-menu .tool-btn img{
  width: 18px; height: 18px;           /* dial down from whatever the SVG/image is */
}

/* smaller label text + tighter line-height; ellipsis to avoid 2 lines */
.left-menu .tool-btn .label{
  font-size: 12px;                     /* your .tool-btn rule doesn’t size the label explicitly */
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* reduce vertical space around the rail’s list (you already set margin:0) */
.sidebar-actions{ margin: 0; gap: 6px; }                                     /* :contentReference[oaicite:3]{index=3} */
/* fallback: push the label 5px away from the icon */
.left-menu .tool-btn .icon,
.left-menu .tool-btn svg,
.left-menu .tool-btn img { margin-inline-end: 10px; }  /* RTL-safe */

/* Mobile: keep cards below the top bar and make scrollIntoView stop under it */
@media (max-width: 900px){
  :root{
    /* JS will set this exactly; 56px is a safe fallback */
    --mobileTopBarH: 56px;
  }

  /* If your page scrolls the body */
  html, body { scroll-padding-top: var(--mobileTopBarH); }

  /* If a container scrolls (keep, doesn't hurt even if body scrolls) */
  #workspace { padding-top: var(--mobileTopBarH); }

  /* When scrolling to a specific card, stop under the bar */
  .gw-card { scroll-margin-top: var(--mobileTopBarH); }
}
.copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s;
}

.copy-btn:hover {
  opacity: 1;
  transform: scale(1.1);
  filter: drop-shadow(0 0 6px #ff7a18);
}

.copy-btn svg {
  width: 18px;
  height: 18px;
  stroke: #ff7a18;
  stroke-width: 2;
  fill: none;
}
/* Base button style (you can keep what you already had) */
.copy-btn {
  background: none;
  border: 0;
  cursor: pointer;
  padding: 4px;
  line-height: 0;
  color: var(--tt-accent, #ff7a18); /* drives the SVG via currentColor */
}

/* SVG styling: stroke + glow; the path is filled to match your sample */
.copy-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none; /* overall */
  filter: drop-shadow(0 0 6px currentColor);
  transition: transform .25s ease, filter .25s ease, opacity .2s ease;
  opacity: .9;
}

/* Fill just the path (like your sample) */
.copy-btn svg path {
  fill: currentColor;
}

/* Hover/Focus effects (desktop); tap just triggers click on mobile) */
.copy-btn:hover svg,
.copy-btn:focus-visible svg {
  transform: scale(1.05);
  filter: drop-shadow(0 0 10px currentColor) drop-shadow(0 0 14px currentColor);
  opacity: 1;
}
/* Hidden by default */
.copy-btn { display: none; }

/* Show only when target content is active (changed from baseline) */
.copy-btn[data-copy-active="1"] { display: inline-flex; }
