/* --- ORGEM Modern, Dark, Paneled CSS --- */
@import url('https://fonts.googleapis.com/css?family=Roboto:400,500,700&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');

:root {
  --bs-blue: #3498db;
  --bs-indigo: #596CFF;
  --bs-accent: #4e8cff;
  --bs-primary: #1976d2;
  --bs-secondary: #7b809a;
  --bs-success: #4CAF50;
  --bs-info: #3567c3;
  --bs-warning: #ff8e00;
  --bs-danger: #F44335;
  --bs-light: #f0f2f5;
  --bs-dark: #23272f;
  --bs-darker: #181a20;
  --bs-white: #fff;
  --bs-gray: #6c757d;
  --bs-border: #2c2f36;
  --bs-shadow: 0 2px 12px rgba(44, 47, 54, 0.25);
  --bs-radius: 12px;
  --bs-radius-sm: 6px;
  --bs-radius-lg: 18px;
  --bs-font-sans-serif: 'Roboto', Arial, sans-serif;
  --bs-body-font-family: var(--bs-font-sans-serif);
  --bs-body-font-size: 1rem;
  --bs-body-font-weight: 400;
  --bs-body-line-height: 1.5;
  --bs-body-color: #e0e6ed;
  --bs-body-bg: var(--bs-darker);
  --layout-side-padding: 0.5rem;
  --layout-gap: 0.5rem;
  --topbar-height: 56px;
  --topbar-icon-size: 1.5rem;
  --topbar-dropdown-height: 2.2rem;
}

html, body {
  font-family: var(--bs-body-font-family);
  font-size: var(--bs-body-font-size);
  font-weight: var(--bs-body-font-weight);
  line-height: var(--bs-body-line-height);
  color: var(--bs-body-color);
  background: var(--bs-body-bg);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: block;
}

body.dark-version, body {
  color: #e0e6ed;
  background: var(--bs-darker);
}

body.light-mode {
  --bs-body-bg: #f5f7fa;
  --bs-darker: #f5f7fa;
  --bs-dark: #e9eef4;
  --bs-border: #d0d6e0;
  --bs-body-color: #23272f;
  --bs-accent: #1976d2;
  --bs-blue: #3498db;
  --bs-primary: #1976d2;
  --bs-secondary: #7b809a;
  --bs-white: #fff;
  color: #23272f;
  background: #f5f7fa;
}

body.dark-mode {
  --bs-body-bg: var(--bs-darker);
  --bs-darker: #181a20;
  --bs-dark: #23272f;
  --bs-border: #2c2f36;
  --bs-body-color: #e0e6ed;
  --bs-accent: #4e8cff;
  --bs-blue: #3498db;
  --bs-primary: #1976d2;
  --bs-secondary: #7b809a;
  --bs-white: #fff;
  color: #e0e6ed;
  background: var(--bs-darker);
}

*, ::before, ::after {
  box-sizing: border-box;
}

.topbar, .toolbar {
  width: auto;
  margin-top: var(--layout-gap);
  margin-bottom: var(--layout-gap);
  margin-left: var(--layout-side-padding); /* now 0.5rem */
  margin-right: var(--layout-side-padding);
  max-width: none;
  box-sizing: border-box;
  padding-left: 0;
  padding-right: 0;
  border-radius: var(--bs-radius);
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  background: linear-gradient(90deg, var(--bs-dark) 60%, var(--bs-blue) 100%);
  color: #fff;
  justify-content: space-between;
}

body.light-mode .topbar, body.light-mode .toolbar {
  background: none !important;
  color: #000 !important;
}

.topbar nav {
  background: none !important;
}

body.light-mode .topbar nav {
  background: none !important;
}

.topbar nav a, .topbar nav button, .toolbar nav a, .toolbar nav button {
  color: #fff;
  border-radius: var(--bs-radius);
  background: none;
  border: 2px transparent;
  font-size: var(--topbar-icon-size);
  margin: 0 0.1em;
  padding: 0.1em 0.1em;
  border-radius: var(--bs-radius-sm);
  transition: background 0.2s;
  display: inline-flex;
  align-items: center;
  height: calc(var(--topbar-height) - 16px);
  min-width: var(--topbar-icon-size);
  min-height: 2.1em;
}

.topbar select, .toolbar select {
  height: calc(var(--topbar-height) - 22px); /* match icon centerline */
  font-size: 1rem;
  margin-left: 0.5rem;
  margin-right: 0.5rem;
  vertical-align: middle;
  border-radius: var(--bs-radius-sm);
  padding: 0 1.2em 0 0.5em;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
}

.topbar .logo {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: 0.5em;
  position: relative;
  height: var(--topbar-height);
}
.topbar .logo .referral-code {
  font-size: 0.5em;
  height: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.5em;
  text-align: center;
  line-height: 1;
}
.topbar nav a, .topbar nav button, .toolbar nav a, .toolbar nav button {
  color: #fff;
  border-radius: var(--bs-radius);
  background: none;
  border: 2px transparent;
  font-size: 1rem;
  margin: 0 0.1em;
  padding: 0.1em 0.1em;
  border-radius: var(--bs-radius-sm);
  transition: background 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  cursor: pointer;
}
.topbar nav a:hover, .topbar nav button:hover, .toolbar nav a:hover, .toolbar nav button:hover {
  background: var(--bs-blue);
  color: #fff;
}

.container {
  display: flex;
  width: 100%;
  margin: 0;
  max-width: none;
  box-sizing: border-box;
  padding-left: var(--layout-side-padding); /* now 0.5rem */
  padding-right: var(--layout-side-padding);
  gap: var(--layout-gap);
}

.container,
.left-nav,
.right-pane {
  padding-top: 0 !important;
  margin-top: 0 !important;
}
.right-pane .frame:first-child {
  margin-top: 0 !important;
}
.right-pane .frame {
  margin-top: 1.2rem;
}
.right-pane .frame:first-child {
  margin-top: 0 !important;
}
/* Make sure .instructions and other sections don't add extra top margin */
.right-pane .instructions:first-child {
  margin-top: 0 !important;
}
.left-nav {
  border-radius: var(--bs-radius);
  color: #fff;
  padding: 1.2em 1em 1em 1em; /* increased padding for more space */
  min-height: calc(100vh - 60px);
  border-right: 1px solid var(--bs-border);
  box-shadow: 2px 0 8px rgba(44, 47, 54, 0.08);
  margin: 0;
}

body.light-mode .left-nav {
  background: #e9eef4;
  color: #23272f;
  border-right: 1px solid #d0d6e0;
}

/* Restore background for normal left nav, keep admin section as is */
.left-nav:not(.admin-nav-section), .responsive-left-nav:not(.admin-nav-section) {
  background: var(--bs-dark);
  border-radius: var(--bs-radius);

}

.org-dropdown-container {
  margin-bottom: 0.1em;
  padding-bottom: 0;
  padding-top: 0.2em;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.org-dropdown-label {
  font-size: 0.98em;
  color: #bfc9d8;
  margin-bottom: 0.1em;
  margin-left: 0.1em;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.1;
}

body.light-mode .org-dropdown-label {
  color: #23272f;
}

#orgs-dropdown {
  width: 100%;
  height: 2.2rem;
  min-height: 2.2rem;
  max-height: 2.2rem;
  font-size: 1em;
  border-radius: var(--bs-radius-sm);
  margin: 0;
  box-sizing: border-box;
  padding: 0 0.7em;
  background: var(--bs-darker);
  color: #e0e6ed;
  border: 1px solid var(--bs-border);
  display: flex;
  align-items: center;
}

body.light-mode #orgs-dropdown {
  background: #fff;
  color: #23272f;
  border: 1px solid #d0d6e0;
}

.left-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.left-nav ul li {
  margin: 0;
  padding: 0;
  height: 2.2rem;
  display: flex;
  align-items: center;
}
.left-nav ul li a {
  display: flex;
  align-items: center;
  height: 100%;
  width: 100%;
  padding: 0 0.7em;
  font-size: 1em;
  color: #e0e6ed;
  border-radius: var(--bs-radius-sm);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.left-nav ul li a .nav-label {
  margin-left: 0.55em;
  display: inline-block;
}

body.light-mode .left-nav ul li a {
  color: #23272f;
}

.left-nav ul li a:hover {
  background: var(--bs-blue);
  color: #fff;
}

body.light-mode .left-nav ul li a:hover {
  background: #3498db;
  color: #fff;
}

.left-nav ul li a.active-nav {
  background: var(--bs-accent);
  color: #fff;
  font-weight: 600;
  border-radius: 8px;
  box-shadow: 0 0 8px 2px var(--bs-accent), 0 2px 8px rgba(44,47,54,0.10);
  outline: 2px solid #4e8cff44;
  outline-offset: 1px;
  opacity: 0.97;
  transition: box-shadow 0.2s, outline 0.2s, opacity 0.2s;
}
body.light-mode .left-nav ul li a.active-nav {
  background: #e9eef4;
  color: var(--bs-primary);
  box-shadow: 0 0 8px 2px #4e8cff55, 0 2px 8px #bfc9d8;
  outline: 2px solid #4e8cff33;
  opacity: 0.99;
}

.topbar nav a.active-nav {
  background: var(--bs-accent);
  color: #fff !important;
  border-radius: 8px;
  box-shadow: 0 0 8px 2px var(--bs-accent), 0 2px 8px rgba(44,47,54,0.10);
  outline: 2px solid #4e8cff44;
  outline-offset: 1px;
  opacity: 0.97;
  transition: box-shadow 0.2s, outline 0.2s, opacity 0.2s;
}
body.light-mode .topbar nav a.active-nav {
  background: #e9eef4;
  color: var(--bs-primary) !important;
  box-shadow: 0 0 8px 2px #4e8cff55, 0 2px 8px #bfc9d8;
  outline: 2px solid #4e8cff33;
  opacity: 0.99;
}

.right-pane {
  flex: 1 1 0;
  padding: 0;
  border-radius: var(--bs-radius);
  background: var(--bs-darker);
  min-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  gap: var(--layout-gap);
  margin: 0;
}

body.light-mode .right-pane .frame,
body.light-mode .calendar-section.frame {
  background: #fff;
  color: #23272f;
  border: 1px solid #d0d6e0;
}

.frame {
  background: var(--bs-dark);
  border-radius: var(--bs-radius);
  box-shadow: var(--bs-shadow);
  padding: 0.25rem;
  border: 2px solid var(--bs-border);
  margin: 0;
}

.right-pane .frame + .frame {
  margin-top: 0;
}

.instructions, .user-profile, .site-features {
  background: var(--bs-darker);
  border-radius: var(--bs-radius-sm);
  box-shadow: 0 1px 4px rgba(44, 47, 54, 0.10);
  padding: 1.5rem;
  margin-top: 1.5rem;
  border: 1px solid var(--bs-border);
}

.login-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.1em;
  padding: 0.5em .2em;
  border-radius: var(--bs-radius-sm);
  border: 1px solid var(--bs-blue);
  background: var(--bs-dark);
  color: #fff;
  font-weight: 500;
  font-size: 1em;
  margin: 0.5em 0.5em 0.5em 0;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

body.light-mode .btn, body.light-mode button, body.light-mode .login-btn {
  background: #3498db;
  color: #fff;
}

body.light-mode .btn:hover, body.light-mode button:hover, body.light-mode .login-btn:hover {
  background: #1976d2;
  color: #fff;
}

input, select, textarea {
  background: var(--bs-darker);
  color: #e0e6ed;
  border: 1px solid var(--bs-border);
  border-radius: var(--bs-radius-sm);
  padding: 0.3em 0.8em; /* thinner vertical padding */
  font-size: 1em;
  margin-bottom: 1em;
  width: 100%;
  box-sizing: border-box;
  height: 2.1em; /* enforce thinner height */
  min-height: 1.7em;
  max-height: 2.2em;
}

body.light-mode input, body.light-mode select, body.light-mode textarea {
  background: #fff;
  color: #23272f;
  border: 1px solid #d0d6e0;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--bs-blue);
  background: var(--bs-dark);
}

button, .btn {
  background: var(--bs-blue);
  color: #fff;
  border: none;
  border-radius: var(--bs-radius-sm);
  padding: 0.7em 1.5em;
  font-size: 1em;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  margin: 0.5em 0;
}
button:hover, .btn:hover {
  background: var(--bs-accent);
}

.logout-btn {
  background: transparent;
  color: #fff;
  border: none;
  font-size: 1.2em;
  padding: 0.1em 0.3em;
  margin-left: 0.2em;
  margin-right: 0.2em;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2em;
  width: 2em;
  min-width: 1.7em;
  min-height: 1.7em;
  transition: background 0.2s;
}
.logout-btn:visible {
  display: inline-flex !important;
}
.logout-btn:hover {
  background: var(--bs-danger);
  color: #fff;
}

/* External nav icons */
.nav-ext {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1em;
  min-height: 2.1em;
  font-size: 1.4em;
  color: var(--bs-accent);
  background: none;
  border: none;
  border-radius: 50%;
  transition: background 0.2s, color 0.2s;
  margin: 0 0.1em;
  padding: 0.1em 0.1em;
}
.nav-ext:hover {
  background: var(--bs-blue);
  color: #fff;
}

/* Regolith icon (asteroid/rock style) */
.regolith-icon {
  display: inline-block;
  width: 1.3em;
  height: 1.3em;
  background: none;
  position: relative;
}
.regolith-icon::before {
  content: "\f5fb"; /* FontAwesome asteroid/meteor icon */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 1.2em;
  color: var(--bs-accent);
  filter: drop-shadow(0 0 2px var(--bs-blue));
}
body.light-mode .regolith-icon::before {
  color: var(--bs-primary);
}

/* Erkul icon (three bullets style) */
.erkul-icon {
  display: inline-block;
  width: 1.3em;
  height: 1.3em;
  position: relative;
}
.erkul-icon::before {
  content: "\f141"; /* FontAwesome ellipsis-v (three bullets) */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 1.2em;
  color: var(--bs-accent);
  letter-spacing: 0.1em;
}
body.light-mode .erkul-icon::before {
  color: var(--bs-primary);
}

/* SPViewer icon uses magnifying glass (FontAwesome) */

/* Theme toggle button: match .nav-ext style, not circular */
#theme-toggle.nav-ext {
  border-radius: var(--bs-radius-sm) !important;
  min-width: var(--topbar-icon-size);
  min-height: 2.1em;
  height: calc(var(--topbar-height) - 16px);
  width: auto;
  font-size: 1rem;
  padding: 0.1em 0.1em;
  background: none;
  color: var(--bs-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
#theme-toggle.nav-ext i {
  font-size: 1.1em !important;
  line-height: 1;
}
#theme-toggle.nav-ext:hover {
  background: var(--bs-blue);
  color: #fff;
}
body.dark-mode #theme-toggle i {
  color: #fff !important;
}
body.light-mode #theme-toggle i {
  color: #23272f !important;
}

/* External link arrow accent */
.external-link {
  position: relative;
}
.external-link::after {
  content: '\2197'; /* Unicode NE arrow */
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 0.7em;
  color: var(--bs-accent);
  opacity: 0.85;
  filter: brightness(1.5) drop-shadow(0 0 2px #0002);
}

body.light-mode .external-link::after {
  color: #23272f;
  opacity: 0.85;
  filter: brightness(0.7) drop-shadow(0 0 2px #fff8);
}
body.dark-mode .external-link::after {
  color: #fff;
  opacity: 0.95;
  filter: brightness(2) drop-shadow(0 0 2px #000a);
}

::-webkit-scrollbar {
  width: 8px;
  background: var(--bs-dark);
}
::-webkit-scrollbar-thumb {
  background: var(--bs-blue);
  border-radius: 8px;
}

/* --- Unified ORGEM Table Styles --- */
.orgem-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.3em;
  border: 2px solid var(--bs-border);
  border-radius: 10px;
  background: var(--bs-dark);
  color: var(--bs-body-color);
  font-size: 1em;
  margin-bottom: 1.5em;
  box-shadow: 0 2px 12px #0002;
}
.orgem-table th, .orgem-table td {
  padding: 0.5em 0.7em;
  text-align: center;
  border-bottom: 1px solid var(--bs-border);
  vertical-align: middle;
}
.orgem-table th {
  background: #23272f;
  color: #fff;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  position: relative;
}
.orgem-table th .sort-icon {
  margin-left: 0.3em;
  display: inline-block;
  vertical-align: middle;
}
.orgem-table tr:last-child td {
  border-bottom: none;
}
body.light-mode .orgem-table {
  background: #fff;
  color: #23272f;
  border: 2px solid #d0d6e0;
}
body.light-mode .orgem-table th {
  background: #e9eef4;
  color: #23272f;
}
body.light-mode .orgem-table th, body.light-mode .orgem-table td {
  border-bottom: 1px solid #d0d6e0;
}

/* --- Admin Table Styling --- */
.admin-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  margin-top: 1em;
  margin-bottom: 2em;
  background: var(--bs-dark);
  border-radius: var(--bs-radius);
  overflow: hidden;
  box-shadow: var(--bs-shadow);
}
.admin-table th, .admin-table td {
  border: 1px solid var(--bs-border);
  padding: 0.5em 0.8em;
  text-align: left;
}
.admin-table th {
  background: var(--bs-darker);
  color: var(--bs-accent);
  font-weight: 500;
}
.admin-table tr:nth-child(even) {
  background: rgba(44,47,54,0.7); /* dark row */
}
.admin-table tr:nth-child(odd) {
  background: rgba(30,32,38,0.7); /* slightly lighter row */
}
body.light-mode .admin-table th {
  background: #e9eef4;
  color: var(--bs-primary);
}
body.light-mode .admin-table tr:nth-child(even) {
  background: #f5f7fa;
}
body.light-mode .admin-table tr:nth-child(odd) {
  background: #e9eef4;
}

/* --- Alignment fix for toolbar icons (font and image) --- */
.topbar nav a, .topbar nav button {
  line-height: 1 !important;
  vertical-align: middle !important;
}

.toolbar-favicon, .uex-logo-img, .sctools-logo-img {
  width: 1.5em !important;
  height: 1.5em !important;
  min-width: 1.5em !important;
  min-height: 1.5em !important;
  max-width: 1.5em !important;
  max-height: 1.5em !important;
  vertical-align: middle !important;
  display: inline-block !important;
  object-fit: contain !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

/* UEX logo SVG theming and sizing */
.uex-logo-img {
  width: 1.25em;
  height: 1.25em;
  min-width: 1.1em;
  min-height: 1.1em;
  max-width: 1.4em;
  max-height: 1.4em;
  display: inline-block;
  vertical-align: middle;
  object-fit: contain;
  filter: none;
  transition: filter 0.2s;
}
body.dark-mode .uex-logo-img {
  filter: invert(0) hue-rotate(180deg) brightness(1.2) saturate(1.2);
}
body.light-mode .uex-logo-img {
  filter: none;
}

/* SC Trade Tools logo theming and sizing */
.sctools-logo-img {
  width: 1.5em;
  height: 1.5em;
  vertical-align: middle;
  background: transparent;
  filter: none !important;
}
body.light-mode .sctools-logo-img {
  filter: none !important;
}

.toolbar-favicon {
  width: 1.5em;
  height: 1.5em;
  min-width: 20px;
  min-height: 20px;
  max-width: 28px;
  max-height: 28px;
  vertical-align: middle;
  display: inline-block;
  border-radius: 4px;
  background: transparent;
  object-fit: contain;
  margin: 0;
  box-sizing: border-box;
}

.topbar nav a, .topbar nav button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2em;
  min-width: 2em;
  padding: 0 0.2em;
  box-sizing: border-box;
  font-size: 1.2em;
}
.topbar nav i, .topbar nav img.toolbar-favicon {
  font-size: 1.2em;
  height: 1.5em;
  width: 1.5em;
  margin: 0;
  line-height: 1.5em;
  vertical-align: middle;
  display: inline-block;
}

/* --- Responsive Styles --- */
@media (max-width: 1200px) {
  :root {
    --layout-side-padding: 1rem;
    --layout-max-width: 100vw;
  }
}

@media (max-width: 900px) {
  .container, .topbar, .toolbar {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  .left-nav, .right-pane {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

@media (max-width: 600px) {
  .topbar, .toolbar {
    flex-direction: column;
    height: auto;
    padding: 1rem;
  }
  .left-nav {
    padding: 0.5rem;
  }
  .right-pane {
    padding: 0.5rem;
  }
  .frame {
    padding: 0.5rem;
  }
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1.2em;
  margin-top: 1em;
}
.calendar-day {
  min-height: 60px;
  position: relative;
  text-align: center;
}
.calendar-header {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.calendar-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bs-dark);
  border-radius: var(--bs-radius);
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.calendar-table th, .calendar-table td {
  text-align: center;
  padding: 0.5em 0.2em;
  border: 1px solid var(--bs-border);
  min-width: 2.2em;
  height: 2.5em;
  vertical-align: top;
  background: var(--bs-darker);
}

body.light-mode .calendar-table th, body.light-mode .calendar-table td {
  background: #fff;
  color: #1976d2;
  border: 1px solid #d0d6e0;
}

.calendar-table th {
  background: var(--bs-dark);
  color: var(--bs-accent);
  font-weight: 500;
  font-size: 1em;
}

body.light-mode .calendar-table th {
  background: #e9eef4;
  color: #1976d2;
}

.calendar-day-num {
  font-size: 1em;
  font-weight: 600;
  margin-bottom: 0.2em;
  color: var(--bs-white);
}
.event-icon {
  display: inline-block;
  margin: 0.1em 0.1em;
  font-size: 1.1em;
  color: var(--bs-accent);
  cursor: pointer;
  transition: color 0.2s;
}

body.light-mode .event-icon {
  color: #1976d2;
}

.event-icon:hover {
  color: var(--bs-warning);
}

body.light-mode .event-icon:hover {
  color: #ff8e00;
}

.calendar-tooltip {
  position: absolute;
  z-index: 1000;
  background: var(--bs-dark);
  color: var(--bs-white);
  border: 1px solid var(--bs-accent);
  border-radius: var(--bs-radius-sm);
  padding: 0.5em 1em;
  font-size: 0.95em;
  pointer-events: none;
  box-shadow: var(--bs-shadow);
  min-width: 160px;
}

body.light-mode .calendar-tooltip {
  background: #fff;
  color: #23272f;
  border: 1px solid #1976d2;
}

.fleet-icon-svg {
  display: inline-block;
  vertical-align: middle;
  height: 1.5em;
  width: 2.2em;
  margin-right: 0.1em;
  margin-left: 0.1em;
  line-height: 1;
}
body.light-mode .fleet-icon-svg svg ellipse {
  fill: var(--bs-primary);
}
body.dark-mode .fleet-icon-svg svg ellipse {
  fill: var(--bs-accent);
}

.erkul-bullets-icon {
  display: inline-block;
  height: 1.3em;
  width: 1.7em;
  color: var(--bs-accent);
  vertical-align: middle;
}
body.light-mode .erkul-bullets-icon {
  color: var(--bs-primary);
}
body.dark-mode .erkul-bullets-icon {
  color: var(--bs-accent);
}

.calendar-section.frame {
  padding: 0.5em 1em 1em 1em;
  background: var(--bs-dark);
  border-radius: var(--bs-radius);
  margin-top: 1.5em;
  min-width: 0;
  border: 2px solid #bfc9d8;
}
body.light-mode .calendar-section.frame {
  background: #fff;
  border: 2px solid #6c757d;
}
.calendar-header-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1em;
  margin-bottom: 0.7em;
}
#calendar-title {
  font-size: 1.2em;
  font-weight: 600;
  flex: 1 1 auto;
  text-align: center;
}
#calendar-view-mode {
  margin-left: auto;
  font-size: 1em;
  border-radius: var(--bs-radius-sm);
  padding: 0.2em 0.7em;
  background: var(--bs-darker);
  color: var(--bs-body-color);
  border: 1px solid var(--bs-border);
}
body.light-mode #calendar-view-mode {
  background: #fff;
  color: #23272f;
  border: 1px solid #d0d6e0;
}
#calendar-main {
  width: 100%;
  min-height: 350px;
  overflow-x: auto;
}
.calendar-grid-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: none;
  border: 2px solid #bfc9d8;
  border-radius: 8px;
  overflow: hidden;
}
.calendar-grid-table th, .calendar-grid-table td {
  border: 1px solid var(--bs-border);
  padding: 0.2em 0.3em;
  min-width: 90px;
  min-height: 60px;
  vertical-align: top;
  background: var(--bs-darker);
  color: var(--bs-body-color);
  font-size: 0.98em;
}
body.light-mode .calendar-grid-table th, body.light-mode .calendar-grid-table td {
  background: #fff;
  color: #23272f;
  border: 1px solid #d0d6e0;
}
.calendar-grid-table th {
  background: var(--bs-dark);
  color: var(--bs-accent);
  font-weight: 600;
  text-align: center;
  font-size: 1em;
  padding: 0.3em 0.2em;
}
body.light-mode .calendar-grid-table th {
  background: #e9eef4;
  color: #1976d2;
}
.calendar-event {
  display: block;
  margin: 0.1em 0;
  padding: 0.2em 0.4em;
  border-radius: 6px;
  font-size: 0.97em;
  font-weight: 500;
  background: var(--bs-blue);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
  box-shadow: 0 1px 4px rgba(44,47,54,0.08);
}
.calendar-event[data-color="green"] { background: #4CAF50; }
.calendar-event[data-color="orange"] { background: #ff8e00; }
.calendar-event[data-color="purple"] { background: #8e44ad; }
.calendar-event[data-color="red"] { background: #F44335; }
.calendar-event[data-color="blue"] { background: #3498db; }
.calendar-event[data-color="gray"] { background: #7b809a; }
.calendar-event[data-color="yellow"] { background: #f7ca18; color: #23272f; }
.calendar-event:hover {
  filter: brightness(1.1);
  background: var(--bs-accent);
}

.support-me-icon {
  position: relative;
  color: #fff;
  background: linear-gradient(120deg, #ffe0b2 40%, #ffb347 100%);
  border-radius: 50%;
  box-shadow: 0 0 4px 1px #ffb347, 0 0 1px 0.5px #fff;
  /* Remove animation for subtlety */
  z-index: 2;
  opacity: 0.85;
  transition: box-shadow 0.2s, opacity 0.2s;
  order: 98;
  margin-left: auto;
  margin-right: 0.5em;
  position: relative;
  z-index: 1;
}
.support-me-icon:hover {
  box-shadow: 0 0 8px 2px #ffb347, 0 0 2px 1px #fff;
  opacity: 1;
}
.support-me-icon i {
  color: #fff;
  font-size: 1.25em;
  filter: none;
}
body.light-mode .support-me-icon {
  color: #fff;
  background: linear-gradient(120deg, #fff3e0 40%, #ffe0b2 100%);
  box-shadow: 0 0 4px 1px #ffb347, 0 0 1px 0.5px #fff;
  opacity: 0.85;
}

/* Coffee icon adjustments */
body.light-mode .topbar nav .support-me-icon i {
  text-shadow: 0 0 8px #ffec80, 0 0 2px #fff;
  color: #b8860b !important;
  filter: none;
}

/* Light theme icon color adjustments */
body.light-mode .topbar nav a, body.light-mode .topbar nav i, body.light-mode .topbar nav button {
  color: #000 !important;
  filter: none;
}

/* Blue gradient extends further left */
body.light-mode .topbar nav {
  background: none !important;
}

/* Calendar week view adjustments */
.calendar-week-scroll {
  max-height: 600px;
  overflow-y: auto;
  border-radius: 8px;
  background: none;
}
.week-view .calendar-time-label {
  min-width: 60px;
  text-align: right;
  font-size: 0.95em;
  color: var(--bs-gray);
  background: var(--bs-dark);
  border-right: 1px solid var(--bs-border);
  position: sticky;
  left: 0;
  z-index: 1;
}
.week-view .calendar-slot {
  min-height: 40px;
  height: 40px;
  vertical-align: top;
  position: relative;
  background: var(--bs-darker);
}
.week-view .calendar-event {
  position: absolute;
  left: 2px;
  right: 2px;
  top: 2px;
  z-index: 2;
  min-height: 36px;
  box-shadow: 0 2px 8px rgba(44,47,54,0.10);
  border: 1px solid #fff2;
  font-size: 0.97em;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.week-view .calendar-event:hover::after {
  content: attr(title);
  position: absolute;
  left: 100%;
  top: 0;
  background: var(--bs-dark);
  color: #fff;
  border: 1px solid var(--bs-accent);
  border-radius: 6px;
  padding: 0.4em 1em;
  font-size: 0.95em;
  white-space: pre-line;
  min-width: 180px;
  z-index: 10;
  box-shadow: var(--bs-shadow);
}

.uex-api-badge-li {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  list-style: none;
  background: none !important;
  box-shadow: none !important;
}
.uex-api-badge-img {
  height: 32px;
  max-width: 90%;
  object-fit: contain;
  border-radius: 6px;
  background: transparent !important;
  box-shadow: none !important;
}

/* --- Restore previous nav button sizing and only target theme toggle & support-me icons for color/centering --- */
#theme-toggle.nav-ext, #theme-toggle.nav-ext i {
  width: 2em !important;
  height: 2em !important;
  min-width: 2em !important;
  min-height: 2em !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1.25em !important;
  line-height: 1 !important;
  margin: 0 !important;
  padding: 0 !important;
  background: none !important;
  box-shadow: none !important;
  filter: none !important;
  border-radius: var(--bs-radius-sm) !important;
}
body.dark-mode #theme-toggle i {
  color: #fff !important;
}
body.light-mode #theme-toggle i {
  color: #23272f !important;
}

.support-me-icon, .support-me-icon i {
  width: 2em !important;
  height: 2em !important;
  min-width: 2em !important;
  min-height: 2em !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1.25em !important;
  line-height: 1 !important;
  margin: 0 !important;
  padding: 0 !important;
  background: none !important;
  box-shadow: none !important;
  filter: none !important;
}
body.dark-mode .support-me-icon i {
  color: #fff !important;
  text-shadow: none !important;
}
body.light-mode .support-me-icon i {
  color: #23272f !important;
  text-shadow: none !important;
}

/* Remove any blue/accent coloring from these icons */
#theme-toggle.nav-ext, #theme-toggle.nav-ext i, .support-me-icon, .support-me-icon i {
  background: none !important;
  box-shadow: none !important;
  filter: none !important;
}

/* Theme toggle always last */
#theme-toggle {
  order: 99;
}

/* --- Navigation Flex Layout Fixes (final) --- */
.left-nav, .responsive-left-nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: auto;
  width: 220px;
  min-width: 200px;
  max-width: 100%;
  background: none;
  border: none;
  box-shadow: none;
  margin-bottom: var(--layout-gap);
  padding: 0;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
}
.admin-nav-section {
  border-radius: var(--bs-radius);
  background: var(--bs-dark);
  margin: 0;
  padding: 0.5em 0.5em 0.5em 0.5em;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
#main-nav {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
.org-dropdown-container {
  width: 100%;
  box-sizing: border-box;
}
#leftnav-include {
  width: 220px;
  min-width: 200px;
  max-width: 100%;
  box-sizing: border-box;
}
.left-nav, .responsive-left-nav, .admin-nav-section, #main-nav, .org-dropdown-container {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding-left: 0;
  padding-right: 0;
}
.org-dropdown-container select {
  width: 100%;
  padding: 0.4em 0.6em;
  border-radius: var(--bs-radius-sm);
  border: 1px solid var(--bs-border);
  background: var(--bs-dark);
  color: var(--bs-body-color);
  margin-top: 0.2em;
  margin-bottom: 0.5em;
  box-sizing: border-box;
}
