/* ==========================================================================
   CSS Web Application — Exact Layout & Typography
   Interactive Top Theme Studio + 6 Default Themes + 7th Custom Mix & Match
   Strictly Burgundy, Ivory & Gold (ZERO Blues / Greys)
   ========================================================================== */

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

:root {
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --sidebar-w: 44px;
  --topbar-h: 38px;
  --subbar-h: 34px;
}

/* ==========================================================================
   THEME 1: ROYAL CLARET & IVORY
   ========================================================================== */
[data-theme="royal-claret"] {
  --bg-canvas: #FAF5EB;
  --bg-surface: #FFFDF9;
  --bg-surface-alt: #FBF6EC;
  --bg-topbar: #FFFDF9;
  --bg-subbar: #FFFDF9;

  --sidebar-bg: #4A0E1D;
  --sidebar-divider: #6B1D30;
  --sidebar-icon: #F2E4CC;
  --sidebar-icon-hover: #FFFDF9;
  --sidebar-hover-bg: #5E1427;
  --sidebar-active-bg: #EED9A8;
  --sidebar-active-icon: #4A0E1D;

  --topbar-text: #4A0E1D;
  --topbar-tab-bg: #F6ECD9;
  --topbar-tab-active-bg: #FFFDF9;
  --topbar-tab-text: #6B1A2E;
  --topbar-tab-active-text: #4A0E1D;
  --topbar-tab-indicator: #B8860B;
  --topbar-util-icon: #5C1527;
  --topbar-util-bg: #F7EEDB;
  --util-emblem-eye: #FFFDF9;

  --subbar-text: #7A2B3D;
  --subbar-active-text: #4A0E1D;
  --subbar-indicator: #B8860B;
  --subbar-meta: #7E4D24;

  --card-bg: #FFFDF9;
  --card-border: #E5D4B3;
  --card-shadow: 0 1px 3px rgba(74, 14, 29, 0.07);
  --card-header-bg: #F3E5C8;
  --card-header-text: #4A0E1D;
  --card-header-icon: #8C6214;
  --card-header-border: #E2CFA8;

  --item-border: #F2E7D3;
  --item-text: #6D1428;
  --item-icon: #9A6E1C;
  --item-hover-bg: #F7EBD4;
  --item-hover-text: #4A0E1D;

  --tooltip-bg: #3C0A16;
  --tooltip-text: #FAF3E3;
  --tooltip-border: #C59B27;

  --input-bg: #FFFDF9;
  --input-border: #DEC9A0;
  --input-focus-border: #B8860B;
  --input-text: #4A0E1D;
  --input-placeholder: #9C7847;

  --btn-danger-bg: #7A1428;
  --btn-danger-text: #FFFDF9;
  --badge-bg: #8E162E;
  --badge-text: #FFFDF9;
  --close-icon: #9B1B30;

  --kam-bg: #FFFDF9;
  --kam-header-bg: #F3E5C8;
  --kam-header-text: #4A0E1D;
  --kam-active-bg: #F8EED8;
  --kam-active-text: #6D1428;
  --kam-text: #7A2337;

  --table-header-bg: #F3E5C8;
  --table-header-text: #4A0E1D;
  --table-border: #E8DAC0;
  --table-row-bg: #FFFDF9;
  --table-row-hover: #FBF3E2;
  --table-link: #6D1428;
  --table-subtext: #6A3D1F;
  --table-dash: #B89864;
  --table-alert-border: #A82840;
  --table-tag-icon: #B8860B;
  --table-total-bg: #EFE0BE;
  --table-total-text: #4A0E1D;
  --table-total-border: #D2B068;

  --scrollbar-track: #F5ECDC;
  --scrollbar-thumb: #C9A65B;
}

/* ==========================================================================
   THEME 2: IVORY GALLERY & ANTIQUE GOLD
   ========================================================================== */
[data-theme="ivory-gallery"] {
  --bg-canvas: #FCF9F2;
  --bg-surface: #FFFDFB;
  --bg-surface-alt: #FAF3E6;
  --bg-topbar: #FFFDFB;
  --bg-subbar: #FAF4E8;

  --sidebar-bg: #F2E5CE;
  --sidebar-divider: #DEC89E;
  --sidebar-icon: #6E1A2E;
  --sidebar-icon-hover: #4A0E1D;
  --sidebar-hover-bg: #E9D7B6;
  --sidebar-active-bg: #7A1830;
  --sidebar-active-icon: #FAF3E3;

  --topbar-text: #591224;
  --topbar-tab-bg: #F7EFE0;
  --topbar-tab-active-bg: #FFFDFB;
  --topbar-tab-text: #853548;
  --topbar-tab-active-text: #591224;
  --topbar-tab-indicator: #7A1830;
  --topbar-util-icon: #6E1A2E;
  --topbar-util-bg: #F5EAD6;
  --util-emblem-eye: #FFFDFB;

  --subbar-text: #8B4252;
  --subbar-active-text: #591224;
  --subbar-indicator: #C2922B;
  --subbar-meta: #8B6123;

  --card-bg: #FFFDFB;
  --card-border: #E7D8BC;
  --card-shadow: 0 1px 4px rgba(122, 24, 48, 0.05);
  --card-header-bg: #F5E6E8;
  --card-header-text: #621327;
  --card-header-icon: #A67B21;
  --card-header-border: #E9D2D6;

  --item-border: #F5ECE0;
  --item-text: #7A1830;
  --item-icon: #B88B2E;
  --item-hover-bg: #FBF2E1;
  --item-hover-text: #4F0E1F;

  --tooltip-bg: #621327;
  --tooltip-text: #FFFDF9;
  --tooltip-border: #D4AA4A;

  --input-bg: #FFFDFB;
  --input-border: #DFCCA8;
  --input-focus-border: #7A1830;
  --input-text: #591224;
  --input-placeholder: #A17D4D;

  --btn-danger-bg: #8E1B34;
  --btn-danger-text: #FFFDFB;
  --badge-bg: #8E1B34;
  --badge-text: #FFFDFB;
  --close-icon: #9E213C;

  --kam-bg: #FFFDFB;
  --kam-header-bg: #F5E6E8;
  --kam-header-text: #621327;
  --kam-active-bg: #FBF1DD;
  --kam-active-text: #621327;
  --kam-text: #7D263B;

  --table-header-bg: #F6E9EB;
  --table-header-text: #591224;
  --table-border: #EFE2CC;
  --table-row-bg: #FFFDFB;
  --table-row-hover: #FCF5E7;
  --table-link: #7A1830;
  --table-subtext: #7C5324;
  --table-dash: #C5A672;
  --table-alert-border: #B32E47;
  --table-tag-icon: #C2922B;
  --table-total-bg: #F4E7CC;
  --table-total-text: #591224;
  --table-total-border: #D4B26A;

  --scrollbar-track: #FAF3E6;
  --scrollbar-thumb: #D1AE65;
}

/* ==========================================================================
   THEME 3: SOVEREIGN BURGUNDY & GOLD TRIM
   ========================================================================== */
[data-theme="sovereign-header"] {
  --bg-canvas: #F8F1E3;
  --bg-surface: #FFFDF8;
  --bg-surface-alt: #FAF2E3;
  --bg-topbar: #590D22;
  --bg-subbar: #FFFDF8;

  --sidebar-bg: #360713;
  --sidebar-divider: #591427;
  --sidebar-icon: #E8D5B5;
  --sidebar-icon-hover: #F5D576;
  --sidebar-hover-bg: #4D0E20;
  --sidebar-active-bg: #D4A437;
  --sidebar-active-icon: #360713;

  --topbar-text: #FAF2E1;
  --topbar-tab-bg: #46091A;
  --topbar-tab-active-bg: #71152E;
  --topbar-tab-text: #E6CEAA;
  --topbar-tab-active-text: #FFFDF8;
  --topbar-tab-indicator: #E8C054;
  --topbar-util-icon: #F5E6CC;
  --topbar-util-bg: #46091A;
  --util-emblem-eye: #590D22;

  --subbar-text: #7B2B3F;
  --subbar-active-text: #590D22;
  --subbar-indicator: #C79626;
  --subbar-meta: #7A4E1E;

  --card-bg: #FFFDF8;
  --card-border: #DEC89E;
  --card-shadow: 0 2px 5px rgba(54, 7, 19, 0.08);
  --card-header-bg: #651228;
  --card-header-text: #FAF2E1;
  --card-header-icon: #E8C054;
  --card-header-border: #C79626;

  --item-border: #F2E5CE;
  --item-text: #5E1125;
  --item-icon: #B5841E;
  --item-hover-bg: #F9EED6;
  --item-hover-text: #3B0815;

  --tooltip-bg: #2E0610;
  --tooltip-text: #F7E9CA;
  --tooltip-border: #E8C054;

  --input-bg: #FFFDF8;
  --input-border: #D9C196;
  --input-focus-border: #651228;
  --input-text: #4A0D1E;
  --input-placeholder: #9A7544;

  --btn-danger-bg: #651228;
  --btn-danger-text: #F7E7C4;
  --badge-bg: #C79626;
  --badge-text: #360713;
  --close-icon: #E8C054;

  --kam-bg: #FFFDF8;
  --kam-header-bg: #651228;
  --kam-header-text: #FAF2E1;
  --kam-active-bg: #F8EBD0;
  --kam-active-text: #590D22;
  --kam-text: #6E1B30;

  --table-header-bg: #651228;
  --table-header-text: #FAF2E1;
  --table-border: #E8D8B8;
  --table-row-bg: #FFFDF8;
  --table-row-hover: #FBF1DB;
  --table-link: #651228;
  --table-subtext: #7A4B1D;
  --table-dash: #B8965E;
  --table-alert-border: #A8233C;
  --table-tag-icon: #C79626;
  --table-total-bg: #F2E0B6;
  --table-total-text: #450A1A;
  --table-total-border: #C79626;

  --scrollbar-track: #F4E9D4;
  --scrollbar-thumb: #B68829;
}

/* ==========================================================================
   THEME 4: GILDED CHAMPAGNE & MERLOT
   ========================================================================== */
[data-theme="gilded-champagne"] {
  --bg-canvas: #F6EDDC;
  --bg-surface: #FFFDF7;
  --bg-surface-alt: #F9F1E1;
  --bg-topbar: #FCF6E9;
  --bg-subbar: #FFFDF7;

  --sidebar-bg: #8A641A;
  --sidebar-divider: #A67E2C;
  --sidebar-icon: #FFF7E4;
  --sidebar-icon-hover: #FFFFFF;
  --sidebar-hover-bg: #755312;
  --sidebar-active-bg: #5C0F22;
  --sidebar-active-icon: #F5DCA0;

  --topbar-text: #5C0F22;
  --topbar-tab-bg: #F2E3C4;
  --topbar-tab-active-bg: #FFFDF7;
  --topbar-tab-text: #7C5616;
  --topbar-tab-active-text: #5C0F22;
  --topbar-tab-indicator: #6E1328;
  --topbar-util-icon: #6E1328;
  --topbar-util-bg: #F1E2C2;
  --util-emblem-eye: #FFFDF7;

  --subbar-text: #845D1C;
  --subbar-active-text: #5C0F22;
  --subbar-indicator: #8A641A;
  --subbar-meta: #7A5417;

  --card-bg: #FFFDF7;
  --card-border: #DFC797;
  --card-shadow: 0 1px 4px rgba(138, 100, 26, 0.1);
  --card-header-bg: #EAD6AA;
  --card-header-text: #580E20;
  --card-header-icon: #6E1328;
  --card-header-border: #D6B97C;

  --item-border: #F2E5C9;
  --item-text: #6E1328;
  --item-icon: #9E7320;
  --item-hover-bg: #F6E9CB;
  --item-hover-text: #490B1A;

  --tooltip-bg: #580E20;
  --tooltip-text: #FFF8E8;
  --tooltip-border: #D9B45B;

  --input-bg: #FFFDF7;
  --input-border: #D8BE8B;
  --input-focus-border: #6E1328;
  --input-text: #580E20;
  --input-placeholder: #9A7638;

  --btn-danger-bg: #6E1328;
  --btn-danger-text: #FFF8E8;
  --badge-bg: #6E1328;
  --badge-text: #FCE8B8;
  --close-icon: #8C1A32;

  --kam-bg: #FFFDF7;
  --kam-header-bg: #EAD6AA;
  --kam-header-text: #580E20;
  --kam-active-bg: #F7EAD0;
  --kam-active-text: #580E20;
  --kam-text: #772136;

  --table-header-bg: #EAD6AA;
  --table-header-text: #580E20;
  --table-border: #E5D1A8;
  --table-row-bg: #FFFDF7;
  --table-row-hover: #FAF0D8;
  --table-link: #6E1328;
  --table-subtext: #7A5417;
  --table-dash: #BA9654;
  --table-alert-border: #9E1F3A;
  --table-tag-icon: #8A641A;
  --table-total-bg: #EBD8AE;
  --table-total-text: #580E20;
  --table-total-border: #C49D4A;

  --scrollbar-track: #F3E6C9;
  --scrollbar-thumb: #A9802D;
}

/* ==========================================================================
   THEME 5: VELVET BORDEAUX & BURNISHED GOLD
   ========================================================================== */
[data-theme="velvet-bordeaux"] {
  --bg-canvas: #2B0711;
  --bg-surface: #3D0D1B;
  --bg-surface-alt: #350A17;
  --bg-topbar: #22050D;
  --bg-subbar: #310915;

  --sidebar-bg: #1B030A;
  --sidebar-divider: #4B1424;
  --sidebar-icon: #DFC8A0;
  --sidebar-icon-hover: #F5D47A;
  --sidebar-hover-bg: #360A17;
  --sidebar-active-bg: #C99A2E;
  --sidebar-active-icon: #1B030A;

  --topbar-text: #FAF1DF;
  --topbar-tab-bg: #2E0813;
  --topbar-tab-active-bg: #450F1F;
  --topbar-tab-text: #D6BC96;
  --topbar-tab-active-text: #FAF1DF;
  --topbar-tab-indicator: #E6C15A;
  --topbar-util-icon: #EBD8B7;
  --topbar-util-bg: #3B0C1A;
  --util-emblem-eye: #22050D;

  --subbar-text: #D6B990;
  --subbar-active-text: #FAF1DF;
  --subbar-indicator: #E6C15A;
  --subbar-meta: #D9B774;

  --card-bg: #3D0D1B;
  --card-border: #6D2639;
  --card-shadow: 0 2px 8px rgba(18, 2, 7, 0.35);
  --card-header-bg: #521325;
  --card-header-text: #F2D078;
  --card-header-icon: #E6C15A;
  --card-header-border: #8B6422;

  --item-border: #531728;
  --item-text: #F6E9D2;
  --item-icon: #DFB54B;
  --item-hover-bg: #541628;
  --item-hover-text: #FFE7A6;

  --tooltip-bg: #E6C15A;
  --tooltip-text: #24050E;
  --tooltip-border: #FAF1DF;

  --input-bg: #2D0813;
  --input-border: #783044;
  --input-focus-border: #E6C15A;
  --input-text: #FAF1DF;
  --input-placeholder: #B88F6A;

  --btn-danger-bg: #C99A2E;
  --btn-danger-text: #22050D;
  --badge-bg: #E6C15A;
  --badge-text: #22050D;
  --close-icon: #E6C15A;

  --kam-bg: #3D0D1B;
  --kam-header-bg: #521325;
  --kam-header-text: #F2D078;
  --kam-active-bg: #5B192C;
  --kam-active-text: #F6D884;
  --kam-text: #EFE0C6;

  --table-header-bg: #521325;
  --table-header-text: #F2D078;
  --table-border: #5E1D30;
  --table-row-bg: #3B0C1A;
  --table-row-hover: #4E1426;
  --table-link: #F2CE72;
  --table-subtext: #EAD7B7;
  --table-dash: #9A6674;
  --table-alert-border: #E6C15A;
  --table-tag-icon: #E6C15A;
  --table-total-bg: #571629;
  --table-total-text: #FFF3D4;
  --table-total-border: #C99A2E;

  --scrollbar-track: #290610;
  --scrollbar-thumb: #9C7526;
}

/* ==========================================================================
   THEME 6: PORCELAIN IVORY LIGHT (Default Light Mode)
   THEME 7: CUSTOM MIX & MATCH (Inherits Light Base + Live Custom Overrides)
   ========================================================================== */
[data-theme="porcelain-ivory"],
[data-theme="custom-mix"] {
  --bg-canvas: #FDFBF7;
  --bg-surface: #FFFEFA;
  --bg-surface-alt: #FAF6EE;
  --bg-topbar: #FFFEFA;
  --bg-subbar: #FFFEFA;

  --sidebar-bg: #FAF6EE;
  --sidebar-divider: #ECE1CD;
  --sidebar-icon: #73182E;
  --sidebar-icon-hover: #4F0E1F;
  --sidebar-hover-bg: #F3EAD8;
  --sidebar-active-bg: #F2E4C4;
  --sidebar-active-icon: #5A1023;

  --topbar-text: #5A1023;
  --topbar-tab-bg: #FAF5EB;
  --topbar-tab-active-bg: #FFFEFA;
  --topbar-tab-text: #8A3A4D;
  --topbar-tab-active-text: #5A1023;
  --topbar-tab-indicator: #C2922B;
  --topbar-util-icon: #6D162B;
  --topbar-util-bg: #FAF4E8;
  --util-emblem-eye: #FFFEFA;

  --subbar-text: #8A4152;
  --subbar-active-text: #5A1023;
  --subbar-indicator: #C2922B;
  --subbar-meta: #8E6526;

  --card-bg: #FFFEFA;
  --card-border: #EDE3D0;
  --card-shadow: 0 1px 3px rgba(107, 20, 41, 0.04);
  --card-header-bg: #FAF4E8;
  --card-header-text: #5A1023;
  --card-header-icon: #B88928;
  --card-header-border: #ECE0C9;

  --item-border: #F7F1E4;
  --item-text: #6B1429;
  --item-icon: #C29432;
  --item-hover-bg: #FCF6E8;
  --item-hover-text: #4A0D1C;

  --tooltip-bg: #5A1023;
  --tooltip-text: #FFFEFA;
  --tooltip-border: #D9B45A;

  --input-bg: #FFFEFA;
  --input-border: #E8DBC3;
  --input-focus-border: #C2922B;
  --input-text: #5A1023;
  --input-placeholder: #A68452;

  --btn-danger-bg: #881A32;
  --btn-danger-text: #FFFEFA;
  --badge-bg: #881A32;
  --badge-text: #FFFEFA;
  --close-icon: #9B1E38;

  --kam-bg: #FFFEFA;
  --kam-header-bg: #FAF4E8;
  --kam-header-text: #5A1023;
  --kam-active-bg: #FAF1DC;
  --kam-active-text: #5A1023;
  --kam-text: #7A2338;

  --table-header-bg: #FAF4E8;
  --table-header-text: #5A1023;
  --table-border: #F2E8D6;
  --table-row-bg: #FFFEFA;
  --table-row-hover: #FCF7EC;
  --table-link: #6B1429;
  --table-subtext: #855A24;
  --table-dash: #CCB07E;
  --table-alert-border: #B32B45;
  --table-tag-icon: #C2922B;
  --table-total-bg: #F6ECD6;
  --table-total-text: #5A1023;
  --table-total-border: #DAC088;

  --scrollbar-track: #FAF5EA;
  --scrollbar-thumb: #D8BC82;
}

/* ==========================================================================
   THEME 7: ROSE GOLD & CHAMPAGNE IVORY (Rose Gold Base)
   Soft Rose Gold Rail · Warm Rose-Beige Ivory Canvas · Deep Rose-Burgundy Ink
   ========================================================================== */
[data-theme="rose-gold-base"] {
  --bg-canvas: #FBF4F0;
  --bg-surface: #FFFCFA;
  --bg-surface-alt: #F8ECE6;
  --bg-topbar: #FFFCFA;
  --bg-subbar: #FDF6F2;

  --sidebar-bg: #EEDAD3;
  --sidebar-divider: #DFC2B8;
  --sidebar-icon: #6D1D2E;
  --sidebar-icon-hover: #4A0E1D;
  --sidebar-hover-bg: #E5CBC2;
  --sidebar-active-bg: #B87264;
  --sidebar-active-icon: #FFFCFA;

  --topbar-text: #5E1A2A;
  --topbar-tab-bg: #F6E8E2;
  --topbar-tab-active-bg: #FFFCFA;
  --topbar-tab-text: #8A4552;
  --topbar-tab-active-text: #5E1A2A;
  --topbar-tab-indicator: #B87264;
  --topbar-util-icon: #6D1D2E;
  --topbar-util-bg: #F5E6E0;
  --util-emblem-eye: #FFFCFA;

  --subbar-text: #8C4D59;
  --subbar-active-text: #5E1A2A;
  --subbar-indicator: #C28576;
  --subbar-meta: #8B574C;

  --card-bg: #FFFCFA;
  --card-border: #E8D2CA;
  --card-shadow: 0 1px 3px rgba(109, 29, 46, 0.05);
  --card-header-bg: #F4E3DC;
  --card-header-text: #5E1A2A;
  --card-header-icon: #AD685A;
  --card-header-border: #E4C9BF;

  --item-border: #F5EAE5;
  --item-text: #6E1C2E;
  --item-icon: #B87566;
  --item-hover-bg: #F8EAE4;
  --item-hover-text: #4B101E;

  --tooltip-bg: #5E1A2A;
  --tooltip-text: #FFFCFA;
  --tooltip-border: #D9A193;

  --input-bg: #FFFCFA;
  --input-border: #E3C9BF;
  --input-focus-border: #B87264;
  --input-text: #5E1A2A;
  --input-placeholder: #A47267;

  --btn-danger-bg: #8C2338;
  --btn-danger-text: #FFFCFA;
  --badge-bg: #8C2338;
  --badge-text: #FFFCFA;
  --close-icon: #A43045;

  --kam-bg: #FFFCFA;
  --kam-header-bg: #F4E3DC;
  --kam-header-text: #5E1A2A;
  --kam-active-bg: #F7E8E1;
  --kam-active-text: #5E1A2A;
  --kam-text: #7A2B3C;

  --table-header-bg: #F4E3DC;
  --table-header-text: #5E1A2A;
  --table-border: #EFE0D9;
  --table-row-bg: #FFFCFA;
  --table-row-hover: #FAF0EB;
  --table-link: #6E1C2E;
  --table-subtext: #855246;
  --table-dash: #C8A196;
  --table-alert-border: #B2324A;
  --table-tag-icon: #B87264;
  --table-total-bg: #F1DDD5;
  --table-total-text: #5E1A2A;
  --table-total-border: #D3A597;

  --scrollbar-track: #F7ECE7;
  --scrollbar-thumb: #D1A496;
}

/* ==========================================================================
   THEME 8: GOLD BEIGE BASE (Warm Champagne Gold & Beige)
   Warm Gold-Beige Rail · Soft Sand-Ivory Canvas · Burnished Gold Accents
   ========================================================================== */
[data-theme="gold-beige-base"] {
  --bg-canvas: #F9F2E4;
  --bg-surface: #FFFDF8;
  --bg-surface-alt: #F6ECD8;
  --bg-topbar: #FFFDF8;
  --bg-subbar: #FBF5E8;

  --sidebar-bg: #E7D2A5;
  --sidebar-divider: #D6BA82;
  --sidebar-icon: #5C1A24;
  --sidebar-icon-hover: #3F0D16;
  --sidebar-hover-bg: #DEC48E;
  --sidebar-active-bg: #A87B22;
  --sidebar-active-icon: #FFFDF8;

  --topbar-text: #541622;
  --topbar-tab-bg: #F4E8CE;
  --topbar-tab-active-bg: #FFFDF8;
  --topbar-tab-text: #7D5B20;
  --topbar-tab-active-text: #541622;
  --topbar-tab-indicator: #A87B22;
  --topbar-util-icon: #6A202D;
  --topbar-util-bg: #F4E7CC;
  --util-emblem-eye: #FFFDF8;

  --subbar-text: #846225;
  --subbar-active-text: #541622;
  --subbar-indicator: #B5882A;
  --subbar-meta: #805B1D;

  --card-bg: #FFFDF8;
  --card-border: #E3CFA8;
  --card-shadow: 0 1px 3px rgba(138, 100, 26, 0.08);
  --card-header-bg: #F1E1BE;
  --card-header-text: #541622;
  --card-header-icon: #9B6E18;
  --card-header-border: #DFC58E;

  --item-border: #F4EAD4;
  --item-text: #651828;
  --item-icon: #A87B22;
  --item-hover-bg: #F7EBD0;
  --item-hover-text: #460E1A;

  --tooltip-bg: #541622;
  --tooltip-text: #FFFDF8;
  --tooltip-border: #D4AE5A;

  --input-bg: #FFFDF8;
  --input-border: #DEC79A;
  --input-focus-border: #A87B22;
  --input-text: #541622;
  --input-placeholder: #9C7A42;

  --btn-danger-bg: #7A1A2D;
  --btn-danger-text: #FFFDF8;
  --badge-bg: #7A1A2D;
  --badge-text: #FFFDF8;
  --close-icon: #942138;

  --kam-bg: #FFFDF8;
  --kam-header-bg: #F1E1BE;
  --kam-header-text: #541622;
  --kam-active-bg: #F6E9CB;
  --kam-active-text: #541622;
  --kam-text: #722434;

  --table-header-bg: #F1E1BE;
  --table-header-text: #541622;
  --table-border: #EBDCB9;
  --table-row-bg: #FFFDF8;
  --table-row-hover: #FAF1DC;
  --table-link: #651828;
  --table-subtext: #7D5B20;
  --table-dash: #C09F63;
  --table-alert-border: #A62840;
  --table-tag-icon: #A87B22;
  --table-total-bg: #EFE0BC;
  --table-total-text: #541622;
  --table-total-border: #CAA558;

  --scrollbar-track: #F5EBD6;
  --scrollbar-thumb: #C8A55C;
}

/* ==========================================================================
   PAGE WRAPPER (Top Studio + App Shell + Bottom Color Codes Bar)
   ========================================================================== */
html,
body {
  height: 100%;
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.35;
  background: var(--bg-canvas);
  color: var(--topbar-text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.page-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ==========================================================================
   TOP-OF-PAGE THEME CUSTOMIZATION STUDIO (Subtle Light Ivory-Beige Chrome)
   ========================================================================== */
.studio-header {
  flex-shrink: 0;
  background: #F9F4EA;
  color: #5E1B2B;
  border-bottom: 1px solid #E4D6BE;
  z-index: 50;
}

/* LINE 1: Overall Theme Options + Screen Options */
.studio-line-1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 12px;
  border-bottom: 1px solid #EDE2CE;
  flex-wrap: wrap;
}

.studio-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.studio-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 5px;
  background: #FFFEFA;
  border: 1px solid #E2D2B4;
  white-space: nowrap;
}

.brand-main {
  font-size: 11.5px;
  font-weight: 700;
  color: #5A1023;
  letter-spacing: -0.01em;
}

.brand-by {
  font-size: 10px;
  font-weight: 600;
  color: #9A7126;
}

.studio-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8D682B;
}

.theme-pill-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.theme-divider {
  width: 1px;
  height: 18px;
  background: #DFCCA8;
  margin: 0 3px;
}

.theme-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 5px;
  border: 1px solid #E5D6BC;
  background: #FFFEFA;
  color: #632030;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.theme-pill:hover {
  background: #F6ECD9;
  border-color: #C9A14A;
}

.theme-pill.active {
  background: #F3E5C8;
  color: #4A0E1D;
  border-color: #B8860B;
  box-shadow: 0 0 0 1px #C9A14A;
}

.theme-pill-custom {
  border-style: dashed;
  border-color: #C2922B;
  background: #FCF7EB;
}

.theme-pill-custom.active {
  border-style: solid;
  background: #EFE0BE;
  color: #4A0E1D;
  border-color: #8A641A;
}

.swatch-trio {
  display: inline-flex;
  align-items: center;
  gap: 1.5px;
}

.swatch-trio i {
  display: inline-block;
  width: 6.5px;
  height: 10px;
  border-radius: 1.5px;
  border: 1px solid rgba(90, 16, 35, 0.25);
}

.screen-pills {
  display: inline-flex;
  background: #F2E9D8;
  border: 1px solid #E2D2B4;
  border-radius: 5px;
  padding: 2px;
  gap: 2px;
}

.screen-pill {
  border: none;
  background: transparent;
  color: #783344;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2.5px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.screen-pill.active {
  background: #FFFEFA;
  color: #4A0E1D;
  box-shadow: 0 1px 2px rgba(74, 14, 29, 0.1);
}

.save-ui-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3.5px 9px;
  border-radius: 5px;
  border: 1px solid #9E3B50;
  background: #6B1429;
  color: #FFFEFA;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.save-ui-btn:hover {
  background: #520E20;
  border-color: #7A1830;
}

.copy-ui-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3.5px 9px;
  border-radius: 5px;
  border: 1px solid #C9A14A;
  background: #F4E6C6;
  color: #4A0E1D;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.copy-ui-btn:hover {
  background: #ECD9AD;
  border-color: #9E731A;
}

.copy-ui-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

/* SAVED COMBINATIONS BAR */
.saved-themes-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 12px;
  background: #FDF9F0;
  border-bottom: 1px solid #EDE2CE;
  flex-wrap: wrap;
}

.saved-themes-bar[hidden] {
  display: none;
}

.saved-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.saved-form[hidden] {
  display: none;
}

.save-name-input {
  width: 195px;
  height: 24px;
  padding: 0 8px;
  border-radius: 4px;
  border: 1px solid #C9A14A;
  background: #FFFEFA;
  color: #4A0E1D;
  font-family: inherit;
  font-size: 11px;
  outline: none;
}

.save-name-input::placeholder {
  color: #A68452;
}

.save-confirm-btn {
  height: 24px;
  padding: 0 10px;
  border-radius: 4px;
  border: 1px solid #6B1429;
  background: #6B1429;
  color: #FFFEFA;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
}

.save-confirm-btn:hover {
  background: #520E20;
}

.save-cancel-btn {
  height: 24px;
  padding: 0 8px;
  border-radius: 4px;
  border: 1px solid #DFCCA8;
  background: #FFFEFA;
  color: #6B1E30;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}

.saved-list-wrap {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  flex: 1;
}

.saved-list-wrap[hidden] {
  display: none;
}

.saved-pills {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.saved-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2.5px 6px 2.5px 7px;
  border-radius: 5px;
  border: 1px solid #DFCCA8;
  background: #FFFEFA;
  color: #5A1023;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.saved-pill:hover {
  border-color: #C2922B;
  background: #F9F0DD;
}

.saved-pill.active {
  border-color: #6B1429;
  background: #F4E6C6;
  box-shadow: 0 0 0 1px #6B1429;
}

.saved-pill-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: none;
  background: transparent;
  color: #8C6429;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.saved-pill-action:hover {
  background: rgba(107, 20, 41, 0.12);
  color: #4A0E1D;
}

/* LINE 2: Additional Customization Option Bar */
.studio-line-2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 12px;
  background: #F5EEE1;
  font-size: 11px;
}

.line-2-left,
.line-2-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.custom-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #DECAA4;
  background: #FFFEFA;
  color: #5E1B2B;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}

.custom-toggle-btn:hover {
  background: #F6EBD4;
  border-color: #C2922B;
}

.toggle-caret {
  color: #A67B21;
  font-size: 11px;
}

.line-2-hint {
  color: #8C6839;
  font-size: 10.5px;
}

.line-2-hint strong {
  color: #6B1E30;
}

.override-badge {
  background: #EFE0BE;
  border: 1px solid #C9A14A;
  color: #541424;
  font-size: 10px;
  font-weight: 700;
  padding: 1.5px 7px;
  border-radius: 999px;
}

.reset-custom-btn {
  border: 1px solid #DFCCA8;
  background: #FFFEFA;
  color: #6B1E30;
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.reset-custom-btn:hover {
  border-color: #B8860B;
  background: #F6EBD4;
}

/* LINE 3: Four Customization Categories (Revealed on Theme 2, Theme 7, or Toggle) */
.studio-line-3 {
  background: #FAF3E6;
  color: #4A0E1D;
  border-top: 1px solid #D9B768;
  padding: 7px 12px;
}

.studio-line-3[hidden] {
  display: none;
}

.custom-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.custom-cat {
  background: #FFFEFA;
  border: 1px solid #E3D2B2;
  border-radius: 6px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.custom-cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.cat-title {
  font-size: 10.5px;
  font-weight: 700;
  color: #5A1023;
}

.color-code-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px;
  border: 1px solid #DFCCA8;
  border-radius: 4px;
  background: #FAF5EA;
  color: #5A1023;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.color-code-trigger:hover {
  border-color: #B8860B;
  background: #F4E9D2;
}

.trigger-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(90, 16, 35, 0.3);
  flex-shrink: 0;
}

.picker-hex {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  color: #5A1023;
}

.cat-mode-tabs {
  display: inline-flex;
  align-self: flex-start;
  background: #F4ECE0;
  border: 1px solid #E5D7BF;
  border-radius: 4px;
  padding: 1.5px;
  gap: 2px;
}

.cat-mode-tab {
  border: none;
  background: transparent;
  color: #7D3B4B;
  font-family: inherit;
  font-size: 9.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
  cursor: pointer;
}

.cat-mode-tab.active {
  background: #FFFEFA;
  color: #4A0E1D;
  box-shadow: 0 1px 2px rgba(74, 14, 29, 0.1);
}

.shade-row[hidden],
.theme-swatches-panel[hidden] {
  display: none;
}

.theme-swatches-panel {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 102px;
  overflow-y: auto;
  padding-right: 2px;
}

.theme-swatch-row {
  display: grid;
  grid-template-columns: 76px repeat(6, 1fr);
  gap: 3px;
  align-items: center;
}

.theme-swatch-label {
  font-size: 9px;
  font-weight: 700;
  color: #6B2335;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shade-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.shade-matrix-head {
  display: grid;
  grid-template-columns: 56px repeat(5, 1fr);
  gap: 3px;
  align-items: center;
  padding-bottom: 1px;
}

.shade-matrix-head span {
  font-size: 8.5px;
  font-weight: 600;
  color: #936F3A;
  text-align: center;
  white-space: nowrap;
}

.shade-family-row {
  display: grid;
  grid-template-columns: 56px repeat(5, 1fr);
  gap: 3px;
  align-items: center;
}

.shade-family-label {
  font-size: 9.5px;
  font-weight: 700;
  color: #632030;
  white-space: nowrap;
}

.shade-tile {
  height: 17px;
  border-radius: 3px;
  border: 1px solid rgba(90, 16, 35, 0.25);
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s ease, box-shadow 0.1s ease, border-color 0.1s ease;
}

.shade-tile:hover {
  transform: scale(1.08);
  border-color: #8A641A;
  z-index: 2;
}

.shade-tile.active {
  border-color: #4A0E1D;
  box-shadow: 0 0 0 1.5px #FFFEFA, 0 0 0 3px #4A0E1D;
  z-index: 3;
}

/* Theme 7 Full-Element Extras */
.theme7-extras {
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px dashed #D8BE8B;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.theme7-extras[hidden] {
  display: none;
}

.extras-title {
  font-size: 10.5px;
  font-weight: 700;
  color: #6B1429;
}

.extra-picker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid #DFCCA8;
  background: #FFFEFA;
  font-size: 10.5px;
  font-weight: 600;
  color: #5A1023;
  cursor: pointer;
}

.extra-picker input[type="color"] {
  width: 16px;
  height: 16px;
  border: none;
  background: transparent;
  cursor: pointer;
}

/* ==========================================================================
   EXACT RECREATED APPLICATION SHELL
   ========================================================================== */
.app-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  width: 100%;
  overflow: hidden;
}

/* --- Left Vertical Sidebar --- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 20;
  user-select: none;
  border-right: 1px solid var(--sidebar-divider);
}

.sidebar-logo {
  width: 100%;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sidebar-icon);
  border-bottom: 1px solid var(--sidebar-divider);
  cursor: pointer;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  width: 100%;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar {
  display: none;
}

.sidebar-item {
  position: relative;
  width: 100%;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--sidebar-icon);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.sidebar-item:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-icon-hover);
}

.sidebar-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-icon);
}

.sidebar-letter {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.nav-badge {
  position: absolute;
  top: 4px;
  right: 5px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* --- Main Right Shell --- */
.main-shell {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-canvas);
}

/* --- Top Bar --- */
.top-bar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 14px 0 16px;
}

.top-tabs {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 100%;
}

.top-tab {
  position: relative;
  height: 30px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  background: var(--topbar-tab-bg);
  color: var(--topbar-tab-text);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.top-tab.active {
  background: var(--topbar-tab-active-bg);
  color: var(--topbar-tab-active-text);
  font-weight: 600;
  border-color: var(--card-border);
}

.top-tab.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2.5px;
  background: var(--topbar-tab-indicator);
}

.tab-close {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1.2px solid var(--close-icon);
  color: var(--close-icon);
  font-size: 10px;
  line-height: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.top-utilities {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
}

.util-btn {
  position: relative;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: var(--topbar-util-bg);
  color: var(--topbar-util-icon);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.util-user {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px 2px 3px;
  border-radius: 14px;
  color: var(--topbar-text);
  font-size: 11px;
  font-weight: 600;
}

.util-user-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--topbar-util-bg);
  border: 1px solid var(--card-border);
  color: var(--topbar-util-icon);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.util-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Sub-Header Bar --- */
.sub-bar {
  height: var(--subbar-h);
  min-height: var(--subbar-h);
  background: var(--bg-subbar);
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 0 16px;
}

.sub-tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 100%;
}

.sub-tab {
  position: relative;
  height: 28px;
  padding: 0 12px;
  border: none;
  background: transparent;
  color: var(--subbar-text);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.sub-tab.active {
  color: var(--subbar-active-text);
  font-weight: 600;
  background: var(--bg-surface-alt);
  border-radius: 4px 4px 0 0;
}

.sub-tab.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2.5px;
  background: var(--subbar-indicator);
}

.sub-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sub-search-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 4px;
  padding: 3px 8px;
  width: 155px;
}

.sub-search-wrap input {
  border: none;
  outline: none;
  background: transparent;
  color: var(--input-text);
  font-family: inherit;
  font-size: 11px;
  width: 100%;
}

.sub-search-wrap input::placeholder {
  color: var(--input-placeholder);
}

.sub-clear-circle {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: none;
  background: var(--btn-danger-bg);
  color: var(--btn-danger-text);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sub-meta-text {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--subbar-meta);
}

.sub-refresh-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--subbar-meta);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.sub-refresh-btn:hover {
  background: var(--item-hover-bg);
}

/* --- Workspace Canvas --- */
.workspace-canvas {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 10px 12px 12px 12px;
  background: var(--bg-canvas);
}

.screen {
  display: none;
  height: 100%;
}
.screen.active {
  display: block;
}

/* ==========================================================================
   SCREEN 1: CSS QUICK LINKS (5x2 Card Grid)
   ========================================================================== */
.quick-links-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(170px, 1fr));
  grid-auto-rows: minmax(230px, 1fr);
  gap: 10px;
}

.ql-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 7px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.ql-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  background: var(--card-header-bg);
  border-bottom: 1px solid var(--card-header-border);
  border-radius: 6px 6px 0 0;
  color: var(--card-header-text);
  font-size: 11.5px;
  font-weight: 600;
}

.ql-card-header svg {
  color: var(--card-header-icon);
  flex-shrink: 0;
}

.ql-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.ql-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6.5px 10px;
  border-bottom: 1px solid var(--item-border);
  color: var(--item-text);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.ql-item:hover,
.ql-item.demo-selected {
  background: var(--item-hover-bg);
  color: var(--item-hover-text);
}

.ql-item svg {
  color: var(--item-icon);
  flex-shrink: 0;
}

.ql-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  background: var(--tooltip-bg);
  color: var(--tooltip-text);
  border: 1px solid var(--tooltip-border);
  font-size: 10.5px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 4px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(45, 8, 18, 0.25);
  z-index: 10;
  pointer-events: none;
}

.ql-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--tooltip-bg);
}

/* ==========================================================================
   SCREEN 2: BUSINESS SUMMARY
   ========================================================================== */
.business-layout {
  display: flex;
  gap: 10px;
  height: 100%;
  min-height: 400px;
}

.kam-panel {
  width: 108px;
  min-width: 108px;
  background: var(--kam-bg);
  border: 1px solid var(--card-border);
  border-radius: 7px;
  box-shadow: var(--card-shadow);
  align-self: flex-start;
  overflow: hidden;
}

.kam-header {
  background: var(--kam-header-bg);
  color: var(--kam-header-text);
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 6px;
  border-bottom: 1px solid var(--card-header-border);
}

.kam-search-wrap {
  padding: 6px;
  border-bottom: 1px solid var(--item-border);
}

.kam-search {
  width: 100%;
  padding: 4px 7px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  background: var(--input-bg);
  color: var(--input-text);
  font-family: inherit;
  font-size: 11px;
  outline: none;
}
.kam-search::placeholder {
  color: var(--input-placeholder);
}

.kam-list {
  list-style: none;
}

.kam-item {
  padding: 7px 10px;
  border-bottom: 1px solid var(--item-border);
  color: var(--kam-text);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
}

.kam-item:last-child {
  border-bottom: none;
}

.kam-item:hover,
.kam-item.active {
  background: var(--kam-active-bg);
  color: var(--kam-active-text);
}

.kam-chevron {
  font-size: 13px;
  line-height: 1;
}

.business-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
}

.filter-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-input-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 8px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 4px;
}

.filter-input-group.search-wide {
  width: 155px;
}

.filter-input-group.party-focus {
  width: 108px;
  border-color: var(--input-focus-border);
  box-shadow: 0 0 0 1px var(--input-focus-border);
}

.filter-input-group input {
  border: none;
  outline: none;
  background: transparent;
  color: var(--input-text);
  font-family: inherit;
  font-size: 11px;
  width: 100%;
}

.filter-input-group input::placeholder,
.filter-combo input::placeholder {
  color: var(--input-placeholder);
}

.input-icon,
.combo-search-icon {
  color: var(--item-icon);
  flex-shrink: 0;
}

.filter-combo {
  display: inline-flex;
  align-items: center;
  height: 28px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 4px;
  padding: 0 6px;
  gap: 5px;
}

.filter-combo select {
  border: none;
  outline: none;
  background: transparent;
  color: var(--input-text);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  height: 100%;
  line-height: 26px;
}

.combo-divider {
  width: 1px;
  height: 16px;
  background: var(--input-border);
}

.filter-combo input {
  width: 72px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--input-text);
  font-family: inherit;
  font-size: 11px;
}

.filter-select {
  height: 28px;
  line-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  background: var(--input-bg);
  color: var(--input-text);
  font-family: inherit;
  font-size: 11px;
  outline: none;
}

.filter-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--subbar-meta);
  margin-left: 2px;
}

.filter-date {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 7px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 4px;
  color: var(--item-icon);
}

.filter-date input {
  width: 106px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--input-placeholder);
  font-family: inherit;
  font-size: 10.5px;
}

.filter-clear-btn {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 4px;
  background: var(--btn-danger-bg);
  color: var(--btn-danger-text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.toolbar-right-icons {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.toolbar-icon-btn {
  width: 26px;
  height: 26px;
  border: 1px solid var(--card-border);
  border-radius: 4px;
  background: var(--bg-surface);
  color: var(--topbar-util-icon);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.toolbar-icon-btn:hover {
  background: var(--item-hover-bg);
}

.table-container {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--table-row-bg);
  border: 1px solid var(--table-border);
  border-radius: 5px;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 1080px;
}

.summary-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--table-header-bg);
  color: var(--table-header-text);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  padding: 7px 6px;
  border-bottom: 1px solid var(--card-header-border);
  border-right: 1px solid var(--table-border);
  white-space: nowrap;
}

.summary-table tbody td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--table-border);
  border-right: 1px solid var(--table-border);
  background: var(--table-row-bg);
  vertical-align: middle;
  font-size: 10.5px;
}

.summary-table tbody tr:hover td {
  background: var(--table-row-hover);
}

.col-co { width: 118px; }
.col-party { width: 104px; }
.col-hco { width: 44px; text-align: center; }
.col-num { width: 104px; }
.col-ofc { width: 44px; text-align: center; }

.co-link {
  color: var(--table-link);
  font-weight: 600;
  font-size: 10.5px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
}

.co-link.alert-box {
  border: 1px solid var(--table-alert-border);
  border-radius: 3px;
  padding: 2px 4px;
  margin: -2px -3px;
}

.hco-cell {
  text-align: center;
  color: var(--table-subtext);
  font-weight: 600;
  font-size: 10.5px;
}

.dash-cell {
  text-align: center;
  color: var(--table-dash);
}

.cell-metric {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.metric-top {
  display: flex;
  justify-content: space-between;
  color: var(--table-link);
  font-weight: 600;
  font-size: 10px;
}

.metric-bottom {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.metric-amt {
  color: var(--table-link);
  font-weight: 600;
  font-size: 10px;
  text-align: center;
}

.metric-tag {
  color: var(--table-tag-icon);
  flex-shrink: 0;
}

.summary-total-row td {
  position: sticky;
  bottom: 0;
  z-index: 3;
  background: var(--table-total-bg);
  color: var(--table-total-text);
  border-top: 1.5px solid var(--table-total-border);
  border-right: 1px solid var(--table-border);
  padding: 6px;
  font-size: 10.5px;
  font-weight: 700;
}

.summary-total-row .metric-top,
.summary-total-row .metric-amt {
  color: var(--table-total-text);
  font-weight: 700;
}

/* ==========================================================================
   SCREEN 3: MASTERS
   ========================================================================== */
.masters-layout {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 4px 2px;
}

.master-card {
  width: 328px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.master-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--card-header-bg);
  border-bottom: 1px solid var(--card-header-border);
}

.master-card-header h3 {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--card-header-text);
}

.master-search-btn {
  width: 24px;
  height: 24px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  background: var(--input-bg);
  color: var(--item-icon);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

[data-theme="velvet-bordeaux"] .master-search-btn {
  background: #3B0C1A;
  border-color: #B58A32;
  color: #F6D884;
}

.master-list {
  list-style: none;
  padding: 8px 12px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.master-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5.5px 8px;
  border-radius: 4px;
  color: var(--item-text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.master-item:hover {
  background: var(--item-hover-bg);
  color: var(--item-hover-text);
}

.master-item svg {
  color: var(--item-icon);
  flex-shrink: 0;
}

/* ==========================================================================
   BOTTOM-OF-PAGE COLOR CODES DISPLAY BAR (Subtle Light Ivory-Beige Chrome)
   ========================================================================== */
.color-codes-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: #F7F1E5;
  color: #5E1B2B;
  border-top: 1px solid #E4D6BE;
  z-index: 40;
  flex-wrap: wrap;
}

.codes-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  white-space: nowrap;
}

.codes-title strong {
  color: #8D682B;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
}

.codes-theme-name {
  background: #FFFEFA;
  border: 1px solid #DFCCA8;
  color: #5E1B2B;
  padding: 1.5px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

.codes-list {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  flex: 1;
}

.code-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #E5D7BF;
  background: #FFFEFA;
  color: #5E1B2B;
  font-family: inherit;
  font-size: 10px;
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.code-chip:hover {
  border-color: #C2922B;
  background: #FBF4E4;
}

.code-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2.5px;
  border: 1px solid rgba(90, 16, 35, 0.25);
  flex-shrink: 0;
}

.code-name {
  color: #8C6839;
  font-weight: 500;
}

.code-hex {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  color: #5A1023;
}

.codes-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.copy-palette-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 4px;
  border: 1px solid #C9A14A;
  background: #F4E6C6;
  color: #4A0E1D;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.copy-palette-btn:hover {
  background: #ECD9AD;
  border-color: #9E731A;
}

.copy-toast {
  font-size: 10px;
  font-weight: 700;
  color: #8A641A;
  white-space: nowrap;
}

/* ==========================================================================
   UNIFIED COLOR CODE POPOVER (Copy/Paste Hex + Custom Color Wheel)
   ========================================================================== */
.color-popover {
  position: fixed;
  z-index: 250;
  width: 266px;
  background: #FFFEFA;
  color: #4A0E1D;
  border: 1.5px solid #C9A14A;
  border-radius: 9px;
  box-shadow: 0 10px 28px rgba(58, 12, 24, 0.22);
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.color-popover[hidden] {
  display: none;
}

.popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid #EDE2CE;
}

.popover-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #5A1023;
}

.popover-preview-dot {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(74, 14, 29, 0.3);
  flex-shrink: 0;
}

.popover-close-btn {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid #E4D4B6;
  background: #FAF5EA;
  color: #6B1429;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.popover-close-btn:hover {
  background: #F3E5C8;
}

.popover-hex-bar {
  display: flex;
  align-items: center;
  gap: 5px;
}

.popover-hex-input {
  width: 82px;
  height: 26px;
  padding: 0 7px;
  border-radius: 4px;
  border: 1px solid #C9A14A;
  background: #FDFBF7;
  color: #4A0E1D;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  outline: none;
}

.popover-action-btn {
  flex: 1;
  height: 26px;
  padding: 0 7px;
  border-radius: 4px;
  border: 1px solid #DFCCA8;
  background: #FAF3E6;
  color: #5A1023;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.popover-action-btn:hover {
  border-color: #B8860B;
  background: #F3E4C2;
}

.popover-paste-btn {
  background: #6B1429;
  border-color: #6B1429;
  color: #FFFEFA;
}

.popover-paste-btn:hover {
  background: #520E20;
  border-color: #520E20;
}

.popover-wheel-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.wheel-wrap {
  position: relative;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px #DFCCA8;
  cursor: crosshair;
}

#colorWheelCanvas {
  display: block;
  width: 148px;
  height: 148px;
  border-radius: 50%;
}

.wheel-cursor {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #FFFEFA;
  box-shadow: 0 0 0 1.5px #4A0E1D;
  transform: translate(-50%, -50%);
  pointer-events: none;
  left: 50%;
  top: 50%;
}

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

.lightness-label {
  font-size: 9.5px;
  font-weight: 700;
  color: #8A652A;
}

#wheelLightnessSlider {
  width: 100%;
  accent-color: #6B1429;
  cursor: pointer;
}

.popover-themes-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 6px;
  border-top: 1px solid #EDE2CE;
}

.popover-sublabel {
  font-size: 9.5px;
  font-weight: 700;
  color: #8A652A;
}

.popover-theme-swatches {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}

.popover-theme-dot {
  height: 18px;
  border-radius: 3px;
  border: 1px solid rgba(90, 16, 35, 0.28);
  cursor: pointer;
  padding: 0;
}

.popover-theme-dot:hover {
  transform: scale(1.1);
  border-color: #6B1429;
}

/* Custom warm scrollbars (zero grey) */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}
