/* ============================================================
   DPLAN — Style Sheet v2.0 — Light/Dark Theme
   ============================================================ */

:root {
  /* Layout */
  --titlebar-h: 36px;
  --ribbon-tabs-h: 32px;
  --ribbon-cmd-h: 108px;
  --ribbon-h: calc(var(--ribbon-tabs-h) + var(--ribbon-cmd-h));
  /* Keep --nav-h for compat, set to titlebar + ribbon total */
  --nav-h: calc(var(--titlebar-h) + var(--ribbon-h));
  --sidebar-w: 220px;
  --toolbar-h: 40px;
  --row-h: 36px;
  --bar-h: 20px;
  --header-h: 52px;
  --radius: 6px;

  /* === LIGHT THEME (default) === */
  --bg:        #f5f7fb;
  --surface:   #ffffff;
  --surface-2: #f0f3f9;
  --surface-3: #e8edf6;
  --border:    rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.14);
  --text:   #1d1d1d;
  --text-2: #3a3a3a;
  --text-3: #6b7280;

  --primary:       #4361ee;
  --primary-hover: #3451d1;
  --primary-glow:  rgba(67,97,238,0.18);
  --success:  #10b981;
  --warning:  #f59e0b;
  --danger:   #ef4444;
  --info:     #3b82f6;

  --nav-bg:      #ffffff;
  --nav-border:  rgba(0,0,0,0.07);
  --sidebar-bg:  #f4f6fb;
  --sidebar-text: #1d1d1d;
  --sidebar-active: rgba(67,97,238,0.09);
  --sidebar-hover:  rgba(0,0,0,0.04);

  --gantt-row-even: rgba(0,0,0,0.016);
  --gantt-row-hover: rgba(67,97,238,0.05);
  --gantt-row-sel:   rgba(67,97,238,0.10);

  /* Compat aliases */
  --text-muted: var(--text-2);
  --text-light: var(--text-3);

  --shadow:    0 1px 4px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.05);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);

  /* Icon shadow for 3D depth effect */
  --icon-shadow: drop-shadow(0 1.5px 2px rgba(0,0,0,0.18)) drop-shadow(0 0.5px 0.5px rgba(0,0,0,0.10));

  /* SVG/canvas colors (read by JS) */
  --tl-top-bg:    #f4f7fd;
  --tl-bot-bg:    #edf1f9;
  --tl-text:      #1d1d1d;
  --tl-text-sub:  #3a3a3a;
  --tl-line:      #d1d9e6;
  --row-bg-alt:   rgba(0,0,0,0.014);
  --row-bg-we:    rgba(0,0,0,0.03);
}

body.dark-theme {
  --bg:        #0d1117;
  --surface:   #161b22;
  --surface-2: #1e2535;
  --surface-3: #252d3d;
  --border:    rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.15);
  --text:   #e2e8f0;
  --text-2: #94a3b8;
  --text-3: #64748b;

  --nav-bg:      #0d1117;
  --nav-border:  rgba(255,255,255,0.08);
  --sidebar-bg:  #161b22;
  --sidebar-text: #94a3b8;
  --sidebar-active: rgba(67,97,238,0.18);
  --sidebar-hover:  rgba(255,255,255,0.05);

  --gantt-row-even: rgba(255,255,255,0.018);
  --gantt-row-hover: rgba(67,97,238,0.08);
  --gantt-row-sel:   rgba(67,97,238,0.16);

  --shadow:    0 2px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.55);

  /* Icon shadow — deeper in dark mode */
  --icon-shadow: drop-shadow(0 2px 4px rgba(0,0,0,0.45)) drop-shadow(0 0.5px 1px rgba(0,0,0,0.3));

  --tl-top-bg:    #1a2234;
  --tl-bot-bg:    #151d2e;
  --tl-text:      #94a3b8;
  --tl-text-sub:  #64748b;
  --tl-line:      rgba(255,255,255,0.08);
  --row-bg-alt:   rgba(255,255,255,0.018);
  --row-bg-we:    rgba(255,255,255,0.04);
}

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

html, body, #app { height: 100%; overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
}

button { cursor: pointer; border: none; background: none; font: inherit; }
input, select, textarea { font: inherit; }
a { color: var(--primary); }

/* ============================================================
   TITLE BAR
   ============================================================ */
#titlebar {
  height: var(--titlebar-h);
  background: var(--nav-bg);
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 14px 0 12px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--nav-border);
  z-index: 200;
  position: relative;
}
.titlebar-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-right: 14px;
  border-right: 1px solid var(--border);
  margin-right: 0;
  flex-shrink: 0;
}
.titlebar-name {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.4px;
  background: linear-gradient(135deg, #4361ee, #9b59b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.titlebar-views {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 0 10px;
  flex: 1;
}
.titlebar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
  flex-shrink: 0;
}
.titlebar-label {
  color: var(--text-3);
  font-size: 11px;
}
.titlebar-select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 12px;
  cursor: pointer;
}
.titlebar-btn {
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.12s;
}
.titlebar-btn:hover { background: var(--surface-3); color: var(--text); }

/* Zoom button group in titlebar */
.titlebar-zoom-group {
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px;
  gap: 1px;
  flex-shrink: 0;
}
.titlebar-zoom-btn {
  padding: 2px 9px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.titlebar-zoom-btn:hover { color: var(--text); background: var(--surface-3); }
.titlebar-zoom-btn.active {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--border-strong);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.titlebar-sep { width: 1px; height: 16px; background: var(--border-strong); }
.privacy-tab-item {
  position: absolute !important;
  right: 14px !important;
  top: 0 !important;
  bottom: 0 !important;
  display: flex !important;
  align-items: center !important;
  pointer-events: none;
  cursor: default !important;
  border: none !important;
  background: transparent !important;
}
.privacy-chip {
  font-size: 12px;
  font-weight: 700;
  color: #145a32;
  background: #d5f5e3;
  border: 1.5px solid #27ae60;
  border-radius: 20px;
  padding: 3px 12px;
  white-space: nowrap;
  letter-spacing: 0.1px;
}
.titlebar-proj-name {
  font-size: 12px;
  color: var(--text-3);
  max-width: 180px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* View tabs (in title bar — pill style) */
.view-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;

  padding: 4px 11px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  background: none;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  cursor: pointer;
  white-space: nowrap;
}
.view-tab:hover { color: var(--text); background: var(--surface-3); }
.view-tab.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

/* Nav buttons (kept for compat) */
.nb {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: all 0.15s ease;
  white-space: nowrap;
}
.nb:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
  color: var(--text);
}
.nb svg { flex-shrink: 0; }
.nav-sep { width: 1px; height: 20px; background: var(--border-strong); margin: 0 4px; }

/* ============================================================
   RIBBON  (Metro UI-inspired)
   ============================================================ */
/* #ribbon is now a Metro UI <nav data-role="ribbonmenu">.
   Only keep layout properties here — colors/styling are in the
   Metro theme overrides section at the bottom of this file. */
#ribbon {
  flex-shrink: 0;
  z-index: 150;
  /* Metro sets display, height, background internally */
}

/* Ribbon tab bar */
#ribbon-tabs {
  display: flex;
  align-items: flex-end;
  height: var(--ribbon-tabs-h);
  padding: 0 8px;
  gap: 1px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.rbn-tab {
  padding: 4px 16px 5px;
  border-radius: 4px 4px 0 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  background: none;
  border: 1px solid transparent;
  border-bottom: none;
  cursor: pointer;
  transition: color 0.1s, background 0.1s;
  white-space: nowrap;
  line-height: 1;
}
.rbn-tab:hover { color: var(--text); background: var(--surface); }
.rbn-tab.active {
  color: var(--primary);
  background: var(--surface);
  border-color: var(--border);
  border-bottom: 3px solid var(--primary);
  font-weight: 700;
  margin-bottom: -1px;
  position: relative;
  z-index: 1;
}

/* Ribbon command area */
#ribbon-commands {
  height: var(--ribbon-cmd-h);
  display: flex;
  align-items: stretch;
  padding: 0 6px;
  overflow: visible;  /* allow group labels to be fully visible */
  background: var(--surface);
}
.rbn-panel {
  display: none;
  align-items: stretch;
  width: 100%;
  gap: 0;
}
.rbn-panel.active { display: flex; }

/* Ribbon group — Metro UI style: buttons area + pinned label footer */
.rbn-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 4px 5px 0;
  min-width: 0;
  position: relative;
}
.rbn-group-btns {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1px;
  flex: 1;
  padding-bottom: 2px;
}
.rbn-col {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* Group label — pinned to bottom, always visible */
.rbn-group-label {
  flex-shrink: 0;
  height: 16px;

  line-height: 16px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-2);
  text-align: center;
  letter-spacing: 0.25px;
  text-transform: uppercase;
  border-top: 1px solid var(--border);
  padding: 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Vertical separator between groups */
.rbn-sep {
  flex-shrink: 0;
  width: 1px;
  background: var(--border);
  margin: 5px 4px 18px;   /* bottom margin aligns with label height */
  align-self: stretch;
}

/* ── Large ribbon button (Metro UI style) ─────────────── */
/* icon (18–20px) on top, text label below, fixed height   */
.rbn-btn-lg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 5px 9px 4px;
  border-radius: 4px;
  color: var(--text);
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
  min-width: 50px;
  height: 58px;   /* fits larger 28px icon comfortably */
  white-space: nowrap;
  line-height: 1;
  flex-shrink: 0;
}
.rbn-btn-lg svg { width: 22px; height: 22px; flex-shrink: 0; stroke-width: 2; filter: var(--icon-shadow); }
.rbn-btn-sm svg { width: 14px; height: 14px; flex-shrink: 0; stroke-width: 2; filter: var(--icon-shadow); }
.view-tab svg  { width: 13px; height: 13px; flex-shrink: 0; }

/* ── Iconify icon sizing ────────────────────────────────── */
.rbn-btn-lg iconify-icon { font-size: 28px; width: 28px; height: 28px; flex-shrink: 0; filter: var(--icon-shadow); display: block; }
.rbn-btn-sm iconify-icon { font-size: 15px; width: 15px; height: 15px; flex-shrink: 0; filter: var(--icon-shadow); }
.view-tab iconify-icon   { font-size: 13px; width: 13px; height: 13px; flex-shrink: 0; }

/* ── Icon color palette ─────────────────────────────────── */
.ic-indigo { color: #5c6bc0; }
.ic-violet { color: #8b5cf6; }
.ic-blue   { color: #1a73e8; }
.ic-sky    { color: #0284c7; }
.ic-cyan   { color: #0891b2; }
.ic-teal   { color: #0d9488; }
.ic-green  { color: #16a34a; }
.ic-amber  { color: #d97706; }
.ic-orange { color: #ea580c; }
.ic-gold   { color: #ca8a04; }
.ic-red    { color: #dc2626; }
.ic-purple { color: #7c3aed; }
.ic-slate  { color: #64748b; }
.rbn-btn-lg span {
  font-size: 10px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  line-height: 1.2;
  max-width: 58px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rbn-btn-lg:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
  color: var(--text);
}
.rbn-btn-lg:active { background: var(--surface-2); }
.rbn-btn-lg:disabled { opacity: 0.28; cursor: default; }
.rbn-btn-lg:disabled:hover { background: none; border-color: transparent; color: var(--text-2); }

/* Variants — only affect button bg/border on hover; icon colors come from .ic-* color classes */
.rbn-btn-lg.rbn-primary         { color: var(--text); }
.rbn-btn-lg.rbn-primary:hover   { background: rgba(67,97,238,0.10); border-color: rgba(67,97,238,0.22); }
.rbn-btn-lg.rbn-danger          { color: var(--text); }
.rbn-btn-lg.rbn-danger:hover    { background: rgba(239,68,68,0.10); border-color: rgba(239,68,68,0.22); }

/* ── Small ribbon button (Metro UI compact row style) ─── */
.rbn-btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
  white-space: nowrap;
  height: 23px;
  flex-shrink: 0;
}
.rbn-btn-sm:hover { background: var(--surface-3); border-color: var(--border-strong); color: var(--text); }
.rbn-btn-sm:active { background: var(--surface-2); }
.rbn-btn-sm.rbn-active {
  background: rgba(67,97,238,0.09);
  border-color: rgba(67,97,238,0.25);
  color: var(--primary);
  font-weight: 600;
}

/* Zoom buttons in View tab */
.rbn-zoom-btn { min-width: 46px; justify-content: center; }

/* Inline toggle rows (weekends, baseline, cost) */
.rbn-toggle-row {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 2px 6px 2px 2px;
  border-radius: 4px;
  transition: background 0.12s;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}
.rbn-toggle-row:hover { background: var(--surface-3); color: var(--text); }
.rbn-toggle-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.rbn-toggle-track {
  width: 28px; height: 15px; border-radius: 8px;
  background: var(--surface-3); border: 1px solid var(--border-strong);
  position: relative; flex-shrink: 0; transition: background 0.2s;
}
.rbn-toggle-knob {
  position: absolute; top: 1px; left: 1px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--text-3); transition: all 0.2s;
}
.rbn-toggle-row input:checked ~ .rbn-toggle-track { background: var(--primary); border-color: var(--primary); }
.rbn-toggle-row input:checked ~ .rbn-toggle-track .rbn-toggle-knob { left: 14px; background: white; }
.rbn-toggle-label { font-size: 11px; }

/* Selection info in ribbon */
.rbn-sel-info {
  font-size: 11px;
  color: var(--text-3);
  padding: 0 8px;
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
#main-layout {
  display: flex;
  height: calc(100vh - var(--titlebar-h) - var(--ribbon-h) - 2px);
  overflow: hidden;
}

/* Sidebar */
#sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.sb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  border-bottom: 1px solid var(--border);
}
.sb-header button {
  color: var(--text-3);
  font-size: 20px;
  line-height: 1;
  border-radius: 4px;
  padding: 0 4px;
  transition: all 0.15s;
}
.sb-header button:hover { color: var(--text); background: var(--surface-3); }
#project-list { flex: 1; overflow-y: auto; padding: 6px 0; }

.proj-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  cursor: pointer;
  color: var(--sidebar-text);
  border-left: 3px solid transparent;
  transition: all 0.15s;
  position: relative;
}
.proj-item:hover { background: var(--sidebar-hover); color: var(--text); }
.proj-item.active { background: var(--sidebar-active); color: var(--primary); border-left-color: var(--primary); }
.proj-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.proj-name { flex: 1; font-size: 13px; font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.proj-actions { display: none; gap: 3px; }
.proj-item:hover .proj-actions { display: flex; }
.proj-actions button { padding: 2px 5px; font-size: 13px; border-radius: 3px; color: var(--text-3); }
.proj-actions button:hover { background: var(--surface-3); color: var(--text); }

.sb-footer { padding: 10px 12px; border-top: 1px solid var(--border); }
.sb-import-btn {
  width: 100%;
  padding: 7px;
  border-radius: 5px;
  color: var(--sidebar-text);
  font-size: 12px;
  border: 1px dashed var(--border-strong);
  text-align: center;
  transition: all 0.15s;
}
.sb-import-btn:hover { background: var(--surface-3); color: var(--text); }

/* Content */
#content { flex: 1; overflow: hidden; display: flex; flex-direction: column; background: var(--bg); }
.view { display: none; flex: 1; flex-direction: column; overflow: hidden; height: 100%; }
.view.active { display: flex; }

/* ============================================================
   GANTT VIEW
   ============================================================ */
#gantt-toolbar {
  height: var(--toolbar-h);
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
#gantt-toolbar::-webkit-scrollbar { display: none; }

.tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}
.tb-btn:hover {
  background: var(--surface-3);
  border-color: var(--primary);
  color: var(--primary);
}
.tb-btn:disabled { cursor: not-allowed; }
.tb-btn.primary-btn { background: var(--primary); color: #fff; border-color: var(--primary); }
.tb-btn.primary-btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.tb-btn.danger-btn { color: var(--danger); }
.tb-btn.danger-btn:hover { background: rgba(239,68,68,0.12); border-color: var(--danger); }
.tb-btn.icon-btn { padding: 5px 8px; }
.tb-sep { width: 1px; height: 20px; background: var(--border); margin: 0 3px; flex-shrink: 0; }
.tb-info { font-size: 11px; color: var(--text-3); margin-left: 6px; }

/* Toolbar dropdown */
.tb-dropdown { position: relative; flex-shrink: 0; }
.tb-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 160px;
  z-index: 200;
  overflow: hidden;
}
.tb-dropdown-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text);
  transition: background 0.12s;
}
.tb-dropdown-menu button:hover { background: var(--surface-3); color: var(--primary); }

#gantt-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Left task panel */
#gantt-left {
  width: 590px;
  min-width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-strong);
  background: var(--surface);
  overflow: hidden;
}

#task-header {
  height: var(--header-h);
  display: grid;
  grid-template-columns: 48px 1fr 48px 82px 82px 64px 90px;
  align-items: center;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-strong);
  flex-shrink: 0;
}
#task-header > div {
  padding: 0 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-right: 1px solid var(--border);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
#task-header > div:last-child { border-right: none; }

#task-body {
  flex: 1;
  overflow-y: scroll;
  overflow-x: hidden;
  scrollbar-width: none;
}
#task-body::-webkit-scrollbar { display: none; }

/* Task rows */
.task-row {
  display: grid;
  grid-template-columns: 48px 1fr 48px 82px 82px 64px 90px;
  align-items: center;
  height: var(--row-h);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
  position: relative;
}
.task-row:nth-child(even) { background: var(--gantt-row-even); }
.task-row:hover { background: var(--gantt-row-hover) !important; }
.task-row.selected { background: var(--gantt-row-sel) !important; }
.task-row.selected::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--primary);
  box-shadow: 0 0 6px var(--primary-glow);
}
.task-row.type-summary .tr-name { font-weight: 600; }
.task-row.type-milestone .task-name-text { color: var(--warning); font-weight: 600; }

.task-row > div {
  padding: 0 6px;
  font-size: 12px;
  height: 100%;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.task-row > div:last-child { border-right: none; }

.tr-wbs { color: var(--text-2); font-size: 10px; font-weight: 600; }
.tr-name { gap: 4px; overflow: visible; }
.task-name-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.expand-btn {
  width: 16px;
  height: 16px;
  font-size: 9px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-3);
  background: var(--surface-3);
  transition: all 0.15s;
}
.expand-btn:hover { background: var(--primary); color: #fff; }
.expand-placeholder { width: 16px; flex-shrink: 0; display: inline-block; }
.task-type-icon { font-size: 13px; flex-shrink: 0; line-height: 1; display: flex; align-items: center; }

.tr-dur, .tr-start, .tr-end { font-size: 11px; color: var(--text); }
.tr-dur-val { cursor: default; }
.tr-dur-val.editable { cursor: text; }
.tr-dur-input {
  width: 44px; font-size: 11px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--primary);
  border-radius: 3px; text-align: center; padding: 1px 3px;
  font-family: inherit; outline: none;
  -moz-appearance: textfield;
}
.tr-dur-input::-webkit-outer-spin-button,
.tr-dur-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tr-prog { flex-direction: column; align-items: flex-start; gap: 2px; }
.prog-bar-mini {
  width: 100%;
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
}
.prog-bar-mini > div {
  height: 100%;
  background: var(--success);
  border-radius: 2px;
  transition: width 0.3s;
}
.prog-pct { font-size: 10px; color: var(--text-3); }
.tr-status { gap: 5px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* Anchor button in task row */
.anchor-btn {
  font-size: 11px;
  opacity: 0.25;
  flex-shrink: 0;
  padding: 0 2px;
  transition: opacity 0.15s;
  line-height: 1;
}
.task-row:hover .anchor-btn { opacity: 0.6; }
.anchor-btn.anchored { opacity: 1 !important; }

.no-project, .no-tasks {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  line-height: 1.8;
}

/* Splitter */
#gantt-splitter {
  width: 5px;
  cursor: ew-resize;
  background: var(--border-strong);
  flex-shrink: 0;
  transition: background 0.15s;
  position: relative;
  z-index: 10;
}
#gantt-splitter:hover, #gantt-splitter.dragging { background: var(--primary); }

/* Timeline */
#gantt-right {
  flex: 1;
  overflow: hidden;
  background: var(--surface);
}
#timeline-scroll {
  width: 100%;
  height: 100%;
  overflow: auto;
}
#timeline-header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--header-h);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-strong);
}
.tl-header-inner { position: relative; }
.tl-row-top, .tl-row-bot { position: relative; }

/* Timeline header cells */
.tl-month-lbl, .tl-year-lbl {
  position: absolute;
  top: 0; bottom: 0;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--tl-text);
  border-right: 1px solid var(--border-strong);
  white-space: nowrap;
  overflow: hidden;
}
.tl-week-lbl, .tl-day-lbl, .tl-month-cell-lbl, .tl-quarter-lbl {
  position: absolute;
  top: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--tl-text-sub);
  border-right: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
}
.tl-day-lbl.is-today { color: var(--danger); font-weight: 700; }
.tl-day-lbl.is-weekend { color: var(--text-3); opacity: 0.5; }

#gantt-svg { display: block; background: var(--surface); }

/* ============================================================
   FILTER BAR
   ============================================================ */
#filter-bar {
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
  flex-shrink: 0;
}
#filter-bar select,
#filter-bar input {
  height: 28px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
}

/* ============================================================
   CALENDAR VIEW
   ============================================================ */
#calendar-view { padding: 0; }
#calendar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#calendar-nav h2 { font-size: 16px; font-weight: 600; flex: 1; }
#calendar-nav button {
  padding: 6px 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
  transition: all 0.15s;
}
#calendar-nav button:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
#calendar-container { flex: 1; overflow-y: auto; padding: 16px; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.cal-day-header {
  padding: 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
}
.cal-cell {
  min-height: 90px;
  padding: 6px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  vertical-align: top;
  position: relative;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.other-month { background: var(--bg); }
.cal-cell.is-today { background: rgba(67,97,238,0.07); }
.cal-cell.is-today .cal-day-num { background: var(--primary); color: #fff; }
.cal-cell.is-weekend { background: rgba(0,0,0,0.04); }
.cal-cell.is-holiday { background: rgba(239,68,68,0.07); }
.cal-day-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.cal-holiday-badge { font-size: 9px; color: var(--danger); font-weight: 600; display: block; margin-bottom: 2px; }
.cal-task-chip {
  display: block;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  color: white;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.cal-team-event {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  margin-bottom: 2px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
}

/* ============================================================
   RESOURCES VIEW
   ============================================================ */
#resources-container { padding: 20px; overflow-y: auto; }
.resources-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.resources-header h2 { font-size: 16px; font-weight: 700; }
.resource-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.resource-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  border-left: 4px solid var(--primary);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.resource-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
.resource-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.resource-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: white; flex-shrink: 0;
}
.resource-name { font-weight: 600; font-size: 14px; }
.resource-role { font-size: 11px; color: var(--text-2); }
.resource-tasks { margin-top: 8px; }
.resource-task-item {
  padding: 5px 8px;
  margin-bottom: 4px;
  background: var(--surface-2);
  border-radius: 4px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.12s;
}
.resource-task-item:hover { background: var(--surface-3); }

/* ============================================================
   SETTINGS VIEW
   ============================================================ */
.settings-page { max-width: 620px; }
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}
.settings-section h3 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.settings-section-hint {
  font-size: 12px;
  color: var(--text-3);
  margin: -6px 0 10px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.settings-row:last-child { border-bottom: none; }
.settings-label { font-size: 13px; color: var(--text); font-weight: 500; }
.settings-desc { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* Toggle switch */
.toggle-switch {
  position: relative;
  width: 38px;
  height: 20px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--surface-3);
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s;
  border: 1px solid var(--border-strong);
}
.toggle-slider::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  top: 2px;
  background: var(--text-3);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); border-color: var(--primary); }
.toggle-switch input:checked + .toggle-slider::after { transform: translateX(18px); background: white; }

/* About card */
.about-card-section {}
.about-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
}
.about-logo {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4361ee, #9b59b6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 900;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(67,97,238,0.35);
}

/* ============================================================
   DASHBOARD VIEW
   ============================================================ */
#dashboard-view { overflow-y: auto; padding: 20px; background: var(--bg); }
.dashboard-grid { display: flex; flex-direction: column; gap: 16px; max-width: 1100px; }
.dash-kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.dash-kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.dash-kpi-card:hover { border-color: var(--border-strong); box-shadow: 0 4px 16px rgba(0,0,0,0.25); }
.dash-kpi-val { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }
.dash-kpi-lbl { font-size: 11px; color: var(--text-3); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; }
.dash-row2, .dash-row3 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  transition: border-color 0.15s;
}
.dash-card:hover { border-color: var(--border-strong); }
.dash-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modal-in 0.15s ease;
}
.modal-lg { width: 680px; }
.modal-sm { width: 360px; }

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(-10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h2 { font-size: 16px; font-weight: 700; color: var(--text); }
.modal-close {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 18px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--surface-3); color: var(--danger); }

.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-footer-left { flex: 1; }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.span2 { grid-column: span 2; }
.form-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.label-hint { font-weight: 400; text-transform: none; letter-spacing: 0; opacity: 0.7; }

input[type="text"], input[type="email"], input[type="date"], input[type="number"],
select, textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  background: var(--surface-2);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67,97,238,0.15);
}
select option { background: var(--surface-2); color: var(--text); }
select[multiple] { padding: 4px; }
textarea { resize: vertical; }

.progress-input-row { display: flex; align-items: center; gap: 8px; }
.progress-input-row input[type="range"] { flex: 1; accent-color: var(--primary); }
.progress-val-label { font-size: 13px; font-weight: 600; color: var(--primary); min-width: 36px; }

.color-input-row { display: flex; align-items: center; gap: 8px; }
input[type="color"] { width: 44px; height: 34px; padding: 2px; border-radius: var(--radius); border: 1.5px solid var(--border); cursor: pointer; background: var(--surface-2); }

/* Deps list */
.deps-list { margin-bottom: 8px; }
.dep-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 5px;
  margin-bottom: 4px;
  font-size: 12px;
}
.dep-item button { color: var(--danger); font-size: 14px; }
.dep-add-row { display: flex; gap: 8px; align-items: center; }
.dep-add-row select { flex: 1; }
.dep-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }

.duration-display { font-size: 12px; color: var(--text-2); }

/* Modal buttons */
.modal-footer button {
  padding: 7px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  border: 1.5px solid var(--border);
  color: var(--text);
  background: var(--surface-2);
  transition: all 0.15s;
}
.modal-footer button:hover { background: var(--surface-3); border-color: var(--border-strong); }
.modal-footer .primary-btn { background: var(--primary); color: #fff; border-color: var(--primary); }
.modal-footer .primary-btn:hover { background: var(--primary-hover); }
.modal-footer .danger-btn { background: var(--danger); color: #fff; border-color: var(--danger); }
.link-btn { background: none; border: none; color: var(--primary); font-size: 11px; cursor: pointer; text-decoration: underline; }

/* Two-col modal layout */
.two-col-modal { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.two-col-modal h3 { font-size: 14px; font-weight: 700; margin-bottom: 12px; }

/* Holiday list */
.holiday-list-modal { margin-bottom: 12px; }
.holiday-item, .team-event-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  background: var(--surface-2);
  border-radius: 5px;
  margin-bottom: 4px;
  font-size: 12px;
}
.holiday-item button, .team-event-item button { margin-left: auto; color: var(--danger); font-size: 14px; }
.team-event-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Resource modal */
.resource-list-modal { margin-bottom: 16px; }
.resource-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: 6px;
  margin-bottom: 6px;
}
.resource-list-item .res-avatar { width:30px;height:30px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:12px;color:white;flex-shrink:0; }
.resource-list-item .res-info { flex: 1; }
.resource-list-item .res-name { font-weight: 600; font-size: 13px; }
.resource-list-item .res-role { font-size: 11px; color: var(--text-2); }
.resource-list-item .del-btn { color: var(--danger); font-size: 16px; }
.add-resource-form { border-top: 1px solid var(--border); padding-top: 14px; }
.add-resource-form h3 { font-size: 13px; font-weight: 700; margin-bottom: 10px; }

/* Import modal */
#import-project-list label {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-strong);
  animation: toast-in 0.25s ease;
  min-width: 220px;
}
.toast.success { background: var(--surface); border-left: 4px solid var(--success); color: var(--text); }
.toast.error   { background: var(--surface); border-left: 4px solid var(--danger);  color: var(--text); }
.toast.info    { background: var(--surface); border-left: 4px solid var(--info);    color: var(--text); }
body.dark-theme .toast.success { background: #0d2a1c; border: 1px solid rgba(16,185,129,0.35); border-left: 4px solid var(--success); color: #6ee7b7; }
body.dark-theme .toast.error   { background: #2a0d0d; border: 1px solid rgba(239,68,68,0.35);  border-left: 4px solid var(--danger);  color: #fca5a5; }
body.dark-theme .toast.info    { background: #0d1a2e; border: 1px solid rgba(59,130,246,0.35); border-left: 4px solid var(--info);    color: #93c5fd; }
@keyframes toast-in  { from { opacity:0; transform:translateY(10px); }  to { opacity:1; transform:translateY(0); } }
@keyframes toast-out { to   { opacity:0; transform:translateY(10px); } }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ============================================================
   UTILITIES
   ============================================================ */
.hidden { display: none !important; }
.text-muted { color: var(--text-2); }
.primary-btn {
  padding: 7px 18px;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}
.primary-btn:hover { background: var(--primary-hover); }
.danger-btn {
  padding: 7px 18px;
  border-radius: var(--radius);
  background: var(--danger);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
}

/* Anchor & Notes icons in task rows */
.anchor-icon, .notes-icon {
  font-size: 11px; opacity: 0.6; cursor: pointer; margin-left: 4px;
  flex-shrink: 0; transition: opacity 0.15s;
}
.anchor-icon:hover, .notes-icon:hover { opacity: 1; }

/* Notes popup */
.notes-popup {
  position: fixed; z-index: 9999;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 10px 14px; max-width: 300px;
  font-size: 12px; color: var(--text-2); line-height: 1.5;
  box-shadow: var(--shadow-lg); pointer-events: none;
  white-space: pre-wrap; word-break: break-word;
}

/* Print styles for PDF */
@media print {
  #navbar, #sidebar, #gantt-toolbar, #gantt-splitter { display: none !important; }
  #gantt-left { width: 400px !important; }
  body { background: #ffffff; }
}

/* ============================================================
   METRO UI v4 RIBBON — THEME OVERRIDES
   Loaded after metro.min.css — overrides only what's needed.
   ============================================================ */

/* ── Container ── */
nav#ribbon {
  height: var(--ribbon-h) !important;
  flex-shrink: 0 !important;
  overflow: visible !important;
  border-bottom: 1px solid var(--border-strong) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07) !important;
}

/* ── Tab bar ── */
nav#ribbon .tabs-holder {
  height: var(--ribbon-tabs-h) !important;
  min-height: var(--ribbon-tabs-h) !important;
  background: var(--surface-2) !important;
  border-bottom: 1px solid var(--border-strong) !important;
  padding: 0 10px !important;
  display: flex !important;
  align-items: flex-end !important;
  gap: 1px !important;
  margin: 0 !important;
}
nav#ribbon .tabs-holder li {
  list-style: none !important;
  margin: 0 !important;
}
nav#ribbon .tabs-holder li > a {
  display: inline-block !important;
  padding: 5px 14px 6px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  color: var(--text-2) !important;
  text-decoration: none !important;
  border-radius: 4px 4px 0 0 !important;
  border: 1px solid transparent !important;
  border-bottom: none !important;
  transition: color 0.12s, background 0.12s !important;
  white-space: nowrap !important;
  line-height: 1 !important;
}
nav#ribbon .tabs-holder li:hover > a {
  color: var(--text) !important;
  background: rgba(0,0,0,0.05) !important;
}
nav#ribbon .tabs-holder li.active > a {
  color: var(--primary) !important;
  font-weight: 700 !important;
  background: var(--surface) !important;
  border-color: var(--border-strong) !important;
  border-bottom: 3px solid var(--primary) !important;
  margin-bottom: -1px !important;
  position: relative !important;
  z-index: 2 !important;
}

/* ── Content area ── */
nav#ribbon .content-holder {
  height: var(--ribbon-cmd-h) !important;
  background: var(--surface) !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch !important;
  padding: 3px 8px 0 !important;
  overflow: visible !important;
  gap: 0 !important;
  border-top: none !important;
}

/* ── Section (tab panel): Metro controls show/hide via .active class ──
   Metro CSS: .section { display:none }  .section.active { display:flex }
   We only need to override the flex layout properties + reinforce flex on .active ── */
nav#ribbon .section {
  flex-direction: row !important;
  align-items: stretch !important;
  height: 100% !important;
  width: 100% !important;
}
nav#ribbon .section.active {
  display: flex !important;
}

/* ── Group: horizontal button row + absolute label at bottom ── */
nav#ribbon .group {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 2px !important;
  padding: 4px 8px 20px !important;
  position: relative !important;
  flex-shrink: 0 !important;
  flex-wrap: nowrap !important;
  border-radius: 3px !important;
}
nav#ribbon .group:hover {
  background: rgba(0,0,0,0.03) !important;
}

/* ── Uniform separator between groups ── */
nav#ribbon .separator {
  flex-shrink: 0 !important;
  width: 1px !important;
  align-self: stretch !important;
  background: var(--border-strong) !important;
  margin: 6px 7px 0 !important;
  display: block !important;
  border: none !important;
  opacity: 0.7 !important;
}
nav#ribbon .group > .title {
  position: absolute !important;
  bottom: 1px !important;
  left: 0 !important;
  right: 0 !important;
  height: 16px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  font-size: 9.5px !important;
  font-weight: 600 !important;
  color: var(--text) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.4px !important;
  border-top: 1px solid var(--border) !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  padding: 0 6px !important;
  pointer-events: none !important;
}

/* ── Large ribbon-button ── */
nav#ribbon .ribbon-button {
  display: inline-flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  padding: 5px 10px 4px !important;
  min-width: 54px !important;
  height: 70px !important;
  border: 1px solid transparent !important;
  border-radius: 4px !important;
  background: transparent !important;
  cursor: pointer !important;
  transition: background 0.12s, border-color 0.12s !important;
  color: var(--text) !important;
  text-align: center !important;
  flex-shrink: 0 !important;
}
nav#ribbon .ribbon-button:hover {
  background: var(--surface-3) !important;
  border-color: var(--border) !important;
}
nav#ribbon .ribbon-button:active { background: var(--surface-2) !important; }
nav#ribbon .ribbon-button[disabled],
nav#ribbon .ribbon-button:disabled {
  opacity: 0.28 !important;
  cursor: default !important;
  pointer-events: none !important;
}
nav#ribbon .ribbon-button.active {
  background: rgba(67,97,238,0.10) !important;
  border-color: rgba(67,97,238,0.28) !important;
}
nav#ribbon .ribbon-button .icon {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 32px !important;
  height: 32px !important;
  flex-shrink: 0 !important;
}
nav#ribbon .ribbon-button .caption {
  font-size: 10.5px !important;
  font-weight: 600 !important;
  color: var(--text) !important;
  line-height: 1.25 !important;
  max-width: 72px !important;
  text-align: center !important;
  word-break: break-word !important;
  white-space: normal !important;
  overflow: visible !important;
}

/* ── Small ribbon-icon-button ── */
nav#ribbon .ribbon-icon-button {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 3px 8px !important;
  height: 26px !important;
  border: 1px solid transparent !important;
  border-radius: 4px !important;
  background: transparent !important;
  cursor: pointer !important;
  transition: background 0.12s, border-color 0.12s !important;
  color: var(--text) !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}
nav#ribbon .ribbon-icon-button:hover {
  background: var(--surface-3) !important;
  border-color: var(--border) !important;
}
nav#ribbon .ribbon-icon-button.active {
  background: rgba(67,97,238,0.10) !important;
  border-color: rgba(67,97,238,0.28) !important;
  color: var(--primary) !important;
}
nav#ribbon .ribbon-icon-button .icon {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 16px !important;
  height: 16px !important;
  flex-shrink: 0 !important;
}
nav#ribbon .ribbon-icon-button .caption {
  font-size: 11px !important;
  font-weight: 600 !important;
  color: inherit !important;
}

/* ── Iconify icon sizing ── */
nav#ribbon .ribbon-button .icon iconify-icon {
  font-size: 30px !important;
  width: 30px !important;
  height: 30px !important;
  display: block !important;
  filter: var(--icon-shadow) !important;
}
nav#ribbon .ribbon-icon-button .icon iconify-icon {
  font-size: 15px !important;
  width: 15px !important;
  height: 15px !important;
  display: block !important;
  filter: var(--icon-shadow) !important;
}

/* ── Button group (Metro data-role="button-group") ── */
nav#ribbon [data-role="button-group"] {
  display: inline-flex !important;
  align-items: center !important;
  gap: 1px !important;
  background: var(--surface-2) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: 5px !important;
  padding: 2px !important;
}
nav#ribbon [data-role="button-group"] > .ribbon-button,
nav#ribbon [data-role="button-group"] > .ribbon-icon-button {
  border-radius: 3px !important;
  background: transparent !important;
  border-color: transparent !important;
}
nav#ribbon [data-role="button-group"] > .ribbon-button.active,
nav#ribbon [data-role="button-group"] > .ribbon-icon-button.active {
  background: var(--surface) !important;
  border-color: var(--border-strong) !important;
  color: var(--primary) !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12) !important;
}
nav#ribbon [data-role="button-group"] > .ribbon-button.active .caption,
nav#ribbon [data-role="button-group"] > .ribbon-icon-button.active .caption {
  color: var(--primary) !important;
}

/* ── rbn-col-stack: vertical column of icon-buttons ── */
nav#ribbon .rbn-col-stack {
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
  align-self: center !important;
}

/* ── Dark theme overrides ── */
body.dark-theme nav#ribbon .tabs-holder {
  background: var(--surface-2) !important;
  border-bottom-color: var(--border-strong) !important;
}
body.dark-theme nav#ribbon .tabs-holder li:hover > a {
  background: rgba(255,255,255,0.05) !important;
}
body.dark-theme nav#ribbon .tabs-holder li.active > a {
  background: var(--surface) !important;
  border-color: var(--border-strong) !important;
}
body.dark-theme nav#ribbon .content-holder {
  background: var(--surface) !important;
}
body.dark-theme nav#ribbon .separator {
  background: var(--border-strong) !important;
}
body.dark-theme nav#ribbon .group:hover {
  background: rgba(255,255,255,0.04) !important;
}
body.dark-theme nav#ribbon .ribbon-button,
body.dark-theme nav#ribbon .ribbon-icon-button {
  color: var(--text) !important;
}
body.dark-theme nav#ribbon .ribbon-button .caption,
body.dark-theme nav#ribbon .ribbon-icon-button .caption {
  color: var(--text) !important;
}
body.dark-theme nav#ribbon [data-role="button-group"] {
  background: rgba(255,255,255,0.05) !important;
  border-color: var(--border-strong) !important;
}
body.dark-theme nav#ribbon [data-role="button-group"] > .ribbon-button.active,
body.dark-theme nav#ribbon [data-role="button-group"] > .ribbon-icon-button.active {
  background: var(--surface-3) !important;
}
