/* Midnight refinement: full-surface contrast for the dark preset. */
body[data-theme="midnight"]{--bg:#0c1220;--card:#151f2e;--ink:#edf4fa;--muted:#acbdce;--line:#36485f;--brand:#71d5e3;--sidebar:#080d16;--sideink:#c5d4e1;background:radial-gradient(circle at 82% 0,#1f3d55 0,transparent 32rem),#0c1220;color:#edf4fa}body[data-theme="midnight"] .sidebar{background:linear-gradient(160deg,#142a3b 0,#080d16 70%)}body[data-theme="midnight"] .sidebar:after{background:linear-gradient(90deg,transparent,#71d5e3,transparent)}body[data-theme="midnight"] .nav-label{color:#86a0b3}body[data-theme="midnight"] .nav a:hover,body[data-theme="midnight"] .nav a.active{background:#1a3144}body[data-theme="midnight"] .nav a:hover:before,body[data-theme="midnight"] .nav a.active:before{background:#f2c14e}body[data-theme="midnight"] .nav-count{background:#f2c14e;color:#132333}body[data-theme="midnight"] .main{background:transparent}body[data-theme="midnight"] .topbar{border-color:#36485f}body[data-theme="midnight"] .userbox{background:transparent;border-color:#51647a}body[data-theme="midnight"] .avatar{background:#f2c14e;color:#102436}body[data-theme="midnight"] h1,body[data-theme="midnight"] h2,body[data-theme="midnight"] h3,body[data-theme="midnight"] strong,body[data-theme="midnight"] .customer-summary strong{color:#f4f8fc}body[data-theme="midnight"] p,body[data-theme="midnight"] .muted,body[data-theme="midnight"] label,body[data-theme="midnight"] .crumb,body[data-theme="midnight"] .title-row p,body[data-theme="midnight"] .customer-summary small{color:#b4c3d1}body[data-theme="midnight"] .panel,body[data-theme="midnight"] .stat,body[data-theme="midnight"] .settings-form,body[data-theme="midnight"] .settings-card{background:#151f2e;border-color:#36485f;color:#edf4fa}body[data-theme="midnight"] .panel-head,body[data-theme="midnight"] .customer-record-list .panel-head{border-color:#36485f}body[data-theme="midnight"] .settings-form-head,body[data-theme="midnight"] .settings-form-footer,body[data-theme="midnight"] .settings-card-head{background:#192536;border-color:#36485f}body[data-theme="midnight"] .settings-nav a{border-color:#40536b;background:#151f2e;color:#b9c9d8}body[data-theme="midnight"] .settings-nav a:hover{border-color:#71d5e3;color:#71d5e3}body[data-theme="midnight"] .settings-nav a.active{border-color:#71d5e3;background:#71d5e3;color:#0c1c2b}body[data-theme="midnight"] .settings-progress{border-color:#47627b;background:#1b3348;color:#a6edf5}body[data-theme="midnight"] .settings-field{border-color:#36485f}body[data-theme="midnight"] .settings-field input,body[data-theme="midnight"] .settings-field select,body[data-theme="midnight"] .settings-field textarea,body[data-theme="midnight"] input,body[data-theme="midnight"] select,body[data-theme="midnight"] textarea{background:#0f1826;border-color:#455b73;color:#edf4fa}body[data-theme="midnight"] .button,body[data-theme="midnight"] button{background:#71d5e3;border-color:#71d5e3;color:#0b1a27}body[data-theme="midnight"] .button:hover,body[data-theme="midnight"] button:hover{background:#a6edf5;border-color:#a6edf5}body[data-theme="midnight"] .button.secondary{background:transparent;border-color:#58718a;color:#d3e5ef}body[data-theme="midnight"] .button.secondary:hover{background:#284158;border-color:#71d5e3;color:#fff}body[data-theme="midnight"] table{border-color:#71d5e3}body[data-theme="midnight"] th{color:#a9c0d0}body[data-theme="midnight"] td{border-color:#304157}body[data-theme="midnight"] tbody tr:nth-child(even),body[data-theme="midnight"] .customer-service-item,body[data-theme="midnight"] .customer-quick-links a,body[data-theme="midnight"] .customer-summary{background:#111a29;border-color:#35475d}body[data-theme="midnight"] tbody tr:hover,body[data-theme="midnight"] .customer-quick-links a:hover{background:#1c2d40;color:#a6edf5}body[data-theme="midnight"] .stat:before{background:#f2c14e}body[data-theme="midnight"] .ticket-link,body[data-theme="midnight"] .panel-head a,body[data-theme="midnight"] .customer-quick-links span{color:#81e1ec}body[data-theme="midnight"] .tabs,body[data-theme="midnight"] .customer-tabs{border-color:#43566e;background:transparent}body[data-theme="midnight"] .tabs a{color:#adbfce}body[data-theme="midnight"] .tabs a.active{color:#a6edf5;border-color:#71d5e3;background:#152a3c}body[data-theme="midnight"] .badge.open,body[data-theme="midnight"] .badge.unpaid{background:#233d59;color:#9cdbff}body[data-theme="midnight"] .badge.due,body[data-theme="midnight"] .badge.high{background:#46391d;color:#ffd579}body[data-theme="midnight"] .badge.paid,body[data-theme="midnight"] .badge.active,body[data-theme="midnight"] .badge.resolved{background:#163f3d;color:#81f0d0}body[data-theme="midnight"] .badge.closed,body[data-theme="midnight"] .badge.terminated{background:#2a3545;color:#c1cfdb}
/* Explicit dark surfaces for pages with specialised light-mode components. */
body[data-theme="midnight"] input::placeholder,body[data-theme="midnight"] textarea::placeholder{color:#8fa4b8;opacity:1}body[data-theme="midnight"] select option{background:#101a29;color:#edf4fa}body[data-theme="midnight"] article:has(.service-customer-picker),body[data-theme="midnight"] article:has(.service-customer-picker)+section.grid>article:first-child,body[data-theme="midnight"] article:has(.service-customer-picker)+section.grid>form{background:#151f2e;border-color:#3b526b;box-shadow:0 14px 32px rgba(0,0,0,.28)}body[data-theme="midnight"] article:has(.service-customer-picker)+section.grid>article:first-child .panel-head{background:#192738;border-color:#3b526b}body[data-theme="midnight"] article:has(.service-customer-picker)+section.grid>article:first-child .panel-head h2,body[data-theme="midnight"] article:has(.service-customer-picker)+section.grid>article:first-child table td:first-child strong,body[data-theme="midnight"] article:has(.service-customer-picker)+section.grid>form h2{color:#f4f8fc}body[data-theme="midnight"] article:has(.service-customer-picker)+section.grid>form p,body[data-theme="midnight"] article:has(.service-customer-picker)+section.grid>form label,body[data-theme="midnight"] .service-customer-picker label{color:#c3d2df}body[data-theme="midnight"] .service-customer-picker select,body[data-theme="midnight"] article:has(.service-customer-picker)+section.grid>form input,body[data-theme="midnight"] article:has(.service-customer-picker)+section.grid>form select,body[data-theme="midnight"] article:has(.service-customer-picker)+section.grid>form textarea{background:#0e1826;border-color:#58718a;color:#edf4fa;box-shadow:inset 0 1px 0 rgba(255,255,255,.035)}body[data-theme="midnight"] article:has(.service-customer-picker)+section.grid>form input:focus,body[data-theme="midnight"] article:has(.service-customer-picker)+section.grid>form select:focus,body[data-theme="midnight"] article:has(.service-customer-picker)+section.grid>form textarea:focus{outline:2px solid rgba(113,213,227,.38);border-color:#71d5e3}
/* Email activity uses a contained light table, so every row needs a dark surface. */
body[data-theme="midnight"] .table-wrap:has(.email-log-table){border-color:#3b526b;background:#0b1421;scrollbar-color:#526c86 #101b2a}body[data-theme="midnight"] .table-wrap:has(.email-log-table) .email-log-table{background:#101a29;color:#e7f0f7}body[data-theme="midnight"] .table-wrap:has(.email-log-table) .email-log-table tr{background:#111c2b;color:#e7f0f7}body[data-theme="midnight"] .table-wrap:has(.email-log-table) .email-log-table tr:nth-child(even){background:#172536}body[data-theme="midnight"] .table-wrap:has(.email-log-table) .email-log-table tr:first-child{background:#1a2a3d}body[data-theme="midnight"] .table-wrap:has(.email-log-table) .email-log-table th{background:#1a2a3d;color:#b9d9e9;box-shadow:0 1px 0 #405873}body[data-theme="midnight"] .table-wrap:has(.email-log-table) .email-log-table td{border-color:#31465d;color:#e7f0f7}body[data-theme="midnight"] .table-wrap:has(.email-log-table) .email-log-table strong{color:#f6fbff}body[data-theme="midnight"] .table-wrap:has(.email-log-table) .email-log-table .muted{color:#aabfd0}body[data-theme="midnight"] .table-wrap:has(.email-log-table) .email-log-table tr:hover{background:#20344a}body[data-theme="midnight"] .table-wrap:has(.email-log-table) .email-log-table .button.secondary{background:#16293c;border-color:#567491;color:#c8e6f3}body[data-theme="midnight"] .table-wrap:has(.email-log-table) .email-log-table .button.secondary:hover{background:#71d5e3;border-color:#71d5e3;color:#071725}
/* Remaining admin workspaces: override their local light-only component skins. */
body[data-theme="midnight"] .staff-account-card{border-color:#3b526b;background:#151f2e;box-shadow:0 14px 32px rgba(0,0,0,.26)}body[data-theme="midnight"] .permission-row{border-color:#3b526b;background:#101a29}body[data-theme="midnight"] .permission-row strong{color:#f2f7fb}body[data-theme="midnight"] .permission-row small,body[data-theme="midnight"] .permission-toggle,body[data-theme="midnight"] .staff-meta,body[data-theme="midnight"] .staff-permissions legend{color:#aebfd0}body[data-theme="midnight"] .permission-row select{border-color:#56718b;background:#0d1725;color:#edf4fa}body[data-theme="midnight"] .full-admin-note,body[data-theme="midnight"] .is-full-admin{border-color:#856d2b;background:#2d2b1c;color:#ffe3a0}body[data-theme="midnight"] .staff-delete-zone{border-color:#7c3945;background:#2a1820}body[data-theme="midnight"] .invoice-item,body[data-theme="midnight"] .billing-options{border-color:#3b526b;background:#101a29;color:#e9f3f9}body[data-theme="midnight"] .remove-invoice-item{background:#223246;color:#c5d6e4}body[data-theme="midnight"] .invoice-form input,body[data-theme="midnight"] .invoice-form select,body[data-theme="midnight"] .invoice-form textarea{border-color:#58718a;background:#0e1826;color:#edf4fa}body[data-theme="midnight"] .customer-danger-zone{border-color:#783743;background:#2b1921}body[data-theme="midnight"] .customer-delete-form{border-color:#743945;background:#171724}body[data-theme="midnight"] .customer-delete-form label,body[data-theme="midnight"] .customer-danger-zone p{color:#e6b8bd}body[data-theme="midnight"] .customer-danger-zone h2{color:#ffc1c9}body[data-theme="midnight"] .customer-delete-form input{border-color:#7e4350;background:#0e1826;color:#edf4fa}body[data-theme="midnight"] section:has(.recurring-search)+article .table-wrap,body[data-theme="midnight"] .invoice-layout>article:first-child .table-wrap{border-color:#3b526b;background:#101a29}body[data-theme="midnight"] section:has(.recurring-search)+article .table-wrap th,body[data-theme="midnight"] .invoice-layout>article:first-child .table-wrap th{background:#1a2a3d;color:#b9d9e9;box-shadow:0 1px 0 #405873}body[data-theme="midnight"] .recurring-search input,body[data-theme="midnight"] .ticket-search select{border-color:#58718a;background:#0e1826;color:#edf4fa}body[data-theme="midnight"] .mailbox-address{border-color:#526b84;background:#101a29;color:#d5e4ee}body[data-theme="midnight"] .mailbox-message-meta,body[data-theme="midnight"] .mailbox-message pre,body[data-theme="midnight"] .mailbox-reply textarea{border-color:#3b526b;background:#101a29;color:#eaf3f9}body[data-theme="midnight"] .mailbox-message-meta strong,body[data-theme="midnight"] .mailbox-message pre{color:#eaf3f9}body[data-theme="midnight"] .mailbox-bulkbar{background:#182637;color:#d5e5ef}body[data-theme="midnight"] .mailbox-row.is-read{background:#111c2b}body[data-theme="midnight"] .mailbox-row.unread{background:#1a2b40;color:#eaf3f9}body[data-theme="midnight"] .mailbox-row-link strong{color:#f3f8fb}body[data-theme="midnight"] .setup-terms,body[data-theme="midnight"] .terms-copy,body[data-theme="midnight"] .newsletter-recipient-toolbar,body[data-theme="midnight"] .newsletter-recipient-list{border-color:#3b526b;background:#101a29;color:#eaf3f9}body[data-theme="midnight"] .terms-copy pre,body[data-theme="midnight"] .newsletter-recipient-list strong{color:#eaf3f9}body[data-theme="midnight"] .newsletter-composer textarea,body[data-theme="midnight"] .customer-email-form textarea{background:#0e1826;color:#edf4fa}body[data-theme="midnight"] .customer-tabs{background:#111c2b}body[data-theme="midnight"] .ticket-unread .panel-head{background:#192b3e}body[data-theme="midnight"] .ticket-section .table-wrap th{background:#1a2a3d;color:#b9d9e9}body[data-theme="midnight"] .invoice-filter-tabs a{border-color:#3d566f;background:#111d2c;color:#c5d7e4}body[data-theme="midnight"] .invoice-filter-tabs a:hover,body[data-theme="midnight"] .invoice-filter-tabs a.active{border-color:#71d5e3;background:#18364b;color:#baf2f7}body[data-theme="midnight"] .online-user-count{border-color:#346d63;background:#15362f;color:#9be8d4}
/* Invoice composer and history use deep nested selectors in the base sheet. */
body[data-theme="midnight"] .invoice-form .invoice-item{border-color:#3b526b!important;background:#101a29!important;box-shadow:0 1px 2px rgba(0,0,0,.32)!important}body[data-theme="midnight"] .invoice-form .invoice-item label,body[data-theme="midnight"] .invoice-form label,body[data-theme="midnight"] .invoice-form .invoice-items-head h3{color:#c7d8e5!important}body[data-theme="midnight"] .invoice-form .remove-invoice-item{background:#223246!important;color:#cbdce7!important}body[data-theme="midnight"] .invoice-form .billing-options{border-color:#3b526b!important;background:#101a29!important}body[data-theme="midnight"] .invoice-form .billing-options summary{color:#edf4fa!important}body[data-theme="midnight"] .invoice-form .muted,body[data-theme="midnight"] .invoice-form p{color:#aec1d1!important}body[data-theme="midnight"] .invoice-layout>article:first-child .table-wrap{background:#0d1725!important;border-color:#3b526b!important}body[data-theme="midnight"] .invoice-layout>article:first-child .table-wrap table{background:#0d1725!important;color:#eaf3f9!important}body[data-theme="midnight"] .invoice-layout>article:first-child .table-wrap table tr{background:#111c2b!important;color:#eaf3f9!important}body[data-theme="midnight"] .invoice-layout>article:first-child .table-wrap table tr:nth-child(even){background:#172536!important}body[data-theme="midnight"] .invoice-layout>article:first-child .table-wrap table tr:first-child,body[data-theme="midnight"] .invoice-layout>article:first-child .table-wrap table th{background:#1a2a3d!important;color:#b9d9e9!important;box-shadow:0 1px 0 #405873!important}body[data-theme="midnight"] .invoice-layout>article:first-child .table-wrap table td{border-color:#31465d!important;color:#eaf3f9!important}body[data-theme="midnight"] .invoice-layout>article:first-child .table-wrap table strong{color:#f6fbff!important}body[data-theme="midnight"] .invoice-layout>article:first-child .table-wrap table tr:hover{background:#20344a!important}
body[data-theme="midnight"] .success,body[data-theme="midnight"] button.success{border-color:#259b77;background:#16795f;color:#effff8}body[data-theme="midnight"] .success:hover,body[data-theme="midnight"] button.success:hover{border-color:#63d4ad;background:#249b76;color:#fff}
/* The appearance previews intentionally remain light, so keep their copy readable in the dark theme. */
body[data-theme="midnight"]{overflow-x:hidden}body[data-theme="midnight"] .settings-page,body[data-theme="midnight"] .settings-form,body[data-theme="midnight"] .settings-form-body,body[data-theme="midnight"] .appearance-grid,body[data-theme="midnight"] .appearance-fonts{min-width:0;max-width:100%}body[data-theme="midnight"] .theme-card-frame{border-color:#6a7b8e;background:#fffdf8}body[data-theme="midnight"] .theme-card-copy{background:#fffdf8!important;color:#213a43!important}body[data-theme="midnight"] .theme-card-copy strong{color:#213a43!important}body[data-theme="midnight"] .theme-card-copy small{color:#596963!important}body[data-theme="midnight"] .font-card span{border-color:#6a7b8e;background:#fffdf8;color:#213a43}body[data-theme="midnight"] .font-card b{color:#213a43!important}body[data-theme="midnight"] .font-card small{color:#596963!important}body[data-theme="midnight"] .font-card input:checked+span{border-color:#f2c14e;background:#fff3dc;color:#213a43}
