/* =========================================================
   LIKESTAR MANAGEMENT — BRAND SYSTEM
   White + Blue + Orange
========================================================== */

:root {
  --brand-blue: #0B5ED7;
  --brand-blue-dark: #084298;
  --brand-blue-light: #EAF3FF;

  --brand-orange: #F7931E;
  --brand-orange-dark: #D97706;
  --brand-orange-light: #FFF4E5;

  --white: #FFFFFF;

  --page-bg: #F7F9FC;
  --surface: #FFFFFF;
  --surface-soft: #F8FAFD;

  --text-primary: #14213D;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;

  --border: #E2E8F0;
  --border-light: #EDF1F5;

  --success: #16A34A;
  --success-light: #ECFDF3;

  --danger: #DC2626;
  --danger-light: #FEF2F2;

  --warning: #F59E0B;
  --warning-light: #FFFBEB;

  --shadow-sm: 0 2px 8px rgba(20, 33, 61, 0.05);
  --shadow-md: 0 8px 24px rgba(20, 33, 61, 0.08);
  --shadow-lg: 0 25px 70px rgba(20, 33, 61, 0.20);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}


/* =========================================================
   RESET
========================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: "DM Sans", sans-serif;
  background: var(--page-bg);
  color: var(--text-primary);
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
}


/* =========================================================
   APP SHELL
========================================================== */

.app-shell {
  min-height: 100vh;
  display: flex;
}


/* =========================================================
   SIDEBAR
========================================================== */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
}

.brand {
  height: 76px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.brand img {
  max-width: 155px;
  max-height: 42px;
  object-fit: contain;
}

.brand-fallback {
  display: none;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--brand-blue);
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 22px 14px;
}

.nav-section {
  margin-bottom: 26px;
}

.nav-section-title {
  padding: 0 12px;
  margin-bottom: 9px;
  font-size: 10px;
  line-height: 1.2;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--text-muted);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-link {
  min-height: 43px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border-radius: 9px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.nav-link:hover {
  background: var(--brand-blue-light);
  color: var(--brand-blue);
}

.nav-link.active {
  background: var(--brand-blue);
  color: var(--white);
  box-shadow: 0 4px 10px rgba(11, 94, 215, 0.18);
}

.nav-icon {
  width: 20px;
  min-width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

.sidebar-footer {
  padding: 15px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.user-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 7px;
}

.user-mini-text {
  min-width: 0;
  flex: 1;
}

.user-mini-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.user-mini-role {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: capitalize;
}


/* =========================================================
   AVATARS
========================================================== */

.avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: var(--brand-blue);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.avatar.has-image {
  background: var(--brand-blue-light);
}

.avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}


/* =========================================================
   SIDEBAR OVERLAY
========================================================== */

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 33, 61, 0.42);
  z-index: 900;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}

.sidebar-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}


/* =========================================================
   MAIN
========================================================== */

.main {
  min-width: 0;
  width: calc(100% - 250px);
  margin-left: 250px;
}


/* =========================================================
   TOPBAR
========================================================== */

.topbar {
  height: 76px;
  padding: 0 30px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 500;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
}

.topbar-left {
  min-width: 0;
  gap: 14px;
}

.topbar-right {
  gap: 10px;
}

.page-context {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--white);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.icon-button:hover {
  background: var(--brand-blue-light);
  border-color: #B9D3F7;
  color: var(--brand-blue);
}

.icon-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.mobile-menu-button {
  display: none;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 8px;
}

.topbar-user-info {
  text-align: right;
  min-width: 0;
}

.topbar-user-name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-user-role {
  margin-top: 2px;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: capitalize;
}


/* =========================================================
   PAGE
========================================================== */

.page {
  width: 100%;
  max-width: 1700px;
  margin: 0 auto;
  padding: 34px 30px 60px;
}

.page-head {
  margin-bottom: 28px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow {
  margin-bottom: 8px;
  font-size: 10px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-orange);
}

h1 {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.045em;
  color: var(--text-primary);
}

.page-head p {
  max-width: 680px;
  margin-top: 11px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.65;
}


/* =========================================================
   BUTTONS
========================================================== */

.btn {
  min-height: 40px;
  padding: 0 15px;
  border-radius: 8px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    opacity 0.2s ease,
    transform 0.2s ease;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--brand-blue-dark);
  border-color: var(--brand-blue-dark);
}

.btn-secondary {
  background: var(--white);
  border-color: var(--border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--brand-blue-light);
  border-color: #B9D3F7;
  color: var(--brand-blue);
}


/* =========================================================
   STATS
========================================================== */

.stats-grid {
  display: grid;
  grid-template-columns:
    repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  min-width: 0;
  padding: 19px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.stat-card:hover {
  border-color: #C8DCF7;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.stat-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--brand-blue-light);
  color: var(--brand-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

.stat-card:nth-child(4n + 2) .stat-icon {
  background: var(--brand-orange-light);
  color: var(--brand-orange-dark);
}

.stat-value {
  margin-top: 14px;
  font-family: "Plus Jakarta Sans", sans-serif;
  color: var(--text-primary);
  font-size: 27px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.stat-note {
  margin-top: 9px;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.4;
}


/* =========================================================
   PANELS
========================================================== */

.panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.panel-head {
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  border-bottom: 1px solid var(--border-light);
}

.panel-title {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 800;
}

.panel-subtitle {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 11px;
}


/* =========================================================
   PIPELINE
========================================================== */

.pipeline-panel {
  margin-bottom: 20px;
}

.pipeline {
  display: grid;
  grid-template-columns:
    repeat(5, minmax(0, 1fr));
  padding: 22px;
  gap: 10px;
}

.pipeline-stage {
  min-width: 0;
  padding: 18px 12px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  text-align: center;
  background: var(--surface-soft);
  transition:
    border-color 0.2s ease,
    background 0.2s ease;
}

.pipeline-stage:hover {
  border-color: #C8DCF7;
  background: var(--brand-blue-light);
}

.pipeline-dot {
  width: 40px;
  height: 40px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: var(--brand-blue);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

.pipeline-stage:nth-child(even) .pipeline-dot {
  background: var(--brand-orange);
}

.pipeline-name {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 800;
}

.pipeline-count {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 10px;
}


/* =========================================================
   TOOLBAR
========================================================== */

.toolbar {
  padding: 13px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  flex: 1 1 300px;
  min-width: 220px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 17px;
  pointer-events: none;
}

.search-wrap .form-control {
  padding-left: 37px;
}

.form-control {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid #D7DEE8;
  border-radius: 8px;
  outline: none;
  background: var(--white);
  color: var(--text-primary);
  font-size: 12px;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-control:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(11, 94, 215, 0.10);
}

.form-control:disabled,
.form-control[readonly] {
  background: #F8FAFD;
  color: var(--text-secondary);
  cursor: default;
}

.toolbar-select {
  width: auto;
  min-width: 145px;
}

.result-count {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}


/* =========================================================
   TABLE
========================================================== */

.table-panel {
  overflow: hidden;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

th {
  padding: 13px 16px;
  background: #F8FAFD;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.3;
  font-weight: 800;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

td {
  padding: 15px 16px;
  border-bottom: 1px solid #EEF2F6;
  color: var(--text-secondary);
  font-size: 12px;
  vertical-align: middle;
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: #F7FAFF;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.request-cell,
.customer-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.request-cell strong,
.customer-cell strong {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 800;
}

.request-cell span,
.customer-cell span {
  color: var(--text-muted);
  font-size: 10px;
}


/* =========================================================
   TABLE ACTION
========================================================== */

.table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--white);
  color: var(--brand-blue);
  font-size: 10px;
  font-weight: 800;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.table-action:hover {
  background: var(--brand-blue-light);
  border-color: #B9D3F7;
  color: var(--brand-blue-dark);
}


/* =========================================================
   STATUS
========================================================== */

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.status-new {
  background: var(--brand-blue-light);
  color: var(--brand-blue-dark);
}

.status-contacted {
  background: #EAF3FF;
  color: #175CD3;
}

.status-quoted {
  background: var(--brand-orange-light);
  color: var(--brand-orange-dark);
}

.status-won {
  background: var(--success-light);
  color: #027A48;
}

.status-lost {
  background: var(--danger-light);
  color: #B42318;
}

.followup {
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.4;
}

.followup.overdue {
  color: var(--danger);
  font-weight: 800;
}

.muted {
  color: var(--text-muted);
}


/* =========================================================
   EMPTY STATE
========================================================== */

.empty-state {
  padding: 60px 24px;
  text-align: center;
}

.empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  border-radius: 12px;
  background: var(--brand-blue-light);
  color: var(--brand-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
}

.empty-state h3 {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 800;
}

.empty-state p {
  max-width: 500px;
  margin: 7px auto 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
}


/* =========================================================
   MODAL
========================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  padding: 24px;
  background: rgba(20, 33, 61, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal {
  width: min(900px, 100%);
  max-height: calc(100vh - 48px);
  background: var(--white);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(0.99);
  transition: transform 0.2s ease;
}

.modal-backdrop.open .modal {
  transform: translateY(0) scale(1);
}

.modal-head {
  padding: 20px 22px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-shrink: 0;
}

.modal-title {
  color: var(--text-primary);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.modal-subtitle {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.modal-close {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.modal-close:hover {
  background: var(--brand-blue-light);
  border-color: #B9D3F7;
  color: var(--brand-blue);
}

.modal-body {
  overflow-y: auto;
  padding: 22px;
  overscroll-behavior: contain;
}

.modal-section {
  margin-bottom: 25px;
}

.modal-section:last-child {
  margin-bottom: 0;
}

.modal-section-title {
  margin-bottom: 12px;
  color: var(--brand-blue-dark);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}


/* =========================================================
   WORKFLOW
========================================================== */

.workflow {
  display: grid;
  grid-template-columns:
    repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.workflow-step {
  min-height: 38px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.workflow-step.active {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  color: var(--white);
  box-shadow: 0 3px 8px rgba(11, 94, 215, 0.18);
}


/* =========================================================
   DETAIL GRID
========================================================== */

.detail-grid {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-card {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--border-light);
  border-radius: 9px;
  background: var(--surface-soft);
}

.detail-card.full {
  grid-column: 1 / -1;
}

.detail-label {
  margin-bottom: 5px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.detail-value {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  word-break: break-word;
}

.detail-value.regular {
  font-weight: 500;
}

.description-box {
  white-space: pre-wrap;
  min-height: 55px;
}


/* =========================================================
   BUSINESS IDENTIFIERS
========================================================== */

#detailSaleId {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 800;
  color: var(--brand-blue-dark);
}

#detailStatus {
  display: inline-flex;
  align-items: center;
  width: fit-content;
}


/* =========================================================
   FORM GRID
========================================================== */

.form-grid {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.field {
  min-width: 0;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 800;
}

textarea.form-control {
  min-height: 110px;
  resize: vertical;
}


/* =========================================================
   FORM HELP TEXT
========================================================== */

.field-help {
  display: block;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.45;
}


/* =========================================================
   INPUT WITH PREFIX
========================================================== */

.input-with-prefix {
  position: relative;
  width: 100%;
}

.input-with-prefix .form-control {
  padding-left: 46px;
}

.input-prefix {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 800;
  pointer-events: none;
  white-space: nowrap;
}


/* =========================================================
   COMMERCIAL DETAILS
========================================================== */

.commercial-summary {
  margin-top: 13px;
  display: grid;
  grid-template-columns:
    repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.commercial-summary .detail-card {
  background: var(--surface-soft);
}

.commercial-summary .detail-card:last-child {
  background: var(--success-light);
  border-color: #C9EBD8;
}

.commercial-summary .detail-card:last-child .detail-label {
  color: #16834B;
}

.commercial-summary .detail-card:last-child .detail-value {
  color: #087443;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 15px;
  font-weight: 800;
}


/* =========================================================
   SALE CALCULATION
========================================================== */

.sale-calculation {
  margin-top: 14px;
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
}

.calculation-row {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--text-secondary);
  font-size: 11px;
}

.calculation-row span {
  font-weight: 600;
}

.calculation-row strong {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.calculation-divider {
  height: 1px;
  margin: 6px 0;
  background: var(--border);
}

.calculation-total {
  min-height: 38px;
}

.calculation-total span {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 800;
}

.calculation-total strong {
  color: var(--success);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 16px;
  font-weight: 800;
}


/* =========================================================
   COMMERCIAL READONLY
========================================================== */

.commercial-readonly {
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: #F8FAFD;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
}


/* =========================================================
   PRICING INPUT STATES
========================================================== */

#detailServicePrice,
#detailDiscountValue {
  font-variant-numeric: tabular-nums;
}

#detailDiscountType {
  cursor: pointer;
}

#detailServicePrice:focus,
#detailDiscountValue:focus,
#detailDiscountType:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(11, 94, 215, 0.10);
}


/* =========================================================
   TIMELINE
========================================================== */

.timeline {
  position: relative;
  padding-left: 21px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 5px;
  bottom: 5px;
  width: 1px;
  background: #D8E1EC;
}

.timeline-item {
  position: relative;
  padding: 0 0 18px 14px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -20px;
  top: 4px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--brand-orange);
  border: 2px solid var(--white);
  box-shadow: 0 0 0 1px #D0D9E5;
}

.timeline-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.timeline-content strong {
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 800;
}

.timeline-content span {
  color: var(--text-muted);
  font-size: 9px;
}

.timeline-content p {
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.5;
}

.timeline-empty {
  padding: 20px;
  border: 1px dashed #D7DEE8;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
}


/* =========================================================
   MODAL FOOTER
========================================================== */

.modal-footer {
  padding: 15px 22px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  flex-shrink: 0;
}


/* =========================================================
   ROLE STATES
========================================================== */

body.role-designer [data-role-only*="staff"],
body.role-designer [data-role-only*="manager"],
body.role-designer [data-role-only*="owner"] {
  /*
   * Actual visibility is controlled by JavaScript.
   * Shared management-auth remains the authority.
   */
}


/* =========================================================
   ACCESSIBILITY / FOCUS
========================================================== */

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}


/* =========================================================
   RESPONSIVE
========================================================== */

@media (max-width: 1200px) {

  .stats-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

  .pipeline {
    grid-template-columns:
      repeat(3, minmax(0, 1fr));
  }

}


@media (max-width: 900px) {

  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow:
      12px 0 40px rgba(20, 33, 61, 0.14);
  }

  .main {
    width: 100%;
    margin-left: 0;
  }

  .mobile-menu-button {
    display: inline-flex;
  }

  .topbar {
    padding: 0 20px;
  }

  .page {
    padding: 28px 20px 50px;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

}


@media (max-width: 700px) {

  .stats-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .stat-card {
    padding: 15px;
  }

  .stat-value {
    font-size: 23px;
  }

  .pipeline {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
    padding: 15px;
  }

  .toolbar {
    align-items: stretch;
  }

  .search-wrap {
    flex-basis: 100%;
  }

  .toolbar-select {
    flex: 1 1 140px;
    width: auto;
  }

  .result-count {
    width: 100%;
    margin-left: 0;
    padding: 3px 2px;
  }

  .detail-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .detail-card.full,
  .field.full {
    grid-column: auto;
  }

  .workflow {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

  .commercial-summary {
    grid-template-columns: 1fr;
  }

  .sale-calculation {
    padding: 13px;
  }

  .calculation-row {
    gap: 12px;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .modal {
    max-height: calc(100vh - 20px);
    border-radius: 11px;
  }

  .modal-body {
    padding: 17px;
  }

  .modal-head,
  .modal-footer {
    padding-left: 17px;
    padding-right: 17px;
  }

  .topbar-user-info {
    display: none;
  }

}


@media (max-width: 480px) {

  .page {
    padding: 23px 14px 40px;
  }

  .topbar {
    height: 66px;
    padding: 0 14px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .pipeline {
    grid-template-columns: 1fr 1fr;
  }

  .pipeline-stage {
    padding: 14px 8px;
  }

  .topbar-right {
    gap: 5px;
  }

  .page-head .btn {
    width: 100%;
  }

  .modal-footer {
    flex-direction: column-reverse;
  }

  .modal-footer .btn {
    width: 100%;
  }

  .sale-calculation {
    padding: 12px;
  }

  .calculation-row {
    min-height: 28px;
    font-size: 10px;
  }

  .calculation-row strong {
    font-size: 11px;
  }

  .calculation-total strong {
    font-size: 14px;
  }

}

