/* ============================================================
   STYLE DEMO – Schnüddels
   ============================================================ */

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

/* ========================
   GLOBAL TOKENS
   ======================== */
:root {
  --toolbar-h:   56px;
  --radius-xs:   3px;
  --radius-sm:   5px;
  --radius:      8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-pill: 9999px;
  --transition:  0.18s ease;
}

/* ========================
   THEMES
   ======================== */
html, html.theme-light,
body, body.theme-light {
  --bg:            #f8fafc;
  --bg-surface:    #ffffff;
  --bg-secondary:  #f1f5f9;
  --bg-tertiary:   #e2e8f0;
  --text:          #1e293b;
  --text-secondary:#475569;
  --text-muted:    #94a3b8;
  --text-inv:      #ffffff;
  --primary:       #4f46e5;
  --primary-h:     #4338ca;
  --primary-light: #eef2ff;
  --success:       #059669;
  --success-h:     #047857;
  --success-light: #d1fae5;
  --warning:       #d97706;
  --warning-h:     #b45309;
  --warning-light: #fef3c7;
  --danger:        #dc2626;
  --danger-h:      #b91c1c;
  --danger-light:  #fee2e2;
  --info:          #0284c7;
  --info-h:        #0369a1;
  --info-light:    #e0f2fe;
  --border:        #e2e8f0;
  --border-focus:  #4f46e5;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:    0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.03);
}

html.theme-dark, body.theme-dark {
  --bg: #0f172a; --bg-surface: #1e293b; --bg-secondary: #1e293b; --bg-tertiary: #334155;
  --text: #f1f5f9; --text-secondary: #94a3b8; --text-muted: #64748b; --text-inv: #0f172a;
  --primary: #818cf8; --primary-h: #a5b4fc; --primary-light: #1e1b4b;
  --success: #34d399; --success-h: #6ee7b7; --success-light: #064e3b;
  --warning: #fbbf24; --warning-h: #fcd34d; --warning-light: #451a03;
  --danger:  #f87171; --danger-h:  #fca5a5; --danger-light:  #450a0a;
  --info:    #38bdf8; --info-h:    #7dd3fc; --info-light:    #0c4a6e;
  --border: #334155; --border-focus: #818cf8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.35);
  --shadow:    0 4px 12px rgba(0,0,0,0.45);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.55);
}

html.theme-nature, body.theme-nature {
  --bg: #f0fdf4; --bg-surface: #ffffff; --bg-secondary: #dcfce7; --bg-tertiary: #bbf7d0;
  --text: #14532d; --text-secondary: #166534; --text-muted: #4ade80; --text-inv: #ffffff;
  --primary: #16a34a; --primary-h: #15803d; --primary-light: #dcfce7;
  --success: #15803d; --success-h: #166534; --success-light: #bbf7d0;
  --warning: #ca8a04; --warning-h: #a16207; --warning-light: #fef9c3;
  --danger: #dc2626; --danger-h: #b91c1c; --danger-light: #fee2e2;
  --info: #0891b2; --info-h: #0e7490; --info-light: #cffafe;
  --border: #bbf7d0; --border-focus: #16a34a;
  --shadow-sm: 0 1px 3px rgba(20,83,45,0.08);
  --shadow: 0 4px 12px rgba(20,83,45,0.10);
  --shadow-lg: 0 8px 24px rgba(20,83,45,0.13);
}

html.theme-ocean, body.theme-ocean {
  --bg: #f0f9ff; --bg-surface: #ffffff; --bg-secondary: #e0f2fe; --bg-tertiary: #bae6fd;
  --text: #0c4a6e; --text-secondary: #0369a1; --text-muted: #7dd3fc; --text-inv: #ffffff;
  --primary: #0284c7; --primary-h: #0369a1; --primary-light: #e0f2fe;
  --success: #059669; --success-h: #047857; --success-light: #d1fae5;
  --warning: #d97706; --warning-h: #b45309; --warning-light: #fef3c7;
  --danger: #dc2626; --danger-h: #b91c1c; --danger-light: #fee2e2;
  --info: #0284c7; --info-h: #0369a1; --info-light: #e0f2fe;
  --border: #bae6fd; --border-focus: #0284c7;
  --shadow-sm: 0 1px 3px rgba(12,74,110,0.08);
  --shadow: 0 4px 12px rgba(12,74,110,0.10);
  --shadow-lg: 0 8px 24px rgba(12,74,110,0.13);
}

html.theme-retro, body.theme-retro {
  --bg: #fdf6e3; --bg-surface: #fffbf0; --bg-secondary: #f5e6c8; --bg-tertiary: #e8d0a8;
  --text: #3c2a1a; --text-secondary: #6b4c2a; --text-muted: #a08060; --text-inv: #fffbf0;
  --primary: #c0562a; --primary-h: #a04020; --primary-light: #fce8d8;
  --success: #5a7a2a; --success-h: #4a6620; --success-light: #e8f0d0;
  --warning: #c08020; --warning-h: #a06818; --warning-light: #fce8b0;
  --danger: #c02020; --danger-h: #a01818; --danger-light: #fce0d0;
  --info: #2a6080; --info-h: #1a4a66; --info-light: #d0e8f0;
  --border: #d4b896; --border-focus: #c0562a;
  --shadow-sm: 0 1px 3px rgba(60,42,26,0.10);
  --shadow: 0 4px 12px rgba(60,42,26,0.12);
  --shadow-lg: 0 8px 24px rgba(60,42,26,0.16);
}

/* ========================
   FONTS (System + Google)
   Google Fonts werden per JS on-demand geladen
   ======================== */

/* System / Safe fonts */
html, body,
html.font-sans, body.font-sans {
  --font: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}
html.font-serif,    body.font-serif    { --font: Georgia, "Times New Roman", "Liberation Serif", serif; }
html.font-mono,     body.font-mono     { --font: "Courier New", Courier, "Liberation Mono", monospace; }
html.font-humanist, body.font-humanist { --font: Verdana, "Trebuchet MS", Geneva, sans-serif; }
html.font-geometric,body.font-geometric{ --font: "Century Gothic", "Futura", Trebuchet MS, sans-serif; }

/* Google Fonts – Sans-Serif */
html.font-inter,      body.font-inter      { --font: "Inter",       system-ui, sans-serif; }
html.font-roboto,     body.font-roboto     { --font: "Roboto",      system-ui, sans-serif; }
html.font-opensans,   body.font-opensans   { --font: "Open Sans",   system-ui, sans-serif; }
html.font-lato,       body.font-lato       { --font: "Lato",        system-ui, sans-serif; }
html.font-poppins,    body.font-poppins    { --font: "Poppins",     system-ui, sans-serif; }
html.font-nunito,     body.font-nunito     { --font: "Nunito",      Tahoma, sans-serif; }
html.font-raleway,    body.font-raleway    { --font: "Raleway",     system-ui, sans-serif; }
html.font-montserrat, body.font-montserrat { --font: "Montserrat",  system-ui, sans-serif; }
html.font-barlow,     body.font-barlow     { --font: "Barlow",      system-ui, sans-serif; }

/* Google Fonts – Serif */
html.font-playfair,    body.font-playfair    { --font: "Playfair Display",  Georgia, serif; }
html.font-merriweather,body.font-merriweather{ --font: "Merriweather",      Georgia, serif; }
html.font-garamond,    body.font-garamond    { --font: "EB Garamond",       Georgia, serif; }
html.font-libre,       body.font-libre       { --font: "Libre Baskerville", Georgia, serif; }
html.font-lora,        body.font-lora        { --font: "Lora",              Georgia, serif; }

/* Google Fonts – Display / Extravagant */
html.font-oswald,    body.font-oswald    { --font: "Oswald",          system-ui, sans-serif; }
html.font-abril,     body.font-abril     { --font: "Abril Fatface",   Georgia, serif; }
html.font-lobster,   body.font-lobster   { --font: "Lobster",         Georgia, cursive; }
html.font-pacifico,  body.font-pacifico  { --font: "Pacifico",        Georgia, cursive; }
html.font-dancing,   body.font-dancing   { --font: "Dancing Script",  Georgia, cursive; }
html.font-cinzel,    body.font-cinzel    { --font: "Cinzel",          Georgia, serif; }
html.font-bebas,     body.font-bebas     { --font: "Bebas Neue",      Arial Narrow, sans-serif; }
html.font-press,     body.font-press     { --font: "Press Start 2P",  "Courier New", monospace; }
html.font-righteous, body.font-righteous { --font: "Righteous",       system-ui, sans-serif; }
html.font-comfortaa, body.font-comfortaa { --font: "Comfortaa",       Tahoma, sans-serif; }

/* ========================
   GLOBAL STYLES
   ======================== */
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  padding-top: var(--toolbar-h);
  transition: background-color 0.25s, color 0.25s;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-h); text-decoration: underline; }

code {
  font-family: "Courier New", Courier, monospace;
  background: var(--bg-secondary);
  color: var(--primary);
  padding: 0.15em 0.45em;
  border-radius: var(--radius-xs);
  font-size: 0.88em;
  border: 1px solid var(--border);
}
pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.75;
  margin: 1rem 0;
}
pre code { background: none; border: none; padding: 0; color: var(--text); font-size: inherit; }

blockquote {
  border-left: 4px solid var(--primary);
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  background: var(--primary-light);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--text-secondary);
}
blockquote cite { display: block; margin-top: 0.5rem; font-style: normal; font-size: 0.875rem; color: var(--text-muted); }

/* ========================
   TOOLBAR
   ======================== */
.toolbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--toolbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 1000;
  transition: background 0.25s, border-color 0.25s;
}
.toolbar-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 1.5rem;
  gap: 1rem;
}
.toolbar-brand {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  white-space: nowrap;
}
.brand-icon { font-size: 1.25rem; }

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
  flex-wrap: nowrap;
}
.ctrl-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
}
.ctrl-group label { color: var(--text-secondary); font-weight: 500; white-space: nowrap; }
.ctrl-group select {
  padding: 0.28rem 1.9rem 0.28rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.82rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  transition: border-color var(--transition);
  max-width: 160px;
}
.ctrl-group select:hover  { border-color: var(--border-focus); }
.ctrl-group select:focus  { outline: none; border-color: var(--border-focus); }

/* ========================
   LAYOUT
   ======================== */
.page-wrapper { min-height: calc(100vh - var(--toolbar-h) - 52px); }

/* Centered */
html.layout-centered .sidebar, body.layout-centered .sidebar { display: none; }
html.layout-centered .main-content, body.layout-centered .main-content {
  max-width: 940px; margin: 0 auto; padding: 2.5rem 2rem;
}

/* Sidebar */
html.layout-sidebar .page-wrapper, body.layout-sidebar .page-wrapper {
  display: grid; grid-template-columns: 240px 1fr; align-items: start;
}
html.layout-sidebar .sidebar, body.layout-sidebar .sidebar {
  display: block;
  position: sticky;
  top: var(--toolbar-h);
  height: calc(100vh - var(--toolbar-h));
  overflow-y: auto;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  transition: background 0.25s;
}
html.layout-sidebar .main-content, body.layout-sidebar .main-content {
  max-width: none; padding: 2.5rem;
}

/* Full Width */
html.layout-fullwidth .sidebar, body.layout-fullwidth .sidebar { display: none; }
html.layout-fullwidth .main-content, body.layout-fullwidth .main-content {
  max-width: none; padding: 2.5rem 4rem;
}

/* Sidebar Nav */
.sidebar-title {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--text-muted); font-weight: 700; margin-bottom: 0.75rem;
}
.sidebar ul { list-style: none; display: flex; flex-direction: column; gap: 0.1rem; }
.sidebar ul li a {
  display: block; padding: 0.45rem 0.75rem; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 0.875rem;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}
.sidebar ul li a:hover { background: var(--bg-tertiary); color: var(--text); text-decoration: none; }

/* ========================
   DEMO SECTIONS
   ======================== */
.demo-section {
  margin-bottom: 3.5rem; padding-bottom: 3rem;
  border-bottom: 1px solid var(--border);
}
.demo-section:last-child { border-bottom: none; margin-bottom: 0; }

.section-title {
  font-size: 1.5rem; font-weight: 800; color: var(--text);
  margin-bottom: 1.75rem; padding-bottom: 0.65rem;
  border-bottom: 3px solid var(--primary); display: inline-block;
}
.demo-section > h3 {
  font-size: 0.72rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em; margin: 1.75rem 0 0.75rem;
}
.demo-section > h3:first-of-type { margin-top: 0; }
.demo-row { display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: flex-start; margin-bottom: 0.25rem; }
.demo-row-align { align-items: center; }

/* ========================
   TYPOGRAPHY SECTION
   ======================== */
#typography h1 { font-size: 2.25rem; font-weight: 800; line-height: 1.15; margin: 0.75rem 0 0.5rem; }
#typography h2 { font-size: 1.75rem; font-weight: 700; line-height: 1.25; margin: 0.75rem 0 0.4rem; }
#typography h3 { font-size: 1.375rem; font-weight: 600; line-height: 1.35; margin: 0.65rem 0 0.35rem; }
#typography h4 { font-size: 1.125rem; font-weight: 600; margin: 0.6rem 0 0.3rem; }
#typography h5 { font-size: 1rem; font-weight: 600; margin: 0.5rem 0 0.25rem; }
#typography h6 { font-size: 0.875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin: 0.5rem 0 0.25rem; color: var(--text-secondary); }
.lead { font-size: 1.125rem; color: var(--text-secondary); line-height: 1.75; margin: 1rem 0; }

/* ========================
   BUTTONS
   ======================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4em;
  padding: 0.5rem 1.1rem; font-family: var(--font); font-size: 0.9rem; font-weight: 500;
  line-height: 1.4; border-radius: var(--radius-sm); border: 2px solid transparent;
  cursor: pointer; transition: all var(--transition); text-decoration: none !important;
  white-space: nowrap; user-select: none; vertical-align: middle;
}
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn-xs { padding: 0.2rem 0.55rem; font-size: 0.75rem; border-width: 1px; border-radius: var(--radius-xs); }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.82rem; }
.btn-lg { padding: 0.7rem 1.6rem; font-size: 1rem; font-weight: 600; border-radius: var(--radius); }

.btn-primary   { background: var(--primary);    color: var(--text-inv); border-color: var(--primary);  }
.btn-primary:hover   { background: var(--primary-h);  border-color: var(--primary-h); }
.btn-secondary { background: var(--bg-secondary); color: var(--text);    border-color: var(--border);   }
.btn-secondary:hover { background: var(--bg-tertiary); }
.btn-success   { background: var(--success);    color: #fff;            border-color: var(--success);  }
.btn-success:hover   { background: var(--success-h);  border-color: var(--success-h); }
.btn-danger    { background: var(--danger);     color: #fff;            border-color: var(--danger);   }
.btn-danger:hover    { background: var(--danger-h);   border-color: var(--danger-h); }
.btn-warning   { background: var(--warning);    color: #fff;            border-color: var(--warning);  }
.btn-warning:hover   { background: var(--warning-h);  border-color: var(--warning-h); }
.btn-info      { background: var(--info);       color: #fff;            border-color: var(--info);     }
.btn-info:hover      { background: var(--info-h);     border-color: var(--info-h); }

.btn-outline-primary   { background: transparent; color: var(--primary);  border-color: var(--primary);  }
.btn-outline-primary:hover   { background: var(--primary);  color: var(--text-inv); }
.btn-outline-secondary { background: transparent; color: var(--text);     border-color: var(--border);   }
.btn-outline-secondary:hover { background: var(--bg-secondary); }
.btn-outline-success   { background: transparent; color: var(--success);  border-color: var(--success);  }
.btn-outline-success:hover   { background: var(--success);  color: #fff; }
.btn-outline-danger    { background: transparent; color: var(--danger);   border-color: var(--danger);   }
.btn-outline-danger:hover    { background: var(--danger);   color: #fff; }
.btn-outline-warning   { background: transparent; color: var(--warning);  border-color: var(--warning);  }
.btn-outline-warning:hover   { background: var(--warning);  color: #fff; }

.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-secondary); color: var(--text); }
.btn-link  { background: transparent; color: var(--primary); border-color: transparent; padding-left: 0; padding-right: 0; }
.btn-link:hover { text-decoration: underline !important; }

.btn-active { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

.btn-loading { opacity: 0.8; cursor: wait; pointer-events: none; }
.btn-spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.4); border-top-color: currentColor;
  border-radius: 50%; animation: spin 0.65s linear infinite; flex-shrink: 0;
}

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.btn-group .btn:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-group .btn + .btn { margin-left: -2px; }

/* ========================
   FORMS
   ======================== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.25rem; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.form-group { margin-bottom: 1.25rem; }
.form-group > label {
  display: flex; align-items: center; gap: 0.35rem;
  font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 0.4rem;
}
.form-control {
  width: 100%; padding: 0.5rem 0.875rem; font-family: var(--font); font-size: 0.9rem;
  line-height: 1.5; color: var(--text); background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  appearance: none; -webkit-appearance: none;
}
.form-control:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2.25rem; cursor: pointer;
}
select[multiple].form-control { padding-right: 0.875rem; background-image: none; }
textarea.form-control { resize: vertical; min-height: 100px; }

.check-list { display: flex; flex-direction: column; gap: 0.5rem; }
.checkbox-label, .radio-label {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-size: 0.9rem; cursor: pointer; user-select: none; color: var(--text);
}
.checkbox-label input, .radio-label input { width: 1rem; height: 1rem; cursor: pointer; accent-color: var(--primary); flex-shrink: 0; }

.toggle-label { display: inline-flex; align-items: center; gap: 0.75rem; cursor: pointer; font-size: 0.9rem; user-select: none; color: var(--text); }
.toggle-input { display: none; }
.toggle-track {
  position: relative; width: 44px; height: 24px; background: var(--bg-tertiary);
  border-radius: var(--radius-pill); border: 1px solid var(--border); flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition); cursor: pointer;
}
.toggle-thumb {
  position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  background: var(--text-muted); border-radius: 50%;
  transition: transform var(--transition), background var(--transition);
}
.toggle-input:checked + .toggle-track { background: var(--primary); border-color: var(--primary); }
.toggle-input:checked + .toggle-track .toggle-thumb { transform: translateX(20px); background: #fff; }
.toggle-input:disabled + .toggle-track { opacity: 0.5; cursor: not-allowed; }

.form-range { width: 100%; accent-color: var(--primary); cursor: pointer; margin: 0.5rem 0; }
.range-labels { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-muted); }
.range-val { font-weight: 700; color: var(--primary); font-size: 0.85rem; margin-left: 0.35rem; }
.form-actions { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0; flex-wrap: wrap; }

/* ========================
   CARDS
   ======================== */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1.25rem; }
.card {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card-elevated { box-shadow: var(--shadow); }
.card-elevated:hover { box-shadow: var(--shadow-lg); }
.card-accent { border-left: 4px solid var(--primary); }

.card-body { padding: 1.25rem; flex: 1; }
.card-title { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 0.45rem; }
.card-text  { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.6; margin: 0; }
.card-footer {
  padding: 0.875rem 1.25rem; border-top: 1px solid var(--border);
  background: var(--bg-secondary); display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap;
}

.card-img { width: 100%; height: 160px; overflow: hidden; }
.img-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  color: var(--text-muted);
}

.card-stat .card-body { text-align: center; padding: 1.75rem 1.25rem; }
.stat-icon  { font-size: 2.25rem; margin-bottom: 0.5rem; line-height: 1; }
.stat-value { font-size: 2.25rem; font-weight: 800; color: var(--text); }
.stat-label { font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; margin: 0.3rem 0; }
.stat-delta { font-size: 0.8rem; font-weight: 600; }
.stat-delta.positive { color: var(--success); }
.stat-delta.negative { color: var(--danger); }

.card-horizontal { flex-direction: row; }
.card-img-side { width: 110px; flex-shrink: 0; }
.card-img-side .img-placeholder { height: 100%; }

.feature-list { list-style: none; margin-top: 0.75rem; display: flex; flex-direction: column; gap: 0.3rem; }
.feature-list li { font-size: 0.875rem; color: var(--text-secondary); padding-left: 1.1rem; position: relative; }
.feature-list li::before { content: '✓'; position: absolute; left: 0; color: var(--success); font-weight: 700; }
.text-muted { color: var(--text-muted) !important; font-size: 0.82rem; }

/* ========================
   TABLE
   ======================== */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; background: var(--bg-surface); }
.table thead tr { background: var(--bg-secondary); border-bottom: 2px solid var(--border); }
.table th { padding: 0.75rem 1rem; text-align: left; font-weight: 700; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); white-space: nowrap; }
.table td { padding: 0.75rem 1rem; color: var(--text); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:nth-child(even) { background: var(--bg-secondary); }
.table tbody tr:hover { background: var(--primary-light); }

/* ========================
   ALERTS
   ======================== */
.alert {
  display: flex; align-items: flex-start; gap: 0.65rem;
  padding: 0.9rem 1.1rem; border-radius: var(--radius-sm); border: 1px solid;
  margin-bottom: 0.875rem; font-size: 0.9rem; line-height: 1.55;
}
.alert:last-child { margin-bottom: 0; }
.alert-icon { font-size: 1.1rem; line-height: 1.3; flex-shrink: 0; }
.alert-info    { background: var(--info-light);    border-color: var(--info);    color: var(--info);    }
.alert-success { background: var(--success-light); border-color: var(--success); color: var(--success); }
.alert-warning { background: var(--warning-light); border-color: var(--warning); color: var(--warning); }
.alert-danger  { background: var(--danger-light);  border-color: var(--danger);  color: var(--danger);  }

/* ========================
   BADGES & TAGS
   ======================== */
.badge {
  display: inline-flex; align-items: center; padding: 0.2em 0.55em;
  font-size: 0.72rem; font-weight: 700; line-height: 1; border-radius: var(--radius-xs);
  text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; vertical-align: middle;
}
.badge-primary   { background: var(--primary);   color: var(--text-inv); }
.badge-secondary { background: var(--bg-tertiary); color: var(--text); }
.badge-success   { background: var(--success);   color: #fff; }
.badge-danger    { background: var(--danger);    color: #fff; }
.badge-warning   { background: var(--warning);   color: #fff; }
.badge-info      { background: var(--info);      color: #fff; }
.badge-pill      { border-radius: var(--radius-pill); }

.tag {
  display: inline-flex; align-items: center; padding: 0.3em 0.8em;
  background: var(--bg-secondary); color: var(--text-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-pill); font-size: 0.8rem; font-weight: 500; cursor: default;
  transition: background var(--transition);
}
.tag:hover { background: var(--bg-tertiary); }
.tag-primary { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

/* ========================
   PROGRESS
   ======================== */
.progress-list { display: flex; flex-direction: column; gap: 0.9rem; }
.progress-label { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; margin-bottom: 0.3rem; }
.progress-bar   { height: 9px; background: var(--bg-tertiary); border-radius: var(--radius-pill); overflow: hidden; }
.progress-fill  { height: 100%; background: var(--primary); border-radius: var(--radius-pill); transition: width 0.6s ease; }
.progress-success { background: var(--success); }
.progress-warning { background: var(--warning); }
.progress-danger  { background: var(--danger);  }

/* ========================
   BREADCRUMBS
   ======================== */
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem; font-size: 0.875rem; }
.breadcrumb a { color: var(--primary); }
.breadcrumb a:hover { text-decoration: underline; }
.bc-sep     { color: var(--text-muted); }
.bc-current { color: var(--text-secondary); font-weight: 500; }

/* ========================
   DIVIDERS
   ======================== */
.divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.divider-dashed { border-top-style: dashed; }
.divider-text { display: flex; align-items: center; gap: 1rem; margin: 1rem 0; color: var(--text-muted); font-size: 0.8rem; }
.divider-text::before, .divider-text::after { content: ''; flex: 1; border-top: 1px solid var(--border); }

/* ========================
   TOOLTIPS
   ======================== */
.tooltip-wrap { position: relative; display: inline-block; }
.tooltip-wrap::after {
  content: attr(data-tooltip); position: absolute;
  bottom: calc(100% + 9px); left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 0.35rem 0.7rem; border-radius: var(--radius-sm);
  font-size: 0.78rem; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity 0.15s; z-index: 200;
}
.tooltip-wrap::before {
  content: ''; position: absolute; bottom: calc(100% + 3px); left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--text);
  pointer-events: none; opacity: 0; transition: opacity 0.15s; z-index: 200;
}
.tooltip-wrap:hover::after, .tooltip-wrap:hover::before { opacity: 1; }
.tooltip-bottom::after { top: calc(100% + 9px); bottom: auto; }
.tooltip-bottom::before { top: calc(100% + 3px); bottom: auto; border-top-color: transparent; border-bottom-color: var(--text); }
.tooltip-right::after  { left: calc(100% + 9px); top: 50%; bottom: auto; transform: translateY(-50%); }
.tooltip-right::before { left: calc(100% + 3px); top: 50%; bottom: auto; transform: translateY(-50%); border-top-color: transparent; border-right-color: var(--text); }

/* ========================
   AVATAR
   ======================== */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; background: var(--primary);
  color: var(--text-inv); font-weight: 700; font-size: 0.85rem; text-transform: uppercase; flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 0.65rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.15rem; }
.avatar-success { background: var(--success); }
.avatar-danger  { background: var(--danger);  }
.avatar-warning { background: var(--warning); }

/* ========================
   SPINNER
   ======================== */
.spinner {
  width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; flex-shrink: 0;
}
.spinner-sm { width: 18px; height: 18px; border-width: 2px; }
.spinner-lg { width: 48px; height: 48px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-text { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: var(--text-secondary); }

/* ========================
   LIST GROUP
   ======================== */
.list-group { list-style: none; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.list-group-item { padding: 0.75rem 1.1rem; background: var(--bg-surface); border-bottom: 1px solid var(--border); font-size: 0.9rem; color: var(--text); }
.list-group-item:last-child { border-bottom: none; }
.list-group-item:hover { background: var(--bg-secondary); }
.list-group-item-active  { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.list-group-item-success { background: var(--success-light); color: var(--success); }
.list-group-item-danger  { background: var(--danger-light);  color: var(--danger);  }

/* ========================
   FOOTER
   ======================== */
.page-footer {
  border-top: 1px solid var(--border); background: var(--bg-surface);
  padding: 0.875rem 0; margin-top: 1rem;
  font-size: 0.8rem; color: var(--text-muted);
  transition: background 0.25s, border-color 0.25s;
}
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.footer-state strong { color: var(--primary); }
body.layout-centered  .footer-inner { max-width: 940px; margin: 0 auto; padding: 0 2rem; }
body.layout-sidebar   .footer-inner { padding: 0 2.5rem; }
body.layout-fullwidth .footer-inner { padding: 0 4rem; }

/* ========================
   EXPORT MODAL
   ======================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
  padding: 1rem;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.2s;
}
.modal-overlay.open .modal-card { transform: translateY(0) scale(1); }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
  gap: 1rem;
}
.modal-title { font-weight: 700; font-size: 1rem; color: var(--text); display: flex; align-items: center; gap: 0.5rem; }
.modal-close {
  background: none; border: none; cursor: pointer; font-size: 1rem;
  color: var(--text-muted); padding: 0.25rem; border-radius: var(--radius-sm);
  line-height: 1; transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: var(--bg-secondary); color: var(--text); }

.modal-meta {
  padding: 0.75rem 1.25rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-secondary);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.modal-meta strong { color: var(--primary); }

.modal-tabs {
  display: flex; gap: 0; padding: 0 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}
.modal-tab {
  padding: 0.6rem 1.1rem; border: none; background: none; cursor: pointer;
  font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); font-family: var(--font);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
}
.modal-tab:hover { color: var(--text); }
.modal-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.modal-body {
  flex: 1; overflow: auto; padding: 0;
}
.modal-code {
  margin: 0; border: none; border-radius: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.82rem;
  line-height: 1.7;
  padding: 1.25rem 1.5rem;
  white-space: pre;
  min-height: 300px;
}

.modal-footer {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.875rem 1.25rem; border-top: 1px solid var(--border);
  background: var(--bg-surface);
}
.copy-feedback {
  font-size: 0.82rem;
  color: var(--success);
  font-weight: 600;
  transition: opacity 0.3s;
  flex: 1;
}

/* ========================
   SCROLLBAR
   ======================== */
::-webkit-scrollbar         { width: 8px; height: 8px; }
::-webkit-scrollbar-track   { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb   { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ========================
   RESPONSIVE
   ======================== */
@media (max-width: 900px) {
  .toolbar-controls { gap: 0.5rem; }
  .ctrl-group label { display: none; }
}
@media (max-width: 768px) {
  html.layout-sidebar .page-wrapper, body.layout-sidebar .page-wrapper { grid-template-columns: 1fr; }
  html.layout-sidebar .sidebar, body.layout-sidebar .sidebar { display: none; }
  html.layout-sidebar .main-content, body.layout-sidebar .main-content { padding: 1.5rem 1rem; }
  html.layout-fullwidth .main-content, body.layout-fullwidth .main-content { padding: 1.5rem 1rem; }
}
@media (max-width: 480px) {
  html.layout-centered .main-content, body.layout-centered .main-content { padding: 1.5rem 1rem; }
  .cards-grid { grid-template-columns: 1fr; }
  .modal-card { max-height: 92vh; }
}
