:root {
  color-scheme: dark;
  --bg: #071322;
  --navy: #0F233D;
  --panel: rgba(15, 35, 61, 0.82);
  --panel-2: rgba(10, 25, 46, 0.92);
  --panel-card: rgba(15, 35, 61, 0.68);
  --line: rgba(186, 214, 245, 0.14);
  --line-hot: rgba(56, 189, 248, 0.45);
  --line-gold: rgba(214, 155, 45, 0.42);
  --text: #f8fffe;
  --muted: #9fb1ca;
  --dim: #64748b;
  --cyan: #38bdf8;
  --cyan-bright: #38bdf8;
  --blue: #1d528d;
  --gold: #d69b2d;
  --orange: #d69b2d;
  --green: #10b981;
  --violet: #8da4c4;
  --pink: #d97706;
  --danger: #ef4444;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-xs: 4px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.22);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13.5px;
  line-height: 1.42;
}

* {
  box-sizing: border-box;
}

[hidden],
.is-hidden {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 4%, rgba(15, 35, 61, 0.45), transparent 30rem),
    radial-gradient(circle at 85% 12%, rgba(29, 82, 141, 0.22), transparent 28rem),
    radial-gradient(circle at 50% 100%, rgba(15, 35, 61, 0.35), transparent 32rem),
    linear-gradient(135deg, #071322 0%, #0F233D 50%, #081628 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(214, 155, 45, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.85), transparent 85%);
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: rgba(7, 19, 34, 0.6);
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.22);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.45);
}

/* Typography Hierarchy */
h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  font-weight: 650;
  margin: 0;
  line-height: 1.22;
}

h1 {
  font-size: 1.25rem;
  letter-spacing: -0.015em;
}

h2 {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 0.92rem;
  letter-spacing: -0.005em;
}

h4 {
  font-size: 0.84rem;
}

p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Micro Eyebrows and Labels */
label span,
legend,
.eyebrow,
.panel-kicker {
  display: inline-block;
  color: var(--cyan);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* Buttons and Controls */
button,
input,
select,
textarea {
  font: inherit;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 11px;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
  background: linear-gradient(135deg, var(--navy), #1d528d);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
  white-space: nowrap;
}

button:hover {
  transform: translateY(-1px);
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow: 0 6px 16px rgba(56, 189, 248, 0.2);
}

button:active {
  transform: translateY(0);
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.ghost-button {
  color: #e2e8f0;
  background: rgba(15, 35, 61, 0.55);
  border: 1px solid var(--line);
  box-shadow: none;
}

.ghost-button:hover {
  background: rgba(29, 82, 141, 0.45);
  border-color: rgba(56, 189, 248, 0.4);
}

.tiny-button {
  min-height: 22px;
  padding: 0 7px;
  font-size: 0.68rem;
  font-weight: 650;
  border-radius: var(--radius-xs);
  box-shadow: none;
}

.danger-button {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}

.danger-button:hover {
  background: rgba(239, 68, 68, 0.45);
  border-color: #ef4444;
  color: #fff;
}

/* Inputs & Form Elements */
input,
select,
textarea {
  width: 100%;
  min-height: 30px;
  padding: 0 9px;
  color: var(--text);
  font-size: 0.8rem;
  background: rgba(8, 20, 38, 0.8);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: 0;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);
}

textarea {
  min-height: 60px;
  padding: 6px 9px;
  resize: vertical;
}

/* Chips and Badges */
.status-badge,
.priority,
.department-pill,
.agent-status,
.live-chip,
.task-pills span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 0 7px;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 999px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.status-badge {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.28);
}

.status-badge.medium {
  background: rgba(214, 155, 45, 0.12);
  color: #d69b2d;
  border-color: rgba(214, 155, 45, 0.3);
}

.status-badge.high,
.status-badge.critical,
.priority {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.status-badge.low,
.status-badge.done {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.department-pill {
  color: var(--cyan);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.live-chip {
  min-height: 20px;
  padding: 0 7px;
  color: #c8e6e4;
  font-size: 0.68rem;
  border: 1px solid rgba(200, 230, 228, 0.4);
  border-radius: 5px;
}

/* Firebase Status Badge */
.firebase-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 20px;
  padding: 1px 7px;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  user-select: none;
}

.firebase-status-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.firebase-status-badge.is-online {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.firebase-status-badge.is-online::before {
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
}

.firebase-status-badge.is-offline {
  background: rgba(214, 155, 45, 0.12);
  color: #d69b2d;
  border: 1px solid rgba(214, 155, 45, 0.35);
}

.firebase-status-badge.is-offline::before {
  background: #d69b2d;
}

/* Login Screen */
.crm-shell {
  min-height: 100vh;
}

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}

.login-card {
  width: 100%;
  max-width: 390px;
  padding: 22px 24px;
  background:
    radial-gradient(circle at 80% 10%, rgba(56, 189, 248, 0.1), transparent 14rem),
    var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(20px);
}

.login-brand-header {
  margin-bottom: 14px;
}

.brand-badge-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.brand-badge-logo img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.brand-badge-company {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
}

.brand-badge-tag {
  display: inline-block;
  font-size: 0.65rem;
  color: var(--cyan);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.login-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  color: #ffffff;
}

.login-desc {
  font-size: 0.78rem;
  margin: 2px 0 14px;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 10px;
}

.input-field-group {
  display: grid;
  gap: 3px;
}

.field-label {
  font-size: 0.7rem;
  font-weight: 650;
  color: var(--muted);
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.field-icon {
  position: absolute;
  left: 9px;
  color: var(--dim);
  pointer-events: none;
}

.input-container input {
  padding-left: 30px;
  padding-right: 32px;
  min-height: 32px;
}

.pass-peek-btn {
  position: absolute;
  right: 4px;
  min-height: 24px;
  padding: 0 4px;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--dim);
}

.pass-peek-btn:hover {
  transform: none;
  color: var(--cyan);
}

.login-submit-button {
  min-height: 32px;
  margin-top: 4px;
  background: linear-gradient(135deg, #0F233D, #1d528d);
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.login-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
  color: var(--dim);
}

.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.login-home-link {
  color: var(--cyan);
}

/* Panels and Base Containers */
.panel,
.module-panel,
.wide-panel,
.erp-panel,
.erp-record-panel {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.008)),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 10px 12px;
  backdrop-filter: blur(14px);
}

/* ==========================================================================
   CEO Overview Dashboard (admin.html)
   ========================================================================== */
.crm-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 4px 16px;
  background: rgba(10, 25, 46, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand-logo img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.brand-lockup strong {
  display: block;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.15;
}

.brand-lockup small {
  display: block;
  font-size: 0.68rem;
  color: var(--cyan);
  line-height: 1.1;
}

.module-tabs {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px;
  background: rgba(15, 35, 61, 0.6);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.module-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  font-size: 0.74rem;
  font-weight: 650;
  color: var(--muted);
  border-radius: var(--radius-xs);
  transition: all 120ms ease;
}

.module-tabs a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.module-tabs a.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--navy), #1d528d);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.74rem;
}

.user-chip strong {
  font-weight: 700;
  color: #fff;
}

.user-chip [data-current-id] {
  color: var(--cyan);
  font-weight: 700;
  font-size: 0.72rem;
}

.business-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.6fr);
  gap: 10px;
  width: min(1480px, calc(100% - 32px));
  margin: 10px auto 24px;
}

/* CEO Agent Banner */
.ceo-agent {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 8px 14px;
  border-color: rgba(56, 189, 248, 0.3);
  background:
    radial-gradient(circle at 90% 20%, rgba(56, 189, 248, 0.12), transparent 12rem),
    linear-gradient(135deg, rgba(15, 35, 61, 0.9), rgba(10, 25, 46, 0.88));
}

.agent-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--gold);
  background: radial-gradient(circle, rgba(214, 155, 45, 0.2), rgba(15, 35, 61, 0.5));
  border: 1px solid var(--line-gold);
  border-radius: var(--radius-sm);
  place-items: center;
}

.ceo-agent h1 {
  font-size: 0.98rem;
  font-weight: 650;
  line-height: 1.25;
}

.ceo-agent p:not(.eyebrow) {
  font-size: 0.76rem;
  margin: 1px 0 0;
}

.ceo-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.ceo-actions button {
  min-height: 26px;
  padding: 0 9px;
  font-size: 0.72rem;
}

/* Section Headings */
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.section-heading h2 {
  font-size: 0.92rem;
  font-weight: 650;
}

/* Task Queue */
.queue-form,
.inline-crm-form {
  display: grid;
  grid-template-columns: 130px minmax(160px, 1fr) minmax(110px, 0.5fr) auto;
  gap: 6px;
  margin-bottom: 8px;
}

.queue-list {
  display: grid;
  gap: 4px;
  max-height: 280px;
  overflow-y: auto;
}

.queue-item {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 5px 9px;
  background: rgba(10, 25, 46, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.queue-item strong {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}

.queue-item p {
  font-size: 0.72rem;
  margin: 1px 0 0;
  color: var(--muted);
}

.queue-actions,
.agent-actions,
.table-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* Agent Department Cards */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.agent-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 88px;
  padding: 8px 10px;
  gap: 4px;
  cursor: pointer;
  background: rgba(10, 25, 46, 0.75);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.agent-card:hover {
  transform: translateY(-1px);
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.agent-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.agent-icon {
  display: grid;
  width: 26px;
  height: 26px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 5px;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--cyan);
}

.agent-card h3 {
  font-size: 0.82rem;
  font-weight: 650;
  margin: 0;
}

.agent-card p {
  font-size: 0.72rem;
  margin: 0;
  line-height: 1.3;
}

.agent-card.violet { border-color: rgba(141, 164, 196, 0.35); }
.agent-card.teal   { border-color: rgba(56, 189, 248, 0.35); }
.agent-card.orange { border-color: rgba(214, 155, 45, 0.35); }
.agent-card.blue   { border-color: rgba(29, 82, 141, 0.4); }
.agent-card.green  { border-color: rgba(16, 185, 129, 0.35); }
.agent-card.pink   { border-color: rgba(217, 119, 6, 0.35); }

/* Activity Log */
.activity-panel {
  grid-column: 2;
  grid-row: 2 / span 2;
  min-height: auto;
  max-height: 440px;
  overflow-y: auto;
}

.activity-log {
  display: grid;
  gap: 4px;
}

.activity-item {
  padding: 5px 8px;
  background: rgba(10, 25, 46, 0.65);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.activity-item span {
  color: var(--cyan);
  font-size: 0.7rem;
  font-weight: 750;
}

.activity-item p {
  font-size: 0.74rem;
  margin: 1px 0 0;
  line-height: 1.35;
}

.empty-state {
  display: grid;
  min-height: 80px;
  text-align: center;
  place-items: center;
  color: var(--dim);
  font-size: 0.78rem;
}

/* ==========================================================================
   Department Shell Layout (sales.html, projects.html, etc.)
   ========================================================================== */
.erp-shell {
  display: grid;
  grid-template-columns: 198px minmax(0, 1fr);
  min-height: 100vh;
}

.erp-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100vh;
  padding: 8px;
  overflow-y: auto;
  background: rgba(10, 25, 46, 0.95);
  border-right: 1px solid var(--line);
}

.sidebar-search {
  position: relative;
}

.sidebar-search span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.sidebar-search input {
  min-height: 28px;
  font-size: 0.74rem;
  padding: 0 28px 0 8px;
  background: rgba(15, 35, 61, 0.75);
}

.sidebar-search kbd {
  position: absolute;
  right: 7px;
  top: 6px;
  color: var(--dim);
  font-size: 0.65rem;
  font-weight: 700;
}

.erp-nav {
  display: grid;
  gap: 2px;
}

.erp-nav a {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all 120ms ease;
}

.erp-nav a span {
  display: grid;
  width: 16px;
  height: 16px;
  color: var(--cyan);
  font-size: 0.62rem;
  background: rgba(148, 163, 184, 0.08);
  border-radius: 3px;
  place-items: center;
}

.erp-nav a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.erp-nav a.is-active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--navy), #1d528d);
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.sidebar-user {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  padding-top: 8px;
  margin-top: auto;
  border-top: 1px solid var(--line);
}

.user-dot {
  display: grid;
  width: 26px;
  height: 26px;
  font-size: 0.7rem;
  font-weight: 800;
  background: linear-gradient(135deg, #1d528d, var(--cyan));
  border-radius: 50%;
  place-items: center;
  color: #fff;
}

.sidebar-user strong {
  display: block;
  font-size: 0.74rem;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user small {
  display: block;
  font-size: 0.66rem;
  color: var(--muted);
  line-height: 1.1;
}

.sidebar-logout {
  grid-column: 1 / -1;
  display: grid;
  min-height: 24px;
  margin-top: 3px;
  color: var(--dim);
  font-size: 0.7rem;
  font-weight: 650;
  background: rgba(148, 163, 184, 0.06);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  place-items: center;
}

.sidebar-logout:hover {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.15);
}

/* Department Topbar */
.erp-main {
  min-width: 0;
}

.erp-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 4px 14px;
  background: rgba(10, 25, 46, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
  flex-wrap: wrap;
}

.erp-back-button {
  transition: all 140ms ease;
}

.erp-back-button:hover {
  background: rgba(56, 189, 248, 0.22) !important;
  color: #fff !important;
  border-color: rgba(56, 189, 248, 0.6) !important;
  transform: translateX(-2px);
}

.topbar-spacer {
  flex: 1;
}

.erp-topbar select {
  width: auto;
  min-width: 90px;
  min-height: 26px;
  font-size: 0.74rem;
  background: rgba(15, 35, 61, 0.85);
  border-radius: var(--radius-xs);
}

.erp-brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.erp-brand strong {
  display: block;
  font-size: 0.78rem;
  line-height: 1.1;
}

.erp-brand small {
  display: block;
  font-size: 0.64rem;
  color: var(--cyan);
  line-height: 1.1;
}

/* Department Content Shell */
.erp-content {
  display: grid;
  gap: 8px;
  width: min(1480px, calc(100% - 28px));
  padding: 10px 0 24px;
  margin: 0 auto;
}

/* Command Center Title Row */
.erp-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
}

.erp-title-row h1 {
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.2;
}

.erp-title-row p {
  max-width: 780px;
  font-size: 0.76rem;
  margin: 1px 0 0;
  color: #9fb1ca;
}

.timestamp {
  flex: 0 0 auto;
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 600;
}

/* Alert Banner */
.erp-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 12px;
  color: #fee2e2;
  background: linear-gradient(90deg, rgba(93, 31, 31, 0.45), rgba(15, 35, 61, 0.75));
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-left: 3px solid var(--danger);
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
}

.erp-alert strong {
  color: #fff;
  font-size: 0.8rem;
}

.erp-alert p {
  margin: 1px 0 0;
  color: #fca5a5;
  font-size: 0.74rem;
}

.erp-alert button {
  min-height: 24px;
  padding: 0 9px;
  font-size: 0.72rem;
  background: linear-gradient(135deg, var(--danger), #b91c1c);
  border: 0;
}

/* Department Hero (Compact) */
.department-hero {
  position: relative;
  min-height: auto;
  padding: 9px 13px;
  margin-top: 4px;
  background:
    radial-gradient(circle at 85% 10%, rgba(56, 189, 248, 0.08), transparent 12rem),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.department-hero h1 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
}

.department-hero p:not(.eyebrow) {
  font-size: 0.76rem;
  line-height: 1.35;
  margin: 2px 0 0;
}

/* KPIs Strip */
.erp-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.erp-kpi {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 60px;
  padding: 6px 12px;
  background:
    radial-gradient(circle at 90% 15%, rgba(56, 189, 248, 0.12), transparent 7rem),
    linear-gradient(145deg, rgba(15, 35, 61, 0.88), rgba(10, 25, 46, 0.85));
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.erp-kpi small {
  display: block;
  color: var(--cyan);
  font-size: 0.65rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.erp-kpi strong {
  display: block;
  margin-top: 2px;
  color: #ffffff;
  font-size: 1.3rem;
  font-weight: 750;
  line-height: 1.1;
}

.erp-kpi p {
  margin: 1px 0 0;
  font-size: 0.7rem;
  color: var(--muted);
}

.erp-kpi.purple { border-color: rgba(141, 164, 196, 0.35); }
.erp-kpi.teal   { border-color: rgba(56, 189, 248, 0.35); }
.erp-kpi.amber  { border-color: rgba(214, 155, 45, 0.35); }

/* Navigation Tabs */
.erp-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px;
  background: rgba(10, 25, 46, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.erp-tabs button {
  min-height: 24px;
  padding: 0 9px;
  font-size: 0.74rem;
  font-weight: 650;
  color: var(--muted);
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: var(--radius-xs);
}

.erp-tabs button:hover {
  transform: none;
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.erp-tabs button.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--navy), #1d528d);
  border: 1px solid rgba(56, 189, 248, 0.35);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.erp-tabs span {
  display: inline-grid;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  color: #ffffff;
  font-size: 0.62rem;
  background: var(--danger);
  border-radius: 999px;
  place-items: center;
}

/* Feature Rails (Compact 4-grid) */
.feature-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.feature-rail article {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 52px;
  padding: 6px 10px;
  gap: 2px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.008)),
    rgba(15, 35, 61, 0.65);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.feature-rail span {
  color: var(--cyan);
  font-size: 0.65rem;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.feature-rail strong {
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.15;
}

.feature-rail p {
  margin: 0;
  font-size: 0.7rem;
  line-height: 1.25;
}

/* Section Pages & Shells */
.section-page {
  display: grid;
  gap: 8px;
}

.section-page-heading {
  padding: 8px 12px;
  background:
    radial-gradient(circle at 90% 15%, rgba(56, 189, 248, 0.08), transparent 10rem),
    linear-gradient(135deg, rgba(15, 35, 61, 0.9), rgba(10, 25, 46, 0.85));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.section-page-heading h2 {
  font-size: 1.08rem;
  font-weight: 700;
  margin: 0;
}

.section-page-heading p {
  font-size: 0.76rem;
  margin: 2px 0 0;
  line-height: 1.35;
}

/* Department Panels and Grids */
.erp-section-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(290px, 0.6fr);
  gap: 8px;
  align-items: stretch;
}

.priority-panel {
  border-color: rgba(56, 189, 248, 0.32);
}

.ai-panel {
  border-color: rgba(214, 155, 45, 0.3);
}

.record-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.record-heading h2 {
  font-size: 0.92rem;
  font-weight: 650;
}

.record-heading p {
  font-size: 0.74rem;
  margin: 1px 0 0;
}

.compact-form {
  padding: 6px;
  background: rgba(10, 25, 46, 0.6);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.status-strip span {
  min-height: 20px;
  padding: 0 7px;
  color: #e2e8f0;
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(15, 35, 61, 0.5);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 999px;
}

.record-list {
  display: grid;
  gap: 4px;
}

.record-row {
  padding: 5px 8px;
  background: rgba(10, 25, 46, 0.6);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
}

.record-row strong {
  display: block;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 650;
}

.record-row p {
  margin: 1px 0 0;
  font-size: 0.72rem;
  line-height: 1.35;
}

.module-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.erp-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.erp-mini-grid article {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 52px;
  padding: 6px 10px;
  gap: 2px;
  background: rgba(15, 35, 61, 0.6);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.erp-mini-grid span {
  color: var(--cyan);
  font-size: 0.65rem;
  font-weight: 750;
}

.erp-mini-grid strong {
  font-size: 0.8rem;
  font-weight: 650;
  color: #fff;
}

.erp-mini-grid p {
  margin: 0;
  font-size: 0.7rem;
  line-height: 1.25;
}

/* ==========================================================================
   Data Tables (CRM High-Density Tables)
   ========================================================================== */
.crm-table {
  overflow-x: auto;
}

.crm-table table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
}

.crm-table th,
.crm-table td {
  padding: 5px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 0.76rem;
  line-height: 1.3;
}

.crm-table th {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(10, 25, 46, 0.45);
}

.crm-table tr:hover td {
  background: rgba(56, 189, 248, 0.05);
}

/* ==========================================================================
   Document Forms (Project, Invoice, Task Inputs)
   ========================================================================== */
.document-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  margin-top: 6px;
  background: rgba(10, 25, 46, 0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.document-form-title {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 38px;
  padding: 5px 8px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(15, 35, 61, 0.2));
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-xs);
}

.document-form-title span,
.document-form label span {
  color: var(--cyan);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.document-form-title small {
  color: var(--muted);
  font-size: 0.68rem;
}

.document-form label {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.document-form input,
.document-form select,
.document-form textarea {
  min-height: 28px;
  padding: 3px 7px;
  font-size: 0.78rem;
}

.document-form textarea {
  min-height: 52px;
}

.document-form .full-span,
.document-form-title.full-span {
  grid-column: 1 / -1;
}

.document-form .wide-field {
  grid-column: span 2;
}

.document-form-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  padding-top: 2px;
}

.document-form-actions button {
  min-width: 100px;
}

/* ==========================================================================
   Department Specific Components (Projects, Finance, Ops, Vendors, HR)
   ========================================================================== */

/* Project Module */
.project-command-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.project-command-grid article {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 56px;
  padding: 6px 10px;
  background: rgba(15, 35, 61, 0.65);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.project-command-grid span {
  display: block;
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 750;
  line-height: 1.1;
}

.project-command-grid p {
  margin: 1px 0 0;
  font-size: 0.7rem;
}

.project-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 6px;
}

.project-card-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.project-card {
  display: flex;
  flex-direction: column;
  padding: 7px 9px;
  gap: 3px;
  background: rgba(10, 25, 46, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.project-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.project-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: 0.68rem;
  font-weight: 750;
  background: rgba(56, 189, 248, 0.12);
  color: var(--cyan);
  border-radius: 4px;
}

.project-card h3 {
  font-size: 0.82rem;
  font-weight: 650;
  margin: 0;
}

.project-card p {
  font-size: 0.72rem;
  margin: 0;
  line-height: 1.3;
}

.project-card-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.project-card-metrics span {
  display: inline-block;
  padding: 1px 5px;
  font-size: 0.65rem;
  font-weight: 650;
  background: rgba(15, 35, 61, 0.7);
  border: 1px solid var(--line);
  border-radius: 3px;
}

.project-filter-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.project-filter-bar input,
.project-filter-bar select {
  min-height: 26px;
  font-size: 0.74rem;
}

/* Kanban Board */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.kanban-board.compact {
  gap: 5px;
}

.kanban-column {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 5px;
  background: rgba(10, 25, 46, 0.75);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: 140px;
}

.kanban-column header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.kanban-column header strong {
  display: inline-grid;
  width: 16px;
  height: 16px;
  font-size: 0.64rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  place-items: center;
  color: #fff;
}

.kanban-dropzone {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 100px;
}

.kanban-card {
  display: flex;
  flex-direction: column;
  padding: 5px 7px;
  gap: 2px;
  background: rgba(15, 35, 61, 0.85);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  cursor: grab;
}

.kanban-card strong {
  font-size: 0.76rem;
  font-weight: 650;
  color: #fff;
}

.kanban-card p {
  font-size: 0.7rem;
  margin: 0;
  line-height: 1.25;
}

.kanban-empty {
  display: grid;
  min-height: 60px;
  place-items: center;
  font-size: 0.68rem;
  color: var(--dim);
  border: 1px dashed rgba(148, 163, 184, 0.16);
  border-radius: var(--radius-xs);
}

.project-task-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 5px 8px;
  background: rgba(10, 25, 46, 0.65);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.project-task-row strong {
  font-size: 0.78rem;
  font-weight: 650;
}

.project-task-row p,
.project-task-row small {
  font-size: 0.7rem;
  margin: 1px 0 0;
  display: block;
}

/* View Toggle */
.view-toggle {
  display: flex;
  gap: 2px;
}

.view-toggle button {
  min-height: 22px;
  padding: 0 7px;
  font-size: 0.68rem;
  background: transparent;
  border: 1px solid var(--line);
  box-shadow: none;
}

.view-toggle button.is-active {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.4);
  color: #fff;
}

/* Finance Module */
.finance-snapshot {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.finance-snapshot article {
  padding: 6px 10px;
  background: rgba(15, 35, 61, 0.65);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.finance-snapshot span {
  display: block;
  font-size: 1.25rem;
  font-weight: 750;
  line-height: 1.1;
  color: #fff;
}

.finance-snapshot p {
  margin: 1px 0 0;
  font-size: 0.7rem;
}

.accounting-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(15, 35, 61, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.accounting-hero h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
}

.accounting-hero p {
  font-size: 0.74rem;
  margin: 1px 0 0;
}

.accounting-total {
  min-width: 200px;
  padding: 6px 10px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(15, 35, 61, 0.3));
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-sm);
}

.accounting-total small {
  display: block;
  color: var(--cyan);
  font-size: 0.65rem;
  font-weight: 750;
  text-transform: uppercase;
}

.accounting-total strong {
  display: block;
  margin-top: 2px;
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 750;
  line-height: 1.1;
}

.finance-donut-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.finance-donut-grid.finance-page-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.finance-donut-card {
  --donut-color: #38bdf8;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  min-height: 56px;
  background: rgba(10, 25, 46, 0.75);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.finance-donut-card.violet { --donut-color: #8da4c4; }
.finance-donut-card.amber  { --donut-color: #d69b2d; }

.finance-donut {
  display: grid;
  width: 42px;
  height: 42px;
  background:
    radial-gradient(circle, rgba(10, 25, 46, 0.96) 0 54%, transparent 55%),
    conic-gradient(var(--donut-color) calc(var(--value) * 1%), rgba(148, 163, 184, 0.18) 0);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 50%;
  place-items: center;
}

.finance-donut span {
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 750;
}

.finance-donut-card strong {
  display: block;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 650;
}

.finance-donut-card p {
  margin: 1px 0 0;
  font-size: 0.7rem;
}

.finance-report-grid,
.finance-pending-summary,
.finance-progress-grid,
.finance-trend-grid,
.accounting-breakdown {
  display: grid;
  gap: 6px;
}

.finance-report-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.finance-pending-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.finance-progress-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.finance-trend-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.accounting-breakdown { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.finance-report-grid article,
.finance-pending-summary article,
.finance-progress-card,
.finance-trend-grid article,
.accounting-breakdown article {
  padding: 6px 10px;
  background: rgba(10, 25, 46, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.finance-pending-summary strong,
.finance-report-grid strong,
.accounting-breakdown strong,
.progress-card-top strong {
  display: block;
  margin-top: 2px;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 750;
  line-height: 1.1;
}

.finance-report-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 12px;
  background: rgba(15, 35, 61, 0.65);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.finance-report-toolbar h2 {
  font-size: 0.98rem;
  font-weight: 650;
  margin: 0;
}

.finance-report-toolbar p {
  font-size: 0.72rem;
  margin: 1px 0 0;
}

.finance-progress-track,
.mini-progress {
  height: 6px;
  margin-top: 6px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.15);
  border-radius: 999px;
}

.finance-progress-track i,
.mini-progress i {
  display: block;
  width: calc(var(--progress) * 1%);
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #10b981);
  border-radius: inherit;
}

/* Operations, Risks, Vendors & HR Grids */
.operation-board,
.risk-board,
.vendor-grid,
.team-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.operation-card,
.risk-card,
.vendor-card,
.team-row {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 60px;
  padding: 6px 9px;
  gap: 2px;
  background: rgba(10, 25, 46, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.operation-card strong,
.risk-card strong,
.vendor-card strong,
.team-row strong {
  color: #fff;
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.2;
}

.operation-card p,
.risk-card p,
.vendor-card p,
.team-row p {
  font-size: 0.72rem;
  margin: 0;
  line-height: 1.3;
}

.operation-card span,
.risk-card span,
.vendor-card span,
.team-row span {
  display: inline-flex;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gold);
}

.risk-card.critical {
  border-color: rgba(239, 68, 68, 0.4);
}

/* Access Control */
.access-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.36fr) minmax(0, 0.64fr);
  gap: 8px;
}

.access-form {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  background: rgba(10, 25, 46, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.split-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

/* Department Actions Bar */
.department-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.department-actions button {
  min-width: 120px;
}

/* Floating AI Bot */
.floating-bot {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 60;
  display: grid;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  color: #ffffff;
  background: linear-gradient(135deg, var(--navy), var(--cyan));
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 50%;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  place-items: center;
  font-size: 0.75rem;
  font-weight: 800;
}

.floating-bot:hover {
  transform: scale(1.06);
  border-color: #38bdf8;
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.3);
}

/* Toast Messages */
.toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 999;
  padding: 6px 14px;
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 650;
  background: rgba(10, 25, 46, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Chat Compose */
.chat-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.chat-message {
  padding: 6px 9px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
}

.chat-message.user {
  justify-self: end;
  border-color: rgba(56, 189, 248, 0.35);
}

.agent-open-link {
  display: inline-grid;
  min-height: 28px;
  padding: 0 10px;
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--navy), #1d528d);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-sm);
  place-items: center;
}

.agent-open-link:hover {
  border-color: var(--cyan);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.2);
}

/* Media Queries for Responsive Density */
@media (max-width: 1180px) {
  .business-grid,
  .erp-section-grid,
  .access-grid,
  .module-columns {
    grid-template-columns: 1fr;
  }

  .activity-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .agent-grid,
  .summary-grid,
  .feature-rail,
  .erp-kpis,
  .erp-mini-grid,
  .finance-snapshot,
  .finance-donut-grid,
  .finance-report-grid,
  .finance-pending-summary,
  .project-command-grid,
  .operation-board,
  .risk-board,
  .vendor-grid,
  .team-list,
  .document-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .erp-shell {
    grid-template-columns: 1fr;
  }

  .erp-sidebar {
    position: relative;
    height: auto;
  }

  .erp-topbar,
  .erp-title-row,
  .erp-alert,
  .record-heading,
  .accounting-hero,
  .finance-report-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .agent-grid,
  .summary-grid,
  .feature-rail,
  .erp-kpis,
  .erp-mini-grid,
  .finance-snapshot,
  .finance-donut-grid,
  .finance-report-grid,
  .finance-pending-summary,
  .project-command-grid,
  .project-card-grid,
  .project-card-grid.compact,
  .operation-board,
  .risk-board,
  .vendor-grid,
  .team-list,
  .document-form,
  .queue-form,
  .inline-crm-form,
  .split-fields {
    grid-template-columns: 1fr;
  }

  .kanban-board {
    grid-template-columns: minmax(220px, 1fr);
  }
}

/* ==========================================================================
   Quotation / Proposal Generator & A4 Preview System
   ========================================================================== */

.quotation-builder-panel {
  background: linear-gradient(180deg, rgba(15, 35, 61, 0.75), rgba(7, 21, 38, 0.9));
  border: 1px solid rgba(0, 240, 255, 0.22);
  border-radius: var(--radius-md, 12px);
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.quotation-header-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.quotation-header-strip h2 {
  margin: 0;
  font-size: 1.15rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.quotation-live-calc-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: 20px;
  color: #00F0FF;
  font-weight: 700;
  font-size: 0.88rem;
}

.quotation-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.quotation-form-grid .span-2 {
  grid-column: span 2;
}

.quotation-form-grid .span-3 {
  grid-column: span 3;
}

.quotation-form-grid .span-full {
  grid-column: 1 / -1;
}

.quotation-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quotation-form-grid label span {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.quotation-form-grid input,
.quotation-form-grid select,
.quotation-form-grid textarea {
  background: rgba(7, 21, 38, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #f1f5f9;
  padding: 7px 10px;
  font-size: 0.82rem;
  font-family: inherit;
  transition: all 0.2s ease;
}

.quotation-form-grid input:focus,
.quotation-form-grid select:focus,
.quotation-form-grid textarea:focus {
  outline: none;
  border-color: #00F0FF;
  box-shadow: 0 0 0 2px rgba(0, 240, 255, 0.2);
}

.quotation-textarea-group {
  margin-top: 4px;
}

.quotation-textarea-group textarea {
  min-height: 95px;
  line-height: 1.45;
  font-size: 0.78rem;
  resize: vertical;
}

/* Multi-Service Scope Repeater */
.quotation-scope-repeater {
  background: rgba(11, 26, 45, 0.85);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: 8px;
  padding: 14px;
  margin: 6px 0;
}

.repeater-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.repeater-title {
  font-size: 0.88rem;
  font-weight: 750;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.repeater-desc {
  margin: 2px 0 0 0;
  font-size: 0.75rem;
  color: #94a3b8;
}

.btn-add-service-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  border: 1px solid rgba(0, 240, 255, 0.4);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
  transition: all 0.15s ease;
}

.btn-add-service-item:hover {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.5);
  transform: translateY(-1px);
}

.quotation-items-table-wrap {
  overflow-x: auto;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(7, 21, 38, 0.6);
}

.quotation-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.quotation-items-table th {
  background: #091728;
  color: #94a3b8;
  font-size: 0.7rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
  white-space: nowrap;
}

.quotation-items-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

.quotation-items-table tr:hover td {
  background: rgba(0, 240, 255, 0.03);
}

.quotation-items-table input,
.quotation-items-table select {
  width: 100%;
  background: rgba(15, 35, 61, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  color: #fff;
  padding: 5px 8px;
  font-size: 0.78rem;
  box-sizing: border-box;
}

.quotation-items-table input:focus,
.quotation-items-table select:focus {
  border-color: #00F0FF;
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 240, 255, 0.2);
}

.item-num {
  text-align: center;
  font-weight: 700;
  color: #00F0FF;
}

.item-row-total {
  font-weight: 750;
  color: #00F0FF;
  font-size: 0.82rem;
  white-space: nowrap;
}

.btn-remove-item {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #ef4444;
  border-radius: 4px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-remove-item:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.quotation-actions-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.quotation-btn-preview {
  background: linear-gradient(135deg, #0ea5e9, #0284c7) !important;
  color: #fff !important;
  font-weight: 600 !important;
  border: none !important;
  box-shadow: 0 2px 10px rgba(14, 165, 233, 0.35);
  cursor: pointer;
}

.quotation-btn-preview:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.quotation-btn-download {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: #fff !important;
  font-weight: 600 !important;
  border: none !important;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
  cursor: pointer;
}

.quotation-btn-download:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* Modal Backdrop */
.quotation-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(7, 18, 33, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.quotation-modal-window {
  background: #0b1a2d;
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 12px;
  width: 100%;
  max-width: 900px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: modalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.quotation-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: #081525;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.quotation-modal-header h3 {
  margin: 0;
  color: #fff;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.quotation-modal-header-actions {
  display: flex;
  gap: 8px;
}

.quotation-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: #060e1a;
  display: flex;
  justify-content: center;
}

/* A4 Sheet Presentation */
.a4-preview-sheet {
  position: relative;
  background: #ffffff;
  color: #0f172a;
  width: 100%;
  max-width: 760px;
  min-height: 1070px;
  padding: 32px 36px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  border-radius: 4px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Watermark */
.a4-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0.095;
  pointer-events: none;
  z-index: 1;
  user-select: none;
  width: auto;
  text-align: center;
}

.a4-watermark img {
  width: 450px;
  max-width: 82%;
  height: auto;
  margin-bottom: 0;
  display: block;
}

.a4-watermark-text {
  display: none !important;
}

.a4-sheet-content {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Top Banner Header */
.a4-brand-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 16px;
  border-bottom: 3px solid #00F0FF;
  margin-bottom: 16px;
}

.a4-brand-logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.a4-brand-logo {
  height: 48px;
  width: auto;
}

.a4-brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0F233D;
  line-height: 1.15;
}

.a4-brand-subtitle {
  font-size: 0.72rem;
  color: #0d9488;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.a4-doc-type-box {
  text-align: right;
}

.a4-doc-tag {
  display: inline-block;
  background: #0F233D;
  color: #00F0FF;
  font-weight: 800;
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 4px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.a4-quote-num {
  font-size: 0.92rem;
  font-weight: 750;
  color: #0F233D;
}

/* Metadata Bar */
.a4-meta-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 14px;
  background: rgba(248, 250, 252, 0.45);
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.78rem;
}

.a4-meta-col h4 {
  margin: 0 0 6px 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.a4-meta-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 3px;
  line-height: 1.35;
}

.a4-meta-label {
  color: #64748b;
  font-weight: 500;
}

.a4-meta-val {
  color: #0f172a;
  font-weight: 650;
  text-align: right;
}

/* Commercial Scope Table */
.a4-table-wrap {
  margin-bottom: 16px;
}

.a4-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.a4-table th {
  background: #0F233D;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 10px;
  text-align: left;
}

.a4-table th:last-child {
  text-align: right;
}

.a4-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  color: #1e293b;
  line-height: 1.35;
  background: transparent;
}

.a4-table td:last-child {
  text-align: right;
  font-weight: 700;
  color: #0F233D;
}

.a4-table tr:nth-child(even) td {
  background: rgba(248, 250, 252, 0.35);
}

/* Total Box */
.a4-total-strip {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.a4-total-card {
  min-width: 250px;
  background: rgba(241, 245, 249, 0.55);
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 10px 14px;
}

.a4-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  margin-bottom: 4px;
  color: #475569;
}

.a4-total-row.grand {
  border-top: 2px solid #0F233D;
  padding-top: 6px;
  margin-top: 4px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #0F233D;
}

.a4-total-row.grand .val {
  color: #0d9488;
}

/* Included Services List */
.a4-section-card {
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 10px 14px;
}

.a4-section-title {
  margin: 0 0 6px 0;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #0d9488;
  display: flex;
  align-items: center;
  gap: 6px;
}

.a4-services-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 14px;
  font-size: 0.72rem;
  color: #334155;
  margin: 0;
  padding-left: 14px;
}

.a4-services-list li {
  line-height: 1.35;
}

/* Multi-Page A4 Presentation */
.a4-pages-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: 100%;
}

.a4-page {
  position: relative;
  background: #ffffff;
  color: #0f172a;
  width: 100%;
  max-width: 780px;
  min-height: 1080px;
  padding: 32px 36px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  border-radius: 4px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

/* 18 Notes & Terms - Single column full width list */
.a4-notes-list,
.a4-notes-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.73rem;
  color: #334155;
  line-height: 1.48;
  margin: 0;
  padding-left: 18px;
}

.a4-notes-list li,
.a4-notes-grid li {
  margin-bottom: 2px;
  padding-left: 4px;
}

.a4-page-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #0284c7;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 4px;
  padding: 4px 10px;
  margin-top: 10px;
}

/* Closing Message */
.a4-closing-box {
  background: rgba(248, 250, 252, 0.45);
  border-left: 3px solid #00F0FF;
  border-top: 1px solid rgba(226, 232, 240, 0.7);
  border-right: 1px solid rgba(226, 232, 240, 0.7);
  border-bottom: 1px solid rgba(226, 232, 240, 0.7);
  padding: 8px 14px;
  margin-bottom: 16px;
  font-size: 0.74rem;
  color: #475569;
  font-style: italic;
  line-height: 1.4;
}

/* Signatures */
.a4-signatures-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

.a4-sig-col {
  display: flex;
  flex-direction: column;
}

.a4-sig-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 30px;
}

.a4-sig-line {
  border-top: 1px dashed #94a3b8;
  padding-top: 4px;
  display: flex;
  justify-content: space-between;
  font-size: 0.66rem;
  color: #64748b;
}

/* Footer */
.a4-footer {
  margin-top: 14px;
  padding-top: 8px;
  border-top: 1px solid #cbd5e1;
  font-size: 0.64rem;
  color: #94a3b8;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Print Specific */
@media print {
  body * {
    visibility: hidden;
  }
  .quotation-modal-backdrop,
  .quotation-modal-backdrop * {
    visibility: visible;
  }
  .quotation-modal-backdrop {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .quotation-modal-window {
    border: none !important;
    box-shadow: none !important;
    max-width: 100% !important;
  }
  .quotation-modal-header {
    display: none !important;
  }
  .quotation-modal-body {
    padding: 0 !important;
    background: transparent !important;
    display: block !important;
  }
  .a4-pages-container {
    gap: 0 !important;
  }
  .a4-page,
  .a4-preview-sheet {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 10mm 15mm !important;
    page-break-after: always !important;
    break-after: page !important;
    margin-bottom: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .a4-page:last-child {
    page-break-after: avoid !important;
    break-after: avoid !important;
  }
}
