/* Shared application theme. Loaded on every full page after module styles.
   Action colours are separate from gold selection and semantic status colours. */
:root {
  --action-primary: #164c45;
  --action-primary-hover: #103c36;
  --action-primary-active: #0b302b;
  --action-on-primary: #ffffff;
  --action-focus: #287d70;
  --action-link: #164c45;
  --selection-gold: #d6a24c;
  --selection-ink: #12181f;
  --action-danger: #a32d2d;
  --action-danger-hover: #842323;
  --theme-surface: #ffffff;
  --theme-soft: #f3f6f4;
  --theme-border: #d8dfdb;
  --theme-text: #172d37;
  --theme-muted: #5b6d64;
}
html.dark-mode {
  --action-focus: #86c5b7;
  --action-link: #9bd6c9;
  --theme-surface: #1a1e2b;
  --theme-soft: #232b35;
  --theme-border: #454c63;
  --theme-text: #edeff2;
  --theme-muted: #b6c0c8;
}
/* A small, explicit action set also covers dynamically created dialogs.
   Important colour declarations override legacy dark-mode and inline colours;
   layout, visibility and behavior remain owned by each module. */
:is(
  .ll-primary,
  button[type="submit"], input[type="submit"],
  #submit-btn, #add-submit-btn,
  #twofa-setup-submit, #twofa-verify-submit,
  .panel-btn--primary, .checkin-btn--accent, .eprofile-btn--primary,
  .dv2-btn--accent, .search-submit-btn,
  .report-export-btn:not(.report-export-btn--csv),
  #cal-book-btn, .booking-action--approve,
  #create-tenant-open-btn, #save-tenant-btn, #save-features-btn,
  #owner-save-resources-btn, #add-user-open-btn
) {
  background: var(--action-primary) !important;
  border-color: var(--action-primary) !important;
  color: var(--action-on-primary) !important;
}
:is(
  .ll-primary,
  button[type="submit"], input[type="submit"],
  #submit-btn, #add-submit-btn,
  #twofa-setup-submit, #twofa-verify-submit,
  .panel-btn--primary, .checkin-btn--accent, .eprofile-btn--primary,
  .dv2-btn--accent, .search-submit-btn,
  .report-export-btn:not(.report-export-btn--csv),
  #cal-book-btn, .booking-action--approve,
  #create-tenant-open-btn, #save-tenant-btn, #save-features-btn,
  #owner-save-resources-btn, #add-user-open-btn
):hover:not(:disabled):not([aria-disabled="true"]) {
  background: var(--action-primary-hover) !important;
  border-color: var(--action-primary-hover) !important;
}
:is(
  .ll-primary, button[type="submit"], input[type="submit"],
  .panel-btn--primary, .checkin-btn--accent, .eprofile-btn--primary,
  .dv2-btn--accent, .search-submit-btn,
  .report-export-btn:not(.report-export-btn--csv)
):active:not(:disabled):not([aria-disabled="true"]) {
  background: var(--action-primary-active) !important;
  border-color: var(--action-primary-active) !important;
}
/* Secondary actions retain their neutral appearance. */
:is(.checkin-btn--ghost,.report-export-btn--csv,.eprofile-btn--secondary,
    .dv2-btn--ghost,.admin__edit-btn:not(.ll-primary)):hover:not(:disabled) {
  border-color: var(--action-focus);
}
:is(button, a[href], input, select, textarea):focus-visible {
  outline: 3px solid var(--action-focus) !important;
  outline-offset: 3px;
}
:is(button,input[type="submit"]):disabled,
:is(button,a)[aria-disabled="true"] {
  opacity: .55;
  cursor: not-allowed;
}
input[type="checkbox"],input[type="radio"] { accent-color: var(--action-primary); }
:is(.sales-dialog a,.crm-workspace-link:hover,.admin__link:hover) { color: var(--action-link); }
/* Selected navigation remains gold, distinct from a button that posts a change. */
.inventory-page button[aria-selected="true"],
html .cal-view-btn.is-active,
html.dark-mode .cal-view-btn.is-active {
  background: var(--selection-gold) !important;
  border-color: var(--selection-gold) !important;
  color: var(--selection-ink) !important;
}
/* Destructive actions must never inherit the positive action colour. */
:is(.ll-danger,.admin__remove-btn,.booking-action--deny,
    #event-delete-confirm,#po-delete-btn,#task-detail-delete,
    #crm-company-delete,#crm-contact-delete,
    #crm-bulk-delete-companies-btn,#crm-bulk-delete-contacts-btn,
    [data-form^="void-"],[data-form="cancel"],
    [data-stage-remove],[data-category-remove],[data-field-remove],[data-team-remove],
    [data-quote-remove]) {
  background: transparent !important;
  border-color: var(--action-danger) !important;
  color: var(--action-danger) !important;
}
:is(#event-delete-confirm,.ll-danger[type="submit"],
    .sales-form[data-submit^="void-"] button[type="submit"],
    .sales-form[data-submit="cancel"] button[type="submit"],
    #adjust button[type="submit"],#reverse-receipt button[type="submit"],#review-reverse button[type="submit"]) {
  background: var(--action-danger) !important;
  border-color: var(--action-danger) !important;
  color: #ffffff !important;
}
:is(#event-delete-confirm,.ll-danger[type="submit"],
    .sales-form[data-submit^="void-"] button[type="submit"],
    .sales-form[data-submit="cancel"] button[type="submit"],
    #adjust button[type="submit"],#reverse-receipt button[type="submit"],#review-reverse button[type="submit"]):hover:not(:disabled) {
  background: var(--action-danger-hover) !important;
  border-color: var(--action-danger-hover) !important;
}
html.dark-mode :is(.admin__remove-btn,.booking-action--deny,#po-delete-btn,
    #task-detail-delete,#crm-company-delete,#crm-contact-delete,
    #crm-bulk-delete-companies-btn,#crm-bulk-delete-contacts-btn,
    [data-form^="void-"],[data-form="cancel"],.ll-danger:not([type="submit"])) {
  color: #ffb4a8 !important;
  border-color: #db7970 !important;
}
/* Inventory shares the app's light/dark surfaces and action palette. */
.inventory-page { color: var(--theme-text); }
.inventory-page :is(.inventory-card,.inventory-metrics article,table) {
  background: var(--theme-surface);
  border-color: var(--theme-border);
}
.inventory-page :is(input,select,textarea,button) {
  background: var(--theme-surface);
  color: var(--theme-text);
  border-color: var(--theme-border);
}
.inventory-page .inventory-line { background: var(--theme-soft); }
.inventory-page :is(th,td) { border-color: var(--theme-border); }
.inventory-page :is(th,.inventory-note,.inventory-heading p) { color: var(--theme-muted); }
html.dark-mode .inventory-page .inventory-low { color: #efbd71; }
@media (forced-colors: active) {
  :is(button,input[type="submit"],.report-export-btn,.checkin-btn) {
    border: 1px solid ButtonText;
  }
}

/* Section navigation stays compact across attendance, reports and search. */
.attendance-section-nav {display:flex;flex-wrap:wrap;gap:8px;margin:12px 0 22px;min-height:36px;}
.attendance-section-nav a {padding:8px 14px;border:1px solid #cbd5d1;border-radius:8px;text-decoration:none;color:inherit;font-size:13px;line-height:18px;}
.attendance-section-nav a.is-active {background:#f5e5c9;border-color:#b78128;color:#51390f;}
.attendance-section-nav a[hidden] {display:none;}
.organization-signin .brand {background:radial-gradient(circle at 85% 25%,#25594a 0,transparent 55%),#122c26;}
.organization-signin .brand__mark {gap:18px;flex-wrap:wrap;overflow-wrap:anywhere;}
.organization-signin .brand__mark span {top:0;letter-spacing:.02em;}
.organization-signin .brand__logo {filter:none;width:auto;height:auto;max-width:180px;max-height:72px;object-fit:contain;background:#fff;padding:12px;border-radius:12px;}
.organization-signin .brand__statement {max-width:100%;}

@media print {
  @page {margin:12mm;}
  body.ll-page-printing {display:block!important;background:white!important;color:#111!important;padding:0!important;margin:0!important;}
  body.ll-page-printing * {visibility:visible;box-shadow:none!important;text-shadow:none!important;}
  body.ll-page-printing [hidden], body.ll-page-printing #ll-header,
  body.ll-page-printing #ll-sidebar, body.ll-page-printing .ll-sidebar-toggle,
  body.ll-page-printing .mobile-bottom-nav, body.ll-page-printing .ll-sidebar-backdrop,
  body.ll-page-printing button, body.ll-page-printing nav,
  body.ll-page-printing .no-print, body.ll-page-printing .modal-overlay,
  body.ll-page-printing dialog:not([open]), body.ll-page-printing .dropdown-menu,
  body.ll-page-printing #global-search-dropdown {display:none!important;}
  body.ll-page-printing .dash, body.ll-page-printing main {display:block!important;width:100%!important;max-width:none!important;margin:0!important;padding:0!important;min-height:0!important;}
  body.ll-page-printing .table-wrap, body.ll-page-printing [class*="table-wrap"],
  body.ll-page-printing [class*="board"], body.ll-page-printing [class*="scroll"] {overflow:visible!important;max-height:none!important;}
  body.ll-page-printing table {width:100%!important;border-collapse:collapse;}
  body.ll-page-printing th, body.ll-page-printing td {overflow-wrap:anywhere;white-space:normal!important;}
  body.ll-page-printing thead {display:table-header-group;}
  body.ll-page-printing tr {break-inside:avoid;}
  body.ll-page-printing a {color:inherit;text-decoration:none;}
}
@media print {
  body.ll-page-printing a.checkin-btn, body.ll-page-printing a.report-export-btn,
  body.ll-page-printing .admin-tabs, body.ll-page-printing .payroll-tabs,
  body.ll-page-printing #inventory-tabs {display:none!important;}
  body.ll-page-printing #payslip-print-area {position:static;width:100%;}
}

/* Customer accounts use the same Finance heading; Sales orders is a local action. */
.finance-customer-heading {display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin:18px 0 12px;}
.finance-customer-heading h2 {margin:0;}
.finance-customer-heading > a {flex:none;width:auto;white-space:nowrap;}

/* Inventory section tabs match the Finance underline navigation. */
#inventory-tabs {
  gap: 12px 24px;
  padding-bottom: 0;
  border-bottom-color: var(--theme-border);
}
#inventory-tabs > button {
  background: transparent !important;
  color: var(--theme-muted) !important;
  border: 0 !important;
  border-bottom: 3px solid transparent !important;
  border-radius: 0;
  padding: 10px 0 13px;
  box-shadow: none !important;
  font-size: 14px;
}
#inventory-tabs > button[aria-selected="true"] {
  background: transparent !important;
  color: var(--action-link) !important;
  border-bottom-color: var(--selection-gold) !important;
}
#inventory-tabs > button:hover { color: var(--action-link) !important; }
