/* PM-Tools Design System */
/* Dark Mode default, Light Mode via .theme-light on <body> */

/* ===== CSS Custom Properties ===== */
:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #21262d;
  --surface3: #2d333b;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --accent-subtle: rgba(88, 166, 255, 0.12);
  --danger: #f85149;
  --danger-hover: #ff6b64;
  --danger-subtle: rgba(248, 81, 73, 0.12);
  --success: #3fb950;
  --success-subtle: rgba(63, 185, 80, 0.12);
  --warning: #d29922;
  --warning-subtle: rgba(210, 153, 34, 0.12);

  /* Quadrant colors (Eisenhower) */
  --q1: rgba(248, 81, 73, 0.08);
  --q1-border: rgba(248, 81, 73, 0.3);
  --q1-accent: #f85149;
  --q2: rgba(88, 166, 255, 0.08);
  --q2-border: rgba(88, 166, 255, 0.3);
  --q2-accent: #58a6ff;
  --q3: rgba(210, 153, 34, 0.08);
  --q3-border: rgba(210, 153, 34, 0.3);
  --q3-accent: #d29922;
  --q4: rgba(139, 148, 158, 0.08);
  --q4-border: rgba(139, 148, 158, 0.25);
  --q4-accent: #8b949e;

  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  --glow: 0 0 0 1px var(--accent), 0 0 12px rgba(88, 166, 255, 0.15);
  --transition: 200ms ease;
}

.theme-light {
  --bg: #ffffff;
  --surface: #f6f8fa;
  --surface2: #eaeef2;
  --surface3: #dde1e6;
  --border: #d0d7de;
  --text: #1f2328;
  --text-muted: #656d76;
  --accent: #0969da;
  --accent-hover: #0860ca;
  --accent-subtle: rgba(9, 105, 218, 0.08);
  --danger: #cf222e;
  --danger-hover: #a40e26;
  --danger-subtle: rgba(207, 34, 46, 0.08);
  --success: #1a7f37;
  --success-subtle: rgba(26, 127, 55, 0.08);
  --warning: #9a6700;
  --warning-subtle: rgba(154, 103, 0, 0.08);

  --q1: rgba(207, 34, 46, 0.06);
  --q1-border: rgba(207, 34, 46, 0.25);
  --q1-accent: #cf222e;
  --q2: rgba(9, 105, 218, 0.06);
  --q2-border: rgba(9, 105, 218, 0.25);
  --q2-accent: #0969da;
  --q3: rgba(154, 103, 0, 0.06);
  --q3-border: rgba(154, 103, 0, 0.25);
  --q3-accent: #9a6700;
  --q4: rgba(101, 109, 118, 0.06);
  --q4-border: rgba(101, 109, 118, 0.2);
  --q4-accent: #656d76;

  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
  --glow: 0 0 0 1px var(--accent), 0 0 12px rgba(9, 105, 218, 0.12);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background-color var(--transition), color var(--transition);
}

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

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

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--surface3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.25;
  font-weight: 600;
  color: var(--text);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

small, .text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }

/* ===== Layout ===== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.container-lg {
  max-width: 1400px;
}

/* ===== Header ===== */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.2);
}

.app-header .container {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 56px;
}

.app-header-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.app-header-title a {
  color: inherit;
  text-decoration: none;
}

.app-header-title a:hover {
  color: var(--accent);
}

.header-spacer { flex: 1; }

/* ===== Footer ===== */
.app-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0.4rem 0;
  margin-top: auto;
}

.app-footer .container {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-spacer { flex: 1; }

/* ===== Page Layout ===== */
.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 56px);
}

.page-main {
  flex: 1;
  padding: 1.5rem 0;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.25;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition), box-shadow var(--transition), color var(--transition);
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(88, 166, 255, 0.3);
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--surface3);
  border-color: var(--text-muted);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-subtle);
  border-color: var(--danger-hover);
  box-shadow: 0 2px 8px rgba(248, 81, 73, 0.2);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--surface2);
  color: var(--text);
}

.btn-icon {
  padding: 0.375rem;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-sm);
}

.btn-sm {
  padding: 0.25rem 0.625rem;
  font-size: 0.8125rem;
}

/* ===== Form Elements ===== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="date"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238b949e' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
  cursor: pointer;
}

input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 150ms ease;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  animation: slideUp 200ms ease;
}

.modal-header {
  display: flex;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
  flex: 1;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
}

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

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

/* ===== Spacing Utilities ===== */
.mt-3 { margin-top: 0.75rem; }

/* ===== Badge ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 2rem;
  white-space: nowrap;
}

.badge-accent {
  background: var(--accent-subtle);
  color: var(--accent);
  border: 1px solid rgba(88, 166, 255, 0.2);
}

.badge-muted {
  background: var(--surface2);
  color: var(--text-muted);
}

/* ===== App Tile (Portal) ===== */
.app-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.875rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  min-height: 5.5rem;
}

.app-tile::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-subtle) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
}

.app-tile:hover::before { opacity: 1; }

.app-tile:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow), 0 0 16px var(--accent-subtle);
  transform: translateY(-2px);
  color: inherit;
  text-decoration: none;
}

.app-tile.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.app-tile-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.app-tile-name {
  font-weight: 600;
  font-size: 0.9375rem;
}

.app-tile-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* ===== Matrix Layout (SWOT, Eisenhower, Umfeldanalyse) ===== */
.matrix-wrapper {
  display: flex;
  gap: 0.5rem;
  flex-direction: column;
  height: calc(100vh - 7.5rem);
  min-height: 360px;
}
.matrix-x-labels {
  display: grid;
  grid-template-columns: 1.5rem 1fr 1fr;
  gap: 0.75rem;
  padding-right: 1.5rem;
}
.matrix-x-label {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}
.matrix-body {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  min-height: 0;
}
.matrix-y-label {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  flex-shrink: 0;
  width: 1.5rem;
}
.matrix-y-label span {
  font-size: 0.75rem;
  color: var(--text-muted);
  user-select: none;
  writing-mode: sideways-lr;
}
.matrix-y-label .y-top  { }
.matrix-y-label .y-bottom { }
.matrix-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 0.625rem;
  min-height: 0;
}

@media (max-width: 640px) {
  .matrix-wrapper { height: auto; min-height: unset; }
  .matrix-grid {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, minmax(200px, auto));
  }
  .matrix-x-labels { display: none; }
  .matrix-y-label  { display: none; }
}

/* ===== Charter / SCAMPER Shared Layout ===== */
.charter-wrapper {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}
.charter-title-block {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.charter-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}
.charter-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.375rem;
  margin-bottom: 1rem;
}
.charter-section-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 1rem;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.charter-section-title::before {
  content: '▾';
  font-size: 0.75rem;
  transition: transform 0.2s ease;
  display: inline-block;
  width: 0.75rem;
  flex-shrink: 0;
}
.charter-section.collapsed .charter-section-title::before {
  transform: rotate(-90deg);
}
.charter-section-body {
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease;
  max-height: 2000px;
  opacity: 1;
}
.charter-section.collapsed .charter-section-body {
  max-height: 0;
  opacity: 0;
}

/* ===== No-Project Banner ===== */
.no-project-banner {
  background: var(--accent-subtle);
  border: 1px solid rgba(88, 166, 255, 0.2);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

/* ===== Quadrants ===== */
.quadrant {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color var(--transition);
  position: relative;
}

.quadrant.drag-over {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent-subtle);
}

.quadrant-q1 { background: var(--q1); border-color: var(--q1-border); }
.quadrant-q2 { background: var(--q2); border-color: var(--q2-border); }
.quadrant-q3 { background: var(--q3); border-color: var(--q3-border); }
.quadrant-q4 { background: var(--q4); border-color: var(--q4-border); }

.quadrant-header {
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.quadrant-header-q1 { border-color: var(--q1-border); }
.quadrant-header-q2 { border-color: var(--q2-border); }
.quadrant-header-q3 { border-color: var(--q3-border); }
.quadrant-header-q4 { border-color: var(--q4-border); }

.quadrant-label {
  font-weight: 600;
  font-size: 0.8125rem;
}

.quadrant-q1 .quadrant-label { color: var(--q1-accent); }
.quadrant-q2 .quadrant-label { color: var(--q2-accent); }
.quadrant-q3 .quadrant-label { color: var(--q3-accent); }
.quadrant-q4 .quadrant-label { color: var(--q4-accent); }

.quadrant-sublabel {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.quadrant-add-btn {
  margin-left: auto;
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}

.quadrant-add-btn:hover {
  background: var(--surface3);
  color: var(--text);
}

.quadrant-tasks {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.task-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.625rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  transition: all var(--transition);
  cursor: grab;
  position: relative;
}

.task-item:hover {
  border-color: var(--text-muted);
  box-shadow: var(--shadow);
}

.task-item.dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.task-item.done .task-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-checkbox {
  margin-top: 2px;
  flex-shrink: 0;
}

.task-content {
  flex: 1;
  min-width: 0;
}

.task-text {
  font-size: 0.875rem;
  line-height: 1.4;
  word-break: break-word;
}

.task-due {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.task-due.overdue {
  color: var(--danger);
}

.task-delete {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  opacity: 0;
  transition: all var(--transition);
}

.task-item:hover .task-delete {
  opacity: 1;
}

.task-delete:hover {
  background: var(--danger-subtle);
  color: var(--danger);
}

.task-add-form {
  padding: 0.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  flex-shrink: 0;
}

.task-add-form input[type="text"] {
  font-size: 0.8125rem;
  padding: 0.375rem 0.5rem;
}

.task-add-form input[type="date"] {
  font-size: 0.8125rem;
  padding: 0.375rem 0.5rem;
}

.task-add-actions {
  display: flex;
  gap: 0.375rem;
  justify-content: flex-end;
}

.done-section {
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.done-toggle {
  padding: 0.375rem 0.625rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  transition: color var(--transition);
}

.done-toggle:hover { color: var(--text); }

.done-tasks {
  padding: 0.375rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  max-height: 120px;
  overflow-y: auto;
}

/* ===== Empty State ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3.5rem;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
}

.empty-state-desc {
  font-size: 0.875rem;
  max-width: 360px;
  line-height: 1.6;
}

/* ===== Divider ===== */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

/* ===== Section ===== */
.section {
  margin-bottom: 2rem;
}

/* ===== Toast / Notification ===== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 200ms ease;
  pointer-events: auto;
  max-width: 320px;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-danger { border-left: 3px solid var(--danger); }
.toast-info { border-left: 3px solid var(--accent); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== Theme Toggle ===== */
.theme-toggle {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all var(--transition);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--surface3);
  border-color: var(--text-muted);
}

/* ===== Project Selector ===== */
.project-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 1;
  min-width: 0;
}

.project-selector select {
  max-width: 220px;
  padding: 0.375rem 2rem 0.375rem 0.625rem;
  font-size: 0.8125rem;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .app-header .container { height: 48px; }
  .app-header-title { font-size: 1rem; }
  .app-header-title a { display: none; }
  .app-header-title .sep { display: none; }
  .modal { max-width: 100%; max-height: 90vh; display: flex; flex-direction: column; }
  .modal-body { overflow-y: auto; flex: 1; }
  .toast-container { left: 1rem; right: 1rem; bottom: 1rem; }
  .toast { max-width: 100%; }
}

@media (max-width: 480px) {
  .project-selector select { max-width: 120px; font-size: 0.8rem; }
  .theme-toggle { padding: 0.2rem 0.35rem; font-size: 0.9rem; }
}

/* ===== Utility Classes ===== */
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}


/* ===== CloudStorage Modal Theme Overrides ===== */
.cs-modal-overlay {
  background: rgba(0, 0, 0, 0.6) !important;
}
.cs-modal {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-lg) !important;
}
.cs-modal h3 { color: var(--text) !important; }
.cs-modal-close {
  color: var(--text-muted) !important;
}
.cs-modal-close:hover {
  color: var(--text) !important;
}
.cs-modal input {
  background: var(--bg) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
  border-radius: var(--radius-sm) !important;
}
.cs-modal input:focus {
  border-color: var(--accent) !important;
  outline: none !important;
  box-shadow: var(--glow) !important;
}
.cs-modal button:not(.cs-modal-close) {
  background: var(--surface2) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
  border-radius: var(--radius-sm) !important;
}
.cs-modal button:not(.cs-modal-close):hover {
  background: var(--surface3) !important;
  border-color: var(--text-muted) !important;
}
.cs-modal button.primary {
  background: var(--accent) !important;
  color: #0d1117 !important;
  border-color: var(--accent) !important;
}
.cs-modal button.primary:hover {
  background: var(--accent-hover) !important;
  border-color: var(--accent-hover) !important;
}
.cs-modal .cs-error { color: var(--danger) !important; }
.cs-modal .cs-info { color: var(--text-muted) !important; }
.cs-modal hr { border-color: var(--border) !important; }
.cs-modal label { color: var(--text-muted) !important; }

/* ===== PMDataMenu ===== */
.pm-data-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.pm-data-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  padding: 4px 0;
}
.pm-data-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 0.8125rem;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background var(--transition);
}
.pm-data-item:hover:not(:disabled) {
  background: var(--surface2);
}
.pm-data-project-name {
  padding: 8px 14px 4px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pm-data-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.pm-data-hint {
  padding: 4px 14px 6px;
  font-size: 0.6875rem;
  color: var(--text-muted);
}

/* Data menu button sizing */
.pm-data-menu .theme-toggle {
  font-size: 1.3rem;
}

/* ===== PMMulti Tab Bar ===== */
.pm-multi-bar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.pm-multi-tab {
  padding: 0.2rem 0.625rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: none;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.5;
}
.pm-multi-tab:hover { color: var(--text); background: var(--surface2); }
.pm-multi-tab.active {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text);
  font-weight: 600;
}
.pm-multi-tab.active-editing { outline: 2px solid var(--accent); }
.pm-multi-actions { margin-left: auto; display: flex; gap: 0.25rem; }
.pm-multi-bar--single { padding: 0.2rem 0; border-bottom-color: transparent; }
.pm-multi-bar--single .pm-multi-tab:not(.pm-multi-actions *) { display: none; }

/* Footer project selector */
.footer-project-selector {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.footer-project-selector select {
  font-size: 0.75rem;
  padding: 0.1rem 0.25rem;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-width: 160px;
}
