/* v0.11.4 — surgical appearance and finance modal refinements */
:root{--page-bg2:#dbeafe;--input-bg:var(--surface2);--soft-bg:#eef2ff;--soft-text:#4338ca}
body{background:linear-gradient(135deg,var(--bg),var(--page-bg2))!important}
.soft-btn{background:var(--soft-bg)!important;color:var(--soft-text)!important;border:1px solid var(--border)}
.field input,.field select,.field textarea,.search input,input,select,textarea{background:var(--input-bg,var(--surface2));color:var(--text);border-color:var(--border)}
input::placeholder,textarea::placeholder{color:var(--muted);opacity:.9}
body.dark .card,body.dark .module-card,body.dark .settings-card,body.dark .pf-panel,body.dark .pf-stat,body.dark .pf-item,body.dark .modal-box{color:var(--text)}
body.dark table,body.dark th,body.dark td{color:var(--text)}
body.dark th{color:var(--muted)}
body.dark option{background:#111827;color:#f8fafc}
body.dark .badge,body.dark .status-pill{background:#273449;color:#e2e8f0}
body.dark .icon-btn{background:#172033;color:#f8fafc;border-color:#334155}
body.dark .muted,body.dark .pf-meta,body.dark .module-card p{color:#a8b3c4!important}
/* Personal Finance add/edit form: wider and never horizontally scrolls */
#modal .modal-box:has(#pfId){width:min(790px,96vw);max-height:94vh;overflow-y:auto;overflow-x:hidden;padding:24px 26px}
#modal .modal-box:has(#pfId) .form-grid{grid-template-columns:repeat(2,minmax(0,1fr));width:100%}
#modal .modal-box:has(#pfId) .field,#modal .modal-box:has(#pfId) input,#modal .modal-box:has(#pfId) select,#modal .modal-box:has(#pfId) textarea{min-width:0;max-width:100%;width:100%}
#modal .modal-box:has(#pfId) #modalBody{overflow-x:hidden}
@media(max-width:700px){#modal .modal-box:has(#pfId){width:100%;max-height:96vh;padding:18px}#modal .modal-box:has(#pfId) .form-grid{grid-template-columns:1fr}}

/* v0.11.5 — dark controls visibility surgical patch */
body.dark{color-scheme:dark;--input-bg:#111827;--input-text:#f8fafc;--input-muted:#aeb9c9}
body.dark input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]),
body.dark select,
body.dark textarea,
body.dark [contenteditable="true"]{
  background-color:#111827!important;
  color:#f8fafc!important;
  border-color:#475569!important;
  caret-color:#f8fafc!important;
  -webkit-text-fill-color:#f8fafc;
  color-scheme:dark;
}
body.dark select{appearance:auto!important;-webkit-appearance:menulist!important}
body.dark select option,
body.dark select optgroup{
  background-color:#111827!important;
  color:#f8fafc!important;
  -webkit-text-fill-color:#f8fafc!important;
}
body.dark input::placeholder,
body.dark textarea::placeholder{color:#aeb9c9!important;opacity:1!important;-webkit-text-fill-color:#aeb9c9!important}
body.dark input:disabled,
body.dark select:disabled,
body.dark textarea:disabled,
body.dark input[readonly],
body.dark textarea[readonly]{background:#1e293b!important;color:#cbd5e1!important;-webkit-text-fill-color:#cbd5e1!important;opacity:1!important}
body.dark input[type="date"],body.dark input[type="time"],body.dark input[type="datetime-local"],body.dark input[type="month"]{color-scheme:dark}
body.dark input[type="date"]::-webkit-calendar-picker-indicator,
body.dark input[type="time"]::-webkit-calendar-picker-indicator,
body.dark input[type="datetime-local"]::-webkit-calendar-picker-indicator,
body.dark input[type="month"]::-webkit-calendar-picker-indicator{filter:invert(1);opacity:.9}
body.dark label,body.dark legend{color:#e5e7eb}
body.dark .field label,body.dark .world-field label,body.dark .inv-form-grid label{color:#dbe4f0!important}
body.dark .note-composer-panel,
body.dark .note-option,
body.dark .editor-toolbar{background:#172033!important;color:#f8fafc!important;border-color:#475569!important}
/* Note paper uses a light paper colour by design, so keep dark ink visible in dark mode. */
body.dark .note-editor{
  background:var(--note-fill,#fff7c2)!important;
  color:#111827!important;
  -webkit-text-fill-color:#111827!important;
  caret-color:#111827!important;
  border-color:var(--note-border,#eab308)!important;
  color-scheme:light;
}
body.dark .note-editor::placeholder{color:#475569!important;-webkit-text-fill-color:#475569!important}
body.dark .note-live-preview,
body.dark #notes .note-card,
body.dark .note-list-row{color:#172033!important}
body.dark .note-live-preview h3,
body.dark .note-live-preview-text,
body.dark #notes .note-card h3,
body.dark #notes .note-card-body,
body.dark #notes .note-card-date{color:#172033!important}
body.dark .note-live-preview-text,body.dark #notes .note-card-date{opacity:.78}
body.dark .check-row input[type="text"]{background:#111827!important;color:#f8fafc!important;-webkit-text-fill-color:#f8fafc!important}
body.dark .note-option input[type="checkbox"],body.dark .note-option input[type="radio"]{accent-color:var(--primary)}
body.dark .soft-btn:not(:disabled){color:#e8edff!important;background:#25324a!important;border-color:#475569!important}
body.dark .search input{background:#111827!important;color:#f8fafc!important}


/* v0.11.6 — Sticky Notes keep readable ink independently from the global dark theme. */
body.dark #notes .note-card,
body.dark #notes .note-card h3,
body.dark #notes .note-card-body,
body.dark #notes .note-card-body *,
body.dark #notes .note-card-date,
body.dark #notes .note-card .note-chip,
body.dark #notes .note-card .note-check-preview,
body.dark #notes .note-card .note-check-preview label,
body.dark #notes .note-card .note-check-preview span,
body.dark #notes .note-card .muted,
body.dark #notes .note-list-row,
body.dark #notes .note-list-row b,
body.dark #notes .note-list-row .muted,
body.dark .note-live-preview,
body.dark .note-live-preview h3,
body.dark .note-live-preview-text{
  color:var(--note-ink,#172033)!important;
  -webkit-text-fill-color:var(--note-ink,#172033)!important;
}
body.dark #notes .note-card .note-chip{
  background:color-mix(in srgb,var(--note-ink,#172033) 10%,transparent)!important;
  border-color:color-mix(in srgb,var(--note-ink,#172033) 22%,transparent)!important;
}
body.dark #notes .note-card .note-actions{
  border-top-color:color-mix(in srgb,var(--note-ink,#172033) 22%,transparent)!important;
}

/* v0.11.9 — Independent sidebar background, automatic contrast and width. */
:root{
  --sidebar-width:285px;
  --sidebar-bg:#111827;
  --sidebar-bg2:#1e1b4b;
  --sidebar-text:#f8fafc;
  --sidebar-muted:#a8b3c4;
  --sidebar-hover:rgba(255,255,255,.13);
  --sidebar-active:rgba(255,255,255,.18);
  --sidebar-active-text:#fff;
}
.app{grid-template-columns:var(--sidebar-width) minmax(0,1fr)!important}
.sidebar{
  width:auto;
  background:linear-gradient(180deg,var(--sidebar-bg),var(--sidebar-bg2))!important;
  color:var(--sidebar-text)!important;
  border-right:1px solid color-mix(in srgb,var(--sidebar-text) 14%,transparent);
}
.sidebar .brand,.sidebar .brand h1,.sidebar .nav-btn{color:var(--sidebar-text)!important}
.sidebar .brand small,.sidebar .menu-title{color:var(--sidebar-muted)!important}
.sidebar .nav-btn:hover{background:var(--sidebar-hover)!important;color:var(--sidebar-active-text)!important}
.sidebar .nav-btn.active{background:var(--sidebar-active)!important;color:var(--sidebar-active-text)!important;box-shadow:inset 3px 0 0 var(--primary)}
.sidebar .nav-btn span{color:inherit!important;-webkit-text-fill-color:currentColor!important}
body.style-typewriter .sidebar,body.style-executive .sidebar,body.style-studio .sidebar{background:linear-gradient(180deg,var(--sidebar-bg),var(--sidebar-bg2))!important}
.app.sidebar-compact{grid-template-columns:92px minmax(0,1fr)!important}
.app.sidebar-icons{grid-template-columns:68px minmax(0,1fr)!important}
@media(max-width:900px){
 .app,.app.sidebar-compact,.app.sidebar-icons{grid-template-columns:1fr!important}
 .sidebar{width:min(var(--sidebar-width),88vw)!important}
}
