
@font-face {
    font-family: 'Mesgentia';
    src: url('/assets/fonts/Mesgentia.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    ascent-override: 100%;
    descent-override: 20%;
    line-gap-override: 0%;
}

@font-face {
    font-family: 'Mineko';
    src: url('/assets/fonts/Mineko.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    ascent-override: 97.5%;
    descent-override: 22.5%;
    line-gap-override: 0%;
}

@font-face {
    font-family: 'Minecraft';
    src: url('/assets/fonts/MinecraftRegular-Bmg3.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Imprima';
    src: url('/assets/fonts/Imprima-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Lora';
    src: url('/assets/fonts/Lora-Regular.ttf?v=2') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Lora';
    src: url('/assets/fonts/Lora-Bold.ttf?v=2') format('truetype');
    font-weight: bold;
    font-style: normal;
}

@font-face {
    font-family: 'Lora';
    src: url('/assets/fonts/Lora-Italic.ttf?v=2') format('truetype');
    font-weight: normal;
    font-style: italic;
}

@font-face {
    font-family: 'Lora';
    src: url('/assets/fonts/Lora-BoldItalic.ttf?v=2') format('truetype');
    font-weight: bold;
    font-style: italic;
}

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


:root {
    --section-height: 320px;
}

:root[data-theme="ballerina"], :root {
    color-scheme: light;
    --bg-cream: #FDF8F4;
    --primary-light: #f5eaea;
    --primary-lighter: #FCF8F4;
    --primary: #e8d4d4;
    --primary-dark: #c9a8a8;
    --accent: #B8878C;
    --text-dark: #4A4A4A;
    --text-muted: #8B7E74;
    --text-muted-alpha: rgba(139, 126, 116, 0.3);
    --paper-white: #FFFEF9;
    --paper-cream: #F5F2ED;
    --card-income: #E8D4D4;
    --card-expenses: #ECCFD2;
    --card-saved: #F5EAEA;
    --card-remaining: #F4E2E2;
    --chart-primary: #B8878C;
    --chart-secondary: #e8d4d4;
    --positive: #4CAF50;
    --negative: #E53935;
    --border-color: rgba(0,0,0,0.08);
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.1);
}

:root[data-theme="teddy"] {
    color-scheme: light;
    --bg-cream: #F3EEE9;
    --primary-light: #E0CFC3;
    --primary-lighter: #EDE5DE;
    --primary: #C3A995;
    --primary-dark: #A07E69;
    --accent: #715546;
    --text-dark: #3E2B23;
    --text-muted: #6B5C52;
    --text-muted-alpha: rgba(107, 92, 82, 0.3);
    --paper-white: #F3EEE9;
    --paper-cream: #E0CFC3;
    --card-income: #E5DCD3;
    --card-expenses: #DECFC3;
    --card-saved: #E6DDD7;
    --card-remaining: #EFEAE4;
    --chart-primary: #715546;
    --chart-secondary: #C3A995;
    --positive: #4CAF50;
    --negative: #C62828;
    --border-color: rgba(0,0,0,0.08);
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.1);
}

:root[data-theme="frosted"] {
    color-scheme: light;
    --bg-cream: #E8F3FE;
    --primary-light: #CEDEEF;
    --primary-lighter: #E9F0F8;
    --primary: #B3C8E0;
    --primary-dark: #91AFCB;
    --accent: #789CBB;
    --text-dark: #313C45;
    --text-muted: #4F6271;
    --text-muted-alpha: rgba(79, 98, 113, 0.3);
    --paper-white: #F5F8FC;
    --paper-cream: #E8F3FE;
    --card-income: #CEDEEF;
    --card-expenses: #B3C8E0;
    --card-saved: #DFE9F5;
    --card-remaining: #EAF1FA;
    --chart-primary: #789CBB;
    --chart-secondary: #B3C8E0;
    --positive: #2E7D32;
    --negative: #C62828;
    --border-color: rgba(0,0,0,0.08);
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.1);
}

:root[data-theme="storm"] {
    color-scheme: light;
    --bg-cream: #F5F4F2;
    --primary-light: #E9E3DB;
    --primary-lighter: #F1EFEB;
    --primary: #D7CDC3;
    --primary-dark: #BFB1A6;
    --accent: #9E8D81;
    --text-dark: #6B5C52;
    --text-muted: #8B7E74;
    --text-muted-alpha: rgba(139, 126, 116, 0.3);
    --paper-white: #F5F4F2;
    --paper-cream: #E9E3DB;
    --card-income: #E9E3DB;
    --card-expenses: #D7CDC3;
    --card-saved: #EFECE8;
    --card-remaining: #F3EFEA;
    --chart-primary: #9E8D81;
    --chart-secondary: #D7CDC3;
    --positive: #4CAF50;
    --negative: #C62828;
    --border-color: rgba(0,0,0,0.08);
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.1);
}

:root[data-theme="blush"] {
    color-scheme: light;
    --bg-cream: #FFF5F5;
    --primary-light: #F7E8E8;
    --primary-lighter: #FDF2F1;
    --primary: #F1D8D9;
    --primary-dark: #DDB2B5;
    --accent: #C99597;
    --text-dark: #6B5A5A;
    --text-muted: #9A8585;
    --text-muted-alpha: rgba(154, 133, 133, 0.3);
    --paper-white: #FFF7F5;
    --paper-cream: #F9DDDD;
    --card-income: #F7E8E8;
    --card-expenses: #F1D8D9;
    --card-saved: #FAEEEE;
    --card-remaining: #FFF1F1;
    --chart-primary: #C99597;
    --chart-secondary: #F1D8D9;
    --positive: #4CAF50;
    --negative: #C62828;
    --border-color: rgba(0,0,0,0.08);
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.1);
}

:root[data-theme="toph"] {
    color-scheme: light;
    --bg-cream: #E1DBCB;
    --primary-light: #9CA089;
    --primary-lighter: #DAD9CF;
    --primary: #C5BEAB;
    --primary-dark: #768064;
    --accent: #5D624C;
    --text-dark: #2C3424;
    --text-muted: #868B6B;
    --text-muted-alpha: rgba(134, 139, 107, 0.3);
    --paper-white: #F5F2ED;
    --paper-cream: #DADED8;
    --card-income: #C5BEAB;
    --card-expenses: #B1B6A2;
    --card-saved: #D2CDBD;
    --card-remaining: #DAD6C8;
    --chart-primary: #5D624C;
    --chart-secondary: #C5BEAB;
    --positive: #33691E;
    --negative: #B71C1C;
    --border-color: rgba(0,0,0,0.1);
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.12);
}

:root[data-theme="snowtop"] {
    color-scheme: light;
    --bg-cream: #F2F2F7;
    --primary-light: #E5E5EA;
    --primary-lighter: #F7F7F9;
    --primary: #D1D1D6;
    --primary-dark: #AEAEB2;
    --accent: #1C1C1E;
    --text-dark: #1C1C1E;
    --text-muted: #6E6E73;
    --text-muted-alpha: rgba(110, 110, 115, 0.3);
    --paper-white: #FFFFFF;
    --paper-cream: #F2F2F7;
    --card-income: #E5E5EA;
    --card-expenses: #D1D1D6;
    --card-saved: #EFEFF4;
    --card-remaining: #F7F7FA;
    --chart-primary: #1C1C1E;
    --chart-secondary: #C7C7CC;
    --positive: #34C759;
    --negative: #FF3B30;
    --border-color: rgba(60,60,67,0.12);
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.1);
}

:root[data-theme="dracula"] {
    color-scheme: light;
    --bg-cream: #D6CBCA;
    --primary-light: #996A6A;
    --primary-lighter: #D0BDBC;
    --primary: #B89896;
    --primary-dark: #7B4647;
    --accent: #5D292C;
    --text-dark: #20060A;
    --text-muted: #3E1318;
    --text-muted-alpha: rgba(62, 19, 24, 0.3);
    --paper-white: #E8E0DF;
    --paper-cream: #D6CBCA;
    --card-income: #C9B4B2;
    --card-expenses: #B89896;
    --card-saved: #D6C5C4;
    --card-remaining: #DFD3D2;
    --chart-primary: #5D292C;
    --chart-secondary: #B89896;
    --positive: #2E7D32;
    --negative: #B71C1C;
    --border-color: rgba(0,0,0,0.1);
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.15);
}

:root[data-theme="misted-oak"] {
    color-scheme: dark;
    --bg-cream: #2D1E17;
    --primary-light: #604D40;
    --primary-lighter: #685648;
    --primary: #796254;
    --primary-dark: #523F31;
    --accent: #B39A83;
    --text-dark: #C4B6AB;
    --text-muted: #9D8A7C;
    --text-muted-alpha: rgba(157, 138, 124, 0.3);
    --paper-white: #523F31;
    --paper-cream: #3D2D24;
    --card-income: #3D2D24;
    --card-expenses: #48372D;
    --card-saved: #523F31;
    --card-remaining: #5C493B;
    --chart-primary: #C4B6AB;
    --chart-secondary: #796254;
    --positive: #81C784;
    --negative: #EF5350;
    --border-color: rgba(255,255,255,0.08);
    --shadow: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.3);
}

:root[data-theme="bloodmoon"] {
    color-scheme: dark;
    --bg-cream: #160909;
    --primary-light: #372E2F;
    --primary-lighter: #3D3133;
    --primary: #4f3438;
    --primary-dark: #5E373E;
    --accent: #5C4A4A;
    --text-dark: #b0a2a7;
    --text-muted: #836F70;
    --text-muted-alpha: rgba(131, 111, 112, 0.3);
    --paper-white: #271E1F;
    --paper-cream: #3F3130;
    --card-income: #241416;
    --card-expenses: #2E181A;
    --card-saved: #371F22;
    --card-remaining: #43262A;
    --chart-primary: #b0a2a7;
    --chart-secondary: #4f3438;
    --positive: #81C784;
    --negative: #EF5350;
    --border-color: rgba(255,255,255,0.06);
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.4);
}

:root[data-theme="polaris"] {
    color-scheme: dark;
    --bg-cream: #0B1227;
    --primary-light: #2B3543;
    --primary-lighter: #394659;
    --primary: #5A6D85;
    --primary-dark: #253745;
    --accent: #4A5C6A;
    --text-dark: #B1B2B5;
    --text-muted: #7D8491;
    --text-muted-alpha: rgba(125, 132, 145, 0.3);
    --paper-white: #192433;
    --paper-cream: #11212D;
    --card-income: #152238;
    --card-expenses: #1D2D44;
    --card-saved: #253851;
    --card-remaining: #2F4562;
    --chart-primary: #8497B1;
    --chart-secondary: #5A6D85;
    --positive: #81C784;
    --negative: #EF5350;
    --border-color: rgba(255,255,255,0.06);
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.4);
}

:root[data-theme="noir-classic"] {
    color-scheme: dark;
    --bg-cream: #0E0E0E;
    --primary-light: #333333;
    --primary-lighter: #3F3F3F;
    --primary: #393939;
    --primary-dark: #1C1C1C;
    --accent: #DBDBDE;
    --text-dark: #DBDBDE;
    --text-muted: #909090;
    --text-muted-alpha: rgba(144, 144, 144, 0.3);
    --paper-white: #1C1C1C;
    --paper-cream: #141316;
    --card-income: #181818;
    --card-expenses: #222222;
    --card-saved: #2C2C2C;
    --card-remaining: #363636;
    --chart-primary: #DBDBDE;
    --chart-secondary: #909090;
    --positive: #81C784;
    --negative: #EF5350;
    --border-color: rgba(255,255,255,0.06);
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.4);
}

:root[data-theme="tourmaline"] {
    color-scheme: dark;
    --bg-cream: #211B18;
    --primary-light: #453C37;
    --primary-lighter: #473E39;
    --primary: #574E47;
    --primary-dark: #3D342F;
    --accent: #5C5551;
    --text-dark: #BFB8AF;
    --text-muted: #807D7D;
    --text-muted-alpha: rgba(128, 125, 125, 0.3);
    --paper-white: #342B27;
    --paper-cream: #2D2420;
    --card-income: #2E2723;
    --card-expenses: #37302C;
    --card-saved: #413935;
    --card-remaining: #4C433E;
    --chart-primary: #BFB8AF;
    --chart-secondary: #746C64;
    --positive: #81C784;
    --negative: #EF5350;
    --border-color: rgba(255,255,255,0.06);
    --shadow: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.3);
}


:root {
    --white: var(--text-dark);
}


body {
    font-family: var(--font-family, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    font-size: 13px;
    background: var(--bg-cream);
    color: var(--text-dark);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-window {
    max-width: 820px;
    margin: 0 auto;
    padding: 24px 16px 20px;
}


.app-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 14px;
}

.header-left {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: var(--primary-light);
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-btn svg {
    width: 15px;
    height: 15px;
}

.icon-btn:hover {
    background: var(--primary);
    transform: scale(1.05);
}

.month-selector select {
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    height: 29px;
    padding: 0 34px;
    text-align: center;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--paper-white);
    color: var(--text-dark);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}


.tab-nav {
    display: flex;
    gap: 2px;
    padding: 2px;
    background: var(--primary-light);
    border-radius: 999px;
}

.tab-btn {
    height: 25px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-dark);
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-dark);
    background: rgba(255,255,255,0.3);
}

.tab-btn.active {
    background: var(--paper-white);
    color: var(--text-dark);
    font-weight: 600;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}


.overview-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.overview-card {
    background: var(--paper-white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
}

.overview-card.card-income {
    background: var(--card-income);
}

.overview-card.card-expenses {
    background: var(--card-expenses);
}

.overview-card.card-saved {
    background: var(--card-saved);
}

.overview-card.card-remaining {
    background: var(--card-remaining);
}



.overview-label {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.overview-value {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-dark);
    font-variant-numeric: tabular-nums;
}


.section-header {
    font-family: var(--font-family, inherit);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-dark);
    padding: 7px 12px;
    background: var(--primary-light);
    border-radius: 14px 14px 0 0;
    margin: 0;
    letter-spacing: 0.02em;
    text-align: center;
}


.data-section {
    margin-bottom: 20px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--paper-white);
    display: flex;
    flex-direction: column;
    height: var(--section-height);
}

.data-section.full-width {
    width: 100%;
}

.two-col-row > .data-section,
.two-col-row > .chart-container {
    margin-bottom: 0;
}

.two-col-row.row-fit > .data-section,
.two-col-row.row-fit > .chart-container {
    height: auto;
    max-height: var(--section-height);
}

.overview-row.overview-stack {
    grid-template-columns: 1fr;
    margin-bottom: 0;
    align-content: stretch;
}

.overview-row.overview-stack .overview-card {
    justify-content: center;
}

.table-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.section-header,
.add-row-btn {
    flex: none;
}

.data-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

#expense-log-table th:nth-child(1) { width: 17%; }
#expense-log-table th:nth-child(2) { width: 22%; }
#expense-log-table th:nth-child(4) { width: 18%; }

#bill-table th:nth-child(2) { width: 22%; }
#bill-table th:nth-child(3) { width: 18%; }

#income-table th:nth-child(2) { width: 27%; }
#income-table th:nth-child(3) { width: 27%; }

#savings-table th:nth-child(2) { width: 16%; }
#savings-table th:nth-child(3) { width: 16%; }
#savings-table th:nth-child(4) { width: 26%; padding-right: 48px; }

#debt-table th:nth-child(2) { width: 19%; }
#debt-table th:nth-child(3) { width: 19%; }
#debt-table th:nth-child(4) { width: 19%; }

#subscription-table th:nth-child(2) { width: 17%; }
#subscription-table th:nth-child(3) { width: 12%; }
#subscription-table th:nth-child(4) { width: 15%; }
#subscription-table th:nth-child(5) { width: 13%; }

#expenses-summary-table th:nth-child(2) { width: 21%; }
#expenses-summary-table th:nth-child(3) { width: 21%; }
#expenses-summary-table th:nth-child(4) { width: 21%; }

.data-table thead th {
    background: var(--primary-light);
    color: var(--text-dark);
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 6px 8px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 2;
}

.data-table tbody td {
    padding: 6px 8px;
    overflow-wrap: anywhere;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-dark);
    vertical-align: middle;
    text-align: center;
}

.data-table tbody tr:hover {
    background: var(--primary-light);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table .total-row td {
    font-weight: 700;
    background: var(--primary-light);
    border-top: 2px solid var(--primary);
    white-space: nowrap;
    position: sticky;
    bottom: 0;
    z-index: 2;
}

.data-table td.amount-cell {
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.data-table .negative {
    color: var(--negative);
}

.data-table .positive {
    color: var(--positive);
}

.th-check {
    width: 48px;
    text-align: center;
}

#bill-table .th-check {
    width: 56px;
}

.th-actions {
    width: 36px;
    text-align: center;
}

.editable-cell {
    cursor: text;
    padding: 2px 8px;
    border-radius: 999px;
    transition: background 0.15s ease;
    min-width: 48px;
    max-width: 100%;
    display: inline-block;
    text-align: center;
    overflow-wrap: anywhere;
}

.editable-cell:empty:not(:focus) {
    outline: 1px solid var(--text-muted);
    outline-offset: -1px;
}

.editable-cell:hover {
    background: var(--primary-light);
}

.editable-cell:focus {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    background: var(--paper-cream);
    border-radius: 999px;
}

.category-select {
    font-family: inherit;
    font-size: 12px;
    text-align: center;
    text-overflow: ellipsis;
    padding: 4px 29px 4px 11px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--paper-white);
    color: var(--text-dark);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    max-width: 92px;
}

.row-check {
    width: 18px;
    height: 18px;
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    border: 1px solid var(--text-muted);
    border-radius: 3px;
    background: transparent;
    cursor: pointer;
    transition: background 0.15s ease;
}

.row-check:checked {
    background: var(--accent);
}

.delete-row-btn {
    width: 26px;
    height: 26px;
    margin: 0 auto;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    font-size: 13px;
    opacity: 0.5;
    margin: 0 auto;
}

.delete-row-btn:hover {
    background: rgba(229, 57, 53, 0.1);
    color: var(--negative);
}


.add-row-btn {
    display: block;
    width: calc(100% - 24px);
    margin: 12px;
    padding: 8px 16px;
    border: 1px dashed var(--border-color);
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.add-row-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--primary-light);
}


.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.chart-container {
    background: var(--paper-white);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: var(--section-height);
}

.chart-container.full-chart {
    width: 100%;
}

.chart-area {
    padding: 12px 16px 18px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

#bar-chart, #planner-bar-chart, #sub-bar-chart, #expense-cat-chart {
    width: 100%;
    height: auto;
    display: block;
}

.chart-empty {
    width: 100%;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}


.two-col-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}


.progress-bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 72px;
}

.chart-container.full-chart {
    margin-bottom: 20px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-cream);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--accent);
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    min-width: 32px;
}


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

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--paper-white);
    border-radius: 20px;
    padding: 24px;
    max-width: 480px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-wide {
    max-width: 560px;
}

.modal-small {
    max-width: 360px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-family: var(--font-family, inherit);
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
}

.modal-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--primary-light);
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: var(--primary);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    font-family: inherit;
    font-size: 14px;
    background: var(--bg-cream);
    color: var(--text-dark);
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
}

.modal-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

.btn-primary {
    padding: 8px 20px;
    border-radius: 999px;
    border: none;
    background: var(--accent);
    color: var(--paper-white);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    filter: brightness(1.1);
}

.btn-secondary {
    padding: 8px 20px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-dark);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--primary-light);
}

.btn-danger {
    padding: 8px 20px;
    border-radius: 999px;
    border: none;
    background: var(--negative);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    filter: brightness(1.1);
}


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

.theme-swatch {
    aspect-ratio: 1;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

.theme-swatch:hover {
    transform: scale(1.08);
}

.theme-swatch.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
}

.theme-swatch::after {
    content: attr(data-name);
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: var(--text-muted);
    white-space: nowrap;
    text-transform: capitalize;
}


.sync-badge {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--primary-light);
    color: var(--text-muted);
}


.toast {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    color: var(--primary);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}


body {
    background-image: linear-gradient(var(--border-color) 1px, transparent 1px),
                      linear-gradient(90deg, var(--border-color) 1px, transparent 1px);
    background-size: 14px 14px;
    background-attachment: fixed;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--primary-dark);
    border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

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

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

@keyframes progressLoad {
    from { width: 0%; }
}

.tab-panel.active {
    animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.overview-card {
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.overview-card:nth-child(1) { animation-delay: 0.05s; }
.overview-card:nth-child(2) { animation-delay: 0.1s; }
.overview-card:nth-child(3) { animation-delay: 0.15s; }
.overview-card:nth-child(4) { animation-delay: 0.2s; }

.progress-fill {
    animation: progressLoad 0.8s cubic-bezier(0.1, 0.8, 0.2, 1) forwards;
}

#settings-btn {
    padding: 0;
}

#settings-btn svg {
    display: block;
    transition: transform 0.3s ease;
}

#settings-btn:hover svg {
    transform: rotate(45deg);
}

#bar-chart rect, #planner-bar-chart rect, #sub-bar-chart rect, #expense-cat-chart rect {
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, filter 0.2s ease;
    cursor: pointer;
}
#bar-chart rect:hover, #planner-bar-chart rect:hover, #sub-bar-chart rect:hover, #expense-cat-chart rect:hover {
    filter: brightness(1.15);
    transform: scaleX(1.015);
    transform-origin: left center;
}


@media (max-width: 768px) {
    .overview-row {
        grid-template-columns: 1fr 1fr;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table thead th,
    .data-table tbody td {
        padding: 8px 8px;
    }

    .data-table thead th {
        padding-left: 6px;
        padding-right: 6px;
    }

    #expense-log-table th:nth-child(2) { width: 24%; }
    #expense-log-table th:nth-child(4) { width: 19%; }
    #bill-table th:nth-child(3) { width: 21%; }
    #savings-table th:nth-child(2) { width: 15%; }
    #savings-table th:nth-child(3) { width: 20%; }

    .app-window {
        padding: 0 8px 24px;
    }

    .overview-value {
        font-size: 16px;
    }
}

@media (max-width: 660px) {
    .charts-row {
        grid-template-columns: 1fr;
    }

    .two-col-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .app-header {
        grid-template-columns: auto 1fr;
        row-gap: 8px;
    }

    .tab-nav {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-self: center;
    }
}

@media (max-width: 480px) {
    .overview-row {
        grid-template-columns: 1fr;
    }

    .tab-btn {
        font-size: 11px;
        padding: 0 4px;
    }

    .app-title {
        font-size: 18px;
    }
}

@media (max-width: 360px) {
    .tab-btn {
        font-size: 10px;
        padding: 0 3px;
    }
}


.settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 220px;
    max-height: 70vh;
    background: var(--paper-white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: none;
    z-index: 1000;
    overflow: hidden;
    box-sizing: border-box;
    box-shadow: none;
}

.settings-panel.active {
    display: block;
}

.settings-content {
    padding: 12px;
    max-height: calc(70vh - 4px);
    overflow-y: auto;
    overflow-x: hidden;
}

.settings-content::-webkit-scrollbar {
    width: 4px;
}

.settings-content::-webkit-scrollbar-track {
    background: transparent;
}

.settings-content::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 2px;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.settings-header h3 {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.settings-close {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-muted);
    opacity: 0.5;
    transition: opacity 0.15s, background-color 0.15s;
    padding: 0;
}

.settings-close:hover {
    opacity: 1;
    background: var(--border-color);
}

.settings-section {
    margin-bottom: 12px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-label {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
    display: block;
}

.y2k-select {
    width: 100%;
    font-size: 10px;
    font-family: inherit;
    color: var(--text-dark);
    background: var(--primary-light);
    border: none;
    border-radius: 999px;
    padding: 6px 30px 6px 12px;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 1 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: background-color 0.15s ease;
}

.y2k-select:focus {
    background-color: var(--primary-light);
    filter: brightness(0.95);
}

.y2k-select option {
    background: var(--paper-white);
    color: var(--text-dark);
}


.sync-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.sync-section label {
    display: block;
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}

.sync-status-text {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-dark);
}

.sync-status-text.synced {
    font-weight: 600;
}

.sync-controls {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.sync-buttons-row {
    display: flex;
    flex-direction: row;
    gap: 6px;
    width: 100%;
}

.sync-buttons-row .sync-btn {
    flex: 1;
    min-width: 0;
    font-size: 10px;
}

.sync-btn {
    flex: 1;
    min-width: 60px;
    padding: 6px 10px;
    border: none;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.sync-btn:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

.sync-btn:active {
    transform: scale(0.98);
}

.sync-btn.secondary {
    background: var(--primary-light);
    color: var(--text-dark);
}

.sync-btn.danger {
    background: rgba(231, 76, 60, 0.15);
    color: #c0392b;
}

.sync-btn.danger:hover {
    background: rgba(231, 76, 60, 0.25);
}

#sync-code-input {
    flex: 1;
    min-width: 60px;
    padding: 6px 10px;
    border: none;
    border-radius: 999px;
    font-size: 9px;
    font-family: inherit;
    background: var(--primary-light);
    transition: background-color 0.15s ease;
    color: var(--text-dark);
}

#sync-code-input:focus {
    outline: none;
    filter: brightness(0.95);
}

.sync-hint {
    font-size: 9px;
    color: var(--text-muted);
    margin: 12px 0 0 0;
    text-align: center;
    line-height: 1.3;
}

.sync-status-panel {
    background: var(--primary-lighter);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
}

.sync-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    min-height: 24px;
}

.sync-status-row:not(:last-child) {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sync-label {
    font-size: 9px;
    color: var(--text-dark);
    font-weight: 500;
    line-height: 1.3;
}

.sync-value {
    font-size: 9px;
    color: var(--text-dark);
    font-weight: 500;
    line-height: 1.3;
    display: flex;
    align-items: center;
}

.sync-time-value {
    color: var(--text-muted);
    font-size: 9px;
}

.sync-code-row {
    flex-wrap: nowrap;
    gap: 6px;
}

.sync-code-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    background: var(--paper-white);
    border-radius: 999px;
    border: 1px solid var(--border-color);
    min-width: 0;
    flex-shrink: 1;
    max-width: 100%;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sync-code-pill:hover {
    background: var(--border-color);
}

.sync-code-pill:active {
    transform: scale(0.97);
}

.sync-code-value {
    font-family: 'Courier Prime', monospace;
    font-size: 9px;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.3px;
    margin-top: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.share-link-section {
    margin-top: 12px;
    padding-top: 12px;
    margin-bottom: 12px;
    border-top: 1px solid var(--border-color);
}

.share-link-section label {
    display: block;
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}

.share-link-container {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-lighter);
    border-radius: 999px;
    padding: 4px 4px 4px 10px;
}

.share-link-input {
    flex: 1;
    min-width: 0;
    padding: 4px 0;
    border: none;
    background: transparent;
    font-size: 9px;
    font-family: inherit;
    color: var(--text-dark);
    outline: none;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.share-copy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.share-copy-btn:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

.share-copy-btn:active {
    transform: scale(0.98);
}

.share-copy-btn svg {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
}

.sync-error-panel {
    background: rgba(231, 76, 60, 0.1);
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 12px;
    border: 1px solid rgba(231, 76, 60, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sync-error-icon {
    font-size: 14px;
    color: #c0392b;
}

.sync-error-message {
    font-size: 10px;
    color: #c0392b;
    flex: 1;
}
.setting-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.setting-toggle-row .settings-label {
    margin-bottom: 0;
}

.cute-toggle {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
    flex-shrink: 0;
}

.cute-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--text-muted);
    transition: .2s ease;
    border-radius: 999px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: var(--paper-white);
    transition: .2s ease;
    border-radius: 50%;
}

.cute-toggle input:checked + .toggle-slider {
    background-color: var(--accent);
}

.cute-toggle input:checked + .toggle-slider:before {
    transform: translateX(14px);
}

html.hide-grid body {
    background-image: none !important;
}

html.transparent-bg body {
    background: transparent;
    background-image: none !important;
}

html.transparent-bg:root {
    color-scheme: light;
}

html.transparent-bg.dark-page:root {
    color-scheme: dark;
}

[data-shape="square"] .tab-nav,
[data-shape="square"] .data-section,
[data-shape="square"] .editable-cell,
[data-shape="square"] .editable-cell:focus,
[data-shape="square"] .chart-container,
[data-shape="square"] .progress-bar,
[data-shape="square"] .progress-fill,
[data-shape="square"] .modal-content,
[data-shape="square"] .settings-close,
[data-shape="square"] .btn-primary,
[data-shape="square"] .btn-secondary,
[data-shape="square"] .btn-danger,
[data-shape="square"] .sync-badge,
[data-shape="square"] .toast,
[data-shape="square"] .row-check,
[data-shape="square"] .sync-error-panel {
    border-radius: 0;
}

[data-shape="square"] .section-header {
    border-radius: 0 0 0 0;
}

[data-shape="square"] #reset-categories-btn,
[data-shape="square"] #reset-data-btn {
    border-radius: 0 !important;
}

[data-shape="square"] #sync-code-input {
    border-radius: 0;
}

html[data-section] body {
    min-height: 0;
}

html[data-section] .app-window {
    max-width: 100%;
    padding: 6px;
}

html[data-section] .table-scroll::-webkit-scrollbar {
    height: 4px;
}

html[data-section] .table-scroll::-webkit-scrollbar-thumb {
    background: var(--border-color);
}

html[data-section] .app-header,
html[data-section] .tab-nav {
    display: none;
}

html[data-section="controls"] .app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0;
    margin-bottom: 0;
    border-bottom: none;
}

html[data-section="controls"],
html[data-section="controls"] body {
    background: transparent;
    background-image: none;
}

html[data-section="controls"] .app-window {
    padding: 2px 4px;
}

html[data-section="controls"] #tab-content {
    display: none;
}

html[data-section="controls"] .settings-panel {
    top: 0;
    left: 0;
    transform: none;
    max-height: 100%;
}

html[data-section="controls"] .settings-content {
    max-height: calc(100vh - 4px);
}

html[data-section] .tab-panel {
    display: none;
}

html[data-section] .tab-panel.section-host {
    display: block;
    animation: none;
}

html[data-section] .sec-hidden {
    display: none !important;
}

html[data-section] .two-col-row,
html[data-section] .two-col-row.row-fit {
    display: block;
    gap: 0;
    margin-bottom: 0;
}

html[data-section] .data-section,
html[data-section] .chart-container,
html[data-section] .two-col-row > .data-section,
html[data-section] .two-col-row > .chart-container,
html[data-section] .two-col-row.row-fit > .data-section,
html[data-section] .two-col-row.row-fit > .chart-container {
    height: auto;
    max-height: none;
    margin-bottom: 0;
}

html[data-section] .data-table thead th,
html[data-section] .data-table tbody td {
    padding-left: 4px;
    padding-right: 4px;
}

html[data-section] .editable-cell {
    min-width: 32px;
    padding-left: 6px;
    padding-right: 6px;
}

html[data-section] .category-select {
    max-width: 84px;
}

html[data-section] .overview-row,
html[data-section] .overview-row.overview-stack {
    margin-bottom: 0;
}

html[data-section] .overview-row,
html[data-section] .overview-row.overview-stack {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.section-embed-section .share-link-container {
    margin-top: 8px;
}

/* section embeds sit inside the embed block now, above Your Embed Link, like koubit's
   Weekly Embed. nari 2026-10-03. */
.share-link-section > .section-embed-section {
    margin-bottom: 10px;
}

#settings-btn {
    width: 18px;
    height: 18px;
    min-width: 18px;
    max-width: 18px;
    min-height: 18px;
    max-height: 18px;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    align-self: center;
    box-sizing: border-box;
    aspect-ratio: 1 / 1;
    background: var(--paper-white);
    border: 1px solid var(--primary);
    border-radius: 50%;
    opacity: 1;
    color: var(--accent);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}

#settings-btn svg {
    display: block;
    width: 12px;
    height: 12px;
    transition: none;
}

[data-settings-border="off"] #settings-btn {
    border-color: transparent;
    background: transparent;
}

#settings-btn:hover {
    background: var(--primary-light);
    color: var(--accent);
    transform: none;
}

#settings-btn:hover svg {
    transform: none;
}

:root[data-theme="bloodmoon"] #settings-btn,
:root[data-theme="polaris"] #settings-btn,
:root[data-theme="tourmaline"] #settings-btn {
    color: var(--text-dark);
}

:root[data-theme="bloodmoon"] #settings-btn:hover,
:root[data-theme="polaris"] #settings-btn:hover,
:root[data-theme="tourmaline"] #settings-btn:hover {
    background: var(--primary);
    color: var(--text-dark);
}

[data-settings-hover="on"] #settings-btn {
    opacity: 0;
    transition: opacity 0.15s, background-color 0.15s, color 0.15s;
}

[data-settings-hover="on"] .app-window:hover #settings-btn,
[data-settings-hover="on"] #settings-btn:focus-visible {
    opacity: 1;
}

@media (hover: none) {
    [data-settings-hover="on"] #settings-btn {
        opacity: 1;
    }
}

[data-shape="square"] #settings-btn {
    border-radius: 0;
}

.window-style-btn {
    background: var(--primary-light);
    color: var(--text-muted);
}

.window-style-btn.active {
    background: var(--accent);
    color: var(--paper-white);
}

.settings-icon-btn:hover,
.settings-icon-btn.active {
    background: var(--primary-light);
}

.settings-icon-btn:hover svg {
    color: var(--text-dark);
}

.settings-icon-btn.active svg {
    color: var(--accent);
}


/* the embed block is the first thing inside the sync section, so its own top
   margin, padding and border doubled the section's own. one divider, not two.
   nari spotted the gap in koucard 2026-10-01. */
.sync-section > .share-link-section:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

/* the title stays put while the settings scroll, like kourie's. it sits outside
   the scroller now, in the same spot as before, and the scroller keeps its 4px
   gutter so the line under the title ends where the rows do. nari 2026-10-02. */
.settings-panel.active {
    display: flex;
    flex-direction: column;
}

.settings-panel > .settings-header {
    flex-shrink: 0;
    margin: 12px 16px 0 12px;
}

.settings-panel > .settings-content {
    min-height: 0;
    scrollbar-gutter: stable;
}

/* the pill words (Curve / Square, Outline / Filled): the line is trimmed to the letters, then
   lifted so the middle point between the capital tops and the lowercase tops sits at the middle
   of the pill. it reads each font's own cap and x-heights, so it fits every widget font; same 25px
   pill. browsers without text-box or the cap unit keep a centered line. nari, 10/02 */
.settings-panel .window-style-btn {
    text-box: trim-both cap alphabetic;
    height: 25px;
    padding-top: 0;
    padding-bottom: 0;
    padding-bottom: calc((1cap - 1ex) / 2);
}

/* Imprima sits a hair high with the rule above, so it comes down a quarter pixel (nari's pick) */
@container style(--font-family: 'Imprima', sans-serif) {
    .settings-panel .window-style-btn {
        padding-bottom: calc((1cap - 1ex) / 2 - 0.5px);
    }
}
