:root {
  --bg-deep: #0b0a08;
  --bg-main: #12110e;
  --bg-surface: #191713;
  --bg-elevated: #221f1a;
  --bg-glass: rgba(13, 12, 10, 0.9);
  --gold: #d6bd96;
  --gold-strong: #e8d2ad;
  --gold-muted: rgba(214, 189, 150, 0.36);
  --gold-subtle: rgba(214, 189, 150, 0.16);
  --gold-tint: rgba(214, 189, 150, 0.08);
  --ivory: #f6f3ec;
  --ivory-muted: #c8c1b4;
  --stone: #8f887c;
  --emerald: #48b885;
  --terracotta: #e06d5b;
  --border: #2c2821;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.28);
  --shadow-elevated: 0 18px 46px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg-deep);
  color: var(--ivory);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.serif {
  font-family: Georgia, "Times New Roman", serif;
}

.hidden {
  display: none !important;
}

/* Login Screen */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(214, 189, 150, 0.16), transparent 55%),
    linear-gradient(180deg, #0b0a08 0%, #151310 100%);
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: linear-gradient(180deg, rgba(28, 25, 20, 0.96), rgba(21, 19, 15, 0.98));
  border: 1px solid var(--gold-subtle);
  border-radius: var(--radius-lg);
  padding: 34px 28px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(214, 189, 150, 0.05) inset;
}

.crest-badge {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  border: 1.5px solid var(--gold);
  background: var(--bg-deep);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Georgia, serif;
  font-size: 26px;
  font-weight: 700;
  margin: 0 auto 14px;
}

.live-crest-wrap {
  position: relative;
  width: 76px;
  height: 76px;
  margin: 0 auto 16px;
}

.crest-badge-img {
  width: 76px;
  height: 76px;
  border-radius: 20px;
  border: 1.5px solid var(--gold);
  background: #141816;
  object-fit: cover;
  display: block;
  margin: 0;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.58), 0 0 0 4px rgba(214, 189, 150, 0.09);
}

.live-crest-dot,
.live-crest-dot-sm,
.live-crest-dot-xs {
  position: absolute;
  border-radius: 999px;
  background: #2ee58d;
  border: 2px solid #0d0c09;
  box-shadow: 0 0 0 0 rgba(46, 229, 141, 0.65);
  animation: milaLiveRadar 2s infinite ease-out;
}

.live-crest-dot {
  width: 16px;
  height: 16px;
  right: -3px;
  bottom: -3px;
}

.live-crest-dot-sm {
  width: 12px;
  height: 12px;
  right: -2px;
  bottom: -2px;
}

.live-crest-dot-xs {
  width: 10px;
  height: 10px;
  right: -2px;
  bottom: -2px;
}

body.is-offline .live-crest-dot,
body.is-offline .live-crest-dot-sm,
body.is-offline .live-crest-dot-xs {
  background: var(--terracotta);
  animation: none;
  box-shadow: none;
}

.live-eyebrow-row {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.live-eyebrow-center {
  justify-content: center;
}

.live-micro-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(46, 229, 141, 0.14);
  border: 1px solid rgba(46, 229, 141, 0.42);
  color: #8bf5be;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  line-height: 1.2;
}

body.is-offline .live-micro-pill {
  background: rgba(224, 109, 91, 0.14);
  border-color: rgba(224, 109, 91, 0.45);
  color: #ffb8ac;
}

.sidebar-crest-wrap {
  position: relative;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.topbar-crest-wrap {
  position: relative;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.topbar-crest-img {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--gold-muted);
  background: #141816;
  object-fit: cover;
  display: block;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

.eyebrow {
  font-size: 10.5px;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-header h1 {
  font-size: 26px;
  margin: 8px 0 6px;
  color: var(--ivory);
}

.login-header p {
  font-size: 13px;
  color: var(--ivory-muted);
}

/* Forms */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 12px;
  color: var(--ivory-muted);
  font-weight: 500;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ivory);
  padding: 11px 13px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(214, 189, 150, 0.12);
}

.field textarea {
  min-height: 82px;
  resize: vertical;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 14px;
  font-size: 13px;
  color: var(--ivory-muted);
}

.checkbox-row input {
  width: 17px;
  height: 17px;
  accent-color: var(--gold);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  min-height: 42px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.12s ease, color 0.16s ease;
  font-family: inherit;
  white-space: nowrap;
}

.btn:active:not(:disabled) {
  transform: scale(0.985);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-gold {
  background: linear-gradient(180deg, #e1c89e 0%, #cfb387 100%);
  color: #14120e;
  box-shadow: 0 4px 14px rgba(214, 189, 150, 0.22);
}

.btn-gold:hover:not(:disabled) {
  background: linear-gradient(180deg, #ebd4ae 0%, #d9be94 100%);
}

.btn-outline {
  background: rgba(214, 189, 150, 0.04);
  border-color: var(--gold-muted);
  color: var(--gold);
}

.btn-outline:hover:not(:disabled) {
  background: rgba(214, 189, 150, 0.14);
  border-color: var(--gold);
}

.btn-danger {
  background: rgba(224, 109, 91, 0.12);
  border-color: rgba(224, 109, 91, 0.42);
  color: #f08979;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(224, 109, 91, 0.22);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.02);
  color: var(--ivory-muted);
  border-color: var(--border);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--gold-muted);
  color: var(--ivory);
  background: rgba(214, 189, 150, 0.07);
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 12px;
}

.btn-full {
  width: 100%;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--ivory);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.icon-btn:hover {
  border-color: var(--gold-muted);
  background: var(--bg-elevated);
  color: var(--gold);
}

.error-box {
  background: rgba(224, 109, 91, 0.12);
  border: 1px solid rgba(224, 109, 91, 0.45);
  color: #ffb8ac;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

.success-box {
  background: rgba(72, 184, 133, 0.12);
  border: 1px solid rgba(72, 184, 133, 0.45);
  color: #a9f0cc;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

.auth-link-row {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 12px;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-link-split {
  justify-content: space-between;
}

.auth-link-btn {
  background: transparent;
  border: none;
  color: var(--gold);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 4px;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-link-btn:hover {
  color: var(--gold-strong);
}

.info-box {
  background: rgba(214, 189, 150, 0.07);
  border: 1px solid var(--gold-subtle);
  color: var(--ivory-muted);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12px;
  margin-top: 16px;
}

.config-toggle {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.config-toggle summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--gold);
  user-select: none;
  margin-bottom: 10px;
}

/* App Shell */
.admin-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 284px;
  background: linear-gradient(180deg, #0d0c09 0%, #0a0907 100%);
  border-right: 1px solid var(--gold-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.sidebar-brand {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.sidebar-brand-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sidebar-brand-copy {
  min-width: 0;
}

.sidebar-role-label {
  font-size: 12.5px;
  color: var(--ivory-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-crest-img {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--gold-muted);
  background: #141816;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

.sidebar-close-btn {
  display: none;
}

.sidebar-search-wrap {
  position: relative;
  padding: 12px 14px 8px;
  flex-shrink: 0;
}

.sidebar-search-icon {
  position: absolute;
  left: 25px;
  top: 50%;
  transform: translateY(-35%);
  color: var(--stone);
  pointer-events: none;
}

.sidebar-search-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ivory);
  padding: 9px 12px 9px 34px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.sidebar-search-input:focus {
  border-color: var(--gold);
}

.sidebar-nav {
  padding: 6px 10px 14px;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.nav-group {
  margin-bottom: 6px;
}

.nav-group-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--gold);
  font-size: 10px;
  letter-spacing: 1.7px;
  text-transform: uppercase;
  font-weight: 700;
  font-family: inherit;
}

.nav-group-toggle:hover {
  color: var(--gold-strong);
}

.nav-group-chevron {
  transition: transform 0.18s ease;
  opacity: 0.75;
}

.nav-group.collapsed .nav-group-chevron {
  transform: rotate(-90deg);
}

.nav-group.collapsed .nav-group-items {
  display: none;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ivory-muted);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  margin-bottom: 3px;
  position: relative;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.nav-item-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--stone);
  flex-shrink: 0;
  transition: color 0.14s ease;
}

.nav-item:hover {
  background: rgba(214, 189, 150, 0.07);
  color: var(--ivory);
}

.nav-item:hover .nav-icon {
  color: var(--gold);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(214, 189, 150, 0.16) 0%, rgba(214, 189, 150, 0.05) 100%);
  color: var(--gold-strong);
  font-weight: 600;
  border-color: var(--gold-subtle);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--gold);
}

.nav-item.active .nav-icon {
  color: var(--gold);
}

.nav-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--ivory-muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  padding: 1px 7px;
  border-radius: 999px;
  flex-shrink: 0;
}

.nav-item.active .nav-count {
  background: rgba(214, 189, 150, 0.18);
  border-color: var(--gold-muted);
  color: var(--gold-strong);
}

.sidebar-footer {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--border);
  background: rgba(18, 16, 12, 0.85);
  flex-shrink: 0;
}

.sidebar-admin-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.admin-avatar-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(214, 189, 150, 0.14);
  border: 1px solid var(--gold-muted);
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-admin-meta {
  min-width: 0;
}

.sidebar-admin-name {
  font-size: 13px;
  color: var(--ivory);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-admin-email {
  font-size: 11.5px;
  color: var(--stone);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Main Area */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background:
    radial-gradient(ellipse at top right, rgba(214, 189, 150, 0.06), transparent 46%),
    var(--bg-main);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--gold-subtle);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-titles {
  min-width: 0;
}

.topbar-module-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ivory);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.mobile-menu-btn {
  display: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.live-sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(46, 229, 141, 0.45);
  background: rgba(46, 229, 141, 0.12);
  color: #9bf7c6;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.9px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.live-sync-pill:hover {
  background: rgba(46, 229, 141, 0.2);
  border-color: rgba(46, 229, 141, 0.7);
}

.live-sync-pill.syncing {
  border-color: var(--gold-muted);
  background: rgba(214, 189, 150, 0.14);
  color: var(--gold-strong);
}

.live-sync-pill.offline,
.live-sync-pill.paused {
  border-color: rgba(224, 109, 91, 0.45);
  background: rgba(224, 109, 91, 0.12);
  color: #ffb8ac;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #2ee58d;
  box-shadow: 0 0 0 0 rgba(46, 229, 141, 0.7);
  animation: milaLiveRadar 1.9s infinite ease-out;
  flex-shrink: 0;
}

.live-dot-xs {
  width: 6px;
  height: 6px;
}

.live-sync-pill.syncing .live-dot {
  background: var(--gold);
  animation: milaLiveRadarGold 1.1s infinite ease-out;
}

.live-sync-pill.offline .live-dot,
.live-sync-pill.paused .live-dot,
body.is-offline .live-micro-pill .live-dot {
  background: var(--terracotta);
  box-shadow: none;
  animation: none;
}

@keyframes milaLiveRadar {
  0% {
    box-shadow: 0 0 0 0 rgba(46, 229, 141, 0.72);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(46, 229, 141, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(46, 229, 141, 0);
  }
}

@keyframes milaLiveRadarGold {
  0% {
    box-shadow: 0 0 0 0 rgba(214, 189, 150, 0.75);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(214, 189, 150, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(214, 189, 150, 0);
  }
}

.content {
  padding: 26px 28px 40px;
  max-width: 1260px;
  width: 100%;
  margin: 0 auto;
}

/* Executive Hero Welcome Strip */
.welcome-banner {
  background: linear-gradient(135deg, rgba(214, 189, 150, 0.13) 0%, rgba(25, 23, 19, 0.96) 55%, rgba(20, 18, 15, 0.98) 100%);
  border: 1px solid var(--gold-muted);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  box-shadow: var(--shadow-card);
}

.welcome-copy h2 {
  font-size: 25px;
  color: var(--ivory);
  margin: 4px 0 6px;
  line-height: 1.25;
}

.welcome-copy p {
  font-size: 13.5px;
  color: var(--ivory-muted);
  max-width: 600px;
}

.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Header & Search */
.module-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.module-header h2 {
  font-size: 24px;
  color: var(--ivory);
  margin-top: 4px;
  line-height: 1.25;
}

.module-header h3 {
  font-size: 19px;
  color: var(--ivory);
  line-height: 1.3;
}

.module-header p {
  font-size: 13px;
  color: var(--ivory-muted);
  margin-top: 4px;
  max-width: 720px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.search-input {
  flex: 1;
  min-width: 240px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ivory);
  padding: 10px 14px;
  font-size: 14px;
}

.search-input:focus {
  outline: none;
  border-color: var(--gold);
}

.filter-select {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ivory);
  padding: 10px 12px;
  font-size: 13px;
}

/* KPI Grid & Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--gold-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.16s ease, transform 0.14s ease, background-color 0.16s ease;
  box-shadow: var(--shadow-card);
}

.kpi-card.clickable {
  cursor: pointer;
}

.kpi-card.clickable:hover {
  border-color: var(--gold);
  background: var(--bg-elevated);
  transform: translateY(-2px);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kpi-icon-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(214, 189, 150, 0.1);
  border: 1px solid var(--gold-subtle);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-arrow {
  color: var(--stone);
  font-size: 14px;
}

.kpi-card.clickable:hover .kpi-arrow {
  color: var(--gold);
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--ivory);
  line-height: 1.15;
}

.kpi-label {
  font-size: 12px;
  color: var(--ivory-muted);
  font-weight: 500;
}

/* Executive Control Hub Grid */
.section-kicker-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 6px 0 12px;
}

.section-kicker-row h3 {
  font-size: 19px;
  color: var(--ivory);
}

.control-hub-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.hub-card {
  background: var(--bg-surface);
  border: 1px solid var(--gold-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-card);
}

.hub-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.hub-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ivory);
}

.hub-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hub-link {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(11, 10, 8, 0.55);
  color: var(--ivory);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.hub-link:hover {
  border-color: var(--gold-muted);
  background: var(--bg-elevated);
}

.hub-link-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.hub-link-icon {
  color: var(--gold);
  display: inline-flex;
  flex-shrink: 0;
}

.hub-link-text {
  min-width: 0;
}

.hub-link-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ivory);
  display: block;
}

.hub-link-sub {
  font-size: 11.5px;
  color: var(--stone);
  display: block;
  margin-top: 1px;
}

.hub-link-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Segmented Live Activity Tabs on Overview */
.feed-panel {
  background: var(--bg-surface);
  border: 1px solid var(--gold-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.feed-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.feed-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  min-height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-deep);
  color: var(--ivory-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.14s ease;
}

.feed-tab:hover {
  border-color: var(--gold-muted);
  color: var(--ivory);
}

.feed-tab.active {
  background: var(--gold);
  color: #14120e;
  border-color: var(--gold);
}

.feed-tab-count {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
}

.feed-tab.active .feed-tab-count {
  background: rgba(20, 18, 14, 0.16);
}

/* Records */
.records-list {
  display: grid;
  gap: 12px;
}

.record-card {
  background: var(--bg-surface);
  border: 1px solid var(--gold-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s ease;
}

.feed-panel .record-card {
  background: rgba(11, 10, 8, 0.55);
  box-shadow: none;
}

.record-card:hover {
  border-color: var(--gold-muted);
}

.record-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.record-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ivory);
  line-height: 1.35;
}

.record-sub {
  font-size: 13px;
  color: var(--gold);
}

.record-meta {
  font-size: 13px;
  color: var(--ivory-muted);
}

.record-small {
  font-size: 12px;
  color: var(--stone);
}

.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.55px;
  text-transform: uppercase;
}

.pill-gold {
  background: rgba(214, 189, 150, 0.14);
  color: var(--gold);
  border: 1px solid var(--gold-muted);
}

.pill-emerald {
  background: rgba(72, 184, 133, 0.14);
  color: var(--emerald);
  border: 1px solid rgba(72, 184, 133, 0.4);
}

.pill-alert {
  background: rgba(224, 109, 91, 0.14);
  color: #f08979;
  border: 1px solid rgba(224, 109, 91, 0.4);
}

.pill-muted {
  background: rgba(143, 136, 124, 0.14);
  color: var(--ivory-muted);
  border: 1px solid var(--border);
}

.empty-state {
  background: rgba(25, 23, 19, 0.65);
  border: 1px dashed var(--gold-subtle);
  border-radius: var(--radius-md);
  padding: 34px 20px;
  text-align: center;
  color: var(--stone);
  font-size: 13.5px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(4px);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--gold-muted);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-elevated);
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h3 {
  font-size: 19px;
  color: var(--ivory);
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: rgba(11, 10, 8, 0.45);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 80;
  background: var(--bg-elevated);
  border: 1px solid var(--gold);
  color: var(--ivory);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  max-width: 420px;
}

.stage-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-btn {
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-deep);
  color: var(--ivory-muted);
}

.chip-btn.active {
  background: var(--gold);
  color: #14120e;
  border-color: var(--gold);
}

.dossier-row {
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.dossier-row strong {
  color: var(--gold);
  display: inline-block;
  min-width: 150px;
}

.review-stars {
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 1px;
}

.review-quote {
  font-size: 14px;
  line-height: 1.55;
  font-style: italic;
  color: var(--ivory);
}

.review-reply-box {
  background: rgba(214, 189, 150, 0.08);
  border: 1px solid var(--gold-muted);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.review-reply-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: var(--gold);
}

.review-reply-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ivory);
}

.sidebar-backdrop {
  display: none;
}

/* Mobile Bottom Navigation (hidden on desktop) */
.mobile-bottom-nav {
  display: none;
}

/* Medium tablets */
@media (max-width: 1120px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .control-hub-grid {
    grid-template-columns: 1fr;
  }
}

/* Mobile Responsive (Phones & Small Tablets) */
@media (max-width: 860px) {
  .desktop-only {
    display: none !important;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(2px);
    z-index: 45;
  }

  .sidebar {
    position: fixed;
    left: -300px;
    top: 0;
    bottom: 0;
    width: min(86vw, 300px);
    z-index: 50;
    transition: left 0.22s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.72);
  }

  .sidebar.open {
    left: 0;
  }

  .sidebar-close-btn {
    display: inline-flex;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .topbar {
    padding: 9px 12px;
    min-height: 58px;
    gap: 8px;
  }

  .topbar-left {
    gap: 8px;
  }

  .topbar-crest-wrap,
  .topbar-crest-img {
    width: 30px;
    height: 30px;
  }

  .topbar-module-title {
    font-size: 14.5px;
  }

  .topbar-actions {
    gap: 6px;
  }

  .live-sync-pill {
    padding: 5px 9px;
    min-height: 34px;
    font-size: 10.5px;
    gap: 5px;
  }

  .content {
    padding: 16px 14px calc(92px + env(safe-area-inset-bottom, 0px));
  }

  .welcome-banner {
    padding: 18px 16px;
  }

  .welcome-copy h2 {
    font-size: 21px;
  }

  .welcome-actions {
    width: 100%;
  }

  .welcome-actions .btn {
    flex: 1 1 calc(50% - 6px);
  }

  .login-shell {
    padding: 14px;
  }

  .login-card {
    padding: 26px 18px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .kpi-card {
    padding: 14px 13px;
  }

  .kpi-value {
    font-size: 24px;
  }

  .feed-panel {
    padding: 14px 12px;
  }

  .feed-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 12px;
  }

  .feed-tabs::-webkit-scrollbar {
    display: none;
  }

  .feed-tab {
    flex-shrink: 0;
  }

  .search-input {
    min-width: 0;
    width: 100%;
  }

  .filter-select {
    width: 100%;
  }

  .record-card {
    padding: 15px 14px;
  }

  .record-actions .btn {
    flex: 1 1 auto;
  }

  .toast {
    left: 14px;
    right: 14px;
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    max-width: none;
  }

  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .modal-box {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
  }

  .modal-header {
    padding: 16px 18px;
  }

  .modal-body {
    padding: 16px 18px;
  }

  .modal-footer {
    padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 0px));
  }

  /* Sleek Mobile Bottom Quick Tab Bar */
  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 35;
    background: rgba(13, 12, 10, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--gold-subtle);
    padding: 6px 6px calc(8px + env(safe-area-inset-bottom, 0px));
    gap: 2px;
  }

  .bottom-nav-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 50px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--stone);
    font-size: 10.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    padding: 4px 2px;
    transition: color 0.14s ease, background-color 0.14s ease;
  }

  .bottom-nav-btn.active {
    color: var(--gold);
    background: rgba(214, 189, 150, 0.12);
  }

  .bottom-nav-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 20px);
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--gold);
    color: #14120e;
    font-size: 9.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* =========================================================
   MILA LIVE EDITABLE PDF INVOICE STUDIO (EMBEDDED IN ADMIN)
   ========================================================= */
.mila-inv-root {
  max-width: 920px;
  margin: 0 auto;
  padding-bottom: 32px;
}

.mila-inv-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mila-inv-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.mila-inv-kicker {
  font-size: 10px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}

.mila-inv-heading {
  font-size: 20px;
  color: var(--ivory);
  margin-top: 2px;
}

.mila-inv-tabs {
  display: inline-flex;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 3px;
  gap: 3px;
}

.mila-inv-tab {
  border: none;
  background: transparent;
  color: var(--ivory-muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 8px;
  cursor: pointer;
}

.mila-inv-tab.active {
  background: rgba(214, 189, 150, 0.18);
  color: var(--gold-strong);
}

.mila-inv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.mila-inv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 13px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.mila-inv-btn-gold {
  background: linear-gradient(135deg, #ead5b0 0%, #c6a572 100%);
  color: #16130e;
}

.mila-inv-btn-emerald {
  background: rgba(72, 184, 133, 0.16);
  color: #7ee3b4;
  border-color: rgba(72, 184, 133, 0.38);
}

.mila-inv-btn-wa {
  background: rgba(37, 211, 102, 0.16);
  color: #74f2a4;
  border-color: rgba(37, 211, 102, 0.4);
}

.mila-inv-btn-outline {
  background: var(--bg-main);
  color: var(--ivory);
  border-color: var(--border);
}

.mila-inv-btn-outline.is-on {
  border-color: var(--gold);
  color: var(--gold-strong);
  background: rgba(214, 189, 150, 0.1);
}

.mila-inv-btn-danger {
  background: rgba(224, 109, 91, 0.15);
  color: #f39b8e;
  border-color: rgba(224, 109, 91, 0.35);
}

.mila-inv-hint {
  background: rgba(214, 189, 150, 0.08);
  border: 1px solid var(--gold-subtle);
  border-radius: 12px;
  padding: 9px 14px;
  font-size: 12.2px;
  color: var(--gold-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

/* Luxury White A4 Editable PDF Sheet */
.mila-pdf-paper {
  width: 100%;
  background: #ffffff;
  color: #171410;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.55);
}

.mila-pdf-ribbon {
  height: 8px;
  background: linear-gradient(90deg, #7e5f2d 0%, #d6bd96 50%, #7e5f2d 100%);
}

.mila-pdf-inner {
  padding: 28px 28px 24px;
}

.mila-p-input,
.mila-p-textarea,
.mila-p-select {
  font-family: inherit;
  color: inherit;
  background: transparent;
  border: 1px dashed rgba(159, 126, 71, 0.45);
  border-radius: 5px;
  padding: 3px 6px;
  outline: none;
  width: 100%;
}

.mila-p-input:focus,
.mila-p-textarea:focus,
.mila-p-select:focus {
  background: rgba(181, 148, 91, 0.15);
  border-style: solid;
  border-color: #8f6f39;
}

.mila-p-input::placeholder,
.mila-p-textarea::placeholder {
  color: #a99f8f;
  font-weight: 400;
}

.mila-p-textarea {
  resize: none;
  overflow: hidden;
  display: block;
  line-height: 1.45;
}

.mila-pdf-paper.preview-clean .mila-p-input,
.mila-pdf-paper.preview-clean .mila-p-textarea,
.mila-pdf-paper.preview-clean .mila-p-select {
  border-color: transparent !important;
  background: transparent !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
}

.mila-pdf-paper.preview-clean .mila-p-input::placeholder,
.mila-pdf-paper.preview-clean .mila-p-textarea::placeholder {
  color: transparent !important;
}

.mila-pdf-paper.preview-clean .editor-only,
.mila-pdf-paper.preview-clean .hide-empty.is-empty {
  display: none !important;
}

.mila-p-topbanner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid #efe8da;
}

.mila-p-topbanner-rule {
  flex: 1;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, #dfd2b9, transparent);
  min-width: 24px;
}

.mila-p-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1.5px solid #e7decb;
}

.mila-p-brand {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
}

.mila-p-logo-btn {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 13px;
  border: 1.5px solid #c9ac78;
  background: #141816;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

.mila-p-logo-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mila-p-logo-tag {
  position: absolute;
  inset: auto 0 0 0;
  background: rgba(16, 14, 11, 0.8);
  color: #f4e4c4;
  font-size: 9.5px;
  font-weight: 700;
  text-align: center;
  padding: 2px;
}

.mila-p-company {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mila-p-company-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 700;
  color: #171410;
}

.mila-p-company-tag {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #8f6f39;
  font-weight: 700;
}

.mila-p-meta {
  font-size: 11.8px;
  color: #4e473e;
}

.mila-p-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
  margin-top: 3px;
}

.mila-p-docmeta {
  width: 242px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.mila-p-doctype {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  font-weight: 700;
  color: #8f6f39;
  text-transform: uppercase;
  text-align: center;
  text-align-last: center;
  letter-spacing: 0.8px;
  width: auto;
  max-width: 100%;
}

.mila-p-status {
  width: auto;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 3px 10px;
  border-style: solid;
}

.mila-p-status.st-DRAFT { background: #f3f1ec; color: #5f584d; border-color: #d6cfc2; }
.mila-p-status.st-SENT { background: #edf5fd; color: #245c96; border-color: #b7d4f2; }
.mila-p-status.st-PARTIAL { background: #fdf5e7; color: #8c5c12; border-color: #ead09c; }
.mila-p-status.st-PAID,
.mila-p-status.st-APPROVED { background: #eaf8f1; color: #1b6f47; border-color: #9dd8ba; }
.mila-p-status.st-OVERDUE,
.mila-p-status.st-DECLINED { background: #fdf0ee; color: #a33827; border-color: #e9aca2; }

.mila-p-meta-rows {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mila-p-meta-row {
  display: grid;
  grid-template-columns: 78px 1fr;
  align-items: center;
  gap: 6px;
  font-size: 11.8px;
}

.mila-p-meta-row span {
  color: #766d5f;
  text-align: right;
  font-weight: 600;
}

.mila-p-meta-val {
  font-size: 12px;
  font-weight: 700;
  color: #171410;
  text-align: right;
}

.mila-p-parties {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 18px;
  padding: 16px 0;
}

.mila-p-kicker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.mila-p-kicker {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.3px;
  color: #8f6f39;
  font-weight: 700;
}

.mila-p-picker {
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 7px;
  border: 1px solid #d5c4a1;
  background: #faf7f0;
  color: #5e4720;
  font-weight: 600;
  max-width: 195px;
}

.mila-p-client-name {
  font-size: 16px;
  font-weight: 700;
  color: #171410;
  margin-bottom: 3px;
}

.mila-p-summary {
  background: #faf7f0;
  border: 1px solid #e7decb;
  border-radius: 10px;
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.mila-p-bigamt {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  font-weight: 700;
  color: #171410;
  line-height: 1.15;
}

.mila-p-subcap {
  font-size: 11.5px;
  color: #766d5f;
}

.mila-p-proj {
  border-top: 1px solid #e7decb;
  padding-top: 7px;
}

.mila-p-proj-input {
  font-size: 12.2px;
  font-weight: 700;
  color: #171410;
}

.mila-p-tablewrap {
  width: 100%;
  overflow-x: auto;
}

.mila-p-table {
  width: 100%;
  border-collapse: collapse;
}

.mila-p-table thead th {
  background: #171511;
  color: #ead5b0;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 9px 8px;
  text-align: left;
  font-weight: 700;
}

.mila-p-table th.num, .mila-p-table td.num { text-align: right; }
.mila-p-table th.center, .mila-p-table td.center { text-align: center; }

.mila-p-table tbody td {
  padding: 9px 7px;
  border-bottom: 1px solid #ece5d8;
  vertical-align: top;
}

.mila-p-table tbody tr:nth-child(even) td {
  background: #fcfaf6;
}

.mila-p-item-title { font-weight: 700; font-size: 12.8px; margin-bottom: 2px; }
.mila-p-item-desc { font-size: 11.4px; color: #5b5449; }
.mila-p-item-sac { text-align: center; font-size: 11.5px; color: #5b5449; }
.mila-p-num { text-align: right; font-size: 12.4px; font-weight: 600; }
.mila-p-linetotal { font-weight: 700; font-size: 12.8px; white-space: nowrap; padding-top: 4px; }

.mila-p-delrow {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid #ecc6bf;
  background: #fdf2f0;
  color: #b6402e;
  font-weight: 700;
  cursor: pointer;
}

.mila-p-addbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0 4px;
}

.mila-p-addbtn {
  align-self: flex-start;
  border: 1px solid #8f6f39;
  background: #faf5ea;
  color: #6b4f21;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.mila-p-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mila-p-preset {
  border: 1px dashed #cdb484;
  background: #fdfbf6;
  color: #6f5426;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
}

.mila-p-bottom {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 20px;
  margin-top: 18px;
  align-items: start;
}

.mila-p-words {
  background: #faf7f0;
  border-left: 3px solid #b5945b;
  padding: 8px 11px;
  font-size: 11.6px;
  color: #3a342c;
  margin-bottom: 11px;
}

.mila-p-bank {
  border: 1px solid #e7decb;
  border-radius: 10px;
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mila-p-bank-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
}

.mila-p-bank-row span { color: #766d5f; font-weight: 600; }
.mila-p-bank-val { font-size: 11.8px; font-weight: 600; text-align: right; }

.mila-p-totals {
  border: 1px solid #e7decb;
  border-radius: 10px;
  overflow: hidden;
}

.mila-pt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12.4px;
  color: #4e473e;
  border-bottom: 1px solid #f0eadf;
}

.mila-pt-row strong { color: #171410; white-space: nowrap; }
.mila-pt-ctrl { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.mila-pt-sel { width: auto; font-size: 11.2px; padding: 2px 4px; font-weight: 600; }
.mila-pt-in { width: 64px; font-size: 11.8px; font-weight: 700; text-align: right; padding: 2px 5px; }

.mila-pt-row.grand {
  background: #171511;
  color: #ead5b0;
  font-size: 15px;
  font-weight: 700;
  border-bottom: none;
  padding: 10px 12px;
}
.mila-pt-row.grand strong { color: #f9eed9; }

.mila-pt-row.balance {
  background: #faf7f0;
  color: #7a5b26;
  font-weight: 700;
  border-bottom: none;
}
.mila-pt-row.balance strong { color: #7a5b26; }

.mila-p-footer {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 20px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid #e7decb;
  align-items: end;
}

.mila-p-foottext {
  font-size: 11.4px;
  color: #4e473e;
  margin-bottom: 8px;
}

.mila-p-sigblock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.mila-p-sigbtn {
  min-width: 170px;
  min-height: 52px;
  border: 1px dashed #cdb891;
  border-radius: 8px;
  background: #fcfaf5;
  color: #876c3f;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
}

.mila-p-sigbtn img {
  max-height: 50px;
  max-width: 170px;
  object-fit: contain;
}

.mila-pdf-paper.preview-clean .mila-p-sigbtn {
  border-color: transparent !important;
  background: transparent !important;
  min-height: auto;
  padding: 0;
  pointer-events: none;
}

.mila-p-sigline {
  width: 190px;
  border-top: 1px solid #b5a892;
  padding-top: 4px;
}

.mila-p-signame { text-align: right; font-size: 12px; font-weight: 700; }
.mila-p-sigrole { text-align: right; font-size: 10.8px; color: #766d5f; }

.mila-p-colophon {
  text-align: center;
  padding: 10px 16px 13px;
  background: #faf7f0;
  border-top: 1px solid #ece5d8;
  font-size: 11px;
  color: #766d5f;
}

/* Saved Invoices inside Admin */
.mila-inv-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.mila-inv-kpi {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 12px 14px;
}

.mila-inv-kpi .lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--stone); font-weight: 700; }
.mila-inv-kpi .val { font-size: 18px; font-weight: 700; margin-top: 3px; }
.mila-inv-kpi .val.gold { color: var(--gold-strong); }
.mila-inv-kpi .val.emerald { color: #7ee3b4; }
.mila-inv-kpi .val.amber { color: #f2be68; }
.mila-inv-kpi .sub { font-size: 11px; color: var(--stone); }

.mila-inv-search {
  width: 100%;
  background: var(--bg-surface);
  color: var(--ivory);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 10px 13px;
  font-size: 14px;
  margin-bottom: 12px;
}

.mila-inv-savedlist {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mila-inv-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mila-inv-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.mila-inv-num { font-size: 11.5px; font-weight: 700; color: var(--gold-strong); letter-spacing: 0.4px; }
.mila-inv-client { font-size: 16px; font-weight: 700; color: var(--ivory); margin-top: 2px; }
.mila-inv-sub { font-size: 12px; color: var(--stone); }
.mila-inv-amt { font-size: 17px; font-weight: 700; color: var(--ivory); }
.mila-inv-due { font-size: 11.5px; color: #f2be68; }
.mila-inv-due.paid { color: #7ee3b4; }

.mila-inv-empty {
  text-align: center;
  padding: 32px 18px;
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  border-radius: 14px;
}
.mila-inv-empty p { font-size: 13px; color: var(--stone); margin: 6px 0 14px; }

.mila-inv-backup {
  margin-top: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .mila-pdf-inner { padding: 16px 12px; }
  .mila-p-header { flex-direction: column; }
  .mila-p-docmeta { width: 100%; align-items: flex-start; }
  .mila-p-meta-row span, .mila-p-meta-val { text-align: left; text-align-last: left; }
  .mila-p-doctype { font-size: 18px; text-align: center; text-align-last: center; }
  .mila-p-grid2, .mila-p-parties, .mila-p-bottom, .mila-p-footer, .mila-inv-kpis, .mila-tc-clientcard, .mila-tc-sigs { grid-template-columns: 1fr; }
  .mila-p-sigblock { align-items: flex-start; }
  .mila-p-signame, .mila-p-sigrole { text-align: left; }
}

/* =========================================================
   MILA TERMS & CONDITIONS EDITABLE PDF SHEET
   ========================================================= */
.mila-tc-clientcard {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 16px;
  background: #faf7f0;
  border: 1px solid #e7decb;
  border-radius: 10px;
  padding: 14px 16px;
  margin: 16px 0;
}

.mila-tc-projbox {
  border-left: 1px solid #e7decb;
  padding-left: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mila-tc-intro {
  margin: 10px 0 16px;
}

.mila-tc-intro-ta {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 13.5px;
  line-height: 1.55;
  color: #3a342c;
}

.mila-tc-clauses {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.mila-tc-clause {
  border-left: 3px solid #c9ac78;
  padding: 6px 0 10px 12px;
  border-bottom: 1px solid #f1ebdf;
}

.mila-tc-clause-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.mila-tc-clause-num {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  font-weight: 700;
  color: #8f6f39;
  flex-shrink: 0;
}

.mila-tc-clause-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  font-weight: 700;
  color: #171410;
  flex: 1;
}

.mila-tc-clause-tools {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.mila-tc-mini {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid #dfd5c2;
  background: #faf7f0;
  color: #5f5545;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.mila-tc-clause-body {
  font-size: 13px;
  line-height: 1.55;
  color: #413b33;
}

.mila-tc-sigs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1.5px solid #e7decb;
}

.mila-tc-sigcol {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.mila-tc-clientsigspace {
  height: 58px;
  width: 100%;
}

.mila-tc-sigline {
  width: 100%;
  max-width: 260px;
  border-top: 1.2px solid #b5a892;
  padding-top: 6px;
}

.mila-tc-signame,
.mila-tc-signame-static {
  font-size: 13px;
  font-weight: 700;
  color: #171410;
}

.mila-tc-sigrole,
.mila-tc-sigrole-static {
  font-size: 11.5px;
  color: #6e6558;
}

/* Proposal & Quotation Embedded Terms & Conditions + Issued By Sign-Off */
.mila-p-notes-row {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #ece5d8;
}

.mila-p-terms-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1.6px solid #dfd2b9;
}

.mila-p-terms-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid #f0eadf;
}

.mila-p-terms-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.9px;
  color: #8f6f39;
}

.mila-p-terms-sub {
  font-size: 11.5px;
  font-weight: 600;
  color: #766d5f;
}

.mila-p-issuedbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1.2px solid #ece5d8;
}

.mila-p-issued-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mila-p-issued-co {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  font-weight: 700;
  color: #171410;
}

.mila-p-issued-meta {
  font-size: 11.5px;
  color: #6e6558;
}

/* Proposal & Quotation Acceptance & Confirmation Block */
.mila-p-acceptance {
  margin-top: 18px;
  background: #faf7f0;
  border: 1.5px solid #d9c9a9;
  border-left: 4px solid #b5945b;
  border-radius: 10px;
  padding: 14px 16px;
}

.mila-p-accept-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.9px;
  color: #8f6f39;
  margin-bottom: 4px;
}

.mila-p-accept-note {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 12.2px;
  color: #413b33;
  margin-bottom: 12px;
}

.mila-p-accept-body {
  display: grid;
  grid-template-columns: 1fr 190px;
  gap: 16px;
  align-items: stretch;
}

.mila-p-accept-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.mila-p-accept-field {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
}

.mila-p-accept-in {
  font-size: 12.5px;
  font-weight: 600;
  color: #171410;
  border: none;
  border-bottom: 1.3px solid #b5a892;
  border-radius: 0;
  padding: 4px 2px;
  background: transparent;
}

.mila-p-accept-sigline {
  height: 28px;
  border-bottom: 1.3px solid #b5a892;
}

.mila-p-accept-lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.7px;
  color: #766d5f;
}

.mila-p-sealbox {
  border: 1.5px dashed #c9ac78;
  border-radius: 8px;
  background: #ffffff;
  min-height: 98px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #9d8d74;
}

@media (max-width: 720px) {
  .mila-p-accept-body,
  .mila-p-accept-fields {
    grid-template-columns: 1fr;
  }
  .mila-p-issuedbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* =========================================================
   EXECUTIVE 100 GSM BOND PAPER DESIGN (INVOICES & QUOTATIONS)
   ========================================================= */
.mila-pdf-paper.paper-bond {
  position: relative;
  background-color: #fbf6e9;
  background-image:
    radial-gradient(ellipse at 50% 45%, rgba(255, 253, 247, 0.72) 0%, rgba(181, 152, 102, 0.11) 100%),
    repeating-linear-gradient(
      to bottom,
      rgba(166, 138, 86, 0.045) 0px,
      rgba(166, 138, 86, 0.045) 1px,
      transparent 1px,
      transparent 12px
    );
  border-radius: 6px;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.62),
    inset 0 0 0 1px rgba(157, 123, 65, 0.25);
}

.mila-bond-frame {
  position: absolute;
  inset: 14px;
  border: 2px solid #9d7b41;
  pointer-events: none;
  z-index: 2;
}

.mila-bond-frame::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid #cbb07c;
}

.mila-bond-corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: #8a6830;
  border-style: solid;
}

.mila-bond-corner.tl { top: -2px; left: -2px; border-width: 3px 0 0 3px; }
.mila-bond-corner.tr { top: -2px; right: -2px; border-width: 3px 3px 0 0; }
.mila-bond-corner.bl { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; }
.mila-bond-corner.br { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; }

.mila-bond-diamond {
  position: absolute;
  left: 50%;
  width: 10px;
  height: 10px;
  background: #9d7b41;
  transform: translateX(-50%) rotate(45deg);
  box-shadow: 0 0 0 4px #fbf6e9;
}

.mila-bond-diamond.top { top: -6px; }
.mila-bond-diamond.bottom { bottom: -6px; }

.mila-bond-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 0.055;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.mila-bond-watermark img {
  width: 190px;
  height: 190px;
  border-radius: 26px;
  object-fit: cover;
  filter: sepia(0.5);
}

.mila-bond-watermark span {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2.2px;
  color: #7e5f2d;
  white-space: nowrap;
}

.mila-pdf-paper.paper-bond .mila-pdf-inner {
  position: relative;
  z-index: 1;
  padding: 38px 38px 26px;
}

.mila-pdf-paper.paper-bond .mila-p-summary,
.mila-pdf-paper.paper-bond .mila-p-words,
.mila-pdf-paper.paper-bond .mila-p-bank,
.mila-pdf-paper.paper-bond .mila-p-totals,
.mila-pdf-paper.paper-bond .mila-p-acceptance {
  background: rgba(246, 239, 223, 0.72);
  border-color: #d5c29d;
}

.mila-pdf-paper.paper-bond .mila-p-sealbox {
  background: rgba(253, 250, 241, 0.85);
}

.mila-pdf-paper.paper-bond .mila-p-colophon {
  position: relative;
  z-index: 1;
  margin: 0 21px 21px;
  border-top: 1px solid #d5c29d;
  background: rgba(242, 232, 210, 0.65);
  font-family: Georgia, "Times New Roman", serif;
  color: #685c49;
}

@media (max-width: 720px) {
  .mila-bond-frame { inset: 8px; }
  .mila-pdf-paper.paper-bond .mila-pdf-inner { padding: 26px 20px 18px; }
  .mila-pdf-paper.paper-bond .mila-p-colophon { margin: 0 14px 14px; }
  .mila-bond-watermark img { width: 130px; height: 130px; }
  .mila-bond-watermark span { font-size: 11px; letter-spacing: 1.4px; }
}



