/* Ayukki v28 — accessible light & dark theme. Loaded AFTER every v27 stylesheet.
   Scope all dark overrides under html[data-ay-theme="dark"] to preserve v27 light theme.
*/
:root{--ay-theme-accent:#810D0D}
html[data-ay-theme="dark"]{
  color-scheme:dark;
  --bg:#111720;--panel:#1b2430;--ink:#ecf1f6;--muted:#abb6c3;
  --line:#34404d;--ok:#65d4a8;--warn:#f1b879;--danger:#f48585;
  --shadow:0 12px 38px rgba(0,0,0,.15);--brand-soft:#42292b;
  --ay-pop-bg:#212a36;--ay-pop-ink:#f0f3f8;--ay-pop-muted:#acb8c3;
  --ay-pop-line:#3c4856;--ay-pop-soft:#402a30;
  --ay-pop-shadow:0 25px 50px rgba(0,0,0,.35);
  --ay-theme-accent:#ffa29a;
}
/* Theme switch fixed beside existing logout in the left rail. */
.app>aside .ay-logout-slot{gap:9px;flex-direction:column!important;align-items:center;padding-bottom:4px}
.app>aside .ay-theme-toggle{
  width:48px;min-width:48px;height:46px;display:flex;align-items:center;justify-content:center;
  border:1px solid #e7e9ee;border-radius:12px;background:#f4f6f9;color:#737d8c;
  padding:0;cursor:pointer;position:relative;font:600 12px Poppins,system-ui,sans-serif;
  transition:background .2s ease,border-color .2s ease,color .2s ease,transform .2s ease;
}
.app>aside .ay-theme-toggle:hover{background:#fff0eb;border-color:#edc9c3;color:#810D0D;transform:translateY(-1px)}
.app>aside .ay-theme-toggle:focus-visible,[data-ay-theme-choice]:focus-visible{outline:3px solid #d88176;outline-offset:3px}
.app>aside .ay-theme-icon{width:20px;height:20px;flex-shrink:0}
.app>aside .ay-sun-icon{display:none}
html[data-ay-theme="dark"] .app>aside .ay-moon-icon{display:none}
html[data-ay-theme="dark"] .app>aside .ay-sun-icon{display:block}
.app>aside .ay-theme-label{display:none}
@media(min-width:861px){
  .app>aside .ay-theme-toggle:after{
    content:attr(title);position:absolute;left:calc(100% + 15px);bottom:8px;
    background:#25292f;color:#fff;padding:9px 13px;border-radius:9px;font-size:11px;
    white-space:nowrap;box-shadow:0 8px 22px rgba(18,25,32,.12);
    opacity:0;visibility:hidden;transform:translateX(-4px);pointer-events:none;z-index:70;
    transition:opacity .16s ease,transform .16s ease,visibility .16s ease;
  }
  .app>aside .ay-theme-toggle:hover:after,.app>aside .ay-theme-toggle:focus-visible:after{opacity:1;visibility:visible;transform:translateX(0)}
}
@media(max-width:860px){
 .app>aside .ay-logout-slot{gap:8px!important;flex-direction:column!important;align-items:stretch!important}
 .app>aside .ay-theme-toggle{width:100%!important;min-height:46px!important;height:46px!important;justify-content:center;gap:10px}
 .app>aside .ay-theme-label{display:inline;font-size:12px}
}
.ay-theme-choices{display:flex;flex-wrap:wrap;gap:10px;margin-top:12px}
.ay-theme-choices button{border:1px solid #e4e7eb;background:#f7f8fa;color:#65707c;border-radius:11px;min-height:43px;padding:9px 14px;font:600 11px Poppins,system-ui,sans-serif;cursor:pointer}
.ay-theme-choices button[aria-pressed="true"]{border-color:#d27a72;background:#fff0ea;color:#810D0D;box-shadow:0 0 0 2px rgba(129,13,13,.05)}
/* Global surfaces */
html[data-ay-theme="dark"] body,
html[data-ay-theme="dark"] .app,
html[data-ay-theme="dark"] .app main,
html[data-ay-theme="dark"] html{background:#111720!important;color:#ecf1f6!important}
html[data-ay-theme="dark"] .app>aside,
html[data-ay-theme="dark"] .ay-workspace-header,
html[data-ay-theme="dark"] .app>aside .menus,
html[data-ay-theme="dark"] .panel,
html[data-ay-theme="dark"] .card,
html[data-ay-theme="dark"] .settings-card,
html[data-ay-theme="dark"] .finance-summary .card,
html[data-ay-theme="dark"] .customer-kpis .card,
html[data-ay-theme="dark"] .an-kpi,
html[data-ay-theme="dark"] .an-toolbar,
html[data-ay-theme="dark"] .an-export-form,
html[data-ay-theme="dark"] .an-export-panel,
html[data-ay-theme="dark"] .customer-form,
html[data-ay-theme="dark"] .catalog-toolbar,
html[data-ay-theme="dark"] .catalog-form,
html[data-ay-theme="dark"] .stock-filter-row,
html[data-ay-theme="dark"] .products .product,
html[data-ay-theme="dark"] .product,
html[data-ay-theme="dark"] .ay-more-options,
html[data-ay-theme="dark"] .ay-shortcut,
html[data-ay-theme="dark"] .login-box,
html[data-ay-theme="dark"] .customer-detail-stat,
html[data-ay-theme="dark"] .ay-theme-settings-card{
 background:#1b2430!important;border-color:#33404f!important;color:#e9eef5!important;
 box-shadow:0 10px 27px rgba(0,0,0,.12)!important;
}
/* Keep coral emphasis hero cards vivid and readable in dark mode */
html[data-ay-theme="dark"] #dashboard .grid-cards .card:first-child{background:linear-gradient(120deg,#c95f58 0%,#a53539 52%,#68191f 100%)!important;border:1px solid #a24b4e!important;box-shadow:0 16px 32px rgba(0,0,0,.25)!important;color:#fff!important}
html[data-ay-theme="dark"] .finance-balance{background:linear-gradient(120deg,#b35a50,#79272d 70%,#50191e)!important;color:#fff!important}
html[data-ay-theme="dark"] #dashboard .grid-cards .card:nth-child(n+2){background:#1b2430!important;border-color:#34404d!important}
/* Typography and secondary copy */
html[data-ay-theme="dark"] .app main,
html[data-ay-theme="dark"] .section>h1,
html[data-ay-theme="dark"] .topbar .section-h1,
html[data-ay-theme="dark"] .panel h2,
html[data-ay-theme="dark"] .product strong,
html[data-ay-theme="dark"] .an-kpi .an-value,
html[data-ay-theme="dark"] .metric,
html[data-ay-theme="dark"] .total,
html[data-ay-theme="dark"] .stockbalance,
html[data-ay-theme="dark"] .finance-amount,
html[data-ay-theme="dark"] .ay-section-toolbar h2,
html[data-ay-theme="dark"] .settings-info-item strong,
html[data-ay-theme="dark"] .ay-workspace-name,
html[data-ay-theme="dark"] .ay-export-summary,
html[data-ay-theme="dark"] .ay-shortcut strong{color:#f0f3f7!important}
html[data-ay-theme="dark"] .lead,
html[data-ay-theme="dark"] .topbar .lead,
html[data-ay-theme="dark"] .section>.lead,
html[data-ay-theme="dark"] .label,
html[data-ay-theme="dark"] .small,
html[data-ay-theme="dark"] .muted,
html[data-ay-theme="dark"] .path,
html[data-ay-theme="dark"] .topbar .path,
html[data-ay-theme="dark"] .ay-workspace-desc,
html[data-ay-theme="dark"] .availability,
html[data-ay-theme="dark"] .itemtag,
html[data-ay-theme="dark"] .month-label,
html[data-ay-theme="dark"] .ay-shortcut small,
html[data-ay-theme="dark"] .settings-info-item span,
html[data-ay-theme="dark"] .an-export-note,
html[data-ay-theme="dark"] .ay-section-toolbar p,
html[data-ay-theme="dark"] .an-export-summary,
html[data-ay-theme="dark"] .ay-table-scroll-hint{color:#aebac7!important}
html[data-ay-theme="dark"] #dashboard .grid-cards .card:nth-child(n+2) .label{color:#b1bdca!important}
html[data-ay-theme="dark"] #dashboard .grid-cards .card:first-child .metric,
html[data-ay-theme="dark"] #dashboard .grid-cards .card:first-child .label,
html[data-ay-theme="dark"] #dashboard .grid-cards .card:first-child .small{color:#fff!important}
/* Side navigation */
html[data-ay-theme="dark"] .app>aside,
html[data-ay-theme="dark"] .ay-workspace-header{border-color:#34404d!important}
html[data-ay-theme="dark"] .app>aside .nav{color:#adbbc8!important}
html[data-ay-theme="dark"] .app>aside .nav:hover{background:#2e3440!important;color:#ffaea4!important}
html[data-ay-theme="dark"] .app>aside .nav.active{background:#8e252d!important;border-color:#a13c42!important;color:white!important}
html[data-ay-theme="dark"] .app>aside .nav-group,
html[data-ay-theme="dark"] .app>aside .ay-logout-slot,
html[data-ay-theme="dark"] .app>aside .nav-group-settings{border-color:#35404b!important}
html[data-ay-theme="dark"] .ay-workspace-tab,
html[data-ay-theme="dark"] .ay-more-trigger{color:#b3bfcb!important}
html[data-ay-theme="dark"] .ay-workspace-tab:hover,
html[data-ay-theme="dark"] .ay-more-trigger:hover,
html[data-ay-theme="dark"] .ay-more-options button:hover{background:#303a48!important;color:#fff!important}
html[data-ay-theme="dark"] .ay-workspace-tab.is-active{background:#354151!important;color:#fff!important}
html[data-ay-theme="dark"] .ay-more-options button{color:#d3dce8!important}
html[data-ay-theme="dark"] .ay-workspace-avatar{background:#8f232c!important}
html[data-ay-theme="dark"] .ay-mobile-nav-toggle{background:#283340!important;color:#e8edf5!important;border-color:#404e5d!important}
/* Bottom controls / theme settings */
html[data-ay-theme="dark"] .app>aside .ay-theme-toggle,
html[data-ay-theme="dark"] .app>aside .ay-sidebar-logout,
html[data-ay-theme="dark"] .ay-theme-choices button{
 background:#2b3644!important;border-color:#495464!important;color:#e8eef5!important;
}
html[data-ay-theme="dark"] .app>aside .ay-theme-toggle:hover,
html[data-ay-theme="dark"] .app>aside .ay-sidebar-logout:hover,
html[data-ay-theme="dark"] .ay-theme-choices button:hover{background:#3b3340!important;border-color:#9e5356!important}
html[data-ay-theme="dark"] .ay-theme-choices button[aria-pressed="true"]{background:#653136!important;border-color:#b65f60!important;color:#fff!important}
/* Inputs, native selects, date pickers and labels */
html[data-ay-theme="dark"] input,
html[data-ay-theme="dark"] select,
html[data-ay-theme="dark"] textarea,
html[data-ay-theme="dark"] .ay-date-trigger,
html[data-ay-theme="dark"] .ay-select-trigger,
html[data-ay-theme="dark"] .ay-calendar-jump select,
html[data-ay-theme="dark"] .ay-list-search{
 background:#232d39!important;background-image:none!important;border-color:#475565!important;color:#f0f3f8!important;
}
html[data-ay-theme="dark"] input::placeholder,
html[data-ay-theme="dark"] textarea::placeholder{color:#8495a7!important;opacity:1}
html[data-ay-theme="dark"] input:focus,
html[data-ay-theme="dark"] select:focus,
html[data-ay-theme="dark"] textarea:focus,
html[data-ay-theme="dark"] .ay-select-trigger:focus-visible,
html[data-ay-theme="dark"] .ay-date-trigger:focus-visible{border-color:#ec948a!important;box-shadow:0 0 0 3px rgba(250,148,138,.17)!important}
html[data-ay-theme="dark"] .field label{color:#d1dbe5!important}
html[data-ay-theme="dark"] input[type="checkbox"]{accent-color:#d97b72}
html[data-ay-theme="dark"] option{background:#24303e;color:#eaf0f8}
/* Tables (scroll behavior inherited from v23) */
html[data-ay-theme="dark"] table{color:#dce4ec!important}
html[data-ay-theme="dark"] th{background:#212d3a!important;color:#b5c1ce!important}
html[data-ay-theme="dark"] td,
html[data-ay-theme="dark"] th,
html[data-ay-theme="dark"] .cartline,
html[data-ay-theme="dark"] .history-item,
html[data-ay-theme="dark"] .settings-info-item{border-color:#344453!important}
html[data-ay-theme="dark"] tbody tr:hover,
html[data-ay-theme="dark"] .customer-row-click:hover{background:#263340!important}
html[data-ay-theme="dark"] .tablewrap{scrollbar-color:#526272 #1b2430}
/* Secondary elements and charts */
html[data-ay-theme="dark"] .btn.secondary,
html[data-ay-theme="dark"] .cartqty button,
html[data-ay-theme="dark"] .product-ico,
html[data-ay-theme="dark"] .ay-shortcut-icon,
html[data-ay-theme="dark"] .ay-quick-action,
html[data-ay-theme="dark"] .an-tabs,
html[data-ay-theme="dark"] .an-tabs button,
html[data-ay-theme="dark"] .reset-date,
html[data-ay-theme="dark"] .stockaction button.secondary{
 background:#293443!important;color:#cfd9e4!important;border-color:#3c4b5c!important;
}
html[data-ay-theme="dark"] .btn.soft-danger{background:#493239!important;color:#ff9e9a!important;border-color:#674047!important}
html[data-ay-theme="dark"] .btn.soft-restore{background:#224038!important;color:#78dfb2!important;border-color:#326051!important}
html[data-ay-theme="dark"] .an-tabs button.selected{background:#493438!important;color:#ffd3ca!important}
html[data-ay-theme="dark"] .catpill,
html[data-ay-theme="dark"] .badge,
html[data-ay-theme="dark"] .customer-repeat-tag{background:#274337!important;color:#87e0b3!important}
html[data-ay-theme="dark"] .badge.warn{background:#514032!important;color:#ffd1a0!important}
html[data-ay-theme="dark"] .notice,
html[data-ay-theme="dark"] .menu-guidance,
html[data-ay-theme="dark"] .finance-tip,
html[data-ay-theme="dark"] .drink-recipe-notice,
html[data-ay-theme="dark"] .an-warning,
html[data-ay-theme="dark"] .settings-note{
 background:#342c28!important;border-color:#594638!important;color:#efd1b4!important;
}
html[data-ay-theme="dark"] .stock-filter-row,
html[data-ay-theme="dark"] .an-export-summary{background:#222e3a!important;border-color:#354453!important}
html[data-ay-theme="dark"] .donut:after{background:#1b2430!important;box-shadow:inset 0 0 0 1px #3f4a59!important}
html[data-ay-theme="dark"] .track,
html[data-ay-theme="dark"] .an-baritem .barline{background:#344251!important}
html[data-ay-theme="dark"] .line-chart-svg text,
html[data-ay-theme="dark"] .an-chart svg text,
html[data-ay-theme="dark"] .an-line svg text{fill:#bac6d2!important}
html[data-ay-theme="dark"] .an-export-form,
html[data-ay-theme="dark"] .an-toolbar{border-color:#394655!important}
/* Custom v21 floating calendar, dropdown and dialogs (fixed outside main) */
html[data-ay-theme="dark"] .ay-floating,
html[data-ay-theme="dark"] .ay-dialog,
html[data-ay-theme="dark"] .ay-toast,
html[data-ay-theme="dark"] .customer-suggestions,
html[data-ay-theme="dark"] #customer-detail-panel{
 background:#222d39!important;background-image:none!important;border-color:#485768!important;color:#ecf1f7!important;
 box-shadow:0 20px 50px rgba(0,0,0,.38)!important;
}
html[data-ay-theme="dark"] .ay-dialog-title,
html[data-ay-theme="dark"] .ay-float-title,
html[data-ay-theme="dark"] .ay-list-head,
html[data-ay-theme="dark"] .ay-calendar-month{color:#f0f4f7!important}
html[data-ay-theme="dark"] .ay-dialog-message,
html[data-ay-theme="dark"] .ay-float-hint,
html[data-ay-theme="dark"] .ay-weekdays span,
html[data-ay-theme="dark"] .ay-toast,
html[data-ay-theme="dark"] .ay-empty{color:#b4c0cf!important}
html[data-ay-theme="dark"] .ay-float-top,
html[data-ay-theme="dark"] .ay-list-head,
html[data-ay-theme="dark"] .ay-calendar-footer{border-color:#3b4a59!important}
html[data-ay-theme="dark"] .ay-day,
html[data-ay-theme="dark"] .ay-option{color:#dae3ec!important}
html[data-ay-theme="dark"] .ay-day:hover:not(:disabled),
html[data-ay-theme="dark"] .ay-option:hover,
html[data-ay-theme="dark"] .ay-option:focus-visible,
html[data-ay-theme="dark"] .customer-suggestion:hover{background:#354251!important;color:#ffe1d7!important}
html[data-ay-theme="dark"] .ay-option[aria-selected="true"],
html[data-ay-theme="dark"] .ay-day.ay-today{background:#46313a!important;border-color:#c37470!important;color:#ffc1ba!important}
html[data-ay-theme="dark"] .ay-day.ay-chosen{background:linear-gradient(135deg,#bf6159,#8d2b34)!important;color:#fff!important}
html[data-ay-theme="dark"] .ay-day.ay-outside{color:#82909d!important}
html[data-ay-theme="dark"] .ay-mini-button,
html[data-ay-theme="dark"] .ay-dialog-cancel{background:#334150!important;border-color:#526071!important;color:#e1e8f0!important}
html[data-ay-theme="dark"] .ay-link-btn{color:#ffaca3!important}
html[data-ay-theme="dark"] .ay-link-btn:hover{background:#3b3138!important}
html[data-ay-theme="dark"] .ay-dialog-icon{background:#52343a!important;border-color:#71464a!important;color:#ffc4bb!important}
html[data-ay-theme="dark"] .ay-dialog-backdrop{background:rgba(0,0,0,.67)!important}
/* Login panel / error / current datetime */
html[data-ay-theme="dark"] .login-overlay{background:rgba(5,8,13,.78)!important}
html[data-ay-theme="dark"] .login-box h2{color:#ffc1ba!important}
html[data-ay-theme="dark"] .login-box .single-account-note{color:#acbac9!important}
html[data-ay-theme="dark"] #ay-local-clock.ay-local-clock{background:#25313f!important;border-color:#3d4b5a!important;color:#edf1f7!important}
html[data-ay-theme="dark"] .ay-clock-symbol{background:#503137!important;color:#ffb2a7!important}
html[data-ay-theme="dark"] .ay-logout-slot .ay-sidebar-logout:after,
html[data-ay-theme="dark"] .ay-theme-toggle:after{background:#343f4e!important;color:#fff!important}
/* Mobile nav remains functional and inherits dark background. */
@media(max-width:860px){
 html[data-ay-theme="dark"] .app>aside .menus{background:#1b2430!important}
 html[data-ay-theme="dark"] .app>aside .nav.active{background:#523139!important;color:#ffc7be!important;border-color:#6c4650!important}
 html[data-ay-theme="dark"] .app>aside{box-shadow:0 5px 24px rgba(0,0,0,.22)!important}
}
@media(prefers-reduced-motion:reduce){.app>aside .ay-theme-toggle,.ay-theme-choices button{transition:none!important}}
