:root {
  /* Background Colors */
  --color-bg-darkest: #30404C;
  --color-bg-dark: #34495E;
  --color-bg-medium: #3C5A6E;
  --color-bg-card: #4A6E7D;
  --color-bg-card-hover: #5A7A8C;
  --color-bg-input: #3E5266;
  --color-bg-lightest: #F7FAFF;
  --color-bg-light: #F1F3F3;

  /* Accent Colors */
  --color-accent-blue: #5DADE2;
  --color-accent-cyan: #38bdf8;
  --color-accent-teal: #4A9EAF;
  
  /* Text Colors */
  --color-text-primary: #FFFFFF;
  --color-text-secondary: #BDC3C7;
  --color-text-muted: #95A5A6;
  --color-text-dark: #2C3E50;
  
  /* UI Colors */
  --color-border: #475569;
  --color-border-light: #64748b;
  --color-success: #27AE60;
  --color-danger: #E74C3C;
  --color-warning: #F39C12;

  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 16px;
  --spacing-xl: 24px;
  
  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 999px;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.4);
}

body[data-theme="light"] {
  --color-bg-darkest: #FAFAF7;
  --color-bg-dark: #F2F2ED;
  --color-bg-medium: #F6F6F1;
  --color-bg-card: #FFFFFF;
  --color-bg-card-hover: #F4F4EE;
  --color-bg-input: #FFFFFF;
  --color-bg-lightest: #FFFFFF;
  --color-bg-light: #F7F7F2;

  --color-accent-blue: #001aff;
  --color-accent-cyan: #00aeff;
  --color-accent-teal: #0077ff;

  --color-text-primary: #2E2E2E;
  --color-text-secondary: #6B6B6B;
  --color-text-muted: #8A8A8A;
  --color-text-dark: #1F1F1F;

  --color-border: #E5E5E0;
  --color-border-light: #EFEFEA;

  --shadow-sm: 0 2px 8px rgba(46, 46, 46, 0.08);
  --shadow-md: 0 6px 18px rgba(46, 46, 46, 0.12);
  --shadow-lg: 0 12px 36px rgba(46, 46, 46, 0.16);
}

body[data-theme="light"] .editor-topbar {
  background: #F2F2ED;
}

body[data-theme="light"] .editor-topbar svg {
  color: #2E2E2E;
}

body[data-theme="light"] .toolbar-btn {
  color: #2E2E2E;
}

body[data-theme="light"] .toolbar-select {
  background-image: url('data:image/svg+xml;charset=UTF-8,<svg width="12" height="8" viewBox="0 0 12 8" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="%232E2E2E" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
}

body[data-theme="light"] .editor-toolbar button[style*="var(--color-bg-input)"] {
  color: #2E2E2E !important;
}

body[data-theme="light"] .editor-toolbar button[style*="var(--color-bg-input)"] svg {
  color: #2E2E2E !important;
}

body[data-theme="light"] .timeline-bar-label,
body[data-theme="light"] .timeline-label-floating {
  color: #2E2E2E;
  text-shadow: none;
}


/*  
RESET & BASE 
*/
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Helvetica Neue', Arial, sans-serif;
  background: var(--color-bg-darkest);
  color: var(--color-text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition-fast);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: inherit;
}

ul {
  list-style: none;
}

/* 
   AUTHENTICATION
 */
.auth-body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #2C3E50 0%, #34495E 50%, #3C5A6E 100%);
  padding: 20px;
}

.auth-container {
  background: var(--color-bg-dark);
  padding: 40px 45px;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
}

.auth-container h2 {
  margin: 0 0 30px 0;
  text-align: center;
  font-size: 28px;
  font-weight: 600;
}

.auth-container label {
  display: block;
  margin-top: 16px;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.auth-container input[type="text"],
.auth-container input[type="email"],
.auth-container input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-input);
  color: var(--color-text-primary);
  font-size: 14px;
}

.auth-container input:focus {
  outline: none;
  border-color: var(--color-accent-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.auth-container button[type="submit"] {
  width: 100%;
  padding: 12px;
  background: var(--color-accent-cyan);
  color: var(--color-text-dark);
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 15px;
  margin-top: 24px;
  cursor: pointer;
}

.auth-container button[type="submit"]:hover {
  background: var(--color-accent-blue);
  transform: translateY(-1px);
}

.alert {
  background: var(--color-danger);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 14px;
}

.alert.success {
  background: var(--color-success);
  color: white;
}

.switch-link {
  margin-top: 20px;
  text-align: center;
  font-size: 14px;
  color: var(--color-text-muted);
}

.switch-link a {
  color: var(--color-accent-cyan);
  font-weight: 500;
}

.switch-link a:hover {
  color: var(--color-accent-blue);
  text-decoration: underline;
}

/* 
   DASHBOARD
 */
.dash-body {
  display: flex;
  background: var(--color-bg-darkest);
  min-height: 100vh;
  margin: 0;
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 220px;
  background: var(--color-bg-darkest);
  border-right: 1px solid var(--color-border);
  padding: 80px 16px 20px 16px;
  overflow-y: auto;
  z-index: 100;
}

.sidebar ul {
  padding: 0;
  margin: 0;
}

.sidebar li {
  margin-bottom: 8px;
}

.sidebar a {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition-fast);
  gap: 10px;
}

.sidebar a:hover {
  background: var(--color-bg-dark);
  color: var(--color-text-primary);
}

.sidebar a.active {
  background: var(--color-bg-dark);
  color: var(--color-accent-cyan);
  font-weight: 600;
}

.main-wrapper {
  margin-left: 220px;
  width: calc(100% - 220px);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: var(--color-bg-dark);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 200;
  height: 60px;
}

.top-left-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-circle {
  width: 36px;
  height: 36px;
  background: var(--color-accent-cyan);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-dark);
}

.logo-text {
  font-weight: 600;
  font-size: 18px;
}

.profile-wrapper {
  position: relative;
}

.profile-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-md);
}

.profile-bar:hover {
  background: var(--color-bg-darkest);
}

.profile-name .name {
  display: block;
  font-weight: 600;
  font-size: 14px;
}

.profile-name .role {
  font-size: 12px;
  color: var(--color-text-muted);
  text-transform: capitalize;
}

.avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--color-bg-darkest);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--color-accent-cyan);
  border: 2px solid var(--color-border);
}

.profile-dropdown {
  position: absolute;
  right: 0;
  top: 52px;
  background: var(--color-bg-dark);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  min-width: 200px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
}

.profile-dropdown.show {
  display: flex;
}

.profile-dropdown a {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
}

.profile-dropdown button {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
  background: none;
  text-align: left;
  width: 100%;
}

.profile-dropdown a:last-child {
  border-bottom: none;
}

.profile-dropdown button:last-child {
  border-bottom: none;
}

.profile-dropdown a:hover {
  background: var(--color-bg-darkest);
  color: var(--color-text-primary);
}

.profile-dropdown button:hover {
  background: var(--color-bg-darkest);
  color: var(--color-text-primary);
}

.main-content {
  padding: 24px;
  flex: 1;
  background: var(--color-bg-darkest);
}

/* 
   PANELS
 */
.panel {
  background: var(--color-bg-dark);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
}

.panel h3 {
  margin: 0 0 16px 0;
  font-size: 20px;
  font-weight: 600;
}

.panel-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header-flex h3 {
  margin: 0;
}

/* 
   BUTTONS
 */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--color-accent-cyan);
  color: var(--color-text-dark);
  border: none;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition-base);
  text-decoration: none;
}

.btn-primary:hover {
  background: var(--color-accent-blue);
  transform: translateY(-2px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
}

.btn-secondary:hover {
  background: var(--color-bg-dark);
  color: var(--color-text-primary);
  border-color: var(--color-accent-cyan);
}

button[type="submit"] {
  padding: 10px 24px;
  background: var(--color-accent-cyan);
  color: var(--color-text-dark);
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  margin-top: 16px;
  cursor: pointer;
}

button[type="submit"]:hover {
  background: var(--color-accent-blue);
  transform: translateY(-1px);
}


/* 
DASHBOARD QUICK START GRID 
*/

.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.quick-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 30px 24px;
  text-align: center;
  text-decoration: none;
  color: var(--color-text-secondary);
  transition: var(--transition-base);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 150px;
}

.quick-card:hover {
  border-color: var(--color-accent-cyan);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  color: var(--color-text-primary);
  background: var(--color-bg-card-hover);
}
.quick-card h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
}
.quick-card p {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.4;
}


/* 
   PROJECT GRID
 */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 16px;
}

.project-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition-base);
}

.project-card:hover {
  border-color: var(--color-accent-cyan);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.project-card h4 {
  margin: 0 0 10px 0;
  font-size: 17px;
  font-weight: 600;
}

.project-card .status,
.project-card .updated {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 6px;
  display: block;
}

/* 
   NOTE GRID
 */
.note-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.note-box {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  transition: var(--transition-base);
  min-height: 180px;
  display: flex;
  flex-direction: column;
}

.note-box:hover {
  border-color: var(--color-accent-cyan);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.note-box h4 {
  margin: 0 0 10px 0;
  font-size: 16px;
  font-weight: 600;
}

.note-box p {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  flex: 1;
}

.note-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.note-modal-overlay.show {
  display: flex;
}

.note-modal {
  background: var(--color-bg-dark);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  padding: 32px;
  width: 90%;
  max-width: 700px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.note-modal h2 {
  margin: 0 0 8px 0;
  font-size: 24px;
}

.note-modal .close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 28px;
  border: none;
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.note-modal .close-btn:hover {
  background: var(--color-bg-darkest);
  color: var(--color-text-primary);
}

/* ]
   FORMS
 */
textarea {
  width: 100%;
  background: var(--color-bg-input);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--color-text-primary);
  resize: vertical;
  font-size: 14px;
  line-height: 1.6;
}

textarea:focus {
  outline: none;
  border-color: var(--color-accent-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-input);
  color: var(--color-text-primary);
  font-size: 14px;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--color-accent-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-muted);
  opacity: 0.6;
}

input:disabled,
select:disabled {
  background: var(--color-bg-darkest);
  color: var(--color-text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

label {
  display: block;
  margin-bottom: 6px;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.form-group {
  margin-bottom: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--color-bg-card);
  color: var(--color-text-secondary);
  margin-left: 8px;
  text-transform: uppercase;
}

.time {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 6px;
}

.muted {
  color: var(--color-text-muted);
  font-size: 14px;
}

/* 
   PROJECT EDITOR LAYOUT
 */
.project-editor {
  display: grid;
  grid-template-columns: 250px 1fr 320px;
  grid-template-rows: 60px 1fr;
  height: 100vh;
  background: var(--color-bg-medium);
  overflow: hidden;
  transition: grid-template-columns 0.3s ease;
}

.editor-topbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  padding: 0 20px;
  background: var(--color-bg-dark);
  border-bottom: 1px solid var(--color-border);
  height: 60px;
  z-index: 200;
}

.editor-title {
  font-size: 18px;
  font-weight: 600;
  text-align: center;
}

/* 
   LEFT PANEL
 */
.left-panel {
  background: var(--color-bg-darkest);
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
}

.left-panel-header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}

.left-panel-header h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.accordion {
  padding: 0;
  margin: 0;
  flex: 1;
}

.accordion-item {
  margin-bottom: 8px;
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--color-bg-dark);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid transparent;
  user-select: none;
}

.accordion-header:hover {
  background: var(--color-bg-card);
}

.accordion-header.accordion-locked {
  background: var(--color-bg-dark);
  border-color: transparent;
}

.accordion-header.active,
.accordion-header.open {
  background: var(--color-bg-card);
  border-color: var(--color-accent-cyan);
}

.accordion-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
}

.accordion-icon {
  font-size: 12px;
  transition: transform var(--transition-fast);
  color: var(--color-text-muted);
  width: 14px;
  text-align: center;
}

.accordion-header.open .accordion-icon {
  transform: rotate(90deg);
}

.accordion-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  padding: 0;
}

.icon-btn:hover {
  background: var(--color-bg-card-hover);
  color: var(--color-accent-cyan);
}

.accordion-content {
  margin-top: 6px;
  display: none;
}

.accordion-content.show {
  display: block;
}

.accordion-child {
  padding: 8px 12px;
  margin-bottom: 4px;
  margin-left: 24px;
  background: var(--color-bg-input);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid transparent;
}

.accordion-child:hover {
  background: var(--color-bg-card);
  color: var(--color-text-primary);
}

.accordion-child.active {
  background: #5A7A8C !important;
  color: var(--color-text-primary) !important;
  border-color: #5ECBD1 !important;
  font-weight: 600 !important;
}

body[data-theme="light"] .accordion-child.active {
  background: #dbeafe !important;
  border-color: #bfdbfe !important;
  color: #1e293b !important;
}

.left-panel-footer {
  border-top: 1px solid var(--color-border);
  padding-top: 16px;
  margin-top: auto;
}

.word-count {
  font-size: 14px;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.word-count strong {
  color: var(--color-accent-cyan);
  font-size: 16px;
}

/* 
   CENTER PANEL
 */
.center-panel {
  background: var(--color-bg-medium);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.center-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding: 10px; 
}

.center-tabs {
  display: flex;
  align-items: stretch;
  background: var(--color-bg-dark);
  border-bottom: 2px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.tab-strip {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.tab-btn {
  padding: 14px 20px;
  background: transparent;
  border: none;
  border-right: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  flex: 1 1 140px;
}

.tab-btn:last-child {
  border-right: none;
}

.tab-btn:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-card);
}

.tab-btn.active {
  color: var(--color-text-primary);
  background: var(--color-bg-medium);
  border-bottom: 3px solid var(--color-accent-cyan);
  font-weight: 600;
}

.tab-btn svg {
  flex-shrink: 0;
  opacity: 0.8;
}

.tab-btn.active svg {
  opacity: 1;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/*
   DRAFT EDITOR 
 */
.draft-editor {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px); 
}

.editor-toolbar {
  flex-shrink: 0;
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  background: var(--color-bg-darkest);
  border-bottom: 1px solid var(--color-border);
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  border-radius: 8px 8px 0 0;
}

.editor-toolbar::-webkit-scrollbar {
  height: 3px;
}

.editor-toolbar::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}

.toolbar-btn {
  padding: 4px 8px;
  background: var(--color-bg-input);
  border: 1px solid var(--color-border);
  color: #FFF;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  min-width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toolbar-btn:hover {
  background: var(--color-bg-card);
  border-color: var(--color-accent-cyan);
}

.toolbar-select {
  padding: 5px 8px;
  background: var(--color-bg-input);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
}

input[type="color"] {
  cursor: pointer;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 2px;
}

input[type="color"]:hover {
  border-color: var(--color-accent-cyan);
}



#chapterContent:empty:before {
  content: attr(data-placeholder);
  color: var(--color-text-muted);
  opacity: 0.5;
}

#chapterContent:focus {
  outline: none;
}

.editor-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--color-bg-darkest);
  border-top: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--color-text-muted);
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 500px;
  text-align: center;
}

.empty-state p {
  font-size: 16px;
  color: var(--color-text-muted);
}

/* 
   ITEM CARDS
*/
.add-item-card {
  background: var(--color-bg-card);
  border: 2px dashed var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  cursor: pointer;
  transition: var(--transition-base);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.add-item-card:hover {
  border-color: var(--color-accent-cyan);
  background: var(--color-bg-card-hover);
  transform: translateY(-2px);
}

.add-item-card h4 {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 600;
}

.add-item-card p {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-muted);
}

.item-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.item-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: var(--transition-base);
  cursor: pointer;
}

.item-card:hover {
  border-color: var(--color-accent-cyan);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.item-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.item-card h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.item-card-menu {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.item-card-menu:hover {
  background: var(--color-bg-card-hover);
  color: var(--color-text-primary);
}

.character-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--color-bg-darkest);
  color: var(--color-text-primary);
  margin-bottom: 8px;
  text-transform: capitalize;
  border: 1px solid var(--color-border);
}

.character-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--color-accent-teal);
  color: white;
  margin-right: 6px;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
}

.back-btn:hover {
  background: var(--color-bg-card-hover);
  color: var(--color-text-primary);
}

.save-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--color-success);
  border: none;
  color: white;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.save-btn:hover {
  background: #229954;
}

.tag-input-wrapper {
  position: relative;
}

.tag-input-wrapper::before {
  content: '#';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-accent-cyan);
  font-size: 16px;
  font-weight: 600;
  pointer-events: none;
}

.tag-input-wrapper input {
  padding-left: 28px;
}

/* 
   RIGHT PANEL
 */
.right-panel {
  background: var(--color-bg-darkest);
  border-left: 1px solid var(--color-border);
  overflow-y: auto;
  padding: 20px 16px;
  width: 320px;
  min-width: 280px;
}

.right-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.right-panel-header h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.wb-accordion-item {
  margin-bottom: 10px;
  background: var(--color-bg-dark);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.wb-accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
}

.wb-accordion-header:hover {
  background: var(--color-bg-card);
}

.wb-accordion-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.wb-accordion-content {
  padding: 0 16px 16px 16px;
  display: none;
  border-top: 1px solid var(--color-border);
}

.wb-accordion-content.show {
  display: block;
}

.wb-character-item {
  background: var(--color-bg-dark);
  margin-bottom: 8px;
}

/* 
   EXPORT DROPDOWN
 */
#exportMenu {
  display: none;
  position: absolute;
  background: var(--color-bg-dark);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  min-width: 180px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  overflow: hidden;
}

#exportMenu a {
  display: block;
  padding: 12px 16px;
  color: var(--color-text-secondary);
  font-size: 13px;
  border-bottom: 1px solid var(--color-border);
}

#exportMenu a:last-child {
  border-bottom: none;
}

#exportMenu a:hover {
  background: var(--color-bg-darkest);
  color: var(--color-text-primary);
}

select {
  appearance: none;
  background-image: url('data:image/svg+xml;charset=UTF-8,<svg width="12" height="8" viewBox="0 0 12 8" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="%2395A5A6" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

/* 
   UTILITY
 */
.hidden {
  display: none !important;
}

/*
   SCROLLBAR
 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-darkest);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-border-light);
}

/*
   ACCESSIBILITY
 */

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--color-accent-cyan);
  outline-offset: 2px;
}

::selection {
  background: var(--color-accent-cyan);
  color: var(--color-text-dark);
}


/* 
   PANEL TOGGLE BUTTONS
 */
.panel-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--color-bg-dark);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  cursor: pointer;
  margin-left: 8px;
  transition: var(--transition-fast);
}
.panel-toggle-btn:hover {
  background: var(--color-bg-card);
  color: var(--color-accent-cyan);
  border-color: var(--color-accent-cyan);
}

.panel-toggle-btn.collapsed svg {
  transform: rotate(180deg); /* Rotate arrow when collapsed */
}
.panel-edge-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 100%;
  background: var(--color-bg-darkest);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  transition: var(--transition-fast);
}
.panel-edge-toggle svg {
  transition: transform var(--transition-fast);
}
.panel-edge-toggle:hover {
  background: var(--color-bg-card);
  color: var(--color-accent-cyan);
  border-color: var(--color-accent-cyan);
}
.panel-edge-toggle.collapsed svg {
  transform: rotate(180deg);
}
.panel-edge-toggle-left {
  border-right: 1px solid var(--color-border);
}
.panel-edge-toggle-right {
  border-left: 1px solid var(--color-border);
}
/*
   COLLAPSIBLE PANELS
*/

.project-editor.left-collapsed {
  grid-template-columns: 0px 1fr 320px; 
}
.project-editor.right-collapsed {
  grid-template-columns: 250px 1fr 0px; 
}
.project-editor.both-collapsed {
  grid-template-columns: 0px 1fr 0px; 
}

/* Hide panels when collapsed */
.left-panel.collapsed,
.right-panel.collapsed {
  width: 0;
  padding: 0;
  overflow: hidden;
  border: none;
  transition: width 0.3s ease, padding 0.3s ease;
}

/* Ensure center panel expands */
.center-panel {
  min-width: 0; 
}

/* 
Timeline 
 */
.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.event-timeline {
  background: var(--color-bg-dark);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.timeline-axis {
  position: relative;
  height: 44px;
  border-bottom: 1px dashed var(--color-border);
  margin: 4px 0 12px;
}

.axis-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  color: var(--color-text-muted);
  font-size: 11px;
  text-align: center;
  min-width: 36px;
  letter-spacing: 0.5px;
}

.axis-tick::after {
  content: '';
  display: block;
  width: 1px;
  height: 12px;
  background: var(--color-border);
  margin: 4px auto 0;
}

.timeline-rows {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-row {
  cursor: pointer;
}

.timeline-bar-track {
  position: relative;
  height: 32px;
  background: var(--color-bg-input);
  border-radius: 8px;
  overflow: hidden;
  margin: 4px 0 2px;
}

.timeline-bar-fill {
  position: absolute;
  top: 4px;
  height: 24px;
  background: linear-gradient(90deg, var(--color-accent-cyan), #6bc2ff);
  border-radius: 6px;
  display: inline-flex;
  justify-content: flex-start;
  align-items: center;
  padding: 0 10px;
  color: var(--color-text-dark);
  font-weight: 700;
  white-space: nowrap;
}

.timeline-bar-label {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-primary);
  z-index: 2;
  pointer-events: none;
}
.timeline-bar-fill.short-bar {
  color: #fff;
}

.timeline-bar-fill.short-bar .timeline-bar-label {
  display: inline;
}

.timeline-label-floating {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  color: #fff;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
  pointer-events: none;
}

.timeline-row-body {
  display: none;
  border-top: 1px solid var(--color-border);
  padding-top: 10px;
  margin-top: 6px;
}

.timeline-row.open .timeline-row-body {
  display: block;
}

.timeline-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.timeline-value {
  color: var(--color-text-primary);
  font-size: 13px;
}

.timeline-description {
  margin-top: 6px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.timeline-note {
  margin-top: 10px;
  padding: 10px;
  background: var(--color-bg-input);
  border-radius: 8px;
  border: 1px dashed var(--color-border);
}

.timeline-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(94, 203, 209, 0.12);
  color: var(--color-accent-cyan);
  border: 1px solid rgba(94, 203, 209, 0.35);
  font-size: 11px;
  margin: 0 6px 6px 0;
}

.timeline-chars .timeline-value {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.timeline-detail-panel {
  margin-top: 14px;
  padding: 12px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  min-height: 90px;
}

.timeline-detail-placeholder {
  color: var(--color-text-muted);
  font-size: 13px;
}

.timeline-detail-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timeline-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timeline-detail-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.timeline-detail-dates {
  color: var(--color-text-muted);
  font-size: 12px;
  margin-top: 2px;
}

.timeline-detail-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-chip.subtle {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
}

.timeline-row.selected .timeline-bar-track {
  box-shadow: 0 0 0 1px rgba(94, 203, 209, 0.35), 0 6px 20px rgba(0, 0, 0, 0.15);
}

.timeline-detail-menu {
  position: relative;
}

/* 
Character correlation graph 
*/

.char-correlation-panel {
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-bg-dark);
}

.char-graph-shell {
  width: 100%;
  height: 400px;
  background: var(--color-bg-input);
  border-radius: 12px;
  border: 1px solid var(--color-border);
  margin-top: 10px;
  position: relative;
}

.char-graph-shell svg {
  width: 100%;
  height: 100%;
}

.char-correlation-panel.collapsed .char-graph-shell,
.char-correlation-panel.collapsed .char-graph-legend {
  display: none;
}

.corr-filter-wrapper {
  position: relative;
}

.corr-filter-popup {
  display: none;
  position: absolute;
  right: 0;
  top: 110%;
  background: var(--color-bg-dark);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  padding: 10px;
  min-width: 180px;
  z-index: 150;
}

.corr-filter-popup.open {
  display: block;
}

.corr-filter-option {
  display: block;
  font-size: 12px;
  color: var(--color-text-primary);
  padding: 6px 4px;
}

.corr-filter-option input {
  margin-right: 8px;
}

.char-graph-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.char-graph-legend {
  margin-top: 8px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.corr-filter-chip {
  background: var(--color-bg-darkest);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--color-text-primary);
}

.corr-filter-chip input {
  margin-right: 6px;
}

.char-node circle {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.char-node:hover circle {
  transform: scale(1.05);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.char-node {
  cursor: grab;
}

.char-node.dragging {
  cursor: grabbing;
}

.char-node text {
  font-size: 14px;
  font-weight: 700;
  fill: #fff;
  stroke: #000;
  stroke-width: 2px;
  paint-order: stroke fill;
}

.char-edge {
  transition: stroke 0.15s ease, stroke-width 0.15s ease;
}

.char-edge:hover {
  stroke: var(--color-accent-cyan);
  stroke-width: 4;
}

.char-edge-label {
  pointer-events: none;
  font-size: 13px;
  font-weight: 700;
  fill: #fff;
  stroke: #000;
  stroke-width: 2.2px;
  paint-order: stroke fill;
}

.correlation-list {
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  gap: 10px;
  background: var(--color-bg-input);
  border: 2px solid var(--color-border);
  border-radius: 12px;
  padding: 12px;
  max-height: none;
  overflow: visible;
  width: 100%;
}

.correlation-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--color-text-primary);
  font-size: 12px;
}

.correlation-table th,
.correlation-table td {
  padding: 8px;
  border-bottom: 1px solid var(--color-border);
}

.corr-color-cell {
  text-align: center;
}

.correlation-table thead th {
  text-align: left;
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: var(--color-bg-darkest);
}

.correlation-color {
  width: 56px;
  height: 32px;
  padding: 2px;
  border: 2px solid var(--color-border);
  background: var(--color-bg-input);
  border-radius: 6px;
  display: inline-block;
  appearance: none;
  -webkit-appearance: none;
}

.correlation-label-input {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-input);
  color: var(--color-text-primary);
  font-size: 12px;
}

.correlation-head-select {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-input);
  color: var(--color-text-primary);
  font-size: 12px;
}


