/* ==========================================================================
   SCORE theme overrides for Frest v5.1.0 (light style).
   Loaded after the theme CSS, so the theme files stay untouched and upgradable.

   Palette: <html data-palette="teal|indigo|plum"> - set by App:Palette in appsettings.json.
   To preview live: browser DevTools > Elements > edit the data-palette attribute on <html>.
   Dark style is not themed yet (Frest defaults apply).
   ========================================================================== */

/* ---- Palette (default = teal; palette rules must stay after the default block) ---- */
html.light-style {
  --score-primary: #0F766E;
  --score-primary-rgb: 15, 118, 110;
  --score-primary-dark: #115E59;

  --score-bg: #F3F6F8;
  --score-surface: #FFFFFF;
  --score-ink: #1E293B;      /* headings */
  --score-text: #475569;     /* body text */
  --score-muted: #94A3B8;
  --score-border: #E2E8F0;

  --bs-primary: var(--score-primary);
  --bs-primary-rgb: var(--score-primary-rgb);
  --bs-link-color: var(--score-primary);
  --bs-link-hover-color: var(--score-primary-dark);
}
html.light-style[data-palette="indigo"] {
  --score-primary: #4F46E5;
  --score-primary-rgb: 79, 70, 229;
  --score-primary-dark: #4338CA;
}
html.light-style[data-palette="plum"] {
  --score-primary: #7E22CE;
  --score-primary-rgb: 126, 34, 206;
  --score-primary-dark: #6B21A8;
}

/* ---- Page ---- */
html.light-style body {
  background-color: var(--score-bg);
  color: var(--score-text);
}
html.light-style h1, html.light-style h2, html.light-style h3,
html.light-style h4, html.light-style h5, html.light-style h6,
html.light-style .h1, html.light-style .h2, html.light-style .h3,
html.light-style .h4, html.light-style .h5, html.light-style .h6 {
  color: var(--score-ink);
}
html.light-style ::selection {
  background: rgba(var(--score-primary-rgb), .2);
}

/* ---- Brand ---- */
html.light-style .app-brand-text {
  color: var(--score-primary-dark) !important;
  font-family: Rubik, sans-serif;
  font-weight: 700 !important;
  font-size: 1.6rem !important;
  letter-spacing: .02em;
}
.score-brand-mark { flex: none; }
.score-brand-mark rect { fill: var(--score-primary-dark); }
.score-brand-mark rect.top { fill: #F2A33A; }

/* ---- Sidebar menu ---- */
html.light-style .layout-menu.bg-menu-theme {
  background-color: var(--score-surface) !important;
  border-right: 1px solid var(--score-border);
  box-shadow: none !important;
}
html.light-style .menu-vertical .menu-item .menu-link {
  color: var(--score-text);
  border-radius: .5rem;
}
html.light-style .menu-vertical .menu-item .menu-link:hover,
html.light-style .menu-vertical .menu-item .menu-link:focus {
  color: var(--score-primary);
  background-color: rgba(var(--score-primary-rgb), .06);
}
html.light-style .menu-vertical .menu-item.active > .menu-link:not(.menu-toggle) {
  background: rgba(var(--score-primary-rgb), .12) !important;
  color: var(--score-primary) !important;
  box-shadow: none !important;
}
html.light-style .menu-vertical .menu-item.active > .menu-link .menu-icon,
html.light-style .menu-vertical .menu-item.open > .menu-link .menu-icon {
  color: var(--score-primary);
}
html.light-style .menu-vertical .menu-item.open > .menu-link.menu-toggle {
  color: var(--score-ink);
}
html.light-style .menu-vertical .menu-sub > .menu-item.active > .menu-link:not(.menu-toggle):before {
  background-color: var(--score-primary) !important;
}
html.light-style .menu-vertical .menu-header .menu-header-text {
  color: var(--score-muted);
  font-weight: 600;
  letter-spacing: .08em;
}

/* ---- Navbar ---- */
html.light-style .bg-navbar-theme {
  background-color: rgba(255, 255, 255, .9) !important;
  border-bottom: 1px solid var(--score-border);
  backdrop-filter: saturate(180%) blur(6px);
}
html.light-style .layout-navbar .search-toggler,
html.light-style .layout-navbar .nav-link {
  color: var(--score-text);
}

/* ---- Cards & tables ---- */
html.light-style .card {
  border: 1px solid var(--score-border);
  border-radius: .75rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 16px rgba(15, 23, 42, .04);
}
html.light-style .table thead th {
  background-color: #F8FAFC;
  color: #64748B;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ---- Primary color: buttons ---- */
html.light-style .btn-primary {
  background-color: var(--score-primary) !important;
  border-color: var(--score-primary) !important;
  color: #fff !important;
  box-shadow: 0 2px 6px rgba(var(--score-primary-rgb), .35);
}
html.light-style .btn-primary:hover,
html.light-style .btn-primary:focus,
html.light-style .btn-primary:active,
html.light-style .btn-primary.active {
  background-color: var(--score-primary-dark) !important;
  border-color: var(--score-primary-dark) !important;
  color: #fff !important;
}
html.light-style .btn-outline-primary {
  color: var(--score-primary);
  border-color: var(--score-primary);
}
html.light-style .btn-outline-primary:hover,
html.light-style .btn-outline-primary:focus,
html.light-style .btn-outline-primary:active {
  background-color: var(--score-primary) !important;
  border-color: var(--score-primary) !important;
  color: #fff !important;
}
html.light-style .btn-label-primary {
  color: var(--score-primary);
  background-color: rgba(var(--score-primary-rgb), .12);
  border-color: transparent;
}
html.light-style .btn-label-primary:hover,
html.light-style .btn-label-primary:focus {
  background-color: var(--score-primary) !important;
  color: #fff !important;
}

/* ---- Primary color: utilities, badges, progress ---- */
html.light-style .text-primary { color: var(--score-primary) !important; }
html.light-style .bg-primary { background-color: var(--score-primary) !important; }
html.light-style .border-primary { border-color: var(--score-primary) !important; }
html.light-style .bg-label-primary {
  background-color: rgba(var(--score-primary-rgb), .12) !important;
  color: var(--score-primary) !important;
}
html.light-style .progress-bar { background-color: var(--score-primary); }

/* ---- Primary color: forms, nav, pagination, dropdowns ---- */
html.light-style .form-control:focus,
html.light-style .form-select:focus {
  border-color: var(--score-primary) !important;
  box-shadow: 0 0 0 .15rem rgba(var(--score-primary-rgb), .15);
}
html.light-style .form-check-input:checked,
html.light-style .form-check-input:indeterminate {
  background-color: var(--score-primary);
  border-color: var(--score-primary);
}
html.light-style .switch-input:checked ~ .switch-toggle-slider {
  background-color: var(--score-primary);
}
html.light-style .nav-pills .nav-link.active,
html.light-style .nav-pills .show > .nav-link {
  background-color: var(--score-primary) !important;
  color: #fff !important;
  box-shadow: 0 2px 6px rgba(var(--score-primary-rgb), .35);
}
html.light-style .page-item.active .page-link {
  background-color: var(--score-primary) !important;
  border-color: var(--score-primary) !important;
  color: #fff !important;
}
html.light-style .dropdown-item.active,
html.light-style .dropdown-item:active,
html.light-style .list-group-item.active {
  background-color: var(--score-primary) !important;
  border-color: var(--score-primary) !important;
  color: #fff !important;
}
html.light-style .timeline-point-primary {
  background-color: var(--score-primary) !important;
  box-shadow: 0 0 0 .25rem rgba(var(--score-primary-rgb), .16) !important;
}

/* ---- Template customizer is removed; hide it in case a theme script still renders it ---- */
.template-customizer-open-btn,
#template-customizer {
  display: none !important;
}

/* ---- Busy overlay (spinner while saving / deleting) ---- */
.score-busy {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .6);
  backdrop-filter: blur(1px);
}
.score-busy.d-none { display: none !important; }
.score-busy .spinner-border {
  width: 3rem;
  height: 3rem;
  color: var(--score-primary);
}

/* ---- Page toolbar: title on the left, Save / Delete on the right ---- */
.score-toolbar {
  padding: .25rem 0;
}

/* small "+" button next to a dropdown */
.score-addon-btn {
  padding-left: .65rem;
  padding-right: .65rem;
}

/* ---- Item photos ---- */
.score-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: .5rem;
  border: 1px solid rgba(0, 0, 0, .08);
  background: #fff;
}
.score-thumb-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #b4b7c0;
  font-size: 1.4rem;
}
.score-photo {
  width: 150px;
  border: 1px solid rgba(0, 0, 0, .1);
  border-radius: .5rem;
  overflow: hidden;
  background: #fff;
}
.score-photo.is-default { border-color: var(--score-primary); box-shadow: 0 0 0 1px var(--score-primary); }
.score-photo img { display: block; width: 100%; height: 130px; object-fit: cover; }
.score-photo .score-photo-bar { display: flex; justify-content: space-between; align-items: center; padding: .25rem .4rem; }


/* a drop-down list or tooltip that reaches past the edge must never give the page a horizontal scroll bar */
html, body { overflow-x: clip; }

/* a searchable list next to a button (input group): it takes the free width and the button stays beside it */
.input-group > .select2-container { flex: 1 1 auto; width: 1% !important; min-width: 0; }
.input-group > .select2-container .select2-selection { border-top-right-radius: 0; border-bottom-right-radius: 0; }

/* ---- Timeline: tighter rows (the theme gives every item a tall minimum height and padding) ---- */
ul.timeline > li.timeline-item {
  padding-bottom: .35rem !important;
  margin-bottom: 0 !important;
  min-height: 0 !important;
}
ul.timeline > li.timeline-item > .timeline-event {
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
  min-height: 0 !important;
}
ul.timeline .timeline-event .timeline-header {
  margin-bottom: .1rem !important;
}
ul.timeline .timeline-event p {
  margin-bottom: 0 !important;
}

/* opportunities board */
.opp-board { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: .75rem; overflow-x: auto; padding-bottom: .5rem; }
.opp-column { background: rgba(105, 108, 255, .04); border: 1px solid rgba(0, 0, 0, .06); border-radius: .5rem; min-height: 320px; display: flex; flex-direction: column; }
.opp-column.opp-over { background: rgba(105, 108, 255, .12); border-color: rgba(105, 108, 255, .4); }
.opp-column-head { padding: .75rem .75rem .5rem; border-bottom: 1px solid rgba(0, 0, 0, .06); }
.opp-column-body { padding: .5rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.opp-card { background: #fff; border: 1px solid rgba(0, 0, 0, .08); border-radius: .4rem; padding: .6rem .7rem; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); cursor: grab; }
.opp-card.opp-dragging { opacity: .45; }
.opp-avatar { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; flex: 0 0 30px; display: inline-flex; align-items: center; justify-content: center; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .1); background: rgba(105, 108, 255, .16); }
.opp-avatar img { width: 100%; height: 100%; object-fit: cover; }
.opp-avatar-initials { font-size: .7rem; font-weight: 600; color: #696cff; }

/* ---- activities calendar ---- */
.cal-loading { opacity: .55; pointer-events: none; transition: opacity .15s; }
.cal-dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; margin-right: .25rem; vertical-align: middle; }
.cal-dot.cal-t1 { background: #696cff; } .cal-dot.cal-t2 { background: #03c3ec; } .cal-dot.cal-t3 { background: #ffab00; }

.cal-chip, .cal-event, .cal-agenda-row { --cal-c: #696cff; --cal-bg: rgba(105, 108, 255, .14); }
.cal-t2 { --cal-c: #03c3ec; --cal-bg: rgba(3, 195, 236, .16); }
.cal-t3 { --cal-c: #ffab00; --cal-bg: rgba(255, 171, 0, .18); }
.cal-overdue { --cal-c: #ff3e1d; --cal-bg: rgba(255, 62, 29, .12); }
.cal-done { opacity: .6; }
.cal-done .cal-chip-text, .cal-done .cal-event-text { text-decoration: line-through; }

.cal-chip { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--cal-bg); border-left: 3px solid var(--cal-c); border-radius: .25rem; padding: 1px 5px; margin-bottom: 2px; font-size: .78rem; cursor: pointer; color: inherit; }
.cal-chip:hover, .cal-event:hover { filter: brightness(.95); }
.cal-chip-time { opacity: .8; }
.cal-dragging { opacity: .4; }

.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid rgba(0, 0, 0, .08); border-left: 1px solid rgba(0, 0, 0, .08); }
.cal-dow { padding: .4rem .5rem; font-weight: 600; font-size: .78rem; text-transform: uppercase; color: #8592a3; border-right: 1px solid rgba(0, 0, 0, .08); border-bottom: 1px solid rgba(0, 0, 0, .08); }
.cal-cell { min-height: 112px; padding: .25rem; border-right: 1px solid rgba(0, 0, 0, .08); border-bottom: 1px solid rgba(0, 0, 0, .08); min-width: 0; }
.cal-cell.cal-other { background: rgba(0, 0, 0, .025); }
.cal-cell.cal-other .cal-num { color: #b4bdc6; }
.cal-cell.cal-weekend { background: rgba(0, 0, 0, .015); }
.cal-cell.cal-today { background: rgba(105, 108, 255, .07); }
.cal-cell-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.cal-num { font-size: .8rem; font-weight: 600; color: #566a7f; padding: 0 .25rem; border-radius: .25rem; }
.cal-today .cal-num { background: #696cff; color: #fff; }
.cal-plus { visibility: hidden; color: #8592a3; line-height: 1; }
.cal-cell:hover .cal-plus { visibility: visible; }
.cal-more { font-size: .75rem; padding-left: 4px; }
.cal-over { background: rgba(105, 108, 255, .16) !important; outline: 2px dashed rgba(105, 108, 255, .5); outline-offset: -2px; }

.cal-grid { border: 1px solid rgba(0, 0, 0, .08); border-radius: .35rem; overflow: hidden; }
.cal-grid-head, .cal-allday, .cal-hours { display: grid; grid-template-columns: 62px repeat(var(--cal-cols, 7), minmax(0, 1fr)); }
.cal-cols-7 { --cal-cols: 7; } .cal-cols-1 { --cal-cols: 1; }
.cal-gutter { border-right: 1px solid rgba(0, 0, 0, .08); padding: .25rem; }
.cal-grid-head { border-bottom: 1px solid rgba(0, 0, 0, .08); }
.cal-day-head { padding: .45rem .5rem; text-align: center; font-weight: 600; border-right: 1px solid rgba(0, 0, 0, .06); }
.cal-day-head.cal-today a { background: #696cff; color: #fff; border-radius: 1rem; padding: .1rem .6rem; }
.cal-day-head a { color: inherit; }
.cal-allday { border-bottom: 1px solid rgba(0, 0, 0, .08); }
.cal-allday-cell { padding: .25rem; min-height: 34px; border-right: 1px solid rgba(0, 0, 0, .06); min-width: 0; }
.cal-scroll { max-height: 620px; overflow-y: auto; }
.cal-hours { position: relative; }
.cal-hour-label { font-size: .7rem; color: #8592a3; text-align: right; padding-right: .35rem; transform: translateY(-.5rem); }
.cal-col { position: relative; border-right: 1px solid rgba(0, 0, 0, .06); background-image: linear-gradient(to bottom, rgba(0, 0, 0, .07) 1px, transparent 1px); }
.cal-col.cal-weekend { background-color: rgba(0, 0, 0, .015); }
.cal-col.cal-today { background-color: rgba(105, 108, 255, .05); }
.cal-event { position: absolute; padding: 2px 5px; overflow: hidden; background: var(--cal-bg); border-left: 3px solid var(--cal-c); border-radius: .25rem; font-size: .75rem; cursor: pointer; box-shadow: 0 0 0 1px #fff; }
.cal-event-time { font-weight: 600; white-space: nowrap; }
.cal-event-text { overflow: hidden; text-overflow: ellipsis; }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: #ff3e1d; z-index: 2; pointer-events: none; }

.cal-agenda-day { display: flex; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid rgba(0, 0, 0, .07); }
.cal-agenda-date { width: 170px; flex: none; font-weight: 600; }
.cal-agenda-day.cal-today .cal-agenda-date { color: #696cff; }
.cal-agenda-rows { flex: 1; display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.cal-agenda-row { display: flex; gap: 1rem; align-items: center; padding: .4rem .6rem; background: var(--cal-bg); border-left: 3px solid var(--cal-c); border-radius: .25rem; cursor: pointer; }
.cal-agenda-time { width: 150px; flex: none; font-size: .8rem; color: #566a7f; }
.cal-done .fw-medium { text-decoration: line-through; }

.cal-pop { position: fixed; z-index: 1090; width: 320px; max-width: calc(100vw - 16px); background: #fff; border-radius: .5rem; padding: .9rem; box-shadow: 0 .5rem 1.5rem rgba(34, 48, 62, .25); display: none; }
.cal-pop.show { display: block; }
.cal-pop-icon { width: 34px; height: 34px; border-radius: .4rem; display: inline-flex; align-items: center; justify-content: center; background: var(--cal-bg, rgba(105, 108, 255, .14)); color: var(--cal-c, #696cff); font-size: 1.2rem; flex: none; --cal-c: #696cff; --cal-bg: rgba(105, 108, 255, .14); }
.cal-pop-icon.cal-t2 { --cal-c: #03c3ec; --cal-bg: rgba(3, 195, 236, .16); }
.cal-pop-icon.cal-t3 { --cal-c: #ffab00; --cal-bg: rgba(255, 171, 0, .18); }
.cal-pop-icon.cal-overdue { --cal-c: #ff3e1d; --cal-bg: rgba(255, 62, 29, .12); }

@media (max-width: 767.98px) {
    .cal-cell { min-height: 78px; }
    .cal-chip-time { display: none; }
    .cal-agenda-day { flex-direction: column; gap: .4rem; }
    .cal-agenda-date { width: auto; }
}

/* ---- quotation editor ---- */
.q-table th { font-size: .75rem; text-transform: uppercase; color: #8592a3; white-space: nowrap; }
.q-handle { width: 28px; cursor: grab; color: #a1acb8; text-align: center; font-size: 1.2rem; }
.q-handle:active { cursor: grabbing; }
.q-no { width: 32px; }
.q-desc { min-width: 220px; resize: none; overflow: hidden; }
.q-line-free td:not(:last-child) { background: rgba(105, 108, 255, .04); }
.q-dragging { opacity: .45; }
.q-drop-before > td { box-shadow: inset 0 3px 0 0 #696cff; }
.q-drop-after > td { box-shadow: inset 0 -3px 0 0 #696cff; }
.q-section .q-sec-title { max-width: 520px; flex: 1 1 260px; }
.q-results { z-index: 30; max-height: 280px; overflow-y: auto; }
.q-dt { max-width: 62px; padding-left: .5rem; padding-right: 1.4rem; }
.q-name-locked { background-color: #f5f5f9; cursor: default; }
/* the item search list of the quotation editor: solid background, visible hover and pointer */
.q-results { background-color: #fff; border: 1px solid #d9dee3; border-radius: .375rem; z-index: 1060; }
.q-results .list-group-item { background-color: #fff; cursor: pointer; border-left: 0; border-right: 0; }
.q-results .list-group-item-action:hover, .q-results .list-group-item-action:focus { background-color: #eceeff; }

/* ---- Sign-in / auth pages: full-screen background image + full-height form panel ---- */
body.score-auth { min-height: 100vh; margin: 0; padding: 0; display: block;
  background: var(--score-primary-dark); }
.score-auth-page { position: relative; min-height: 100vh; display: flex; justify-content: center; align-items: center; padding: 1.5rem; }
/* art panel: pure CSS/SVG (no image), fills the area left of the form at any width */
.score-auth-art { position: absolute; top: 0; bottom: 0; left: 0; right: 0; overflow: hidden;
  background: linear-gradient(160deg, #0A4A42 0%, var(--score-primary-dark) 35%, var(--score-primary) 100%); }
.score-auth-orb { position: absolute; right: -6%; top: -22%; width: 46vmin; height: 46vmin; min-width: 300px; min-height: 300px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.score-auth-wave { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; }
.score-dot { position: absolute; border-radius: 50%; transform: translate(-50%, -50%); opacity: .85; box-shadow: 0 0 14px 2px rgba(255, 255, 255, .25); }
.score-badge { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center; border-radius: 50%;
  background: rgba(255, 255, 255, .12); border: 1.5px solid rgba(255, 255, 255, .35); box-shadow: 0 8px 24px rgba(0, 0, 0, .18); backdrop-filter: blur(2px); }
.score-auth-main { position: relative; z-index: 1; width: min(440px, 100%); display: flex; align-items: center; justify-content: center;
  padding: 1.75rem 2.25rem; background: #fff; border-radius: 1.25rem; box-shadow: 0 24px 60px rgba(0, 0, 0, .28); }
.score-auth-form { width: 100%; }
.score-auth-brand { text-align: center; }
.score-auth-logo { display: inline-flex; align-items: center; gap: .6rem; }
.score-auth-logo .b1 { fill: var(--score-primary-dark); }
.score-auth-name { font-family: Rubik, sans-serif; font-weight: 700; font-size: 1.9rem; line-height: 1; color: var(--score-primary-dark); }
.score-auth-tagline { margin-top: .3rem; font-size: .62rem; letter-spacing: .05rem; text-transform: uppercase; color: var(--score-text); }
.score-auth-form .btn-lg { padding-top: .6rem; padding-bottom: .6rem; font-size: .95rem; }
.score-auth-form h4 { font-size: 1.25rem; }
.score-auth-form .mb-3 { margin-bottom: .85rem !important; }
.score-auth-form .mb-4 { margin-bottom: 1rem !important; }
.score-auth-form .form-label { margin-bottom: .25rem; }
.score-signin-btn .bx { vertical-align: middle; }


@media (max-width: 575.98px) { .score-auth-page { padding: 1rem; } .score-auth-main { padding: 1.5rem 1.25rem; } }

/* quotation details: lines without their descriptions (the item name stays) */
.q-hide-desc .q-line-desc { display: none; }

/* error screen */
.score-auth-main.score-auth-wide { width: min(880px, 100%); }
.score-error-icon { display: inline-flex; width: 64px; height: 64px; align-items: center; justify-content: center; border-radius: 50%; background: rgba(255, 62, 29, .12); color: #ff3e1d; font-size: 2.2rem; }
.score-error-facts { display: grid; grid-template-columns: 90px 1fr; gap: .25rem .75rem; margin: 0 0 1rem; font-size: .9rem; }
.score-error-facts dt { color: var(--score-muted); font-weight: 500; }
.score-error-facts dd { margin: 0; word-break: break-all; }
.score-error-stack { max-height: 300px; overflow: auto; margin: 0; padding: .75rem; background: #f6f8fa; border: 1px solid var(--score-border); border-radius: .5rem; font-size: .75rem; white-space: pre-wrap; word-break: break-word; }
.score-error-icon-warn { background: rgba(242, 163, 58, .18); color: #E08A00; }
