:root {
  --bg: #0b1220;
  --panel: rgba(18, 27, 46, 0.92);
  --panel-2: rgba(255,255,255,0.04);
  --border: rgba(255,255,255,0.08);
  --text: #eef4ff;
  --muted: #9cadc8;
  --primary: #6d5dfc;
  --primary-2: #50a7ff;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(109,93,252,0.25), transparent 35%),
    radial-gradient(circle at top right, rgba(80,167,255,0.18), transparent 30%),
    linear-gradient(180deg, #09101b 0%, #0f172a 100%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
}
.auth-backdrop {
  position: absolute;
  inset: 0;
  backdrop-filter: blur(4px);
}
.card-glass,
.panel-modern,
.modal-modern {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  backdrop-filter: blur(12px);
}
.auth-card {
  width: 100%;
  max-width: 460px;
  border-radius: 28px;
  padding: 28px;
  position: relative;
  z-index: 2;
}
.auth-brand { display: flex; gap: 16px; align-items: center; }
.auth-brand h1 { font-size: 1.6rem; margin: 0 0 6px; }
.auth-brand p { margin: 0; color: var(--muted); }
.brand-badge {
  width: 54px; height: 54px; border-radius: 18px;
  display: grid; place-items: center; font-size: 1.4rem;
  background: linear-gradient(135deg, var(--primary-2), var(--primary));
  color: #fff;
  box-shadow: 0 14px 28px rgba(109,93,252,.35);
}
.input-modern,
.form-select.input-modern,
.form-select,
.form-control {
  background: rgba(255,255,255,0.06) !important;
  color: var(--text) !important;
  border: 1px solid rgba(255,255,255,0.12) !important;
  border-radius: 16px !important;
  min-height: 50px;
}
.input-modern::placeholder,
.form-control::placeholder { color: #9fb1d0; }
.form-control:focus,
.form-select:focus {
  box-shadow: 0 0 0 .25rem rgba(109,93,252,.16) !important;
  border-color: rgba(109,93,252,.5) !important;
}
.form-select option { color: #0f172a; }
.btn-modern {
  border-radius: 16px !important;
  min-height: 48px;
  font-weight: 600;
  border: 0 !important;
}
.btn-primary.btn-modern,
.btn.btn-primary.btn-modern {
  background: linear-gradient(135deg, var(--primary-2), var(--primary)) !important;
  box-shadow: 0 14px 30px rgba(109,93,252,.28);
}
.app-shell {
  display: grid;
  grid-template-columns: 290px 1fr;
  min-height: 100vh;
}
.sidebar-modern {
  border-right: 1px solid var(--border);
  background: rgba(6, 11, 21, 0.62);
  backdrop-filter: blur(14px);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
}
.sidebar-brand,
.user-mini { display: flex; align-items: center; gap: 14px; }
.sidebar-brand { padding: 8px 10px 22px; }
.sidebar-brand small,
.user-mini small { color: var(--muted); display: block; }
.app-nav { gap: 10px; }
.app-nav .nav-link {
  background: transparent;
  border: 1px solid transparent;
  color: #d7e4ff;
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}
.app-nav .nav-link:hover,
.app-nav .nav-link.active {
  background: rgba(255,255,255,0.06);
  border-color: var(--border);
}
.sidebar-footer { margin-top: auto; padding: 14px 10px 0; }
.avatar-circle {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}
.main-modern { padding: 26px; }
.topbar-modern {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 22px;
}
.topbar-modern h2 { margin: 0 0 6px; }
.topbar-modern p { margin: 0; color: var(--muted); }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.stat-card { padding: 18px; border-radius: 24px; }
.stat-card .icon {
  width: 48px; height: 48px; border-radius: 16px;
  display: grid; place-items: center; margin-bottom: 14px;
  background: rgba(255,255,255,0.06);
}
.stat-card .label { color: var(--muted); margin-bottom: 6px; }
.stat-card .value { font-size: 2rem; font-weight: 700; }
.content-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}
.panel-modern { border-radius: 26px; padding: 20px; }
.section-head,
.module-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.module-toolbar { margin-bottom: 16px; flex-wrap: wrap; }
.search-box {
  min-width: 280px;
  flex: 1;
  position: relative;
}
.search-box i {
  position: absolute;
  top: 50%; left: 16px;
  transform: translateY(-50%);
  color: var(--muted);
}
.search-box input { padding-left: 44px; }
#appContent,
.panel-modern,
.table-wrap {
  min-width: 0;
}

.table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border-radius: 18px;
  border: 1px solid var(--border);
}

.table-wrap.table-responsive {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch;
  border-radius: 18px;
}

.table-wrap.table-responsive > .modern-table,
.table-wrap.table-responsive > .module-table {
  width: 100% !important;
  min-width: 100%;
  margin-bottom: 0;
  table-layout: auto !important;
}

.modern-table,
.module-table {
  color: var(--text) !important;
}

.modern-table thead th,
.module-table thead th {
  background: rgba(255,255,255,0.04);
  color: #cfe0ff;
  border-bottom: 1px solid var(--border) !important;
  padding: 14px 16px !important;
  vertical-align: middle;
  white-space: nowrap;
}

.modern-table tbody td,
.module-table tbody td {
  padding: 14px 16px !important;
  border-bottom: 1px solid rgba(255,255,255,0.06) !important;
  vertical-align: middle;
  white-space: nowrap;
}

.modern-table tbody tr:last-child td,
.module-table tbody tr:last-child td {
  border-bottom: 0 !important;
}

.id-col { min-width: 70px; text-align: center; }
.status-col { min-width: 130px; }
.date-col { min-width: 170px; }
.actions-col { min-width: 125px; }
.actions { min-width: 125px; }

@media (max-width: 768px) {
  .table-wrap.table-responsive > .modern-table,
  .table-wrap.table-responsive > .module-table {
    width: max-content !important;
    min-width: 780px;
  }
}
.text-truncate-cell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge-soft {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: .83rem;
  text-transform: capitalize;
  background: rgba(255,255,255,0.08);
}
.tone-success { background: rgba(22,163,74,.18); color: #8ef0b0; }
.tone-warning { background: rgba(217,119,6,.18); color: #ffd38c; }
.tone-danger { background: rgba(220,38,38,.18); color: #ffb4b4; }
.tone-muted { background: rgba(148,163,184,.18); color: #d2dce8; }
.btn-icon {
  width: 36px; height: 36px;
  display: inline-grid !important; place-items: center;
  border-radius: 12px !important;
}
.next-card {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}
.empty-state {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}
.modal-modern {
  border-radius: 26px !important;
  color: var(--text);
}
.modal-subtitle { color: var(--muted); margin-top: 3px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 16px;
}
.form-grid .full { grid-column: 1 / -1; }
.textarea-modern { min-height: 120px; resize: vertical; }
.quick-add-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 14px;
}
.quick-add-card {
  text-align: left;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px;
}
.quick-add-card:hover {
  transform: translateY(-2px);
  border-color: rgba(109,93,252,.4);
}
.quick-add-icon {
  width: 48px; height: 48px; border-radius: 16px;
  display: grid; place-items: center;
  margin-bottom: 14px;
  background: linear-gradient(135deg, rgba(80,167,255,.25), rgba(109,93,252,.35));
}
.quick-add-title { font-weight: 700; margin-bottom: 6px; }
.quick-add-text { color: var(--muted); font-size: .95rem; }
.toast { color: #fff; border-radius: 18px; }
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar-modern { border-right: 0; border-bottom: 1px solid var(--border); }
  .quick-add-grid,
  .form-grid { grid-template-columns: 1fr; }
  .main-modern { padding: 18px; }
}


.table-wrap .table,
.table-wrap .modern-table {
  --bs-table-bg: transparent !important;
  --bs-table-striped-bg: rgba(255,255,255,0.03) !important;
  --bs-table-hover-bg: rgba(255,255,255,0.05) !important;
  --bs-table-border-color: rgba(255,255,255,0.08) !important;
  background: transparent !important;
  color: var(--text) !important;
}
.table-wrap .table > :not(caption) > * > *,
.table-wrap .modern-table > :not(caption) > * > * {
  background-color: rgba(15, 23, 42, 0.92) !important;
  color: var(--text) !important;
  box-shadow: none !important;
}
.table-wrap .modern-table thead th {
  background-color: rgba(255,255,255,0.06) !important;
}
.table-wrap .modern-table tbody td {
  background-color: rgba(15, 23, 42, 0.92) !important;
}
.table-wrap .modern-table tbody tr:hover > td {
  background-color: rgba(255,255,255,0.05) !important;
}
.table-wrap .empty-state {
  background: rgba(15, 23, 42, 0.92) !important;
}


.section-kicker {
  color: #8fb6ff;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.dashboard-stack {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}
.chart-box {
  position: relative;
  height: 280px;
  margin-top: 14px;
}
.chart-box.tall {
  height: 320px;
}
.chart-hero,
.chart-panel {
  overflow: hidden;
}
.chart-hero::after,
.chart-panel::after {
  content: "";
  position: absolute;
  inset: auto -60px -60px auto;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(109,93,252,.18), transparent 70%);
  pointer-events: none;
}
.panel-modern {
  position: relative;
}
.panel-modern::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,0));
  opacity: .8;
}
.module-toolbar .btn-modern {
  min-width: 168px;
}
.search-box input {
  padding-right: 14px;
}
.modern-table thead th:first-child { border-top-left-radius: 14px; }
.modern-table thead th:last-child { border-top-right-radius: 14px; }
.modern-table tbody tr {
  transition: transform .16s ease, background-color .16s ease;
}
.modern-table tbody tr:hover {
  transform: translateY(-1px);
}
.modern-table tbody td:first-child,
.modern-table thead th:first-child {
  padding-left: 18px !important;
}
.modern-table tbody td:last-child,
.modern-table thead th:last-child {
  padding-right: 18px !important;
}
.form-grid > div {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 20px;
  padding: 14px;
}
.form-grid > div.full {
  padding: 16px;
}
.form-grid .form-label {
  color: #cfe0ff;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 10px;
}
.form-grid .d-flex.justify-content-end {
  background: transparent;
  border: 0;
  padding: 0;
}
.input-modern,
.form-select.input-modern,
.form-select,
.form-control {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.input-modern:hover,
.form-select:hover,
.form-control:hover {
  border-color: rgba(143,182,255,.28) !important;
}
.quick-add-card {
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.quick-add-card:hover {
  box-shadow: 0 18px 30px rgba(0,0,0,.18);
}
.next-card {
  transition: transform .16s ease, border-color .16s ease, background-color .16s ease;
}
.next-card:hover {
  transform: translateY(-1px);
  border-color: rgba(109,93,252,.22);
  background: rgba(255,255,255,0.05);
}
@media (max-width: 1100px) {
  .chart-box.tall {
    height: 280px;
  }
}

.sidebar-brand.sidebar-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 0;
}
.brand-copy { min-width: 0; }
.toggle-indicator {
  margin-left: auto;
  color: var(--muted);
  transition: transform .22s ease;
}
.app-shell.sidebar-collapsed .toggle-indicator { transform: rotate(180deg); }
.mobile-menu-btn { display: none; margin-bottom: 16px; }
.toolbar-actions { display: flex; gap: 10px; align-items: center; }
.status-filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}
.status-filter-pill {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: .88rem;
}
.status-filter-pill.active,
.status-filter-pill:hover {
  color: var(--text);
  border-color: rgba(109,93,252,.45);
  background: rgba(109,93,252,.16);
}
.chart-box {
  position: relative;
  height: 280px;
  margin-top: 12px;
}
.chart-box.tall { height: 330px; }
.chart-panel { padding: 24px; }
.dashboard-stack { display: grid; gap: 16px; margin-top: 16px; }
.section-kicker {
  color: #93a6c6;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .72rem;
  margin-bottom: 6px;
}
.input-modern,
.form-select.input-modern {
  min-height: 52px;
  border-radius: 16px !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  background: rgba(255,255,255,0.05) !important;
  color: var(--text) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 8px 24px rgba(0,0,0,0.18);
}
.textarea-modern {
  min-height: 140px;
  padding-top: 14px;
}
.input-modern:focus,
.form-select.input-modern:focus {
  border-color: rgba(109,93,252,.7) !important;
  box-shadow: 0 0 0 .2rem rgba(109,93,252,.18), 0 16px 35px rgba(0,0,0,0.25) !important;
}
.form-label {
  color: #cfd8ee;
  font-weight: 600;
  margin-bottom: 8px;
}
.modal-modern .modal-body {
  padding-top: 16px;
}
.form-grid > div {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 20px;
  padding: 14px;
}
.form-grid > .full:last-child {
  background: transparent;
  border: 0;
  padding: 0;
}
.modern-table tbody td,
.modern-table thead th {
  text-align: left;
}
.modern-table .actions-col,
.modern-table td.text-end,
.modern-table th.text-end { text-align: right !important; }
.modern-table tbody tr {
  transition: transform .18s ease, background .18s ease;
}
.modern-table tbody tr:hover {
  transform: translateY(-1px);
}
@media (min-width: 901px) {
  .app-shell.sidebar-collapsed {
    grid-template-columns: 92px 1fr;
  }
  .app-shell.sidebar-collapsed .sidebar-modern {
    padding-inline: 12px;
  }
  .app-shell.sidebar-collapsed .brand-copy,
  .app-shell.sidebar-collapsed .sidebar-footer .user-mini > div:last-child,
  .app-shell.sidebar-collapsed .app-nav .nav-link span,
  .app-shell.sidebar-collapsed .sidebar-footer .btn {
    display: none;
  }
  .app-shell.sidebar-collapsed .app-nav .nav-link {
    justify-content: center;
    padding-inline: 0;
  }
  .app-shell.sidebar-collapsed .sidebar-footer .user-mini {
    justify-content: center;
  }
}
@media (max-width: 900px) {
  .mobile-menu-btn { display: inline-flex; align-self: flex-start; }
  .app-shell { position: relative; }
  .sidebar-modern {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(300px, 85vw);
    z-index: 1040;
    transform: translateX(-105%);
    transition: transform .25s ease;
  }
  .app-shell.sidebar-open .sidebar-modern { transform: translateX(0); }
}


/* V9 refinements */
.dashboard-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.modern-table {
  min-width: 880px;
  table-layout: auto;
}
.calendar-slot {
  margin-bottom: 18px;
}
.calendar-panel {
  padding: 22px;
}
.calendar-grid-head,
.calendar-grid-body {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}
.calendar-grid-head {
  margin-top: 16px;
  margin-bottom: 10px;
}
.calendar-grid-head div {
  color: #8ea4c8;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  text-align: center;
}
.calendar-day {
  min-height: 132px;
  border-radius: 18px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.calendar-day.is-empty {
  visibility: hidden;
}
.calendar-day.has-events {
  background: rgba(109,93,252,0.09);
  border-color: rgba(109,93,252,0.22);
}
.calendar-day-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.calendar-date {
  font-weight: 700;
  color: #eef4ff;
}
.calendar-count,
.calendar-more {
  font-size: .74rem;
  color: #9db1d3;
}
.calendar-events {
  display: grid;
  gap: 6px;
}
.calendar-event-dot {
  border-radius: 999px;
  padding: 7px 10px;
  font-size: .77rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.calendar-empty {
  color: rgba(255,255,255,0.2);
  margin-top: auto;
}
.client-sheet {
  display: grid;
  gap: 18px;
}
.client-sheet-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(109,93,252,0.18), rgba(91,140,255,0.12));
  border: 1px solid rgba(255,255,255,0.08);
}
.client-avatar {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
}
.client-sheet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.sheet-card,
.sheet-block {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 18px;
  padding: 16px;
}
.sheet-label {
  color: #8ea4c8;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 8px;
}
.sheet-value {
  color: #eef4ff;
}
.client-sheet-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.sheet-block-title {
  font-weight: 700;
  margin-bottom: 12px;
}
.sheet-list-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sheet-list-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.sheet-empty {
  color: #8ea4c8;
}
.sheet-timeline-item {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 12px;
  padding: 10px 0;
}
.sheet-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-top: 7px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}
.xsmall {
  font-size: .74rem;
}
@media (max-width: 1200px) {
  .calendar-day {
    min-height: 116px;
  }
}
@media (max-width: 900px) {
  .dashboard-stack {
    grid-template-columns: 1fr;
  }
  .client-sheet-grid,
  .client-sheet-columns {
    grid-template-columns: 1fr;
  }
  .calendar-grid-head,
  .calendar-grid-body {
    min-width: 820px;
  }
}
@media (max-width: 768px) {
  .modern-table {
    min-width: 760px;
  }
}

@media (max-width: 768px) {
  .table-wrap.table-responsive {
    margin-bottom: 0;
  }
  .table-wrap.table-responsive > .modern-table {
    min-width: 760px;
  }
  body {
    overflow-x: hidden;
  }
}


/* V10.2 - correção forte da rolagem horizontal das tabelas */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}
.app-shell, .main-modern, #appContent, .panel-modern {
  max-width: 100%;
  min-width: 0;
}
.panel-modern {
  overflow: hidden;
}
.table-wrap,
.table-wrap.table-responsive {
  position: relative;
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
}
.table-wrap.table-responsive table,
.table-wrap.table-responsive > table,
.table-wrap .modern-table,
.table-wrap .module-table {
  display: table !important;
  width: 1200px !important;
  min-width: 1200px !important;
  max-width: none !important;
  table-layout: auto !important;
  border-collapse: separate;
}
.table-wrap.table-responsive th,
.table-wrap.table-responsive td,
.table-wrap th,
.table-wrap td {
  white-space: nowrap !important;
}
@media (max-width: 992px) {
  .table-wrap.table-responsive table,
  .table-wrap.table-responsive > table,
  .table-wrap .modern-table,
  .table-wrap .module-table {
    width: 980px !important;
    min-width: 980px !important;
  }
}


.metrics-grid { display:grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap:16px; margin-bottom:18px; }
.metric-card { padding:18px; border-radius:22px; }
.metric-label { color: var(--muted); font-size:.92rem; }
.metric-value { font-size:1.7rem; font-weight:700; margin:6px 0; }
.metric-hint { color: var(--muted); font-size:.84rem; }
.dashboard-grid-2 { display:grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap:18px; margin-top:18px; }
.toolbar-date { display:flex; gap:10px; }
.toolbar-date .form-control { min-width: 160px; }
.calendar-panel { margin-bottom:16px; border-radius:24px; padding:18px; }
.calendar-grid-head, .calendar-grid-body { display:grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap:8px; }
.calendar-grid-head { color: var(--muted); font-size:.82rem; margin-bottom:10px; }
.calendar-day { min-height:110px; border:1px solid var(--border); border-radius:18px; padding:10px; background: rgba(255,255,255,.02); }
.calendar-day.is-empty { background: transparent; border-style:dashed; opacity:.35; }
.calendar-day-top { display:flex; justify-content:space-between; gap:10px; font-size:.82rem; margin-bottom:8px; }
.calendar-date { font-weight:700; }
.calendar-events { display:grid; gap:6px; }
.calendar-event-dot { background: rgba(80,167,255,.12); border:1px solid rgba(80,167,255,.2); color:#dbeafe; border-radius:999px; font-size:.78rem; padding:4px 8px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.calendar-more, .calendar-empty { font-size:.78rem; color: var(--muted); }
.client-kpis { display:grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap:12px; margin-bottom:12px; }
.link-inline { background:none; border:0; color:#dbeafe; padding:0; font-weight:600; text-align:left; }
.link-inline:hover { color:#fff; text-decoration:underline; }
.doc-upload-form { display:grid; grid-template-columns: 1.2fr 1fr auto; gap:10px; margin-bottom:14px; }
.doc-list { display:grid; gap:10px; }
.doc-item { display:flex; justify-content:space-between; gap:14px; align-items:center; padding:12px; border:1px solid var(--border); border-radius:16px; background: rgba(255,255,255,.03); }
.tiny-pill { margin-top:6px; display:inline-block; padding:2px 8px; border-radius:999px; background: rgba(45,212,191,.12); color:#99f6e4; font-size:.72rem; }
.section-head { display:flex; justify-content:space-between; gap:14px; align-items:flex-start; margin-bottom:14px; }
.section-kicker { color:var(--muted); font-size:.8rem; text-transform:uppercase; letter-spacing:.08em; margin-bottom:2px; }
.chart-box { position:relative; height:280px; }
.chart-box.tall { height:320px; }
.next-card { padding:14px; border-radius:18px; background: rgba(255,255,255,.04); border:1px solid var(--border); }
.sheet-block, .sheet-card { border:1px solid var(--border); background: rgba(255,255,255,.03); border-radius:18px; padding:14px; }
.client-sheet-head { display:flex; align-items:center; gap:16px; margin-bottom:14px; }
.client-avatar { width:60px; height:60px; border-radius:20px; display:grid; place-items:center; font-size:1.4rem; font-weight:700; background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.client-sheet-grid, .client-sheet-columns { display:grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap:12px; }
.sheet-label { color: var(--muted); font-size:.82rem; }
.sheet-value { font-weight:600; margin-top:6px; }
.sheet-block-title { font-weight:700; margin-bottom:12px; }
.sheet-list-item { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:10px 0; border-top:1px solid rgba(255,255,255,.06); }
.sheet-list-item:first-of-type { border-top:0; padding-top:0; }
.sheet-empty { color: var(--muted); }
.sheet-timeline-item { display:flex; gap:12px; padding:10px 0; border-top:1px solid rgba(255,255,255,.06); }
.sheet-dot { width:10px; height:10px; border-radius:50%; background: linear-gradient(135deg, var(--primary-2), var(--primary)); margin-top:6px; }
@media (max-width: 1100px) {
  .metrics-grid, .dashboard-grid-2, .client-kpis, .client-sheet-grid, .client-sheet-columns { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .toolbar-date { width:100%; }
  .doc-upload-form { grid-template-columns: 1fr; }
  .calendar-day { min-height: 90px; }
}


.calendar-events { display:grid; gap:8px; max-height:none; }
.calendar-event-card {
  display:grid;
  gap:2px;
  border-radius:14px;
  padding:8px 10px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
}
.calendar-event-time {
  font-size:.76rem;
  font-weight:700;
  letter-spacing:.02em;
  color:#fff;
}
.calendar-event-name {
  font-size:.82rem;
  font-weight:600;
  color:#eaf1ff;
  line-height:1.2;
}
.calendar-event-status {
  font-size:.72rem;
  text-transform:capitalize;
  color:var(--muted);
}
.calendar-event-card.tone-success {
  background: rgba(34,197,94,.12);
  border-color: rgba(34,197,94,.28);
}
.calendar-event-card.tone-warning {
  background: rgba(245,158,11,.12);
  border-color: rgba(245,158,11,.28);
}
.calendar-event-card.tone-danger {
  background: rgba(239,68,68,.12);
  border-color: rgba(239,68,68,.28);
}
.calendar-event-card.tone-muted {
  background: rgba(148,163,184,.10);
  border-color: rgba(148,163,184,.24);
}
.calendar-day { min-height: 150px; }
@media (max-width: 991.98px) {
  .calendar-day { min-height: 120px; }
  .calendar-event-time { font-size:.72rem; }
  .calendar-event-name { font-size:.78rem; }
}


/* v11.3 mobile corrections */
body.sidebar-open-lock {
  overflow: hidden;
}

.calendar-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  padding-bottom: 2px;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    position: relative;
  }

  .sidebar-modern {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 84vw);
    max-width: 300px;
    border-right: 1px solid var(--border);
    border-bottom: 0;
    z-index: 1045;
    transform: translateX(-104%);
    transition: transform .25s ease;
    overflow-y: auto;
  }

  .app-shell.sidebar-open .sidebar-modern {
    transform: translateX(0);
  }

  .app-shell.sidebar-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(3, 8, 18, 0.48);
    z-index: 1040;
  }

  .mobile-menu-btn {
    display: inline-flex;
    align-self: flex-start;
    position: relative;
    z-index: 1046;
  }

  .calendar-panel {
    overflow: hidden;
  }

  .calendar-scroll {
    margin-inline: -2px;
    padding-inline: 2px;
  }

  .calendar-grid-head,
  .calendar-grid-body {
    width: 820px;
    min-width: 820px;
  }
}

@media (min-width: 901px) {
  .calendar-scroll {
    overflow: visible;
  }

  .calendar-grid-head,
  .calendar-grid-body {
    width: 100%;
    min-width: 0;
  }
}


.table-pagination { display:flex; justify-content:flex-end; margin-top:14px; }
.pagination-modern { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.page-btn { border:1px solid rgba(255,255,255,.12); background:rgba(255,255,255,.06); color:#e8eefc; border-radius:12px; padding:8px 14px; }
.page-btn:disabled { opacity:.45; cursor:not-allowed; }
.page-info { color:#b8c5df; font-size:.95rem; }


.toolbar-actions{display:flex;gap:10px;flex-wrap:wrap;}

@media print {
  @page { size: auto; margin: 10mm; }
  body {
    background: #fff !important;
    color: #000 !important;
    zoom: 1 !important;
  }
  .sidebar-modern,
  .mobile-menu-btn,
  .topbar-modern,
  .module-toolbar,
  .status-filter-row,
  .toolbar-actions,
  .search-box,
  .toolbar-date,
  .table-pagination,
  .toast-container,
  .btn,
  .quick-add-grid,
  .calendar-panel,
  .metrics-grid,
  .stats-grid,
  .content-grid,
  .dashboard-grid-2,
  .modal,
  .screen-only {
    display: none !important;
  }
  .app-shell,
  .main-modern,
  #appContent,
  .panel-modern,
  .table-wrap,
  .module-table,
  .modern-table {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    background: #fff !important;
    box-shadow: none !important;
    border: 0 !important;
    color: #000 !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .module-table,
  .modern-table {
    border-collapse: collapse !important;
  }
  .module-table thead th,
  .modern-table thead th,
  .module-table tbody td,
  .modern-table tbody td {
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #bbb !important;
    white-space: normal !important;
  }
  .badge-soft, .tiny-pill { border: 1px solid #777 !important; color:#000 !important; background:#fff !important; }
}
