/* =====================
   Base, Theme & Glass
   ===================== */
:root {
  /* New palette (from your target style) */
  --ink: #0e1318;
  --bg-1: #0f141a;
  --bg-2: #131a22;
  --text: #eaf1f6;
  --muted: #9fb0c1;

  --teal: #4aa8b5;
  --coral: #ff8c8c;
  --peach: #ffb0a3;
  --foam: #b9f3e0;

  --accent: var(--teal);
  --card: rgba(22, 29, 38, 0.88);
  --stroke: rgba(255, 255, 255, .12);
  --shadow: rgba(0, 0, 0, .45);

  /* Glass tuning */
  --glass-blur: 6px;
  --glass-sat: 140%;

  /* Keep your custom layout vars so JS/CSS continues to work */
  --radius: 16px;
  --base-size: 18px;
  --open-h: 120vh;

  /* Map old variable names to new theme for compatibility */
  --bg: var(--bg-2);
  --bg-soft: var(--bg-1);
  --eule-blue: var(--teal);

  --search-gap-top: 10px;
  /* keeps search & sidebar aligned */
  --input-bg: rgba(255, 255, 255, 0.06);
  --layout-gap: 24px;
  --sidebar-w: 320px;
  --sidebar-collapsed-w: 52px;
  /* width when collapsed (shows just the toggle/label) */

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;

  color-scheme: dark;
}

.light {
  --bg-1: #f6f8fb;
  --bg-2: #ffffff;
  --text: #0f141a;
  --muted: #546475;
  --card: rgba(255, 255, 255, 0.92);
  --stroke: rgba(0, 0, 0, .10);
  --shadow: rgba(17, 24, 39, .08);
  --accent: #2e7f8c;
  --input-bg: rgba(0, 0, 0, 0.05);

  /* compatibility */
  --bg: var(--bg-2);
  --bg-soft: var(--bg-1);
}

/* Resets / base */
* {
  box-sizing: border-box;
}

/* Prevent browsers from applying light-theme defaults to form controls */
input, select, textarea, button {
  font-family: var(--font-sans);
  color: var(--text);
}

input:not([type="radio"]):not([type="checkbox"]), select, textarea {
  background-color: var(--input-bg) !important;
  color: var(--text) !important;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  -webkit-appearance: none;
  appearance: none;
}

input:not([type="radio"]):not([type="checkbox"]):focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}

/* Kill Chrome/Safari autofill white override */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--bg-1) inset !important;
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text);
}

/* Accessibility: Skip to main */
.skip-to-main {
  position: absolute;
  top: -100px;
  left: 0;
  z-index: 9999;
  padding: 10px 15px;
  background-color: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: bold;
  border-radius: 0 0 8px 0;
  transition: top 0.2s ease-in-out;
}

.skip-to-main:focus {
  top: 0;
  outline: 3px solid #fff;
  outline-offset: -2px;
}

/* One scroller (html) + stable gutter; avoid double scrollbars */
html {
  height: 100%;
  scrollbar-gutter: stable;
  color-scheme: dark;
}

body {
  min-height: 100%;
  overflow-y: auto;
  scroll-behavior: smooth;
}

/* Fallback only for browsers that don't support scrollbar-gutter */
@supports not (scrollbar-gutter: stable) {
  body {
    overflow-y: scroll;
  }

  /* reserve space without layout shift */
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--base-size);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-2);
  /* base behind the gradient layer */
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

/* Continuous fixed background (no seams) */
.bg {
  position: fixed;
  inset: -20vmax;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(120vmax 80vmax at 10% 10%, rgba(74, 168, 181, .18), transparent 60%),
    radial-gradient(90vmax 70vmax at 85% 15%, rgba(255, 140, 140, .16), transparent 60%),
    radial-gradient(90vmax 70vmax at 20% 90%, rgba(185, 243, 224, .12), transparent 60%),
    linear-gradient(180deg, var(--bg-1), var(--bg-2));
  background-repeat: no-repeat;
  background-attachment: fixed;
  will-change: transform;
}

/* Glass utility */
.glass {
  background: var(--card);
  border: 1px solid var(--stroke);
  box-shadow: 0 10px 30px var(--shadow);
  position: relative;
  border-radius: var(--radius);
  isolation: isolate;
}

.glass:before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, .09) 0%, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, .05) 70%);
}

/* =====================
   Container & Header
   ===================== */
.container {
  width: 75%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* Top bar (use your existing markup) */
/* Make header a positioning context */
.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  /* center the brand line */
  gap: 16px;
  flex-wrap: wrap;
  padding: 0px 0 8px;
}

/* User Account Icon - Glass Style */
.user-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;

  /* Glass effect reusing vars */
  background: var(--card);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  box-shadow: 0 6px 16px var(--shadow);

  color: var(--accent);
  text-decoration: none;
  font-weight: bold;
  font-size: 18px;

  /* Position absolute to sit on same row as centered brand */
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;

  overflow: hidden;
}

.user-icon-btn:before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, 0) 35%, rgba(255, 255, 255, .08) 70%);
  mix-blend-mode: overlay;
}

.user-icon-btn:hover {
  box-shadow: 0 8px 20px var(--shadow);
  color: var(--text);
  border-color: rgba(255, 255, 255, .25);
}

/* Brand centered across the row */
.brand {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 36px;
  font-weight: 100;
}

/* Base mobile hidden elements */
.mobile-menu-btn {
  display: none;
}

.mobile-backdrop {
  display: block;
  /* Logic handled by opacity/pointer-events in media query, or hide here */
  display: none;
}

@media (max-width: 1024px) {
  .mobile-backdrop {
    display: block;
  }
}

/* Toggle pinned to top-right of header */
.actions {
  position: absolute;
  top: 12px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 2;
}

/* (Optional) keep it clear on very small screens */
@media (max-width: 480px) {
  .actions {
    top: 8px;
    right: 10px;
  }
}

.logo-wrap {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.logo-obj {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.brand-name {
  margin: 0;
  font-weight: 300;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.1;
}

h1 {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 28px);
}

.sub {
  color: var(--muted);
  margin-top: 4px;
  font-size: 0.95em;
}


/* =====================
   Utility Classes
   ===================== */
/* Flexbox utilities */
.flex-row {
  display: flex;
  align-items: center;
}

/* Spacing utilities */
.gap-xs {
  gap: 4px;
}

.gap-sm {
  gap: 8px;
}

.gap-md {
  gap: 10px;
}

.ml-auto {
  margin-left: auto;
}

/* Button variants */
.navbtn--icon-sm {
  padding: 4px;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.navbtn--compact {
  padding: 4px 10px;
  font-size: 12px;
  margin-left: 8px;
}

/* Container utilities */
.scroll-container {
  max-height: 382px;
  overflow-y: auto;
  flex: 0 0 382px;
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* IE and Edge */
}

.scroll-container::-webkit-scrollbar {
  display: none;
  /* Chrome, Safari, Opera */
}

.padding-0 {
  padding: 0 !important;
}

/* =====================
   Loading Skeletons
   ===================== */
.skeleton {
  background: linear-gradient(90deg,
      rgba(255, 255, 255, 0.04) 0%,
      rgba(255, 255, 255, 0.08) 50%,
      rgba(255, 255, 255, 0.04) 100%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

@keyframes skeleton-pulse {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.skeleton-card {
  height: 80px;
  margin: 12px 0;
}

.skeleton-text {
  height: 1em;
  margin: 8px 0;
  border-radius: 4px;
}

.skeleton-text--short {
  width: 60%;
}

.skeleton-text--long {
  width: 90%;
}

.skeleton-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}


/* =====================
   Navigation & Search
   ===================== */
nav.primary {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 0 10px 0;
}

.navbtn {
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 16px;
  font-weight: 600;
  box-shadow: 0 6px 18px var(--shadow);
  transition: transform .2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow .2s ease, background .2s ease, border-color .2s ease;
}

.navbtn:hover {
  transform: translateY(-2px) scale(1.02);
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .18);
  box-shadow: 0 10px 24px var(--shadow);
}

.navbtn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.search {
  margin: var(--search-gap-top) 0 24px 0;
  display: flex;
  gap: 10px;
}

.search input {
  flex: 1;
  padding: 14px 16px;
  font-size: 1.05em;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: var(--input-bg);
  color: var(--text);
  box-shadow: 0 6px 18px var(--shadow);
}

/* Homescreen top search: ID selector beats the global input !important rule (specificity 1,0,0 vs 0,2,1) */
#navSearch {
  width: 100%;
  display: block;
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--stroke) !important;
  background: #1c2430 !important;
  color: var(--text) !important;
  font-size: 16px;
  outline: none !important;
  box-shadow: 0 6px 18px var(--shadow);
  font-family: var(--font-sans);
  transition: all 0.2s ease;
  -moz-appearance: textfield;
  -webkit-appearance: none;
  appearance: none;
}

#navSearch::placeholder {
  color: rgba(159, 176, 193, .85);
}

#navSearch:focus {
  border-color: rgba(74, 168, 181, .6) !important;
  box-shadow: 0 0 0 3px rgba(74, 168, 181, .18), 0 10px 26px var(--shadow);
  outline: none !important;
}

#navSearch::-webkit-search-decoration,
#navSearch::-webkit-search-cancel-button,
#navSearch::-webkit-search-results-button,
#navSearch::-webkit-search-results-decoration {
  -webkit-appearance: none;
}

/* =====================
   Sections & Titles
   ===================== */
section {
  margin: 28px 0;
  padding: 0;
}

.section-title {
  margin: 0 0 12px;
  font-size: 24px;
  font-weight: 900;
  color: var(--text);
}

/* =====================
   Workflow cards (glass)
   ===================== */
.wf-card {
  /* Apply glass look */
  background: var(--card);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  box-shadow: 0 10px 30px var(--shadow);
  position: relative;

  border-radius: var(--radius);
  margin: 12px 0;
  overflow: hidden;
  transition: transform .2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow .2s ease, border-color .2s ease, background .2s ease;
}

.wf-card:before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, .09) 0%, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, .05) 70%);
}

.wf-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px var(--shadow);
  border-color: rgba(255, 255, 255, .25);
}

.wf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  cursor: pointer;
  background: rgba(255, 255, 255, .04);
  border-bottom: 1px solid var(--stroke);
}

.wf-title {
  font-weight: 600;
  font-size: 0.9rem;
  flex: 1;
  text-align: center;
}

.wf-ind {
  color: var(--muted);
  font-size: .95em;
}

/* Expanding content (PDF) */
.wf-body {
  max-height: 0;
  transition: max-height .3s ease;
  background: var(--bg-1);
}

.wf-card.open .wf-body {
  overflow-y: auto;
  max-height: min(var(--open-h), 80vh);
}

.pdfwrap {
  height: var(--open-h);
}

.pdfwrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

/* Footer */
footer {
  color: var(--muted);
  margin-top: 26px;
  font-size: .95em;
  border-top: 1px solid var(--stroke);
  padding-top: 16px;
}

/* Responsive tweaks (mirroring target style) */
@media (max-width: 1024px) {
  .container {
    width: 85%;
  }
}

@media (max-width: 768px) {
  .topbar {
    justify-content: center;
    text-align: center;
  }

  .brand {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .container {
    width: 92%;
  }

  h1 {
    font-size: 22px;
  }
}

.nores {
  margin: 12px 0;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: #1c2430;
  color: var(--muted);
  display: inline-block;
}

/* Grid: main content + sidebar. Sidebar column uses its own width so we can animate it */
.layout {
  display: grid;
  grid-template-columns: 1fr auto;
  /* main grows; sidebar width is set on .sidebar */
  gap: var(--layout-gap);
  align-items: start;
}

/* Main column */
.content {
  min-width: 0;
}

/* Sidebar column flush with right edge of the container (not floating) */
.sidebar {
  width: var(--sidebar-w);
  height: calc(100vh - 32px);
  /* Fill viewport minus top/bottom gaps */
  transition: width .25s ease;
  align-self: start;
  margin-top: var(--search-gap-top);
  /* aligns top with search */
  position: sticky;
  top: 16px;
  /* stick under header as you scroll */
  overflow: hidden;
  /* Clip content during transition */
  overflow-y: auto;
  /* Allow scrolling if content is long, though desktop sidebar usually fits */
}

/* Panel inside the sidebar */
/* Panel inside the sidebar */
.side-panel.glass {
  padding: 16px;
  border-radius: 16px;
  /* min-width removed to prevent button from being pushed out of view */
  display: flex;
  flex-direction: column;
}

.side-title {
  margin: 0 0 10px;
  font-size: 18px;
  color: var(--text);
}

/* Text-only links */
.side-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.side-link {
  display: block;
  padding: 2px 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 16px;
  color: var(--accent);
  text-decoration: none;
  transition: color .15s ease, opacity .15s ease;
}

/* Toggle button (inside sidebar, top-right) */
.side-toggle {
  appearance: none;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  height: 36px;
  width: 36px;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 18px var(--shadow);
  transition: background .15s ease, transform .08s ease;

  /* Position absolute to track the Sidebar width */
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 20;
}

.layout.sidebar-collapsed .side-toggle {
  right: auto;
  left: 50%;
  transform: translateX(-50%);
  /* Use transform for cleaner centering than margin calc */
  margin-left: 0;
  /* Force it to stay on the left side when collapsed */
}

.side-toggle:hover {
  background: rgba(255, 255, 255, .1);
}

.side-toggle:active {
  transform: translateY(1px);
}

/* Optionally hide the toggle label text and use an icon-like character */
.side-toggle .lbl {
  font-size: 18px;
  line-height: 1;
}

/* Collapsed state (applied on the layout wrapper) */
.layout.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-w);
}

/* Hide panel contents when collapsed, keep only the toggle visible */
/* Animate text appearance/disappearance */
.side-title,
.side-links {
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.25s ease, transform 0.25s ease;
  white-space: nowrap;
  /* Prevent wrapping during width change */
  min-width: 220px;
  /* Ensure content retains shape/width while parent shrinks, allowing smooth clip */
}

/* Hide panel contents when collapsed */
/* Note: toggle stays visible because it tracks sidebar width via absolute pos */

/* Hide panel contents when collapsed */
/* Hide panel contents when collapsed */
.layout.sidebar-collapsed .side-title,
.layout.sidebar-collapsed .side-links,
.layout.sidebar-collapsed #calendar-container,
.page.sidebar-collapsed .side-title,
.page.sidebar-collapsed .side-links,
.page.sidebar-collapsed #calendar-container {
  opacity: 0;
  transform: translateX(-20px);
  pointer-events: none;
  /* Reverse animation must be explicit */
  transition: opacity 0.25s ease, transform 0.25s ease;
  /* position: absolute; removed to fix instant disappear */
}

.page.sidebar-collapsed #calendar-container {
  transition: opacity 0s, transform 0s;
}

/* Keep the glass box compact when collapsed */
.layout.sidebar-collapsed .side-panel.glass {
  padding: 8px;
  display: grid;
  justify-items: end;
}

/* Responsive: stack columns on tablets/phones and show full panel content */
@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 1fr;
  }

  /* Sidebar: Flow layout (push content down) */
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    max-height: 0;
    overflow: hidden;
    background: #1e1e1e;
    margin-top: 0;
    opacity: 0;

    /* Reset transforms & fixed pos from previous step */
    top: auto;
    left: auto;
    bottom: auto;
    transform: none;
    box-shadow: none;
    z-index: 10;

    /* Animate Height & Opacity: Even Slower + Bounce */
    transition: max-height 1.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.8s ease;
    border-bottom: 1px solid var(--stroke);
    border-radius: 0 !important;
  }

  /* Ensure inner panel also has no radius on mobile */
  .sidebar .side-panel {
    border-radius: 0 !important;
  }

  /* Open state: expand height */
  .sidebar.mobile-open {
    max-height: 800px;
    /* Arbitrary large enough value */
    opacity: 1;
    transform: none;
  }

  /* Hide backdrop since we pushed content */
  .mobile-backdrop {
    display: none !important;
  }

  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 24px;
    height: 44px;
    width: 44px;
    cursor: pointer;
    /* Move button into flow or keep abs if topbar is relative */
    position: absolute;
    left: 0;
    top: 0;
    z-index: 10;
  }

  .layout.sidebar-collapsed .sidebar {
    width: 280px;
    /* Don't collapse on mobile, just hide/show */
  }

  /* Reset layout for mobile */
  .layout {
    grid-template-columns: 1fr;
  }

  .side-toggle {
    display: none;
  }

  /* Ensure content doesn't get pushed */
  .content {
    width: 100%;
  }

  /* Adjust topbar for btn */
  .topbar {
    justify-content: center;
    padding-left: 44px;
    /* Space for btn */
    min-height: 50px;
  }

  .brand {
    justify-content: center;
    font-size: 24px;
    /* Smaller brand on mobile */
  }

  .logo-wrap {
    width: 48px;
    height: 48px;
  }
}

/* ===== Left sidebar, full-bleed, collapsible (clean) ===== */
:root {
  --layout-gap: 24px;
  --sidebar-w: 257px;
  --sidebar-collapsed-w: 52px;
}

/* Grid: left sidebar + main content */
.page {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: var(--layout-gap);
  align-items: start;
  width: 100%;
  max-width: none;
  margin: 0;
  transition: grid-template-columns .2s ease;
}

.page.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed-w) minmax(0, 1fr);
}

/* Center the content column within the right grid cell */
.page>.container {
  justify-self: center;
  width: min(75%, 1200px);
}

/* Left rail: attached to window edge, full height */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: var(--sidebar-w);
  margin: 0;
  transition: width .25s ease;
}

.page.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-w);
}

/* Sidebar panel visuals */
.side-panel.glass {
  height: 100%;
  padding: 16px;
  border-radius: 0 0 0 0;
  /* flush left edge */
  display: flex;
  flex-direction: column;
}

/* Calendar in Sidebar */
/* Calendar in Sidebar / Dashboard */
#calendar-container {
  width: 100%;
}

/* Ensure calendar content fits or scrolls */
.calendar-widget-container {
  /* Positioning: Relative inside card */
  position: relative;
  width: 100%;
  min-width: 0;
  /* Allow shrinking */

  /* Remove duplicate card styling since parent .card.glass already has it */
  background: transparent;
  backdrop-filter: none;
  border: none;
  box-shadow: none;
  box-shadow: none;
  padding: 20px !important;
  /* Internal padding */

  color: var(--text);
  font-size: 0.9rem;
}

@media (max-width: 1280px) {

  /* Hide specific position on smaller screens or move it */
  .calendar-widget-container {
    position: relative;
    top: 0;
    right: 0;
    width: 100%;
    margin-bottom: 20px;
    z-index: 1;
  }
}

/* Collapsed State */
.calendar-widget-container.collapsed .calendar-body {
  display: none;
}

.calendar-widget-container.collapsed #prevMonth,
.calendar-widget-container.collapsed #nextMonth {
  display: none;
}

.calendar-widget-container.collapsed {
  padding-bottom: 8px;
  /* Tighter spacing */
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
  background: transparent !important;
  border-bottom: none !important;
}




.cal-nav-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-weight: bold;
  /* Bigger buttons */
  padding: 6px 12px;
  font-size: 1.1rem;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.cal-nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

/* ... */

.cal-title {
  font-weight: 700;
  /* Bigger title */
  font-size: 1.3rem;
  color: var(--accent);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--muted);

  /* Separator Line */
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--stroke);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 2px;
  column-gap: 1px;
  /* Reduced to balance with aspect-ratio */
  margin-top: 0px;
  overflow: hidden;
}

.cal-day {
  aspect-ratio: 1.6;
  /* Wider than tall = compact vertical spacing */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
  font-size: 1.2rem !important;
  /* Increased for better visibility */
  position: relative;
}

.cal-day:not(.empty):hover {
  background: rgba(255, 255, 255, 0.05);
}

.cal-day.today {
  background: var(--accent);
  color: #fff !important;
  font-weight: bold;
}

.cal-day.selected {
  border: 2px solid var(--accent);
}

.cal-day.has-event::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 4px;
  height: 4px;
  background: var(--coral);
  border-radius: 50%;
}

.calendar-summary {
  margin-top: 0px;
  padding-top: 6px;
  border-top: none !important;
  background: transparent !important;
  font-size: 0.75rem;
}

.summary-header {
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  font-size: 0.7rem;
  background: transparent !important;
}

.summary-content {
  line-height: 1.4;
  color: var(--text);
}

.time {
  color: var(--muted);
  font-size: 0.7em;
  margin-left: 0;
  display: block;
}

/* Hide content when collapsed (keep just the toggle) */
.page.sidebar-collapsed .side-title,
.page.sidebar-collapsed .side-links {
  display: none;
}

.page.sidebar-collapsed .side-panel.glass {
  padding: 8px;
  display: grid;
  justify-items: end;
}

/* Icon-only toggle (no box) */
.side-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: px;
  /* keeps a decent hit area */
  margin-left: auto;
  cursor: pointer;
  transition: transform .08s ease, color .15s ease, opacity .15s ease;
}

.side-toggle:hover {
  color: var(--accent);
}

.side-toggle:active {
  transform: scale(0.96);
}

/* Accessible focus ring */
.side-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
  /* just for the focus ring shape */
}

/* The “≡” icon */
.side-toggle .lbl {
  font-size: 20px;
  line-height: 1;
  font-weight: 600;
}

/* Text-only links (keep) */
.side-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.side-link {
  display: block;
  padding: 2px 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 16px;
  color: var(--accent);
  text-decoration: none;
  transition: color .15s ease, opacity .15s ease;
}

.side-link:hover {
  text-decoration: underline;
}

.side-link:active {
  opacity: .85;
}

/* Responsive: stack; content full-width; rounded panel; hide toggle */
@media (max-width: 1024px) {
  .page {
    grid-template-columns: 1fr;
  }

  .page>.container {
    justify-self: stretch;
    width: 100%;
  }

  .sidebar {
    position: static;
    height: auto;
    width: 100%;
  }

  .side-panel.glass {
    border-radius: 16px;
  }

  .side-toggle {
    display: none;
  }
}

/* 1) Keep card background inside the border */
.wf-card {
  background-clip: padding-box;
}

/* 2) Pull the overlay in by 1px so it never hits the border */
.wf-card::before {
  inset: 1px;
  /* was: inset: 0 */
  border-radius: calc(var(--radius) - 1px);
  /* match the inset */
}

/* 3) Make sure a collapsed body can’t draw a divider */
.wf-body {
  overflow: hidden;
  border-top: 0 !important;
  /* in case an old rule adds one */
}

/* 4) Nudge GPU to avoid subpixel hairlines on some setups */
.wf-card,
.wf-card::before {
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* =====================
   Comments – subtle, non-intrusive
   ===================== */

/* Container spacing */
.comment-item {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;

  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .06);
}

/* Email + timestamp */
.comment-meta {
  font-size: 12px;
  line-height: 1.3;
  color: var(--muted);
  opacity: 0.85;
  margin-bottom: 4px;
}

/* Comment text */
.comment-text {
  font-size: 14px;
  line-height: 1.45;
  color: rgba(255, 255, 255, .88);
}

/* Make markdown inside comments quieter */
.comment-text p {
  margin: 0;
}

.comment-text code {
  font-size: 13px;
  background: rgba(0, 0, 0, .25);
  padding: 2px 4px;
  border-radius: 6px;
}

/* Actions: hidden unless hover */
.comment-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 4px;

  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}

.comment-item:hover .comment-actions {
  opacity: 1;
  pointer-events: auto;
}

/* Smaller buttons */
.navbtn.small {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 8px;
}

/* Softer danger button */
.navbtn.danger {
  color: rgba(255, 140, 140, .85);
  border-color: rgba(255, 140, 140, .25);
  background: transparent;
}

.navbtn.danger:hover {
  background: rgba(255, 140, 140, .12);
}

/* Make Quill actually show a writing area */
.quill-editor .ql-container {
  min-height: 140px;
  /* <- this is the key */
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
}

.quill-editor .ql-editor {
  min-height: 140px;
  /* <- also important */
  padding: 12px 14px;
}

/* Optional: match your dark UI better */
.quill-editor .ql-toolbar {
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}

/* If you use CSS variables for dark/light */
.quill-editor .ql-toolbar,
.quill-editor .ql-container {
  border: 1px solid var(--input-border);
}

.quill-editor .ql-editor {
  background: var(--input-bg);
  color: var(--input-text);
}

/* Quill icons/labels can be hard to see in dark mode */
body.dark-mode .quill-editor .ql-stroke {
  stroke: var(--input-text);
}

body.dark-mode .quill-editor .ql-fill {
  fill: var(--input-text);
}

body.dark-mode .quill-editor .ql-picker {
  color: var(--input-text);
}

/* Quill needs height for the editable area */
.quill-editor .ql-container {
  border: none;
}

.quill-editor .ql-editor {
  min-height: 140px;
  padding: 12px;
}


/* Make toolbar readable in dark UI */
.quill-editor .ql-toolbar.ql-snow,
.quill-editor .ql-container.ql-snow {
  border-color: var(--stroke) !important;
}

.quill-editor .ql-toolbar.ql-snow .ql-stroke {
  stroke: var(--text) !important;
}

.quill-editor .ql-toolbar.ql-snow .ql-fill {
  fill: var(--text) !important;
}

.quill-editor .ql-toolbar.ql-snow .ql-picker {
  color: var(--text) !important;
}

/* =========================
   Inline workflow polishing
   ========================= */

/* 1) No gap between steps */
.wf-inline-root {
  padding: 0 !important;
}

.wf-inline-root .step-card {
  margin: 0 !important;
  border-radius: 0 !important;
}

/* add a subtle divider between steps instead of gaps */
.wf-inline-root .step-card+.step-card {
  border-top: 1px solid var(--stroke);
}

/* 2) Comment input + button on same row, smaller and less intrusive */
.wf-inline-root .comment-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.wf-inline-root .comment-input {
  flex: 1;
  height: 34px;
  padding: 8px 10px;
  margin: 0 !important;
  font-size: 13px;
  border-radius: 10px;
}

/* smaller "Lisa" button */
.wf-inline-root .comment-form .navbtn {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 10px;
  white-space: nowrap;
}

/* 3) Comment entry (input) more transparent / less visible */
.wf-inline-root .comment-input {
  background: rgba(255, 255, 255, .03) !important;
  border: 1px solid rgba(255, 255, 255, .08) !important;
}

.wf-inline-root .comment-input:focus {
  border-color: rgba(255, 255, 255, .18) !important;
}

/* 4) Make step card background more transparent */
.wf-inline-root .step-card.glass {
  background: rgba(255, 255, 255, .02) !important;
  box-shadow: none !important;
}

/* Optional: if you want them almost fully transparent, use this instead:
.wf-inline-root .step-card.glass {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: none !important;
  border-left: 0 !important;
  border-right: 0 !important;
}
*/
/* =====================
   Comment actions (reliable)
   ===================== */

.comment-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 4px;

  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}

/* Desktop hover */
.comment-item:hover .comment-actions {
  opacity: 1;
  pointer-events: auto;
}

/* Keyboard + click/tap focus */
.comment-item:focus-within .comment-actions,
.comment-item:active .comment-actions {
  opacity: 1;
  pointer-events: auto;
}

/* Devices where hover is unreliable (touch / hybrid laptops) */
@media (hover: none),
(pointer: coarse) {
  .comment-actions {
    opacity: 1;
    pointer-events: auto;
  }
}

/* =========================
   Workflow steps – unified styling (index inline + viewer page)
   ========================= */

/* Make viewer (#steps) behave like inline (.wf-inline-root) */
.wf-inline-root,
#steps {
  padding: 0 !important;
}

/* Step cards: remove gaps + same look */
.wf-inline-root .step-card,
#steps .step-card {
  margin: 0 !important;
  border-radius: 0 !important;
}

/* Divider between steps */
.wf-inline-root .step-card+.step-card,
#steps .step-card+.step-card {
  border-top: 1px solid var(--stroke);
}

/* Transparent-ish step background (same in both) */
.wf-inline-root .step-card.glass,
#steps .step-card.glass {
  background: rgba(255, 255, 255, .02) !important;
  box-shadow: none !important;
}

/* Comment form: same row, smaller */
.wf-inline-root .comment-form,
#steps .comment-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.wf-inline-root .comment-input,
#steps .comment-input {
  flex: 1;
  height: 34px;
  padding: 8px 10px;
  margin: 0 !important;
  font-size: 13px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .03) !important;
  border: 1px solid rgba(255, 255, 255, .08) !important;
}

.wf-inline-root .comment-form .navbtn,
#steps .comment-form .navbtn {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 10px;
  white-space: nowrap;
}

/* =========================
   Workflow steps – unified styling (index inline + viewer page)
   ========================= */

/* Make viewer (#steps) behave like inline (.wf-inline-root) */
.wf-inline-root,
#steps {
  padding: 0 !important;
}

/* Step cards: remove gaps + same look */
.wf-inline-root .step-card,
#steps .step-card {
  margin: 0 !important;
  border-radius: 0 !important;
}

/* Divider between steps */
.wf-inline-root .step-card+.step-card,
#steps .step-card+.step-card {
  border-top: 1px solid var(--stroke);
}

/* --- Starring & Collapsing Improvements --- */

/* Star Icon Wrapper */
.star-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--stroke);
  /* Default empty star color */
  transition: color 0.2s, transform 0.1s;
  padding: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.star-btn:hover {
  color: var(--muted);
  transform: scale(1.1);
}

.star-btn.active {
  color: #f1c40f;
  /* Gold color for starred */
}

/* Workflow Card Star Positioning */
.wf-head .star-btn {
  margin-right: 8px;
  /* Space between star and title */
  font-size: 1.4rem;
}

/* Step Header Styling for Collapse */
.step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  padding-bottom: 8px;
  /* Give some breathing room */
}

.step-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.step-toggle-icon {
  font-size: 0.9rem;
  color: var(--muted);
  transition: transform 0.3s ease;
}

/* Rotate icon when collapsed (reverted to 180deg for clarity) */
.step-card.collapsed .step-toggle-icon {
  transform: rotate(-90deg);
}

/* Collapsible Body */
.step-body {
  transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
  overflow: hidden;
  max-height: 5000px;
  opacity: 1;
}

.step-card.collapsed .step-body {
  max-height: 0;
  opacity: 0;
  margin: 0 !important;
  padding: 0 !important;
}

/* Star in Step Header */
.step-header .star-btn {
  font-size: 1.3rem;
  margin-left: 10px;
}

/* Transparent-ish step background (same in both) */
.wf-inline-root .step-card.glass,
#steps .step-card.glass {
  background: #1e1e1e !important;
  /* Solid dark grey/black */
  box-shadow: none !important;
  color: #e0e0e0;
  /* Light text for better contrast */
}

/* Reduce text spacing & size */
.wf-body,
.step-body {
  line-height: 1.35;
  font-size: 15px;
  /* Increased to 15px (+1px from 14px) */
}

/* Force tighter spacing on text elements */
.step-body p,
.step-body li,
.step-body div:not(.comment-item):not(.step-header):not(.step-body) {
  margin-bottom: 8px !important;
}

.step-body ul,
.step-body ol {
  margin-bottom: 8px !important;
  padding-left: 20px;
}

/* Comment form: same row, smaller */

/* Comment form: same row, smaller */
.wf-inline-root .comment-form,
#steps .comment-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.wf-inline-root .comment-input,
#steps .comment-input {
  flex: 1;
  height: 34px;
  padding: 8px 10px;
  margin: 0 !important;
  font-size: 13px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .03) !important;
  border: 1px solid rgba(255, 255, 255, .08) !important;
}

.wf-inline-root .comment-form .navbtn,
#steps .comment-form .navbtn {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 10px;
  white-space: nowrap;
}

/* =====================
   Dashboard Grid Overhaul
   ===================== */
.dashboard-container {
  width: 90%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  min-height: 100vh;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: minmax(300px, auto);
  gap: 24px;
  margin-top: 24px;
}

/* Coin Spans */
.col-span-12 {
  grid-column: span 12;
}

.col-span-6 {
  grid-column: span 6;
}

.col-span-4 {
  grid-column: span 4;
}

.col-span-3 {
  grid-column: span 3;
}

.col-span-2 {
  grid-column: span 2;
}

/* Responsive adjustment: 1 column on mobile */
@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .col-span-12,
  .col-span-6,
  .col-span-4,
  .col-span-3,
  .col-span-2 {
    grid-column: span 1;
  }
}

/* Card Base Styles */
.card {
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  /* Glass effect inherited if .glass class used */
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  /* transform: translateY(-2px); removed per request */
  box-shadow: 0 14px 36px var(--shadow);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.5px;
}

.card-body {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
}

.padding-0 {
  padding: 0 !important;
}

/* Vertical Navigation Link Stack */
.vertical-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.navbtn-block {
  display: flex;
  align-items: center;
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  text-decoration: none;
  justify-content: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.navbtn-block::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, .09) 0%, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, .05) 70%);
  z-index: 1;
}

/* Ensure text is above overlay */
.navbtn-block span,
.navbtn-block {
  z-index: 2;
}

.navbtn-block:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  text-decoration: none;
}

.navbtn-block:active {
  transform: translateX(2px);
}

/* Side links in card context */
/* Favorites Container Grid */
#fav-container {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: minmax(62px, auto) !important;
  /* CRITICAL: Prevent row shrinking */
  gap: 21px;
  align-items: start;
  align-content: start;

  /* CRITICAL: Override .card-body flex behavior */
  flex: 0 0 420px !important;

  /* Fixed height for exactly 5 rows - cutoff at card bottom */
  height: 420px !important;
  min-height: 420px !important;
  max-height: 420px !important;

  /* Allow scrolling but hide scrollbar */
  overflow-y: scroll !important;
  overflow-x: hidden !important;
  -ms-overflow-style: none;
  scrollbar-width: none;

  scroll-behavior: smooth;
  padding: 20px !important;
  /* Symmetric padding */
}

#fav-container::-webkit-scrollbar {
  display: none;
}

#fav-container .wf-card {
  margin: 0 !important;
}

/* Ensure nores message spans both */
#fav-container .nores {
  grid-column: span 2;
}

.card-body .side-link {
  padding: 8px 12px;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.card-body .side-link:hover {
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
}

/* Old Content Sections below grid */
.content-sections {
  margin-top: 60px;
  padding-top: 40px;
  border-top: 1px solid var(--stroke);
}

/* Responsive */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }

  .dashboard-container {
    width: 95%;
    padding: 12px;
  }
}

/* =====================
   iOS-Style Icon Buttons
   ===================== */
.icon-btn-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 16px;

  /* Glassmorphism */
  background: var(--card);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  box-shadow: 0 8px 24px var(--shadow);

  text-decoration: none;
  color: var(--text);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.icon-btn:before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, 0) 35%, rgba(255, 255, 255, .08) 70%);
  mix-blend-mode: overlay;
}

.icon-btn .material-icons-outlined {
  font-size: 36px;
  color: var(--accent);
}

.icon-btn-label {
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
  color: var(--text);
  max-width: 100%;
  word-wrap: break-word;
}

.icon-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px var(--shadow);
  border-color: rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .08);
  text-decoration: none;
}

.icon-btn:active {
  transform: translateY(0);
  box-shadow: 0 6px 16px var(--shadow);
}

.icon-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Inline Workflow Expansion */
.wf-body {
  display: none;
}

.wf-card.open .wf-body {
  display: block;
}

/* Fix for nested glass inputs (ensure they are clickable) */
.wf-edit-body input,
.wf-edit-body textarea,
.wf-edit-body select,
.wf-edit-body button {
  position: relative;
  z-index: 50;
  /* Ensure above any glass overflows */
  pointer-events: auto;
}

/* Centralized Input Styles (in case missing from page) */
.calc-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: #1c2430 !important;
  color: var(--text) !important;
  box-shadow: 0 6px 18px var(--shadow);
  font-size: 16px;
  outline: none;
  font-family: var(--font-sans);
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
  appearance: none;
}

.calc-input::placeholder {
  color: var(--muted);
  opacity: 1;
}

select.calc-input {
  color: var(--text) !important;
}

select.calc-input option {
  background: #1c2430;
  color: var(--text);
}

.calc-input:focus {
  border-color: rgba(74, 168, 181, .6);
  box-shadow: 0 0 0 3px rgba(74, 168, 181, .18), 0 10px 26px var(--shadow);
}

textarea.calc-input {
  min-height: 100px;
  resize: vertical;
}

/* =====================
   Quill Editor Styling (WYSIWYG matches Output)
   ===================== */
.ql-container {
  font-family: var(--font-sans) !important;
  font-size: 15px !important;
}

.ql-editor {
  line-height: 1.35 !important;
  color: #e0e0e0 !important;
  /* Match .step-body color */
  padding: 12px 16px !important;
  /* Comfortable padding */
}

/* Match spacing from .step-body */
.ql-editor p,
.ql-editor ul,
.ql-editor ol,
.ql-editor li {
  margin-top: 0 !important;
  margin-bottom: 8px !important;
  line-height: 1.35 !important;
}

.ql-editor ul,
.ql-editor ol {
  padding-left: 20px !important;
}

/* Ensure step body matches exactly */
.step-body p,
.step-body li,
.step-body ul,
.step-body ol {
  margin-top: 0 !important;
  margin-bottom: 8px !important;
  line-height: 1.35 !important;
}

/* Headings: Tighter spacing (editor preference) */
.ql-editor h1,
.ql-editor h2,
.ql-editor h3,
.step-body h1,
.step-body h2,
.step-body h3 {
  margin-top: 12px !important;
  margin-bottom: 4px !important;
  line-height: 1.2 !important;
  font-weight: 700;
}

.ql-editor h1:first-child,
.step-body h1:first-child {
  margin-top: 0 !important;
}

/* Placeholder color */
.ql-editor.ql-blank::before {
  color: rgba(255, 255, 255, 0.4) !important;
  font-style: italic;
}


/* Line Height Dropdown Labels */
.ql-snow .ql-picker.ql-line-height .ql-picker-label::before,
.ql-snow .ql-picker.ql-line-height .ql-picker-item::before {
  content: "Rida";
}

.ql-snow .ql-picker.ql-line-height .ql-picker-label[data-value="1.0"]::before,
.ql-snow .ql-picker.ql-line-height .ql-picker-item[data-value="1.0"]::before {
  content: "1.0";
}

.ql-snow .ql-picker.ql-line-height .ql-picker-label[data-value="1.2"]::before,
.ql-snow .ql-picker.ql-line-height .ql-picker-item[data-value="1.2"]::before {
  content: "1.2";
}

.ql-snow .ql-picker.ql-line-height .ql-picker-label[data-value="1.35"]::before,
.ql-snow .ql-picker.ql-line-height .ql-picker-item[data-value="1.35"]::before {
  content: "1.35 (Vaikimisi)";
}

.ql-snow .ql-picker.ql-line-height .ql-picker-label[data-value="1.5"]::before,
.ql-snow .ql-picker.ql-line-height .ql-picker-item[data-value="1.5"]::before {
  content: "1.5";
}

.ql-snow .ql-picker.ql-line-height .ql-picker-label[data-value="1.6"]::before,
.ql-snow .ql-picker.ql-line-height .ql-picker-item[data-value="1.6"]::before {
  content: "1.6";
}

.ql-snow .ql-picker.ql-line-height .ql-picker-label[data-value="2.0"]::before,
.ql-snow .ql-picker.ql-line-height .ql-picker-item[data-value="2.0"]::before {
  content: "2.0";
}

.ql-snow .ql-picker.ql-line-height .ql-picker-label[data-value="3.0"]::before,
.ql-snow .ql-picker.ql-line-height .ql-picker-item[data-value="3.0"]::before {
  content: "3.0";
}

/* Set default width for the picker */
.ql-snow .ql-picker.ql-line-height {
  width: 98px !important;
}

/* Toolbar customization */
.ql-toolbar {
  border-color: var(--stroke) !important;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

.ql-container.ql-snow {
  border-color: var(--stroke) !important;
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
  background: rgba(10, 14, 18, 0.6);
  /* Slightly darker bg for editor area */
}

/* =====================
   Calendar Widget Styles
   ===================== */
.calendar-widget-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--stroke);
}

.cal-title {
  font-weight: 600;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
  /* Prevent overflow */
}

.cal-nav-btn {
  background: transparent;
  border: 1px solid var(--stroke);
  color: var(--text);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}

.cal-nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent);
}

.calendar-body {
  padding: 12px;
  flex: 1;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 1fr;
  gap: 4px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
  position: relative;
}

.cal-day:hover:not(.empty) {
  background: rgba(255, 255, 255, 0.08);
}

.cal-day.today {
  border: 1px solid var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.cal-day.selected {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  border-color: transparent;
}

.cal-day.has-event::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--coral);
}

.cal-day.selected.has-event::after {
  background-color: #fff;
}

.cal-day.empty {
  cursor: default;
  pointer-events: none;
}

.calendar-summary {
  border-top: 1px solid var(--stroke);
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  min-height: 80px;
}

.summary-header {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.summary-content {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.4;
}

/* Hide scrollbars globally on cards and containers */
.card-body,
.vertical-nav {
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* IE and Edge */
}

.card-body::-webkit-scrollbar,
.vertical-nav::-webkit-scrollbar {
  display: none;
  /* Chrome, Safari, Opera */
}

/* Greyed-out days from other months */
.cal-day.other-month {
  opacity: 0.3 !important;
  cursor: default !important;
  pointer-events: none;
}

.cal-day.other-month:hover {
  background: transparent !important;
}

/* Modal Overlay - Light Blur */
.modal-overlay {
  background: rgba(0, 0, 0, 0.1) !important;
  backdrop-filter: blur(6px) !important;
  -webkit-backdrop-filter: blur(6px) !important;
}

/* Modal Overlay - Even Lighter Blur */
.modal-overlay {
  background: rgba(0, 0, 0, 0.02) !important;
  backdrop-filter: blur(2px) !important;
  -webkit-backdrop-filter: blur(2px) !important;
}

/* --- Global Scrollbar Styling (Appended) --- */
/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* WebKit (Chrome, Edge, Safari) */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  border: 2px solid var(--bg-2);
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--teal);
}
/* Flatpickr date picker - perfectly matching application dark theme */
.flatpickr-calendar {
  z-index: 2147483647 !important;
  background: #2d2d2d !important;
  border: 1px solid var(--stroke) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6) !important;
  color: var(--text) !important;
  border-radius: 12px !important;
}
.flatpickr-months, .flatpickr-innerContainer, .flatpickr-month, .flatpickr-days {
  background: transparent !important;
}
.flatpickr-weekdays, .flatpickr-weekdaycontainer {
  background: #2d2d2d !important;
}
.flatpickr-weekday {
  background: #2d2d2d !important;
  color: var(--text) !important;
}
.flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
}
.flatpickr-day:hover {
  background: rgba(255, 255, 255, 0.1) !important;
}
.flatpickr-current-month, .flatpickr-month {
  color: var(--text) !important;
  fill: var(--text) !important;
  font-weight: 600 !important;
}
.flatpickr-monthDropdown-months {
  background: #2d2d2d !important;
  color: var(--text) !important;
}
.flatpickr-day {
  color: var(--text) !important;
}
.flatpickr-time {
    background: #2d2d2d !important; /* Specific dark color */
    border-top: 1px solid var(--stroke) !important;
}
.flatpickr-time input {
    color: var(--text) !important;
}
.flatpickr-time .flatpickr-am-pm {
    color: var(--text) !important;
}
.flatpickr-time input:hover, .flatpickr-time .flatpickr-am-pm:hover, .flatpickr-time input:focus, .flatpickr-time .flatpickr-am-pm:focus {
    background: rgba(255, 255, 255, 0.05) !important;
}


/* YouTube Embedding */
.video-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  max-width: 100%;
  margin-top: 14px;
  border-radius: 12px;
  box-shadow: 0 4px 12px var(--shadow);
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* =====================
   Back-link (shared across subpages)
   ===================== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
  border-radius: 8px;
}

.back-link:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
}

/* When inside a .topbar header, anchor it to the left */
.topbar .back-link {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
}
/* ============================================================
   PAGE: Homepage (index.html)
   ============================================================ */
    /* --- VÄRVISÜSTEEM --- */
    :root {
      /* Hele teema (vaikimisi) */
      --bg-overlay: rgba(0, 0, 0, 0.6);
      --modal-bg: #1c2430;
      --modal-text: #eaf1f6;
      --modal-header-bg: #1a2030;
      --modal-border: rgba(255,255,255,.12);

--input-bg: rgba(255, 255, 255, 0.06);
  --input-border: rgba(255, 255, 255, .15);
      --input-text: #eaf1f6;

      --table-th-bg: #1a2030;
      --table-th-text: #eaf1f6;
      --table-row-bg: #1c2430;
      --table-row-alt: #1a2030;
      --table-row-hover: #222d3d;

      --tab-btn-bg: #1c2430;
      --tab-btn-text: #eaf1f6;
      --tab-active-bg: #4aa8b5;
      --tab-active-text: #ffffff;

      --calc-bg: #1c2430;
      --calc-text: #eaf1f6;
    }

    /* Tume teema */
    body.dark-mode {
      --bg-overlay: rgba(0, 0, 0, 0.8);
      --modal-bg: #1e1e1e;
      --modal-text: #f0f0f0;
      --modal-header-bg: #252526;
      --modal-border: #333333;

      --input-bg: #2d2d2d;
      --input-border: #444444;
      --input-text: #ffffff;

      --table-th-bg: #111111;
      --table-th-text: #e0e0e0;
      --table-row-bg: #1e1e1e;
      --table-row-alt: #252526;
      --table-row-hover: #2a2d2e;

      --tab-btn-bg: #333333;
      --tab-btn-text: #cccccc;
      --tab-active-bg: #3498db;
      --tab-active-text: #ffffff;

      --calc-bg: #2d2d2d;
      --calc-text: #cccccc;
    }

    /* --- Modal (Hüpikaken) --- */
    .modal-overlay {
      position: fixed !important;
      top: 0 !important;
      left: 0 !important;
      right: 0 !important;
      bottom: 0 !important;
      width: 100vw !important;
      height: 100vh !important;
      min-width: 100vw !important;
      min-height: 100vh !important;
      background-color: var(--bg-overlay);
      z-index: 9999;
      display: none;
      justify-content: center;
      align-items: center;
      padding: 20px;
      backdrop-filter: blur(4px);
    }

    .modal-overlay.active {
      display: flex;
      visibility: visible !important;
      opacity: 1 !important;
      z-index: 10000 !important; /* High, but lower than Flatpickr */
    }
    
    .flatpickr-day.prevMonthDay, .flatpickr-day.nextMonthDay {
      color: var(--muted) !important;
      opacity: 0.2;
    }
    .flatpickr-calendar.arrowTop:after {
      border-bottom-color: #2d2d2d !important;
    }
    .flatpickr-calendar.arrowTop:before {
      border-bottom-color: var(--stroke) !important;
    }
    .flatpickr-calendar.arrowBottom:after {
      border-top-color: #2d2d2d !important;
    }
    .flatpickr-calendar.arrowBottom:before {
      border-top-color: var(--stroke) !important;
    }
    .flatpickr-time {
      background: #2d2d2d !important;
      border-radius: 12px !important;
    }
    .flatpickr-calendar.noCalendar {
      width: 160px !important; /* Narrower for time-only */
    }
    .flatpickr-calendar.noCalendar .flatpickr-time {
      border: none !important;
    }
    .flatpickr-time input, .flatpickr-time .flatpickr-time-separator, .flatpickr-time .flatpickr-am-pm {
      color: var(--text) !important;
    }
    .flatpickr-time input:hover, .flatpickr-time input:focus {
      background: rgba(255, 255, 255, 0.1) !important;
    }
    .flatpickr-time .numInputWrapper span.arrowUp:after {
      border-bottom-color: var(--text) !important;
    }
    .flatpickr-time .numInputWrapper span.arrowDown:after {
      border-top-color: var(--text) !important;
    }
    .flatpickr-months .flatpickr-prev-month, .flatpickr-months .flatpickr-next-month {
      fill: var(--text) !important;
      color: var(--text) !important;
    }
    /* Hide the default shadow if it exists */
    .flatpickr-calendar:before, .flatpickr-calendar:after {
       border-width: 0;
    }
    /* Restore only the arrow ones we defined */
    .flatpickr-calendar.arrowTop:before, .flatpickr-calendar.arrowTop:after,
    .flatpickr-calendar.arrowBottom:before, .flatpickr-calendar.arrowBottom:after {
       border-width: 5px;
    }

    .modal-card {
      background-color: var(--modal-bg) !important;
      /* Force override */
      color: var(--modal-text) !important;
      width: 100%;
      max-width: 450px;
      border-radius: 12px;
      box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
      position: relative;
      overflow: hidden;
      animation: slideUp 0.3s ease-out;
      display: flex;
      flex-direction: column;
      max-height: 90vh;
      border: 1px solid var(--modal-border);
    }

    .modal-card.large {
      max-width: 900px;
      width: 95%;
    }

    @keyframes slideUp {
      from {
        transform: translateY(20px);
        opacity: 0;
      }

      to {
        transform: translateY(0);
        opacity: 1;
      }
    }

    .modal-header {
      background-color: var(--modal-header-bg) !important;
      padding: 15px 20px;
      border-bottom: 1px solid var(--modal-border);
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-shrink: 0;
    }

    .modal-header h3 {
      margin: 0;
      font-size: 1.2rem;
      color: var(--modal-text) !important;
    }

    .close-btn {
      background: none;
      border: none;
      font-size: 2rem;
      line-height: 1;
      color: #999;
      cursor: pointer;
      transition: color 0.2s;
    }

    .close-btn:hover {
      color: var(--modal-text);
    }

    /* Chrome-specific dark mode fix for modals */
    body.dark-mode .modal-card {
      background-color: #1e1e1e !important;
      color: #f0f0f0 !important;
      border-color: #333333 !important;
    }

    body.dark-mode .modal-header {
      background-color: #252526 !important;
      border-bottom-color: #333333 !important;
    }

    body.dark-mode .modal-header h3,
    body.dark-mode .modal-body,
    body.dark-mode .calc-label,
    body.dark-mode .calc-result-item,
    body.dark-mode .calc-val {
      color: #f0f0f0 !important;
    }

    body.dark-mode .calc-input,
    body.dark-mode select.calc-input {
      background-color: #2d2d2d !important;
      border-color: #444444 !important;
      color: #ffffff !important;
    }

    body.dark-mode .tab-button {
      background-color: #333333 !important;
      color: #cccccc !important;
    }

    body.dark-mode .tab-button.active {
      background-color: #3498db !important;
      color: #ffffff !important;
    }

    body.dark-mode .req-table th {
      background-color: #111111 !important;
      color: #e0e0e0 !important;
    }

    body.dark-mode .req-table td {
      background-color: #1e1e1e !important;
      color: #f0f0f0 !important;
    }

    body.dark-mode .req-table tr:nth-child(even) td {
      background-color: #252526 !important;
    }

    body.dark-mode .calc-explanation {
      background-color: #2d2d2d !important;
      color: #cccccc !important;
    }

    body.dark-mode .calc-formula {
      color: #f0f0f0 !important;
    }


    .modal-body {
      padding: 20px;
      overflow-y: auto;
    }

    .ot-suggestions {
      display: none;
      position: absolute;
      top: 100%;
      left: 0; right: 0;
      background: var(--input-bg, #1e1e1e);
      border: 1px solid var(--input-border, #444);
      border-top: none;
      border-radius: 0 0 6px 6px;
      margin: 0; padding: 0;
      list-style: none;
      max-height: 180px;
      overflow-y: auto;
      z-index: 9999;
      box-shadow: 0 6px 16px rgba(0,0,0,0.4);
    }
    .ot-suggestions.open { display: block; }
    .ot-suggestions li {
      padding: 9px 12px;
      font-size: 14px;
      color: var(--input-text, #f0f0f0);
      cursor: pointer;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .ot-suggestions li:hover, .ot-suggestions li.ot-sug-active {
      background: rgba(255,255,255,0.1);
    }

    /* --- Kalkulaator (Taastatud stiilid) --- */
    .calc-label {
      display: block;
      margin-bottom: 0.5rem;
      color: var(--modal-text);
      opacity: 0.9;
      font-weight: 500;
      font-size: 0.9rem;
    }

    .calc-input {
      width: 100%;
      padding: 10px;
      margin-bottom: 1.25rem;
      background-color: var(--input-bg) !important;
      border: 1px solid var(--input-border) !important;
      color: var(--input-text) !important;
      border-radius: 6px;
      box-sizing: border-box;
      font-size: 16px;
    }

    /* Hide arrows in number input */
    .calc-input::-webkit-outer-spin-button,
    .calc-input::-webkit-inner-spin-button {
      -webkit-appearance: none;
      margin: 0;
    }

    .calc-results {
      margin-top: 1rem;
      padding-top: 1rem;
      border-top: 1px solid var(--modal-border);
    }

    .calc-result-item {
      display: flex;
      justify-content: space-between;
      margin-bottom: 0.8rem;
      font-size: 1rem;
      color: var(--modal-text);
    }

    .calc-val {
      font-weight: bold;
      color: var(--modal-text);
    }

    .calc-val.highlight {
      color: #3498db;
    }

    .calc-error {
      color: #e74c3c;
      font-weight: bold;
      text-align: center;
      display: none;
      margin-bottom: 1rem;
      font-size: 0.9rem;
      background: rgba(231, 76, 60, 0.1);
      padding: 8px;
      border-radius: 4px;
    }

    .calc-explanation {
      margin-top: 1.5rem;
      padding: 10px;
      background-color: var(--calc-bg);
      border-radius: 6px;
      font-size: 0.85rem;
      color: var(--calc-text);
    }

    .calc-formula {
      font-family: monospace;
      background: rgba(128, 128, 128, 0.1);
      padding: 2px 5px;
      border-radius: 3px;
      color: var(--modal-text);
    }

    /* Custom Select Arrow for Time Modal */
    select.calc-input {
      appearance: none;
      cursor: pointer;
      padding-right: 40px;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='gray' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 10px center;
      background-size: 20px;
    }

    /* Project Info Stats in Modal */
    .project-stats {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      background: var(--calc-bg);
      padding: 12px;
      border-radius: 8px;
      margin-top: -10px;
      margin-bottom: 15px;
      font-size: 13px;
      border: 1px solid var(--modal-border);
    }

    .stat-row {
      display: flex;
      flex-direction: column;
    }

    .stat-row span {
      font-size: 11px;
      text-transform: uppercase;
      font-weight: 700;
      opacity: 0.7;
      color: var(--modal-text);
    }

    .stat-row b {
      color: var(--modal-text);
      font-size: 16px;
      margin-top: 2px;
    }

    /* --- Nõuete tabel --- */
    .tabs {
      display: flex;
      justify-content: center;
      margin-bottom: 20px;
      gap: 10px;
      flex-wrap: wrap;
    }

    .tab-button {
      padding: 8px 16px;
      cursor: pointer;
      border: 1px solid var(--modal-border);
      background-color: var(--tab-btn-bg);
      color: var(--tab-btn-text);
      font-size: 14px;
      border-radius: 20px;
      transition: 0.3s;
      font-weight: 500;
    }

    .tab-button:hover {
      filter: brightness(90%);
    }

    .tab-button.active {
      background-color: var(--tab-active-bg);
      color: var(--tab-active-text);
      border-color: var(--tab-active-bg);
    }

    .table-container {
      overflow-x: auto;
      border-radius: 8px;
      border: 1px solid var(--modal-border);
      background-color: var(--table-row-bg);
    }

    .req-table {
      width: 100%;
      border-collapse: collapse;
      min-width: 600px;
      font-size: 14px;
    }

    .req-table th {
      background-color: var(--table-th-bg) !important;
      color: var(--table-th-text) !important;
      padding: 12px 15px;
      text-align: left;
      position: sticky;
      top: 0;
      font-weight: 600;
      z-index: 10;
    }

    .req-table td {
      padding: 12px 15px;
      text-align: left;
      border-bottom: 1px solid var(--modal-border);
      vertical-align: top;
      color: var(--modal-text);
      background-color: var(--table-row-bg);
    }

    /* Triibuline tabel */
    .req-table tr:nth-child(even) td {
      background-color: var(--table-row-alt);
    }

    .req-table tr:hover td {
      background-color: var(--table-row-hover);
    }

    /* --- Team Activity Dashboard --- */
    .team-user-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
      gap: 12px;
      margin-bottom: 24px;
    }

    .team-user-card {
      background: var(--calc-bg);
      border: 1px solid var(--modal-border);
      border-radius: 10px;
      padding: 14px 16px;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .team-user-card-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }

    .team-user-email {
      font-size: 13px;
      font-weight: 600;
      color: var(--modal-text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .team-user-project {
      font-size: 12px;
      color: var(--calc-text);
      word-break: break-word;
    }

    .team-user-meta {
      font-size: 11px;
      color: var(--calc-text);
      opacity: 0.75;
    }

    .team-activity-section-title {
      font-size: 13px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--calc-text);
      margin: 0 0 10px 0;
    }

    .team-project-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 10px 14px;
      background: var(--calc-bg);
      border: 1px solid var(--modal-border);
      border-radius: 8px;
      margin-bottom: 8px;
      gap: 12px;
    }

    .team-project-name {
      font-size: 13px;
      font-weight: 600;
      color: var(--modal-text);
    }

    .team-project-users {
      font-size: 12px;
      color: var(--calc-text);
    }

    .badge-active {
      background: rgba(39, 174, 96, 0.18);
      color: #27ae60;
      padding: 3px 9px;
      border-radius: 20px;
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      white-space: nowrap;
      flex-shrink: 0;
    }

    .badge-idle {
      background: rgba(243, 156, 18, 0.18);
      color: #f39c12;
      padding: 3px 9px;
      border-radius: 20px;
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      white-space: nowrap;
      flex-shrink: 0;
    }

    .badge-offline {
      background: rgba(150, 150, 150, 0.15);
      color: #999999;
      padding: 3px 9px;
      border-radius: 20px;
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      white-space: nowrap;
      flex-shrink: 0;
    }

    .team-activity-divider {
      border: none;
      border-top: 1px solid var(--modal-border);
      margin: 20px 0;
    }

    .team-activity-empty {
      text-align: center;
      color: var(--calc-text);
      font-size: 13px;
      padding: 16px 0;
      opacity: 0.7;
    }

    /* Staatused */
    .status-badge {
      padding: 4px 8px;
      border-radius: 12px;
      font-size: 11px;
      font-weight: bold;
      text-transform: uppercase;
    }

    .status-false {
      background-color: rgba(231, 76, 60, 0.15);
      color: #e74c3c;
    }

    .status-true {
      background-color: rgba(39, 174, 96, 0.15);
      color: #27ae60;
    }

    #req-loader {
      text-align: center;
      margin: 20px;
      color: var(--modal-text);
      display: none;
    }

    #req-row-count {
      text-align: right;
      margin-bottom: 10px;
      font-size: 12px;
      color: var(--calc-text);
    }

    /* Action Button inside Modal */
    .btn-action {
      background: #3498db;
      color: #fff;
      border: none;
      padding: 12px;
      border-radius: 8px;
      font-weight: 700;
      cursor: pointer;
      width: 100%;
      font-size: 16px;
      transition: 0.2s;
    }

    .btn-action:hover {
      filter: brightness(1.1);
    }

    .btn-action:disabled {
      opacity: 0.6;
      cursor: not-allowed;
    }

    /* Radio Button Styles */
    .radio-group {
      display: flex;
      flex-direction: column;
      gap: 6px;
      margin-bottom: 1rem;
    }

    .radio-option {
      display: flex;
      align-items: center;
      gap: 8px;
      cursor: pointer;
      padding: 4px 6px;
      border-radius: 4px;
      transition: background 0.2s;
    }

    .radio-option:hover {
      background: rgba(255, 255, 255, 0.05);
    }

    .radio-option input[type="radio"] {
      width: 16px;
      height: 16px;
      cursor: pointer;
      accent-color: #3498db;
      margin: 0;
      flex-shrink: 0;
    }

    .radio-option label {
      cursor: pointer;
      color: var(--modal-text);
      font-size: 0.9rem;
      margin: 0;
      line-height: 1.3;
    }

    /* Conditional Date Picker */
    .conditional-date-picker {
      margin-left: 28px;
      margin-top: 8px;
      display: none;
    }

    .conditional-date-picker.active {
      display: block;
    }

    /* Vacation Modal Split Layout */
    .vacation-split-container {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 20px;
      max-height: 70vh;
    }

    .vacation-form-panel {
      overflow-y: auto;
      padding-right: 10px;
    }

    .vacation-preview-panel {
      background: var(--calc-bg);
      border: 1px solid var(--modal-border);
      border-radius: 8px;
      padding: 30px;
      overflow-y: auto;
      font-family: 'Times New Roman', serif;
      line-height: 1.6;
    }

    .vacation-preview-panel h4 {
      text-align: center;
      margin: 0 0 10px 0;
      font-size: 1rem;
      font-weight: bold;
      color: var(--modal-text);
    }

    .vacation-preview-panel h3 {
      text-align: center;
      margin: 20px 0;
      font-size: 1.1rem;
      font-weight: bold;
      color: var(--modal-text);
    }

    .vacation-preview-panel p {
      margin: 15px 0;
      color: var(--modal-text);
      font-size: 0.95rem;
    }

    .vacation-preview-panel .signature-line {
      margin-top: 40px;
      border-top: 1px solid var(--modal-text);
      width: 200px;
      padding-top: 5px;
      font-size: 0.85rem;
      font-style: italic;
      color: var(--modal-text);
    }

    .preview-placeholder {
      color: var(--calc-text);
      font-style: italic;
      opacity: 0.6;
    }

    @media (max-width: 900px) {
      .vacation-split-container {
        grid-template-columns: 1fr;
      }
      
      .vacation-preview-panel {
        max-height: 400px;
      }
    }

/* ============================================================
   PAGE: Admin
   ============================================================ */

/* Heatmap */
:root {
  --hm-0: rgba(255,255,255,.06);
  --hm-1: rgba(74,168,181,.25);
  --hm-2: rgba(74,168,181,.50);
  --hm-3: rgba(74,168,181,.75);
  --hm-4: #4aa8b5;
}

.hm-week   { display: inline-flex; flex-direction: column; gap: 3px; margin-right: 3px; vertical-align: top; }
.hm-cell   { width: 13px; height: 13px; border-radius: 3px; background: var(--hm-0); cursor: default; flex-shrink: 0; }
.hm-month-labels { display: flex; gap: 0; margin-bottom: 4px; }
.hm-month-label { font-size: 10px; color: var(--muted); white-space: nowrap; }
.hm-dow-labels  { display: inline-flex; flex-direction: column; gap: 3px; margin-right: 6px; vertical-align: top; padding-top: 0; }
.hm-dow-label   { height: 13px; font-size: 10px; color: var(--muted); line-height: 13px; }

/* Heatmap tooltip */
.hm-tooltip {
  position: fixed;
  z-index: 9999;
  background: #1a2030;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  max-width: 220px;
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
}
.hm-tooltip.visible { opacity: 1; }
.hm-tooltip-date { font-weight: 600; margin-bottom: 4px; color: var(--accent); }
.hm-tooltip-row  { display: flex; justify-content: space-between; gap: 12px; }

.heatmap-range-btn.active { background: var(--accent); color: #fff; }
/* Page Layout Overrides */
#page-admin .dashboard-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 0 8px;
}

#page-admin .content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  margin-top: 24px;
  padding-bottom: 40px;
}

.admin-logo-link {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Section Styles */
.admin-section {
  margin: 0 0 12px 0;
  animation: fadeIn 0.4s ease-out;
  background: var(--card);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  box-shadow: 0 4px 12px var(--shadow);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  transition: box-shadow .2s ease, border-color .2s ease;
}
.admin-section::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,.14), rgba(255,255,255,0) 35%, rgba(255,255,255,.08) 70%);
  mix-blend-mode: overlay;
  z-index: 0;
}
.admin-section:hover { box-shadow: 0 6px 20px var(--shadow); border-color: rgba(255,255,255,.18); }
.section-toggle {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 20px;
  min-height: 58px;
  background: rgba(255,255,255,0.04);
  position: relative;
  z-index: 1;
  transition: background 0.2s;
}
.admin-section.open .section-toggle { border-bottom: 1px solid var(--stroke); }
.section-toggle:hover { background: rgba(255,255,255,0.07); }
.section-body { display: none; padding: 16px 4px 4px; position: relative; z-index: 1; }
.admin-section.open .section-body { display: block; }
.section-collapse-arrow { font-size: 20px; color: var(--muted); transition: transform 0.2s; flex-shrink: 0; line-height: 1; }
.admin-section.open .section-collapse-arrow { transform: rotate(180deg); }

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1;
  margin: 0;
}

.section-icon {
    color: var(--accent);
    font-size: 1.2rem;
    line-height: 1;
}

.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius);
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  white-space: nowrap;
}

.dash-table th {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--stroke);
  user-select: none;
}

.dash-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--stroke);
  color: var(--text);
}

.dash-table tr:last-child td {
  border-bottom: none;
}

.dash-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-pending { background: rgba(255, 193, 7, 0.2); color: #ffc107; }
.status-approved { background: rgba(76, 175, 80, 0.2); color: #4caf50; }
.status-rejected { background: rgba(244, 67, 54, 0.2); color: #f44336; }

/* Action Buttons */
.btn-small {
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-approve { background: #4caf50; color: white; }
.btn-approve:hover { background: #45a049; }
.btn-reject { background: #f44336; color: white; }
.btn-reject:hover { background: #da190b; }
.btn-approve:disabled, .btn-reject:disabled { opacity: 0.5; cursor: not-allowed; }

/* Admin Controls */
.admin-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.admin-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.admin-pill {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-weight: 600;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.calc-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: #1c2430;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.calc-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(74, 168, 181, .15);
}

select.calc-input {
  appearance: none;
  cursor: pointer;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='rgba(159,176,193,0.7)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
}

select.calc-input option {
    background: #1e242c;
    color: #fff;
}

.navbtn.glass-accent {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(74, 168, 181, 0.5);
  color: var(--accent);
  font-weight: 600;
  padding: 10px 18px;
  transition: background .2s ease, box-shadow .2s ease;
  cursor: pointer;
}

.navbtn.glass-accent:hover {
  background: rgba(74, 168, 181, 0.18);
  border-color: var(--accent);
  color: #fff;
}

/* Charts */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

@media (max-width: 900px) {
  .charts-grid { grid-template-columns: 1fr; }
}

.chart-card {
  padding: 18px;
  display: flex;
  flex-direction: column;
}

.chart-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
}

.chart-container {
  position: relative;
  height: 240px;
  width: 100%;
}

.chart-hint { opacity: 0.7; font-weight: 400; text-transform: none; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Overtime Section --- */
.ot-month-card {
  background: var(--card, rgba(20,26,34,.6));
  border: 1px solid var(--stroke, rgba(255,255,255,.08));
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}
.ot-month-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  font-weight: 700;
  font-size: 15px;
  color: var(--text, #f0f0f0);
  transition: background .15s;
}
.ot-month-header:hover { background: rgba(255,255,255,.04); }
.ot-month-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(74,168,181,.2);
  color: var(--accent, #4aa8b5);
  white-space: nowrap;
}
.ot-month-body { display: none; padding: 0 14px 14px; }
.ot-month-body.open { display: block; }
.ot-user-card {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--stroke, rgba(255,255,255,.08));
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
}
.ot-user-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  color: var(--text, #f0f0f0);
  transition: background .15s;
}
.ot-user-header:hover { background: rgba(255,255,255,.04); }
.ot-user-name { font-weight: 600; }
.ot-user-hours {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent, #4aa8b5);
}
.ot-user-body { display: none; }
.ot-user-body.open { display: table; width: 100%; border-collapse: collapse; }
.ot-entry-row td {
  padding: 9px 16px;
  font-size: 13px;
  border-top: 1px solid var(--stroke, rgba(255,255,255,.06));
  color: var(--text, #f0f0f0);
  vertical-align: top;
}
.ot-entry-row td:first-child { color: var(--muted, #8a9ab5); white-space: nowrap; }
.ot-arrow {
  font-size: 18px;
  transition: transform .2s;
  color: var(--muted, #8a9ab5);
}
.ot-arrow.open { transform: rotate(180deg); }

/* Export modal overlay */
.admin-modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: rgba(0,0,0,.88) !important;
  z-index: 99999 !important;
  isolation: isolate;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.admin-modal-overlay.active { display: flex !important; }
.admin-modal-card {
  background: var(--card, #1e1e1e);
  border: 1px solid var(--stroke, rgba(255,255,255,.1));
  border-radius: 14px;
  width: min(420px, 95vw);
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  animation: fadeIn .2s ease;
}
.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--stroke, rgba(255,255,255,.08));
  font-weight: 700;
  font-size: 15px;
  color: var(--text, #f0f0f0);
}
.admin-modal-body { padding: 20px; }
.admin-modal-close {
  background: none;
  border: none;
  color: var(--muted, #8a9ab5);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.admin-modal-close:hover { color: var(--text, #f0f0f0); }

/* ============================================================
   PAGE: Editor (editor.html)
   ============================================================ */
/* ===== Editor layout helpers ===== */
.row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.row.full {
  grid-template-columns: 1fr;
}

@media (max-width: 768px) {
  .row {
    grid-template-columns: 1fr;
  }
}

/* Dark themed inputs */
.calc-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: #1c2430;
  color: var(--text);
  box-shadow: 0 6px 18px var(--shadow);
  font-size: 16px;
  outline: none;
}

.calc-input::placeholder {
  color: rgba(159, 176, 193, .85);
}

.calc-input:focus {
  border-color: rgba(74, 168, 181, .6);
  box-shadow: 0 0 0 3px rgba(74, 168, 181, .18), 0 10px 26px var(--shadow);
}

textarea.calc-input {
  min-height: 140px;
  resize: vertical;
}

/* Make the editor panel fill remaining height when visible */
.editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px;
  margin-top: 14px;
}

/* Give the big editor area a slightly darker "work surface" feel */
#editor.glass {
  background: rgba(10, 14, 18, .55);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  margin-bottom: 20px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
  border-radius: 8px;
}

.back-link:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
}

/* ============================================================
   PAGE: Login (login.html)
   ============================================================ */
/* Login input improvements */
.login-input {
  height: 52px;
  font-size: 17px;
  padding: 12px 14px;
}

/* Dark mode input styling */
body.dark-mode input[type="email"],
body.dark-mode input[type="password"],
body.dark-mode .calc-input,
body.dark-mode .login-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text);
}

body.dark-mode input[type="email"]::placeholder,
body.dark-mode input[type="password"]::placeholder,
body.dark-mode .calc-input::placeholder,
body.dark-mode .login-input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

body.dark-mode input[type="email"]:focus,
body.dark-mode input[type="password"]:focus,
body.dark-mode .calc-input:focus,
body.dark-mode .login-input:focus {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

/* ============================================================
   PAGE: Workflow (workflow.html)
   ============================================================ */
.step-card {
  padding: 14px;
  margin-top: 12px;
}

/* Darker, calmer surface */
.step-card.glass {
  background: rgba(10, 14, 18, .55);
}

/* =====================
   Comments – small & unobtrusive
   ===================== */

.comment-item {
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .025);
  border: 1px solid rgba(255, 255, 255, .05);
}

/* Email + timestamp */
.comment-meta {
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--muted);
  opacity: 0.8;
  margin-bottom: 2px;
}

/* Comment text */
.comment-text {
  font-size: 13px;
  line-height: 1.45;
  color: rgba(255, 255, 255, .85);
}

/* Remove extra spacing from markdown */
.comment-text p {
  margin: 0;
}

/* =====================
   Comment form
   ===================== */
.comment-form {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.comment-input {
  flex: 1;
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 10px;
}

/* Dark themed inputs (comment box etc.) */
.calc-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: #1c2430;
  color: var(--text);
  box-shadow: 0 6px 18px var(--shadow);
  font-size: 16px;
  outline: none;
}

.calc-input::placeholder {
  color: rgba(159, 176, 193, .85);
}

.calc-input:focus {
  border-color: rgba(74, 168, 181, .6);
  box-shadow: 0 0 0 3px rgba(74, 168, 181, .18), 0 10px 26px var(--shadow);
}

/* =====================
   Buttons – tiny & quiet
   ===================== */
.navbtn.small {
  padding: 3px 7px;
  font-size: 11.5px;
  border-radius: 7px;
}

/* Hide actions unless hover */
.comment-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}

.comment-item:hover .comment-actions {
  opacity: 1;
  pointer-events: auto;
}

/* Softer delete */
.navbtn.danger {
  color: rgba(255, 140, 140, .8);
  border-color: rgba(255, 140, 140, .25);
  background: transparent;
}

.navbtn.danger:hover {
  background: rgba(255, 140, 140, .12);
}

/* ============================================================
   PAGE: AjakuluKalkulaator
   ============================================================ */
/* ===== Layout Styles (Matches Editor/Projektid) ===== */
.calc-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 24px;
}

/* Back Link Style (Matched to Projektid) */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  margin-bottom: 20px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
  border-radius: 8px;
}

.back-link:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
}

/* Grid & Input Styles */
.row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.row.full {
  grid-template-columns: 1fr;
}

.row.row-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.row.row-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

@media (max-width: 900px) {
  .row.row-5 {
     grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .row, .row.row-4, .row.row-5 {
    grid-template-columns: 1fr;
  }
}

/* Dark themed inputs */
.calc-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: #1c2430;
  color: var(--text);
  box-shadow: 0 6px 18px var(--shadow);
  font-size: 16px;
  outline: none;
  transition: all 0.2s ease;
  -moz-appearance: textfield;
}

.calc-input::-webkit-outer-spin-button,
.calc-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.calc-input::placeholder {
  color: rgba(159, 176, 193, .85);
}

.calc-input:focus {
  border-color: rgba(74, 168, 181, .6);
  box-shadow: 0 0 0 3px rgba(74, 168, 181, .18), 0 10px 26px var(--shadow);
}

/* Custom Select Styling */
select.calc-input {
  appearance: none;
  cursor: pointer;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.7)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 20px;
}

select.calc-input option {
  background-color: #1e242c;
  color: #fff;
  padding: 10px;
}

.home-link {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.home-link:hover {
  filter: brightness(1.05);
}

.home-link:active {
  filter: brightness(0.95);
}

/* Labels & Text */
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  opacity: .7;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.calc-panel {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.muted {
  opacity: .6;
  font-size: 13px;
  margin-top: 6px;
}

.error {
  color: #ff8c8c;
  white-space: pre-wrap;
  margin-top: 10px;
  font-weight: 500;
}

/* Custom Checkbox */
.custom-chk {
  appearance: none;
  width: 20px;
  height: 20px;
  background: #1c2430;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s;
}

.custom-chk:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.custom-chk:checked::after {
  content: "✔";
  font-size: 14px;
  color: #fff;
}

.pointer {
  cursor: pointer;
}

/* Result Table Styling */
.result-container {
  margin-top: 0;
  animation: fadeIn 0.3s ease;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

th,
td {
  padding: 12px 16px;
  text-align: right;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

th {
  background: rgba(255, 255, 255, 0.03);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

th:first-child,
td:first-child {
  text-align: left;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

tr:last-child td {
  border-bottom: none;
}

tfoot td {
  font-weight: 800;
  background: rgba(74, 168, 181, 0.1);
  color: #fff;
  border-top: 2px solid rgba(255, 255, 255, 0.15);
}

/* Tooltip & Action Buttons */
.action-btn {
  background: rgba(20, 26, 34, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  border-radius: 12px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(159, 176, 193, 1);
  transition: all 0.2s ease;
  position: relative;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  color: #eaf1f6;
  border-color: rgba(255, 255, 255, 0.25);
}

.action-btn:active {
  transform: translateY(0);
}

.action-btn.text-success {
  color: #b9f3e0 !important;
  border-color: #b9f3e0 !important;
}

/* Tooltip text */
.action-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 115%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
}

.action-btn:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   PAGE: Filters
   ============================================================ */
.page {
  display: block !important;
  min-height: 100vh;
}

.container#app {
  width: 75%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
  box-sizing: border-box;
}

main.content {
  display: block;
  width: 100%;
}

.filters-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.home-link {
  display: inline-flex;
}

.home-link:focus {
  outline: 2px solid rgba(74, 168, 181, 0.45);
  outline-offset: 4px;
  border-radius: 12px;
}

.filters-toolbar,
.controls-panel,
.canvas-card {
  width: 100%;
  box-sizing: border-box;
}

.filters-toolbar.glass,
.controls-panel.glass,
.canvas-card.glass {
  border: 1px solid var(--stroke, rgba(255, 255, 255, 0.12));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.filters-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 14px;
  border-radius: 14px;
}

.f-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 260px;
  flex: 0 1 260px;
}

.f-label span {
  font-size: 12px;
  opacity: 0.85;
}

/* Inputs / selects styling (site-matching) */
.filters-toolbar .f-input,
.controls-panel .f-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke, rgba(255, 255, 255, 0.12));
  color: var(--text, #eaf1f6);
  font: inherit;
  font-size: 14px;
  line-height: 1.2;
  outline: none;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  height: 46px;
}

.filters-toolbar .f-input::placeholder,
.controls-panel .f-input::placeholder {
  color: rgba(234, 241, 246, 0.55);
}

.filters-toolbar .f-input:focus,
.controls-panel .f-input:focus {
  border-color: rgba(74, 168, 181, 0.55);
  box-shadow: 0 0 0 3px rgba(74, 168, 181, 0.18);
}

.filters-toolbar select.f-input,
.controls-panel select.f-input {
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgba(234,241,246,0.75)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px;
}

body.dark-mode select.f-input option {
  background: #151b22;
  color: #eaf1f6;
}

body:not(.dark-mode) select.f-input option {
  background: #ffffff;
  color: #111;
}

/* Estonian help text above filter controls */
.help-et {
  font-size: 12px;
  opacity: 0.78;
  line-height: 1.25;
  margin: 0 0 2px 0;
}

/* Categories */
.cat-panel {
  min-width: 320px;
  flex: 1 1 320px;
}

.cat-box {
  border: 1px solid var(--stroke, var(--modal-border));
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  padding: 8px;
  max-height: 190px;
  overflow: auto;
}

.cat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.15;
}

.cat-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.cat-item input[type='checkbox'] {
  width: 15px;
  height: 15px;
  accent-color: var(--tab-active-bg);
}

.controls-panel {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
}

.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: end;
}

@media (max-width: 900px) {
  .container#app {
    width: 100%;
    max-width: 900px;
  }

  .controls-grid {
    grid-template-columns: 1fr;
  }

  .f-label {
    flex-basis: 100%;
    min-width: 0;
  }
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke, var(--modal-border));
}

.toggle-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--tab-active-bg);
}

/* Override cards */
.override-card {
  grid-column: 1 / -1;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke, var(--modal-border));
  box-sizing: border-box;
}

.override-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: stretch;
}

.override-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
}

.seg-inline {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 700;
  font-size: 13px;
  opacity: 0.95;
  white-space: nowrap;
  cursor: pointer;
}

.seg-inline input {
  width: 16px;
  height: 16px;
  accent-color: var(--tab-active-bg);
}

/* stacked segment (title + controls) */
.seg.stack {
  display: grid;
  grid-template-rows: auto 1fr;
  align-items: start;
  justify-items: stretch;
  padding: 10px 12px;
}

.seg-title {
  margin-bottom: 8px;
}

.seg {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.seg:not(:last-child) {
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.seg-title {
  font-weight: 750;
  font-size: 13px;
  opacity: 0.92;
  letter-spacing: 0.2px;
  text-align: center;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.seg-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.color-controls-2eq {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-width: 0;
}

@media (max-width: 900px) {
  .override-grid-3 {
    grid-template-columns: 1fr;
  }

  .override-grid-2 {
    grid-template-columns: 1fr;
  }

  .seg:not(:last-child) {
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
}

/* Color swatches */
.color-swatch {
  width: 100%;
  height: 46px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--stroke, rgba(255, 255, 255, 0.12));
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  box-sizing: border-box;
}

.color-swatch::-webkit-color-swatch-wrapper {
  padding: 6px;
}

.color-swatch::-webkit-color-swatch {
  border: none;
  border-radius: 9px;
}

.color-swatch::-moz-color-swatch {
  border: none;
  border-radius: 9px;
}

/* Patterns: 2-group layout */
.group {
  padding: 10px 12px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  min-width: 0;
}

.group:first-child {
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.group-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 800;
  font-size: 13px;
  opacity: 0.92;
  letter-spacing: 0.2px;
  text-align: center;
  white-space: nowrap;
}

.group-title label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 12px;
  opacity: 0.95;
}

.group-title input[type='checkbox'] {
  width: 16px;
  height: 16px;
  accent-color: var(--tab-active-bg);
}

.group-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
  min-width: 0;
}

.mini {
  display: grid;
  grid-template-rows: auto auto;
  gap: 10px;
  min-width: 0;
}

.mini-label {
  font-size: 12px;
  opacity: 0.85;
  text-align: center;
  margin-top: 2px;
}

.color-inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

/* Transparency */
.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.slider-row input[type='range'] {
  flex: 1 1 auto;
  width: 100%;
}

.canvas-card {
  padding: 0;
  overflow: hidden;
  border-radius: 14px;
}

canvas {
  width: 100%;
  height: auto;
  display: block;
}

.meta {
  margin-left: auto;
  font-size: 12px;
  opacity: 0.8;
  align-self: center;
  padding: 0 4px 8px 4px;
  white-space: nowrap;
}

/* ============================================================
   PAGE: KilbiTaituvus
   ============================================================ */
/* Panel Designer specific styles */

.designer-grid {
    display: grid;
    grid-template-columns: 350px 1fr 350px;
    gap: 20px;
    height: calc(100vh - 140px);
    /* Fill remaining height */
    min-height: 600px;
    padding: 20px 100px;
    /* Margin from edges */
    box-sizing: border-box;
}

.panel-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

/* Card overrides for inner panels */
.inner-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    /* For absolute positioning if needed */
}

/* Fix excessive top space in cards */
.inner-card h3 {
    margin-top: 0;
    margin-bottom: 0;
    /* Let flex gap handle spacing */
    font-size: 16px;
    font-weight: 600;
}

/* Fix Number Input Arrows (Dark Theme) */
input[type="number"] {
    color-scheme: dark;
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    /* Scroll inside if needed, or stick to canvas zoom */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

canvas#panelCanvas {
    background-color: transparent;
    /* Shadow removed as requested */
}

/* Component Table */
.comp-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 4px;
}

.comp-table th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    opacity: 0.7;
    padding: 0 8px 8px 8px;
}

.comp-table td {
    padding: 0;
}

.comp-row {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    transition: background 0.2s;
}

.comp-row:hover {
    background: rgba(255, 255, 255, 0.08);
}

.comp-row.selected {
    background: rgba(74, 168, 181, 0.15);
    border: 1px solid rgba(74, 168, 181, 0.3);
}

.comp-row input,
.comp-row select {
    background: transparent;
    border: none;
    color: var(--text);
    width: 100%;
    padding: 8px;
    font-family: inherit;
}

.comp-row input:focus,
.comp-row select:focus {
    outline: none;
    background: rgba(0, 0, 0, 0.2);
}

/* Fix dropdown options */
.comp-row select option,
select.calc-input option {
    background-color: #1e242c;
    color: #eaf1f6;
    padding: 10px;
}

/* Small Action Buttons */
.btn-icon-sm {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: var(--text);
    opacity: 0.7;
    cursor: pointer;
    background: transparent;
    border: none;
}

.btn-icon-sm:hover {
    background: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

/* Separator styling in table */
.row-separator td {
    padding: 0;
}

.sep-line {
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
    width: 100%;
    border-radius: 2px;
}

/* Settings Inputs */
.setting-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: center;
}

.setting-row {
    margin-bottom: 12px;
}

.setting-label {
    font-size: 12px;
    opacity: 0.7;
    margin-bottom: 4px;
    display: block;
}

/* Range Slider */
input[type=range] {
    width: 100%;
    accent-color: var(--accent);
}

/* Responsive */
@media (max-width: 1100px) {
    .designer-grid {
        grid-template-columns: 1fr;
        height: auto;
    }

    .canvas-container {
        height: 600px;
    }
}

/* Drag & Drop Visuals */
.comp-row.dragging {
    opacity: 0.5;
    background: rgba(255, 255, 255, 0.1);
}

.comp-row.drag-over {
    /* Visual cue for drop target */
    border-top: 2px solid var(--accent, #4aa8b5);
    background: rgba(74, 168, 181, 0.1);
}

.col-handle {
    user-select: none;
    transition: color 0.2s, background 0.2s;
    border-radius: 4px;
}

.col-handle:hover {
    color: var(--text, #fff);
    background: rgba(255, 255, 255, 0.05);
}
/* ============================================================
   PAGE: KilbiTaituvus — Modal
   ============================================================ */
/* Modal Overlay & Card Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: #1e242c;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 0;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-card.large {
    max-width: 900px;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    opacity: 1;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Tab Styling */
.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: rgba(255, 255, 255, 0.6);
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: rgba(255, 255, 255, 0.9);
}

.tab-btn.active {
    color: #5FB878;
    border-bottom-color: #5FB878;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}
/* ============================================================
   PAGE: Laud
   ============================================================ */
#page-laud .dashboard-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 0 8px;
}

#page-laud .content {
  flex: 1;
  overflow-y: auto;
  margin-top: 24px;
  padding-bottom: 60px;
}


/* ---- Page layout ---- */
.laud-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.section-icon { color: var(--accent); }

/* ---- Legend ---- */
.legend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 24px;
  align-items: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
}

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ---- SVG Floor Plan ---- */
.desk-grid-wrap {
  overflow-x: auto;
  padding-bottom: 8px;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.floor-plan-edit-mode {
  border-color: rgba(255,176,0,0.6) !important;
  box-shadow: 0 0 0 3px rgba(255,176,0,0.15), 0 10px 30px var(--shadow) !important;
}

.edit-mode-hint {
  font-size: 12px;
  color: #ffb000;
  background: rgba(255,176,0,0.07);
  border: 1px solid rgba(255,176,0,0.2);
  border-radius: 8px;
  padding: 8px 14px;
  margin-bottom: 10px;
  display: none;
}

/* Default desk rect */
.desk-rect {
  fill: rgba(255,255,255,0.08);
  stroke: rgba(255,255,255,0.2);
  stroke-width: 1.5;
  transition: fill 0.2s, stroke 0.2s;
}

.desk-chair {
  fill: rgba(255,255,255,0.08);
  stroke: rgba(255,255,255,0.2);
  stroke-width: 1;
  pointer-events: none;
  transition: fill 0.2s;
}
.desk-chair.state-free     { fill: rgba(255,255,255,0.08); stroke: rgba(255,255,255,0.18); }
.desk-chair.state-mine     { fill: rgba(74,168,181,0.3);   stroke: #4aa8b5; }
.desk-chair.state-booked   { fill: rgba(255,176,0,0.2);    stroke: rgba(255,176,0,0.5); }
.desk-chair.state-assigned { fill: rgba(76,175,80,0.25);   stroke: rgba(76,175,80,0.6); }

.desk-text {
  fill: #eaf1f6;
  pointer-events: none;
  font-family: 'Inter', sans-serif;
}

.chair-circle {
  fill: rgba(255,255,255,0.12);
  stroke: rgba(255,255,255,0.18);
  stroke-width: 1;
  pointer-events: none;
}

/* Booking state colours applied via JS */
.desk-rect.state-free   { fill: rgba(255,255,255,0.08); stroke: rgba(255,255,255,0.22); }
.desk-rect.state-mine   { fill: rgba(74,168,181,0.35);  stroke: #4aa8b5; stroke-width: 2; }
.desk-rect.state-booked { fill: rgba(255,176,0,0.25);   stroke: rgba(255,176,0,0.7); stroke-width: 2; }
.desk-rect.state-assigned { fill: rgba(76,175,80,0.3);  stroke: rgba(76,175,80,0.8); stroke-width: 2; }

/* Hover/focus on the group */
.desk-svg {
  cursor: pointer;
  outline: none;
}

.desk-svg:hover .desk-rect,
.desk-svg:focus-visible .desk-rect {
  filter: brightness(1.35);
}

.desk-svg:focus-visible {
  outline: 2px solid #4aa8b5;
  outline-offset: 3px;
}

/* ---- Popup / modal ---- */
.desk-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeInOverlay 0.15s ease-out;
}

@keyframes fadeInOverlay {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.desk-popup {
  background: #1c2430;
  border: 1px solid var(--stroke);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  width: 100%;
  max-width: 380px;
  animation: slideUp 0.18s ease-out;
  overflow: hidden;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.desk-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--stroke);
}

.desk-popup-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.desk-popup-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.close-popup-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.close-popup-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,0.07);
}

.bookings-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bookings-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.bookings-list li .priority-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(74,168,181,0.15);
  color: var(--teal);
  flex-shrink: 0;
}

.bookings-list li.is-me {
  color: var(--text);
  font-weight: 600;
}

.bookings-list li.is-me .priority-pill {
  background: rgba(74,168,181,0.35);
}

.assigned-banner {
  background: rgba(76,175,80,0.15);
  border: 1px solid rgba(76,175,80,0.4);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: #81c784;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Select + label in popup */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-select {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 14px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='rgba(159,176,193,0.7)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
  padding-right: 36px;
}

.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(74,168,181,0.18);
}

.form-select option {
  background: #1e242c;
  color: #fff;
}

/* Buttons */
.btn-primary {
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  background: var(--teal);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  width: 100%;
}

.btn-primary:hover { background: #3d96a2; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-danger {
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid rgba(244,67,54,0.4);
  background: rgba(244,67,54,0.1);
  color: #f44336;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
}

.btn-danger:hover { background: rgba(244,67,54,0.2); }
.btn-danger:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-admin {
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid rgba(255,176,0,0.4);
  background: rgba(255,176,0,0.1);
  color: #ffb000;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-admin:hover { background: rgba(255,176,0,0.2); }
.btn-admin:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* Admin panel */
.admin-panel {
  margin-top: 32px;
  padding: 20px 22px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,176,0,0.3);
  background: rgba(255,176,0,0.05);
}

.admin-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: #ffb000;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.admin-panel-body {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.assign-status {
  font-size: 13px;
  color: var(--muted);
}

/* Error / info banners */
.laud-error {
  padding: 16px 20px;
  border-radius: 12px;
  background: rgba(244,67,54,0.1);
  border: 1px solid rgba(244,67,54,0.3);
  color: #f44336;
  text-align: center;
  margin-bottom: 20px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.laud-container > * {
  animation: fadeIn 0.3s ease-out both;
}

/* ---- Spin wheel overlay ---- */
.wheel-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,0.72);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 24px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeInOverlay 0.2s ease-out;
}

.wheel-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.3px;
}

.wheel-wrap {
  position: relative;
  width: 300px;
  height: 300px;
}

#wheelCanvas {
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(255,176,0,0.5), 0 12px 40px rgba(0,0,0,0.6);
}

.wheel-pointer {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 22px solid #ffb000;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.wheel-result {
  font-size: 1.3rem;
  font-weight: 700;
  color: #81c784;
  text-align: center;
  min-height: 2em;
}

.wheel-actions {
  display: flex;
  gap: 12px;
}

/* ============================================================
   PAGE: Meeskond
   ============================================================ */
.team-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.team-card {
  flex: 0 0 300px; /* Don't grow, don't shrink, fixed basis */
  width: 300px;
  max-width: 100%;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.team-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: #1c2430;
  border: 3px solid var(--stroke);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: bold;
  color: var(--accent);
  overflow: hidden;
}

.team-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.team-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin: 0;
}

.team-job {
  font-size: 0.95rem;
  color: var(--accent);
  text-align: center;
  font-weight: 500;
}

.team-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}

.team-info-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text);
}

.team-info-item .material-icons-outlined {
  font-size: 18px;
  color: var(--muted);
}

.team-phone,
.team-email {
  cursor: pointer;
  user-select: all;
  transition: color 0.2s;
}

.team-phone:hover,
.team-email:hover {
  color: var(--accent);
}

.loading-skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
  border-radius: 8px;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  margin: 20px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
  border-radius: 8px;
}

.back-link:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
}

.page-header {
  text-align: center;
  padding: 0 20px 20px;
  max-width: 800px;
  margin: 0 auto;
}

.page-header h1 {
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--text);
  margin: 0;
}

.department-section {
  margin-bottom: 48px;
}

.department-header {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin: 0 0 20px 0;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--stroke);
  text-align: center;
}

/* ============================================================
   PAGE: my-account
   ============================================================ */
/* Specific tweaks if needed, but relying on global glass */
.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--stroke);
    padding-bottom: 20px;
}

.profile-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #1c2430;
    border: 1px solid var(--stroke);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
}

.info-row {
    margin-bottom: 15px;
}

.info-label {
    font-weight: 600;
    color: var(--muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 1.1rem;
    color: var(--text);
}

.logout-btn {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.2);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: rgba(231, 76, 60, 0.2);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}

.back-link:hover {
    color: var(--accent);
    text-decoration: none;
}

/* Form Styles */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

@media (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--stroke);
    border-radius: 8px;
    padding: 12px;
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(74, 168, 181, 0.2);
}

.form-input.readonly {
    background: rgba(255, 255, 255, 0.05);
    border-color: transparent;
    cursor: default;
    color: var(--muted);
}

.form-input.readonly.highlight {
    color: var(--teal);
    font-weight: bold;
}

.save-btn {
    background: rgba(74, 168, 181, 0.2);
    backdrop-filter: blur(10px);
    color: var(--accent);
    border: 1px solid rgba(74, 168, 181, 0.3);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
}

.save-btn:hover {
    background: rgba(74, 168, 181, 0.3);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.save-btn:active {
    transform: translateY(0);
}

.account-card {
    max-width: 650px;
    margin: 40px auto;
    padding: 32px;
}

/* Overtime Entries Section */
.ot-section { border-top: 1px solid var(--stroke); margin-top: 30px; padding-top: 20px; }
/* Month cards */
.ot-month-card { border: 1px solid var(--stroke); border-radius: 10px; margin-top: 10px; overflow: hidden; }
.ot-month-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; cursor: pointer; user-select: none; background: rgba(255,255,255,0.03); transition: background 0.15s; }
.ot-month-header:hover { background: rgba(255,255,255,0.06); }
.ot-month-header .ot-month-name { font-weight: 600; font-size: 14px; color: var(--text); }
.ot-month-header .ot-month-meta { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }
.ot-month-header .ot-month-total { font-weight: 700; color: var(--text); font-size: 13px; }
.ot-month-arrow { font-size: 18px; color: var(--muted); transition: transform 0.2s; line-height: 1; }
.ot-month-card.open .ot-month-arrow { transform: rotate(180deg); }
.ot-month-body { display: none; border-top: 1px solid var(--stroke); }
.ot-month-card.open .ot-month-body { display: block; }
/* Entries table inside card */
.ot-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ot-table th { font-size: 0.72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; padding: 8px 14px; border-bottom: 1px solid var(--stroke); text-align: left; background: rgba(255,255,255,0.015); }
.ot-table td { padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,0.04); color: var(--text); vertical-align: middle; }
.ot-table tbody tr:last-child td { border-bottom: none; }
.ot-table tbody tr:hover td { background: rgba(255,255,255,0.02); }
.ot-icon-btn { background: none; border: none; cursor: pointer; padding: 4px 6px; border-radius: 6px; color: var(--muted); font-size: 16px; line-height: 1; transition: background 0.15s, color 0.15s; }
.ot-icon-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.ot-del-btn:hover { background: rgba(231,76,60,0.15) !important; color: #e74c3c !important; }
.ot-locked-badge { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); padding: 2px 7px; border-radius: 4px; border: 1px solid var(--stroke); }
/* Edit modal */
.ot-modal-overlay { position: fixed !important; inset: 0; background: rgba(0,0,0,0.85); z-index: 9999; display: none; align-items: center; justify-content: center; padding: 20px; }
.ot-modal-overlay.active { display: flex; }
.ot-modal-card { background: #1e2430; border: 1px solid var(--stroke); border-radius: 14px; width: min(460px, 95vw); box-shadow: 0 20px 60px rgba(0,0,0,0.6); }
.ot-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--stroke); font-weight: 700; font-size: 15px; color: var(--text); }
.ot-modal-body { padding: 20px; }
.ot-modal-close { background: none; border: none; color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1; padding: 0 4px; }
.ot-modal-close:hover { color: var(--text); }

/* ============================================================
   PAGE: Projektid
   ============================================================ */
/* --- Dashboard Specific Styles --- */

/* Layout Helpers */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.dash-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .dash-row {
    grid-template-columns: 1fr;
  }
}

/* Stats Cards */
.stat-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 32px;
  font-weight: 300;
  color: var(--text);
  line-height: 1.1;
}

.stat-sub {
  margin-top: 12px;
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.stat-sub span b {
  color: var(--text);
  font-weight: 600;
  margin-left: 4px;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
  border-radius: 0;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  white-space: nowrap;
}

/* Sortable Headers */
.dash-table th {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--stroke);
  user-select: none;
}

.dash-table th.sortable {
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.dash-table th.sortable:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
}

.sort-icon {
  font-size: 10px;
  margin-left: 6px;
  opacity: 0.5;
  display: inline-block;
  width: 10px;
}

.sort-active {
  opacity: 1;
  color: var(--accent);
}

/* Filter Row */
.filter-row td {
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 16px;
  border-bottom: 1px solid var(--stroke);
}

.filter-input {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  outline: none;
}

.filter-input:focus {
  border-color: var(--accent);
}

/* Custom Styling for Filter Selects to match Dark Theme */
select.filter-input {
  appearance: none;
  cursor: pointer;
  padding-right: 24px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='rgba(159,176,193,0.7)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 14px;
}

select.filter-input option,
select.calc-input option {
  background-color: #1e242c;
  color: #fff;
  padding: 8px;
}

/* Cells */
.dash-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--stroke);
  color: var(--text);
}

.dash-table tr:last-child td {
  border-bottom: none;
}

.dash-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Form Styles */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.calc-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: #1c2430;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.calc-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(74, 168, 181, .15);
}

select.calc-input {
  appearance: none;
  cursor: pointer;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='rgba(159,176,193,0.7)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  margin-left: 4px;
}

/* Badges */
.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.badge.active {
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
  border-color: rgba(52, 152, 219, 0.2);
}

.badge.done {
  background: rgba(39, 174, 96, 0.15);
  color: #27ae60;
  border-color: rgba(39, 174, 96, 0.2);
}

.badge.wait {
  background: rgba(230, 126, 34, 0.15);
  color: #e67e22;
  border-color: rgba(230, 126, 34, 0.2);
}

.user-pill {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 11px;
  margin-right: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.view-toggle {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
}

.view-btn {
  flex: 1;
  text-align: center;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: 0.2s;
}

.view-btn.active {
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.view-btn:hover:not(.active) {
  color: var(--text);
}

.hidden {
  display: none;
}

.chart-container {
  position: relative;
  height: 260px;
  width: 100%;
}

.gantt-card {
  width: 100%;
}

.gantt-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.gantt-header-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 18px;
  margin-left: auto;
}

.gantt-interaction-hint {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.gantt-completed-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.gantt-completed-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--teal);
  cursor: pointer;
}

.gantt-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.gantt-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.gantt-legend-swatch {
  display: inline-block;
  width: 18px;
  height: 6px;
  border-radius: 999px;
}

.gantt-legend-swatch.project { background: var(--teal); }
.gantt-legend-swatch.subtask { background: var(--foam); }
.gantt-legend-swatch.waiting { background: var(--peach); }
.gantt-legend-swatch.overdue { background: var(--coral); }

.gantt-chart-container {
  display: grid;
  grid-template-columns: minmax(190px, 260px) minmax(0, 1fr);
  align-items: start;
  width: 100%;
  margin-top: 14px;
  min-width: 0;
}

.gantt-label-column {
  position: relative;
  z-index: 2;
  min-width: 0;
  border-right: 1px solid var(--stroke);
  background: var(--card);
}

.gantt-label-header,
.gantt-month-header {
  height: 42px;
  border-bottom: 1px solid var(--stroke);
}

.gantt-label-header {
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.gantt-label-rows {
  height: var(--gantt-chart-height, 240px);
}

.gantt-label-row {
  --gantt-tree-x: 17px;
  --gantt-tree-branch: 8px;
  position: relative;
  display: flex;
  align-items: center;
  height: var(--gantt-row-height, 30px);
  min-width: 0;
  padding: 0 12px;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.gantt-label-row.subtask {
  padding-left: 28px;
  color: var(--muted);
  font-weight: 400;
}

.gantt-label-row.project,
.gantt-label-row.subtask {
  cursor: pointer;
}

.gantt-label-row.project.has-subtasks::after,
.gantt-label-row.subtask::before {
  position: absolute;
  left: var(--gantt-tree-x);
  width: 1px;
  background: var(--stroke);
  content: '';
}

.gantt-label-row.project.has-subtasks::after {
  top: 50%;
  bottom: 0;
}

.gantt-label-row.subtask::before {
  top: 0;
  bottom: 0;
}

.gantt-label-row.subtask.last-subtask::before {
  bottom: 50%;
}

.gantt-label-row.subtask::after {
  position: absolute;
  top: 50%;
  left: var(--gantt-tree-x);
  width: var(--gantt-tree-branch);
  height: 1px;
  background: var(--stroke);
  content: '';
}

.gantt-timeline-scroll {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
}

.gantt-timeline {
  width: 100%;
  min-width: 100%;
}

.gantt-month-header {
  display: grid;
  width: 100%;
}

.gantt-month-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0 4px;
  overflow: hidden;
  border-left: 1px solid var(--stroke);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.gantt-month-cell:last-child {
  border-right: 1px solid var(--stroke);
}

.gantt-month-cell.current {
  color: var(--coral);
}

.gantt-month-today {
  font-size: 10px;
  font-weight: 700;
}

.gantt-canvas-wrap {
  position: relative;
  width: 100%;
  height: var(--gantt-chart-height, 240px);
}

.gantt-canvas-wrap canvas {
  display: block;
  cursor: pointer;
}

.gantt-empty {
  padding: 28px 0 12px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

@media (max-width: 700px) {
  .gantt-card {
    padding: 16px !important;
  }

  .gantt-header-tools,
  .gantt-legend {
    width: 100%;
  }

  .gantt-header-tools {
    justify-content: flex-start;
  }

  .gantt-chart-container {
    grid-template-columns: minmax(135px, 165px) minmax(0, 1fr);
  }

  .gantt-label-row {
    --gantt-tree-x: 10px;
    --gantt-tree-branch: 6px;
    padding: 0 8px;
    font-size: 11px;
  }

  .gantt-label-row.subtask {
    padding-left: 20px;
  }

  .gantt-month-cell {
    font-size: 10px;
  }
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  margin-bottom: 20px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
  border-radius: 8px;
}

.back-link:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
}

/* ============================================================
   PAGE: Rack
   ============================================================ */
/* Rack Power Calculator – Local Styles */

.rack-grid {
    display: grid;
    grid-template-columns: 320px 1fr 350px;
    gap: 20px;
    height: calc(100vh - 140px);
    min-height: 600px;
    padding: 20px 100px;
    box-sizing: border-box;
}

.panel-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.inner-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
}

.inner-card h3 {
    margin-top: 0;
    margin-bottom: 0;
    font-size: 16px;
    font-weight: 600;
}

/* Force dark color-scheme so native browser controls (dropdowns, checkboxes, number spinners) render in dark mode */
input[type="number"],
input[type="checkbox"],
select {
    color-scheme: dark;
}

/* Settings */
.setting-row {
    margin-bottom: 8px;
}

.setting-label {
    font-size: 12px;
    opacity: 0.7;
    margin-bottom: 4px;
    display: block;
}

/* Small Icon Buttons */
.btn-icon-sm {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: var(--text);
    opacity: 0.7;
    cursor: pointer;
    background: transparent;
    border: none;
}

.btn-icon-sm:hover {
    background: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

.btn-icon-sm:disabled {
    opacity: 0.3;
    cursor: default;
}

.btn-icon-sm:disabled:hover {
    background: transparent;
    opacity: 0.3;
}

/* Action Buttons (modal, tree) */
.btn-action {
    background: rgba(255, 255, 255, 0.08);
    color: #eaf1f6;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 14px;
}

.btn-action:hover {
    background: rgba(255, 255, 255, 0.14);
}

.btn-action.btn-danger {
    background: linear-gradient(135deg, #E85D5D 0%, #d14545 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(232, 93, 93, 0.3);
}

/* Small text buttons for tree actions */
.tree-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 12px;
}

.btn-sm {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-sm:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
}

.btn-sm:disabled {
    opacity: 0.35;
    cursor: default;
}

/* ===== Tree View ===== */
.tree-root {
    font-size: 13px;
}

.tree-node {
    user-select: none;
}

.tree-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.tree-row:hover {
    background: rgba(255, 255, 255, 0.06);
}

.tree-row.selected {
    background: rgba(74, 168, 181, 0.18);
}

.tree-row .material-icons-outlined {
    font-size: 18px;
    opacity: 0.7;
}

.tree-toggle {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    opacity: 0.5;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s;
    border: none;
    background: none;
    color: inherit;
    padding: 0;
}

.tree-toggle.collapsed {
    transform: rotate(-90deg);
}

.tree-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-rename-btn {
    display: none;
    width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: inherit;
    opacity: 0.45;
    cursor: pointer;
    border-radius: 4px;
    flex-shrink: 0;
    padding: 0;
}
.tree-rename-btn:hover { opacity: 1; background: rgba(255,255,255,0.1); }
.tree-row:hover .tree-rename-btn,
.tree-row.selected .tree-rename-btn { display: inline-flex; }

.tree-label-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(74, 168, 181, 0.4);
    color: var(--text);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
}

.tree-children {
    padding-left: 18px;
}

.tree-children.collapsed {
    display: none;
}

.tree-badge {
    font-size: 10px;
    opacity: 0.5;
    margin-left: 4px;
    background: rgba(255, 255, 255, 0.08);
    padding: 1px 6px;
    border-radius: 4px;
}

/* Inline rename button */
.tree-row .btn-rename {
    opacity: 0;
    transition: opacity 0.15s;
    width: 20px;
    height: 20px;
    font-size: 14px;
}

.tree-row:hover .btn-rename {
    opacity: 0.5;
}

.tree-row:hover .btn-rename:hover {
    opacity: 1;
}

/* ===== Device Table ===== */
.comp-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 4px;
}

.comp-table th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    opacity: 0.7;
    padding: 0 8px 8px 8px;
}

.comp-table td {
    padding: 0;
}

.comp-row {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    transition: background 0.2s;
}

.comp-row:hover {
    background: rgba(255, 255, 255, 0.08);
}

.comp-row.selected {
    background: rgba(74, 168, 181, 0.15);
    border: 1px solid rgba(74, 168, 181, 0.3);
}

.comp-row input,
.comp-row select {
    background: transparent;
    border: none;
    color: var(--text);
    width: 100%;
    padding: 8px;
    font-family: inherit;
}

.comp-row input:focus,
.comp-row select:focus {
    outline: none;
    background: rgba(0, 0, 0, 0.2);
}

.comp-row select option,
select.calc-input option {
    background-color: #1e242c;
    color: #eaf1f6;
    padding: 10px;
}

/* UPS checkbox styling */
.ups-check {
    width: 16px;
    height: 16px;
    accent-color: #4aa8b5;
    cursor: pointer;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: #1e242c;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 0;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-card.large {
    max-width: 900px;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    opacity: 1;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* ===== Summary styling ===== */
.summary-section {
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.summary-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.summary-title {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.summary-title .material-icons-outlined {
    font-size: 16px;
    opacity: 0.6;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 1px 0;
}

.summary-label {
    opacity: 0.6;
}

.summary-value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.summary-value.ups {
    color: #5FB878;
}

.summary-value.normal {
    color: #4aa8b5;
}

.summary-value.total {
    color: #eaf1f6;
}

/* Power group list */
.pg-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 13px;
}

.pg-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.pg-item.editing .pg-label {
    display: none;
}

.pg-item .pg-input {
    display: none;
}

.pg-item.editing .pg-input {
    display: block;
}

/* ===== Responsive ===== */
@media (max-width: 1100px) {
    .rack-grid {
        grid-template-columns: 1fr;
        height: auto;
        padding: 20px;
    }
}

@media (max-width: 1400px) and (min-width: 1101px) {
    .rack-grid {
        padding: 20px 40px;
    }
}

/* ============================================================
   PAGE: RedeliTäituvus
   ============================================================ */
    :root { color-scheme: dark; }
    body { color-scheme: dark; }

    /* ── Page Layout ──────────────────────────────────────────── */
    .rt-wrap {
      display: flex;
      gap: 0;
      min-height: calc(100vh - 80px);
    }

    /* ── Left: Config Panel ───────────────────────────────────── */
    .config-panel {
      width: 380px;
      flex-shrink: 0;
      border-right: 1px solid rgba(255,255,255,0.08);
      padding: 24px 20px 40px;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 20px;
    }

    /* ── Right: Viz Panel ─────────────────────────────────────── */
    .viz-panel {
      flex: 1;
      padding: 24px 32px 40px;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 24px;
      min-width: 0;
    }

    /* ── Section cards ────────────────────────────────────────── */
    .cfg-section {
      background: rgba(255,255,255,0.04);
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 12px;
      padding: 16px;
    }

    .cfg-section-title {
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.09em;
      opacity: 0.45;
      margin: 0 0 12px;
    }

    /* ── Mode Toggle ──────────────────────────────────────────── */
    .mode-toggle {
      display: flex;
      background: rgba(255,255,255,0.06);
      border-radius: 8px;
      padding: 3px;
      gap: 3px;
    }

    .mode-toggle button {
      flex: 1;
      padding: 7px 10px;
      border: none;
      border-radius: 6px;
      background: transparent;
      color: rgba(255,255,255,0.55);
      font-family: inherit;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.18s;
    }

    .mode-toggle button.active {
      background: rgba(74,168,181,0.22);
      color: #4ab8c5;
    }

    .toggle-btn {
      padding: 5px 12px;
      border: 1px solid rgba(255,255,255,0.15);
      border-radius: 6px;
      background: rgba(255,255,255,0.06);
      color: rgba(255,255,255,0.45);
      font-family: inherit;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.18s;
    }
    .toggle-btn.active {
      background: rgba(74,168,181,0.22);
      color: #4ab8c5;
      border-color: rgba(74,168,181,0.4);
    }

    /* ── Pill width buttons ───────────────────────────────────── */
    .width-pills {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-bottom: 10px;
    }

    .width-pill {
      padding: 4px 10px;
      border: 1px solid rgba(255,255,255,0.15);
      border-radius: 20px;
      background: transparent;
      color: rgba(255,255,255,0.65);
      font-family: inherit;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.15s;
    }

    .width-pill:hover {
      border-color: rgba(74,168,181,0.5);
      color: #4ab8c5;
    }

    .width-pill.active {
      border-color: #4ab8c5;
      background: rgba(74,168,181,0.15);
      color: #4ab8c5;
    }

    /* ── Form fields ──────────────────────────────────────────── */
    .field-row {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 10px;
    }

    .field-row:last-child { margin-bottom: 0; }

    .field-label {
      font-size: 12px;
      opacity: 0.65;
      white-space: nowrap;
      min-width: 80px;
    }

    .field-unit {
      font-size: 12px;
      opacity: 0.45;
      white-space: nowrap;
    }

    .rt-input {
      flex: 1;
      background: rgba(255,255,255,0.06);
      border: 1px solid rgba(255,255,255,0.12);
      border-radius: 6px;
      color: inherit;
      font-family: inherit;
      font-size: 13px;
      padding: 6px 10px;
      outline: none;
      transition: border-color 0.2s;
      min-width: 0;
    }

    .rt-input:focus {
      border-color: rgba(74,168,181,0.6);
    }

    select.rt-input {
      color-scheme: dark;
      background-color: #151d27;
      color: #eaf1f6;
    }

    select.rt-input option {
      background-color: #1a2332;
      color: #eaf1f6;
    }

    select.rt-input option:checked {
      background-color: #1f3040;
      color: #4ab8c5;
    }

    /* ── Type toggle (EL / LV) ────────────────────────────────── */
    .type-toggle {
      display: flex;
      background: rgba(255,255,255,0.06);
      border-radius: 6px;
      padding: 2px;
      gap: 2px;
      width: 100%;
    }

    .type-toggle button {
      flex: 1;
      padding: 5px 8px;
      border: none;
      border-radius: 5px;
      background: transparent;
      font-family: inherit;
      font-size: 12px;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.18s;
      color: rgba(255,255,255,0.5);
    }

    .type-toggle button.active-el {
      background: rgba(74,168,181,0.22);
      color: #4ab8c5;
    }

    .type-toggle button.active-lv {
      background: rgba(255,140,140,0.2);
      color: #ff8c8c;
    }

    /* ── Cable selector row ───────────────────────────────────── */
    .cable-adder-row {
      display: flex;
      gap: 8px;
      align-items: center;
    }

    .cable-adder-row select {
      flex: 1;
      min-width: 0;
    }

    .cable-adder-row input {
      width: 60px;
      flex-shrink: 0;
    }

    .btn-add {
      background: rgba(74,168,181,0.18);
      border: 1px solid rgba(74,168,181,0.35);
      color: #4ab8c5;
      border-radius: 6px;
      padding: 6px 14px;
      font-family: inherit;
      font-size: 13px;
      font-weight: 700;
      cursor: pointer;
      white-space: nowrap;
      transition: background 0.2s;
      flex-shrink: 0;
    }

    .btn-add:hover { background: rgba(74,168,181,0.3); }

    /* ── Cable list ───────────────────────────────────────────── */
    .cable-list {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .cable-row {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 6px 8px;
      border-radius: 7px;
      background: rgba(255,255,255,0.03);
      border: 1px solid rgba(255,255,255,0.06);
      font-size: 12px;
    }

    .cable-badge {
      padding: 2px 7px;
      border-radius: 4px;
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.04em;
      flex-shrink: 0;
    }

    .cable-badge.el {
      background: rgba(74,168,181,0.18);
      color: #4ab8c5;
    }

    .cable-badge.lv {
      background: rgba(255,140,140,0.18);
      color: #ff8c8c;
    }

    .cable-name {
      flex: 1;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      opacity: 0.85;
    }

    .cable-meta {
      opacity: 0.45;
      white-space: nowrap;
      font-size: 11px;
    }

    .cable-qty-ctrl {
      display: flex;
      align-items: center;
      gap: 4px;
    }

    .cable-qty-btn {
      width: 22px;
      height: 22px;
      border: 1px solid rgba(255,255,255,0.15);
      background: transparent;
      border-radius: 4px;
      color: inherit;
      font-size: 14px;
      line-height: 1;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.15s;
      padding: 0;
    }

    .cable-qty-btn:hover {
      border-color: rgba(255,255,255,0.3);
      background: rgba(255,255,255,0.06);
    }

    .cable-qty-val {
      min-width: 22px;
      text-align: center;
      font-weight: 600;
    }

    .cable-remove {
      border: none;
      background: transparent;
      color: rgba(255,100,100,0.55);
      cursor: pointer;
      font-size: 16px;
      line-height: 1;
      padding: 0 2px;
      transition: color 0.15s;
    }

    .cable-remove:hover { color: #ff6060; }

    .cable-list-empty {
      text-align: center;
      padding: 20px 0;
      opacity: 0.3;
      font-size: 12px;
    }

    /* ── SVG Tray visualization ───────────────────────────────── */
    .tray-viz-container {
      background: rgba(255,255,255,0.03);
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 12px;
      padding: 20px;
    }

    .tray-viz-title {
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      opacity: 0.4;
      margin: 0 0 16px;
    }

    .tray-svgs {
      display: flex;
      flex-wrap: wrap;
      gap: 20px;
      align-items: flex-start;
    }

    .tray-svg-wrap {
      flex: 1;
      min-width: 200px;
    }

    .tray-svg-label {
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.07em;
      margin-bottom: 8px;
    }

    .tray-svg-label.el { color: #4ab8c5; }
    .tray-svg-label.lv { color: #ff8c8c; }

    .tray-svg-wrap svg {
      display: block;
      width: 100%;
      height: auto;
      overflow: visible;
    }

    /* ── Fill bars ────────────────────────────────────────────── */
    .fill-bars {
      display: flex;
      flex-direction: column;
      gap: 16px;
    }

    .fill-bar-section {
      background: rgba(255,255,255,0.03);
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 12px;
      padding: 16px 20px;
    }

    .fill-bar-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 10px;
    }

    .fill-bar-title {
      font-size: 13px;
      font-weight: 700;
    }

    .fill-bar-title.el { color: #4ab8c5; }
    .fill-bar-title.lv { color: #ff8c8c; }

    .fill-status-badge {
      font-size: 11px;
      font-weight: 700;
      padding: 3px 9px;
      border-radius: 20px;
      letter-spacing: 0.05em;
    }

    .fill-status-badge.ok {
      background: rgba(80,200,100,0.15);
      color: #5bc870;
    }

    .fill-status-badge.warn {
      background: rgba(255,190,50,0.15);
      color: #ffc84a;
    }

    .fill-status-badge.over {
      background: rgba(220,60,60,0.2);
      color: #f06060;
    }

    .fill-bar-track {
      height: 12px;
      background: rgba(255,255,255,0.07);
      border-radius: 6px;
      overflow: hidden;
      position: relative;
    }

    .fill-bar-fill {
      height: 100%;
      border-radius: 6px;
      transition: width 0.35s ease;
    }

    .fill-bar-fill.el { background: linear-gradient(90deg, #3a9aaa, #4ab8c5); }
    .fill-bar-fill.el.warn { background: linear-gradient(90deg, #c8a030, #ffc84a); }
    .fill-bar-fill.el.over { background: linear-gradient(90deg, #bb3030, #f06060); }
    .fill-bar-fill.lv { background: linear-gradient(90deg, #cc5555, #ff8c8c); }
    .fill-bar-fill.lv.warn { background: linear-gradient(90deg, #c8a030, #ffc84a); }
    .fill-bar-fill.lv.over { background: linear-gradient(90deg, #bb3030, #f06060); }

    .fill-bar-limit-line {
      position: absolute;
      top: 0;
      height: 100%;
      width: 2px;
      background: rgba(255,255,255,0.35);
      border-radius: 1px;
    }

    .fill-bar-stats {
      display: flex;
      justify-content: space-between;
      margin-top: 8px;
      font-size: 11px;
      opacity: 0.55;
    }

    .fill-pct-label {
      font-size: 22px;
      font-weight: 700;
      line-height: 1;
      margin-bottom: 8px;
    }

    .fill-pct-label.el { color: #4ab8c5; }
    .fill-pct-label.lv { color: #ff8c8c; }
    .fill-pct-label.warn { color: #ffc84a; }
    .fill-pct-label.over { color: #f06060; }

    /* ── Dimensions display ───────────────────────────────────── */
    .dim-display {
      font-size: 12px;
      opacity: 0.5;
      margin-top: 4px;
    }

    /* ── Standard info pill ───────────────────────────────────── */
    .std-info {
      display: flex;
      align-items: center;
      gap: 8px;
      background: rgba(74,168,181,0.08);
      border: 1px solid rgba(74,168,181,0.2);
      border-radius: 8px;
      padding: 8px 12px;
      font-size: 11px;
      color: rgba(255,255,255,0.6);
    }

    .std-info span.material-icons-outlined {
      font-size: 15px;
      color: #4ab8c5;
      flex-shrink: 0;
    }

    /* ── Scrollbar ────────────────────────────────────────────── */
    .config-panel::-webkit-scrollbar,
    .viz-panel::-webkit-scrollbar { width: 4px; }
    .config-panel::-webkit-scrollbar-thumb,
    .viz-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

    /* ── Derating card (HD 60364-5-52) ────────────────────────── */
    .derating-params {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 8px;
      margin: 12px 0;
      background: rgba(255,255,255,0.03);
      border-radius: 8px;
      padding: 12px;
    }

    .derating-param { text-align: center; }

    .derating-param-val {
      font-size: 20px;
      font-weight: 700;
      line-height: 1.2;
      color: #4ab8c5;
    }

    .derating-param-val.warn { color: #ffc84a; }
    .derating-param-val.over { color: #f06060; }
    .derating-param-val.ok   { color: #5bc870; }

    .derating-param-label {
      font-size: 10px;
      opacity: 0.45;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      margin-top: 3px;
    }

    .derating-table-wrap { overflow-x: auto; margin-top: 6px; }

    .derating-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 12px;
    }

    .derating-table th {
      text-align: left;
      padding: 4px 8px;
      opacity: 0.45;
      font-size: 10px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      border-bottom: 1px solid rgba(255,255,255,0.08);
    }

    .derating-table td {
      padding: 5px 8px;
      border-bottom: 1px solid rgba(255,255,255,0.04);
    }

    .derating-table tbody tr:last-child td { border-bottom: none; }
    .derating-table td strong { color: #4ab8c5; }

    .cable-iz {
      font-size: 10px;
      color: rgba(74,184,197,0.9);
      font-weight: 700;
      background: rgba(74,168,181,0.12);
      border-radius: 4px;
      padding: 1px 5px;
      flex-shrink: 0;
      white-space: nowrap;
    }

    /* ── Responsive ───────────────────────────────────────────── */
    @media (max-width: 780px) {
      .rt-wrap { flex-direction: column; }
      .config-panel { width: 100%; border-right: none; border-bottom: 1px solid rgba(255,255,255,0.08); }
      .viz-panel { padding: 20px 16px 40px; }
    }

/* ============================================================
   PAGE: Tööaeg
   ============================================================ */
/* Layout */
#page-tooaeg .content {
  flex: 1;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Centered Card */
.calc-wrap {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: slideUp 0.4s ease-out;
}

.calc-panel {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-radius: 20px;
  border: 1px solid var(--stroke);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.3);
}

/* Form Elements */
.calc-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: #1c2430;
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: all 0.2s ease;
  -moz-appearance: textfield;
}

.calc-input::-webkit-outer-spin-button,
.calc-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.calc-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(74, 168, 181, .15);
}

/* Custom Select Arrow */
select.calc-input {
  appearance: none;
  cursor: pointer;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgba(159,176,193,0.7)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 20px;
}

select.calc-input option {
  background-color: #1e242c;
  color: #fff;
  padding: 10px;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.btn-action {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 16px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.2s, transform 0.1s;
  width: 100%;
  font-size: 16px;
  margin-top: 10px;
}

.btn-action:hover {
  filter: brightness(1.1);
}

.btn-action:active {
  transform: scale(0.98);
}

.btn-action:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* Stats inside the card */
.project-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  padding: 15px;
  border-radius: 12px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--stroke);
}

.stat-row {
  display: flex;
  flex-direction: column;
}

.stat-row span {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  opacity: 0.7;
}

.stat-row b {
  color: var(--text);
  font-size: 18px;
  margin-top: 2px;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* =====================
   Calendar Expanded Modal
   ===================== */

#calendarModal .modal-card {
  width: 1352px;
  max-width: calc(100vw - 48px);
  height: 988px;
  max-height: calc(100vh - 40px);
}

.cal-modal-body {
  display: flex;
  gap: 0;
  padding: 0 !important;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

.cal-modal-grid-wrap {
  flex: 1;
  min-width: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cal-modal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}

.cal-modal-weekdays span {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  padding: 4px 0;
}

.cal-modal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  flex: 1;
  overflow-y: auto;
  align-content: start;
}

.cal-modal-day {
  min-height: 110px;
  padding: 4px 5px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s;
  overflow: hidden;
}

.cal-modal-day.empty {
  background: transparent;
  border-color: transparent;
  cursor: default;
}

.cal-modal-day:not(.empty):hover {
  background: rgba(255, 255, 255, 0.07);
}

.cal-modal-day.today {
  border-color: var(--accent);
}

.cal-modal-day.selected {
  background: rgba(74, 168, 181, 0.15);
  border-color: var(--accent);
}

.cal-modal-day-num {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}

.cal-modal-day.today .cal-modal-day-num {
  color: var(--accent);
}

.cal-modal-event-chip {
  font-size: 0.72rem;
  padding: 2px 4px;
  border-radius: 3px;
  color: #fff;
  border: 3px solid transparent;
  margin-bottom: 2px;
  overflow: hidden;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45);
}

.cal-modal-side {
  width: 280px;
  flex-shrink: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cal-modal-legend {
  margin-top: auto;
  width: 100%;
  background: rgba(18, 28, 36, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 10px;
  backdrop-filter: blur(4px);
}

.cal-legend-title {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.cal-legend-group {
  margin-top: 6px;
}

.cal-legend-group-title {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.cal-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 10px 5px 0;
  color: var(--text);
  font-size: 0.72rem;
}

.cal-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
  background: transparent;
}

.cal-legend-swatch.border {
  width: 13px;
  height: 13px;
  border: 3px solid var(--legend-color);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
}

.cal-legend-swatch.fill {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: var(--legend-color);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.cal-legend-empty {
  color: var(--muted);
  font-size: 0.72rem;
  margin-bottom: 4px;
}

.cal-modal-detail {
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  border-left: none;
  padding: 4px;
}

.cal-modal-detail-placeholder {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 8px;
}

.cal-modal-detail-date {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.cal-modal-detail-empty {
  color: var(--muted);
  font-size: 0.85rem;
}

.cal-modal-detail-event {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
  overflow: hidden;
}

.cal-modal-detail-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.cal-modal-detail-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.cal-modal-detail-desc {
  font-size: 0.78rem;
  opacity: 0.8;
  margin-top: 3px;
}

.light .cal-modal-day {
  background: rgba(0, 0, 0, 0.02);
}

.light .cal-modal-day:not(.empty):hover {
  background: rgba(0, 0, 0, 0.06);
}

.light .cal-modal-day.selected {
  background: rgba(74, 168, 181, 0.12);
}

.light .cal-modal-detail {
  border-left-color: rgba(0, 0, 0, 0.1);
}

.light .cal-modal-detail-date {
  border-bottom-color: rgba(0, 0, 0, 0.1);
}

.light .cal-modal-detail-event {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

@media (max-width: 700px) {
  .cal-modal-body {
    flex-direction: column;
    height: auto;
    max-height: 85vh;
    overflow-y: auto;
  }

  .cal-modal-detail {
    width: 100%;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px 16px;
  }
}

/* =========================================
   FOOR (TRAFFIC LIGHT) BADGES
   ========================================= */

.foor-badge {
  font-size: 20px;
  font-weight: 700;
  margin: 6px 0 4px;
  padding: 4px 14px;
  border-radius: 20px;
  display: inline-block;
  letter-spacing: 0.01em;
}

.foor-badge.green  { color: var(--foam);  background: rgba(185, 243, 224, 0.12); }
.foor-badge.yellow { color: #f0c040;      background: rgba(240, 192, 64, 0.12);  }
.foor-badge.red    { color: var(--coral); background: rgba(255, 140, 140, 0.12); }

body.light .foor-badge.green  { color: #1a7a44; background: rgba(39, 174, 96, 0.1);   }
body.light .foor-badge.yellow { color: #9a6f00; background: rgba(240, 192, 64, 0.15); }
body.light .foor-badge.red    { color: #b91c1c; background: rgba(220, 53, 69, 0.1);   }

/* =========================================
   SUBTASKS
   ========================================= */

/* Expand toggle button */
.expand-btn {
  background: transparent; border: none; cursor: pointer;
  color: var(--muted); padding: 4px 8px;
  transition: transform 0.15s, color 0.15s;
  font-size: 14px; line-height: 1;
}
.expand-btn.open { transform: rotate(90deg); color: var(--teal); }

/* Small icon-only button used in card headers, e.g. workload weights gear */
.card-gear-btn {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
  width: 26px; height: 26px; padding: 0;
  background: transparent; border: 1px solid var(--stroke); border-radius: 8px;
  color: var(--muted); cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.card-gear-btn svg { display: block; }
.card-gear-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); border-color: var(--text); }

/* Subtask accordion row */
.subtask-row > td { padding: 0 !important; background: rgba(0,0,0,0.15); }
body.light .subtask-row > td { background: rgba(0,0,0,0.04); }
.subtask-panel { padding: 12px 20px 16px 32px; }
.subtask-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; font-size: 13px; color: var(--muted); font-weight: 600;
}

/* Subtask inner table */
.subtask-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.subtask-table td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
body.light .subtask-table td { border-color: rgba(0,0,0,0.06); }
.subtask-table tr:last-child td { border-bottom: none; }

/* Count badge on project row */
.subtask-count-badge {
  font-size: 10px; padding: 1px 6px; border-radius: 10px;
  background: rgba(74,168,181,0.15); color: var(--teal);
  margin-left: 6px; white-space: nowrap; font-weight: 600;
}

/* Dashboard "Minu ülesanded" widget items */
.my-tasks-item {
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
body.light .my-tasks-item { border-color: rgba(0,0,0,0.06); }
.my-tasks-item:last-child { border-bottom: none; }
.my-tasks-project { font-size: 11px; color: var(--muted); margin-bottom: 1px; }
.my-tasks-title { font-size: 13px; font-weight: 600; color: var(--text); }

/* =========================================
   PROJECT COMMENTS (chat-style)
   ========================================= */

/* Count badge on the chat icon button */
.cmt-btn { position: relative; }
.cmt-count-badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; font-size: 9px; font-weight: 700;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; line-height: 1;
}

/* Sticky input area at the bottom of the modal */
.comment-input-area {
  display: flex; gap: 8px; padding: 12px 16px;
  border-top: 1px solid var(--stroke); flex-shrink: 0;
}
.comment-input-area .calc-input { flex: 1; resize: none; }

/* =========================================
   PROJECT PROGRESS & MONTHLY BILLING
   ========================================= */

.progress-table-button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  min-width: 0;
  max-width: 100%;
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.progress-table-button:hover .progress-table-chip,
.progress-table-button:focus-visible .progress-table-chip {
  border-color: currentColor;
}

.progress-table-action {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.progress-table-values {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.progress-table-chip {
  padding: 2px 6px;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.progress-el { color: var(--teal); }
.progress-en { color: var(--foam); }
.progress-ea { color: var(--peach); }

.progress-billing-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--muted);
}

.progress-billing-status::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
}

.progress-billing-status.sent::before { background: #f0c040; }
.progress-billing-status.partial::before { background: var(--peach); }
.progress-billing-status.received::before { background: var(--foam); }

.progress-modal-card {
  width: min(960px, 96vw);
  max-width: 960px;
}

.progress-modal-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.progress-modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 24px 28px;
  overflow-y: auto;
}

.progress-section {
  padding: 18px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: rgba(255,255,255,0.025);
}

.progress-section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.progress-section-heading h4 {
  margin: 0;
  font-size: 15px;
}

.progress-section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.progress-edit-hint {
  align-self: flex-start;
  padding: 4px 8px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.progress-access-notice {
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-color: rgba(240,192,64,0.35);
}

.progress-access-notice[hidden] {
  display: none;
}

.progress-access-notice strong {
  color: #f0c040;
  font-size: 13px;
}

.progress-access-notice span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.progress-discipline-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.progress-value-card,
.progress-input-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--stroke);
  border-radius: 11px;
  background: rgba(0,0,0,0.08);
}

.progress-value-card span,
.progress-input-card > span:first-child {
  font-size: 12px;
  font-weight: 700;
}

.progress-value-card strong {
  color: inherit;
  font-size: 21px;
}

.progress-latest-meta {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.progress-percent-input,
.progress-received-input {
  display: flex;
  align-items: center;
  gap: 6px;
}

.progress-percent-input .calc-input {
  width: 90px;
  padding: 7px 9px;
  color: var(--text);
  text-align: right;
}

.progress-notes-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.progress-notes-field textarea {
  resize: vertical;
}

.progress-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.progress-message {
  min-height: 18px;
  font-size: 12px;
  font-weight: 600;
}

.progress-primary-btn {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.progress-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
}

.progress-history-item {
  padding: 11px 13px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: rgba(0,0,0,0.06);
}

.progress-history-meta,
.progress-history-values {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-history-meta {
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

.progress-history-values {
  margin-top: 8px;
  font-size: 12px;
}

.progress-history-item p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.progress-billing-heading {
  align-items: flex-end;
}

.progress-month-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.progress-month-field .calc-input {
  padding: 7px 9px;
}

.progress-billing-banner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
}

.progress-billing-banner.sent { border-color: rgba(240,192,64,0.35); }
.progress-billing-banner.partial { border-color: rgba(255,191,143,0.4); }
.progress-billing-banner.received { border-color: rgba(185,243,224,0.4); }

.progress-billing-table,
.progress-billing-preview {
  overflow: hidden;
  border: 1px solid var(--stroke);
  border-radius: 10px;
}

.progress-billing-row {
  display: grid;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--stroke);
  font-size: 12px;
}

.progress-billing-table .progress-billing-row {
  grid-template-columns: minmax(70px, 1fr) minmax(90px, 1fr) minmax(130px, 1.2fr);
}

.progress-billing-preview .progress-billing-row {
  grid-template-columns: minmax(60px, .8fr) repeat(3, minmax(90px, 1fr));
}

.progress-billing-row:last-child {
  border-bottom: 0;
}

.progress-billing-header {
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.progress-received-input .calc-input {
  width: 100px;
  padding: 6px 8px;
  text-align: right;
}

.progress-billing-audit,
.progress-billing-warning {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.progress-empty {
  grid-column: 1 / -1;
  padding: 14px;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  text-align: center;
}

body.light .progress-section,
body.light .progress-value-card,
body.light .progress-input-card,
body.light .progress-history-item {
  background: rgba(0,0,0,0.02);
}

@media (max-width: 720px) {
  .progress-modal-body {
    padding: 14px;
  }

  .progress-section {
    padding: 14px;
  }

  .progress-discipline-grid {
    grid-template-columns: 1fr;
  }

  .progress-billing-heading,
  .progress-billing-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .progress-month-field {
    width: 100%;
  }

  .progress-billing-row,
  .progress-billing-table .progress-billing-row,
  .progress-billing-preview .progress-billing-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .progress-billing-header {
    display: none;
  }
}

/* Individual comment row */
.comment-bubble { display: flex; gap: 10px; align-items: flex-start; }

/* Round avatar circle — mirrors user-pill pattern */
.comment-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  flex-shrink: 0; display: flex; align-items: center;
  justify-content: center; font-size: 11px; font-weight: 700;
  color: #fff; text-transform: uppercase;
}

.comment-content { flex: 1; min-width: 0; }

.comment-meta {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 4px; flex-wrap: wrap;
}
.comment-author { font-weight: 600; font-size: 13px; color: var(--text); }
.comment-time   { font-size: 11px; color: var(--muted); }

.comment-delete-btn {
  margin-left: auto; background: none; border: none;
  color: var(--muted); cursor: pointer; padding: 0 2px;
  font-size: 15px; line-height: 1; opacity: 0;
  transition: opacity .15s, color .15s;
}
.comment-bubble:hover .comment-delete-btn { opacity: 1; }
.comment-delete-btn:hover { color: var(--coral); }

.comment-body {
  font-size: 13px; line-height: 1.5; color: var(--modal-text);
  white-space: pre-wrap; word-break: break-word;
}

/* =========================================
   RESPONSIVE PROJECTS TABLE
   ========================================= */

/* Fixed layout: column widths come from <colgroup>, not content — this is
   what makes the table always fit the container instead of growing wider
   and forcing .table-responsive to scroll. */
#listView .dash-table { table-layout: fixed; }
/* Allow text and action buttons to wrap onto multiple lines instead of
   forcing the column wider than its assigned share of the table. */
#listView .dash-table { white-space: normal; }
/* User pills and stage badges stay on one line inside their cells */
#listView .dash-table .user-pill { white-space: nowrap; }

/* ≤ 900px — hide Suurus (col 5), tighten padding + font */
@media (max-width: 900px) {
  #listView .dash-table { font-size: 13px; }
  #listView .dash-table th,
  #listView .dash-table td { padding: 9px 10px; }
  #listView .filter-row td { padding: 5px 10px; }
  #listView .dash-table th:nth-child(5),
  #listView .dash-table td:nth-child(5) { display: none; }
  #listView .dash-table col.col-size { display: none; }
}

/* ≤ 700px — also hide Staadium (col 3), further compact */
@media (max-width: 700px) {
  #listView .dash-table { font-size: 12px; }
  #listView .dash-table th,
  #listView .dash-table td { padding: 7px 8px; }
  #listView .filter-row td { padding: 4px 8px; }
  #listView .dash-table th:nth-child(3),
  #listView .dash-table td:nth-child(3) { display: none; }
  #listView .dash-table col.col-stage { display: none; }
}

/* ≤ 480px — also hide Tähtaeg (col 6), minimal padding */
@media (max-width: 480px) {
  #listView .dash-table th,
  #listView .dash-table td { padding: 6px 5px; }
  #listView .dash-table th:nth-child(6),
  #listView .dash-table td:nth-child(6) { display: none; }
  #listView .dash-table col.col-deadline { display: none; }
}

.calc-input:focus-visible,
.tab-button:focus-visible,
.btn-action:focus-visible,
.close-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
