:root {
  color-scheme: light;
  --navy-950: #10182c;
  --navy-900: #17233d;
  --navy-800: #253451;
  --ink: #172033;
  --muted: #697386;
  --soft: #8d96a6;
  --canvas: #f3f3ef;
  --card: #ffffff;
  --line: #e4e6e8;
  --teal: #119f99;
  --teal-dark: #0a7d79;
  --teal-soft: #e0f4f2;
  --amber: #d99b2b;
  --amber-soft: #fff2d6;
  --red: #cc4d5b;
  --red-soft: #fdebed;
  --green: #277c5d;
  --green-soft: #e5f4ec;
  --blue: #496fac;
  --blue-soft: #eaf0fb;
  --purple: #745ea7;
  --purple-soft: #f0ebfa;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 1px 2px rgba(16, 24, 44, 0.04),
    0 10px 32px rgba(16, 24, 44, 0.05);
  --shadow-lg: 0 24px 70px rgba(16, 24, 44, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, Aptos, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  display: grid;
  grid-template-columns: 246px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: 246px;
  flex-direction: column;
  overflow-y: auto;
  background:
    radial-gradient(circle at 5% 4%, rgba(35, 183, 175, 0.12), transparent 28%),
    var(--navy-950);
  color: #fff;
  padding: 24px 16px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 28px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 13px;
  background: linear-gradient(145deg, #22bdb5, #0b7d79);
  box-shadow: 0 8px 22px rgba(10, 125, 121, 0.3);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand span {
  margin-top: 1px;
  color: #93a0b8;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.main-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-label {
  margin: 17px 12px 7px;
  color: #697892;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.nav-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 43px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #aeb9cc;
  padding: 0 11px;
  cursor: pointer;
  text-align: left;
  transition:
    background 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(22, 171, 164, 0.28), rgba(22, 171, 164, 0.1));
  color: #fff;
  box-shadow: inset 3px 0 0 #30c8c0;
}

.nav-item span {
  color: #7d8ba5;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
}

.nav-item.active span {
  color: #47d4cd;
}

.nav-item em {
  min-width: 24px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  color: #91a0b9;
  padding: 2px 7px;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  text-align: center;
}

.nav-item.active em {
  background: rgba(47, 201, 193, 0.18);
  color: #79e3de;
}

.connection-card {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  padding: 13px;
}

.connection-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #dce3ef;
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(217, 155, 43, 0.12);
}

.status-dot.online {
  background: #35d39a;
  box-shadow: 0 0 0 4px rgba(53, 211, 154, 0.12);
}

.status-dot.error {
  background: #f06f78;
  box-shadow: 0 0 0 4px rgba(240, 111, 120, 0.12);
}

.connection-card p {
  margin: 8px 0 2px 16px;
  color: #8795ad;
  font-size: 11px;
}

.connection-card small {
  margin-left: 16px;
  color: #5f6f89;
  font-size: 10px;
}

.main {
  grid-column: 2;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 22px;
  border-bottom: 1px solid rgba(208, 211, 215, 0.84);
  background: rgba(249, 249, 246, 0.91);
  padding: 13px 30px;
  backdrop-filter: blur(16px);
}

.search-wrap {
  display: grid;
  width: min(560px, 48vw);
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid #dedfdf;
  border-radius: 11px;
  background: #fff;
  color: var(--soft);
  padding: 0 10px;
  box-shadow: 0 1px 2px rgba(16, 24, 44, 0.03);
}

.search-wrap input {
  height: 42px;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
}

.search-wrap input::placeholder {
  color: #9ca4b0;
}

kbd {
  border: 1px solid #e3e5e7;
  border-bottom-color: #d0d3d6;
  border-radius: 6px;
  background: #f7f7f5;
  color: #8a929f;
  padding: 2px 7px;
  font-family: inherit;
  font-size: 10px;
}

.top-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.sync-meta {
  max-width: 178px;
  padding-right: 4px;
  text-align: right;
}

.sync-meta span,
.sync-meta small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-meta span {
  color: #4f596b;
  font-size: 11px;
  font-weight: 700;
}

.sync-meta small {
  margin-top: 2px;
  color: var(--soft);
  font-size: 10px;
}

.btn {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 700;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: wait;
  opacity: 0.6;
  transform: none;
}

.btn-primary {
  border-color: #0d8e89;
  background: linear-gradient(180deg, #15aaa3, #0e918c);
  color: #fff;
  box-shadow: 0 7px 16px rgba(17, 159, 153, 0.17);
}

.btn-primary:hover {
  box-shadow: 0 9px 22px rgba(17, 159, 153, 0.23);
}

.btn-secondary {
  border-color: #d8dcdf;
  background: #fff;
  color: #303a4b;
}

.btn-ghost {
  border-color: #dfe2e5;
  background: #f8f8f6;
  color: #5c6677;
}

.btn-ghost.danger {
  border-color: #efc6cb;
  background: var(--red-soft);
  color: #a23c48;
}

.btn-sm {
  min-height: 32px;
  border-radius: 7px;
  padding: 0 10px;
  font-size: 11px;
}

.avatar {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid #d8dadc;
  border-radius: 50%;
  background: #fff;
  color: var(--navy-900);
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
}

.page {
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
  padding: 28px 30px 46px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 22px;
}

.page-heading h1 {
  margin: 2px 0 4px;
  color: var(--ink);
  font-size: clamp(25px, 2vw, 32px);
  font-weight: 760;
  letter-spacing: -0.035em;
}

.page-heading p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  display: block;
  color: var(--teal-dark);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.14em;
}

.page-heading .heading-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 13px;
  margin-bottom: 18px;
}

.kpi-card {
  position: relative;
  min-height: 127px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 18px;
  box-shadow: var(--shadow);
}

.kpi-card::after {
  position: absolute;
  top: -32px;
  right: -28px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: var(--tone, var(--teal-soft));
  content: "";
  opacity: 0.7;
}

.kpi-label {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.kpi-icon {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 9px;
  background: var(--tone, var(--teal-soft));
  color: var(--tone-strong, var(--teal-dark));
  font-size: 15px;
}

.kpi-value {
  display: block;
  margin-top: 16px;
  font-size: 29px;
  font-weight: 790;
  letter-spacing: -0.04em;
  line-height: 1;
}

.kpi-help {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  color: var(--soft);
  font-size: 10px;
}

.kpi-help strong {
  color: var(--tone-strong, var(--teal-dark));
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.75fr);
  gap: 16px;
  margin-bottom: 18px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  min-height: 62px;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #eceeef;
  padding: 13px 17px;
}

.card-head h2 {
  margin: 0;
  font-size: 14px;
  letter-spacing: -0.015em;
}

.card-head p {
  margin: 2px 0 0;
  color: var(--soft);
  font-size: 10px;
}

.card-head .head-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
}

.chart-card {
  min-height: 290px;
}

.chart-body {
  padding: 18px;
}

.bar-chart {
  display: flex;
  height: 210px;
  align-items: flex-end;
  gap: 13px;
  border-bottom: 1px solid #e5e7e9;
  background:
    linear-gradient(to top, transparent 24%, #eff1f2 25%, transparent 26%),
    linear-gradient(to top, transparent 49%, #eff1f2 50%, transparent 51%),
    linear-gradient(to top, transparent 74%, #eff1f2 75%, transparent 76%);
  padding: 6px 8px 0;
}

.bar-item {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  flex-direction: column;
  justify-content: flex-end;
  gap: 7px;
}

.bar {
  position: relative;
  width: min(42px, 68%);
  min-height: 3px;
  border-radius: 7px 7px 2px 2px;
  background: linear-gradient(180deg, #35bcb6, #0e8f8a);
  transition: height 350ms ease;
}

.bar::after {
  position: absolute;
  top: -22px;
  left: 50%;
  color: #344055;
  content: attr(data-value);
  font-size: 10px;
  font-weight: 800;
  transform: translateX(-50%);
}

.bar-item span {
  width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.decision-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 15px;
}

.decision-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  border: 1px solid #e9ebec;
  border-radius: 11px;
  background: #fbfbfa;
  padding: 10px;
}

.decision-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  background: var(--tone, var(--teal-soft));
  color: var(--tone-strong, var(--teal-dark));
  font-weight: 900;
}

.decision-item strong,
.decision-item small {
  display: block;
}

.decision-item strong {
  font-size: 12px;
}

.decision-item small {
  margin-top: 2px;
  color: var(--soft);
  font-size: 9px;
}

.decision-item b {
  color: var(--ink);
  font-size: 19px;
}

.table-card {
  overflow: hidden;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #eceeef;
  background: #fafaf8;
  padding: 11px 14px;
}

.purchase-filter {
  padding: 11px 14px;
  border-bottom: 1px solid #eceeef;
  background: #fafaf8;
}

.purchase-filter input {
  width: min(520px, 100%);
  height: 35px;
  padding: 0 10px;
}

.filters input,
.filters select,
.field-input,
.form-grid input,
.form-grid select,
.form-grid textarea {
  border: 1px solid #dfe2e5;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.filters input,
.filters select {
  height: 35px;
  padding: 0 10px;
}

.filters input {
  min-width: 240px;
  flex: 1;
}

.filters select {
  min-width: 135px;
}

.filters input:focus,
.filters select:focus,
.field-input:focus,
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  border-color: rgba(17, 159, 153, 0.72);
  box-shadow: 0 0 0 3px rgba(17, 159, 153, 0.1);
}

.result-count {
  color: var(--soft);
  font-size: 10px;
  font-weight: 700;
}

.table-wrap {
  max-width: 100%;
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid #e5e7e9;
  background: #f8f8f6;
  color: #788291;
  padding: 10px 12px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.055em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  border-bottom: 1px solid #eef0f1;
  color: #4f596a;
  padding: 10px 12px;
  vertical-align: middle;
}

.data-table tr {
  transition: background 120ms ease;
}

.data-table tbody tr:hover {
  background: #f8fbfb;
}

.data-table .ptn-link {
  border: 0;
  background: none;
  color: var(--navy-800);
  cursor: pointer;
  padding: 0;
  font-size: 11px;
  font-weight: 850;
  text-align: left;
}

.data-table .main-cell {
  min-width: 260px;
}

.data-table .main-cell strong,
.data-table .main-cell small {
  display: block;
}

.data-table .main-cell strong {
  max-width: 360px;
  overflow: hidden;
  color: #2a3548;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table .main-cell small {
  margin-top: 3px;
  color: var(--soft);
  font-size: 9px;
}

.num-cell {
  color: #384459 !important;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.tag {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  gap: 5px;
  border: 1px solid transparent;
  border-radius: 99px;
  padding: 2px 8px;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.tag::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.tag-teal {
  border-color: #bde5e2;
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.tag-amber {
  border-color: #f0d69d;
  background: var(--amber-soft);
  color: #9b6814;
}

.tag-red {
  border-color: #f0c6cb;
  background: var(--red-soft);
  color: #a94450;
}

.tag-green {
  border-color: #c5e6d4;
  background: var(--green-soft);
  color: var(--green);
}

.tag-blue {
  border-color: #cdd8ee;
  background: var(--blue-soft);
  color: var(--blue);
}

.tag-purple {
  border-color: #ddd1f0;
  background: var(--purple-soft);
  color: var(--purple);
}

.tag-gray {
  border-color: #dfe2e5;
  background: #f3f4f4;
  color: #697386;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  background: #fbfbfa;
  padding: 10px;
}

.empty-state {
  display: grid;
  min-height: 250px;
  place-items: center;
  padding: 40px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 15px;
}

.empty-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  margin: 0 auto 12px;
  border-radius: 17px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 22px;
}

.agenda-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(190px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.agenda-day {
  min-height: 440px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8f8f6;
}

.agenda-day.today {
  border-color: rgba(17, 159, 153, 0.55);
  box-shadow: inset 0 3px 0 var(--teal);
}

.agenda-day-head {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.agenda-day-head strong,
.agenda-day-head small {
  display: block;
}

.agenda-day-head strong {
  font-size: 12px;
}

.agenda-day-head small {
  color: var(--soft);
  font-size: 9px;
}

.agenda-day-head b {
  margin-left: auto;
  color: var(--teal-dark);
  font-size: 11px;
}

.agenda-lane {
  min-height: 115px;
  padding: 9px;
}

.agenda-lane + .agenda-lane {
  border-top: 1px dashed #dfe2e5;
}

.lane-label {
  margin-bottom: 7px;
  color: #87909e;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.schedule-card {
  width: 100%;
  margin-bottom: 7px;
  border: 1px solid #dfe4e5;
  border-left: 3px solid var(--teal);
  border-radius: 8px;
  background: #fff;
  padding: 9px;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 2px 8px rgba(16, 24, 44, 0.04);
}

.schedule-card.priority-critical {
  border-left-color: var(--red);
}

.schedule-card.priority-high {
  border-left-color: var(--amber);
}

.schedule-card strong,
.schedule-card span,
.schedule-card small {
  display: block;
}

.schedule-card strong {
  font-size: 10px;
}

.schedule-card span {
  margin-top: 2px;
  overflow: hidden;
  color: #596375;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-card small {
  margin-top: 5px;
  color: var(--soft);
  font-size: 8px;
}

.split-tabs {
  display: inline-flex;
  border: 1px solid #dde0e2;
  border-radius: 9px;
  background: #f5f5f3;
  padding: 3px;
}

.split-tabs button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 750;
}

.split-tabs button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(16, 24, 44, 0.08);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.summary-box {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  padding: 13px 15px;
}

.summary-box span,
.summary-box strong {
  display: block;
}

.summary-box span {
  color: var(--soft);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.summary-box strong {
  margin-top: 5px;
  font-size: 20px;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.7fr);
  gap: 16px;
}

.settings-section {
  padding: 20px;
}

.settings-section h2 {
  margin: 0 0 5px;
  font-size: 16px;
}

.settings-section > p {
  margin: 0 0 20px;
  color: var(--muted);
}

.settings-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}

.settings-form label,
.form-grid label {
  display: flex;
  color: #596375;
  flex-direction: column;
  gap: 6px;
  font-size: 10px;
  font-weight: 750;
}

.field-input {
  height: 40px;
  padding: 0 11px;
}

.settings-form .span-2,
.form-grid .span-2 {
  grid-column: span 2;
}

.readonly-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid #bfe3df;
  border-radius: 11px;
  background: var(--teal-soft);
  color: #315d5a;
  padding: 13px;
}

.readonly-banner strong,
.readonly-banner span {
  display: block;
}

.readonly-banner strong {
  color: var(--teal-dark);
  font-size: 11px;
}

.readonly-banner span {
  margin-top: 2px;
  font-size: 9px;
}

.count-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 17px;
}

.count-list div {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fafaf8;
  padding: 11px;
}

.count-list span,
.count-list strong {
  display: block;
}

.count-list span {
  color: var(--soft);
  font-size: 9px;
}

.count-list strong {
  margin-top: 3px;
  font-size: 17px;
}

.drawer-backdrop,
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(11, 17, 31, 0.46);
  backdrop-filter: blur(3px);
}

.drawer-backdrop[hidden],
.modal-backdrop[hidden] {
  display: none;
}

.drawer {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(760px, calc(100vw - 40px));
  overflow-y: auto;
  background: #f7f7f4;
  box-shadow: var(--shadow-lg);
  animation: slide-in 180ms ease-out;
}

@keyframes slide-in {
  from {
    transform: translateX(34px);
    opacity: 0;
  }
}

.drawer-head,
.modal-head {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 18px 20px;
}

.drawer-head h2,
.modal-head h2 {
  margin: 2px 0 0;
  font-size: 20px;
  letter-spacing: -0.025em;
}

.icon-btn {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  margin-left: auto;
  border: 1px solid #dfe2e5;
  border-radius: 9px;
  background: #fafaf8;
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
}

.drawer-content {
  padding: 18px;
}

.drawer-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 17px;
  box-shadow: var(--shadow);
}

.drawer-hero h3 {
  margin: 5px 0;
  font-size: 16px;
  line-height: 1.3;
}

.drawer-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.drawer-actions {
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.detail-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 11px;
}

.detail-box span,
.detail-box strong {
  display: block;
}

.detail-box span {
  color: var(--soft);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.detail-box strong {
  margin-top: 4px;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-section {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.drawer-section-head {
  display: flex;
  min-height: 53px;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #eceeef;
  padding: 11px 14px;
}

.drawer-section-head h4 {
  margin: 0;
  font-size: 12px;
}

.drawer-section-head span {
  margin-left: 5px;
  color: var(--soft);
  font-size: 9px;
}

.drawer-section-head .head-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9px;
}

.mini-table th,
.mini-table td {
  border-bottom: 1px solid #eff0f1;
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.mini-table th {
  background: #f8f8f6;
  color: var(--soft);
  font-size: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.mini-table td {
  color: #566173;
}

.section-empty {
  padding: 25px;
  color: var(--soft);
  font-size: 10px;
  text-align: center;
}

.modal-backdrop {
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal {
  width: min(690px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  border-radius: 17px;
  background: #fff;
  box-shadow: var(--shadow-lg);
}

.modal form {
  padding: 18px 20px 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}

.form-grid input,
.form-grid select {
  height: 40px;
  padding: 0 10px;
}

.form-grid textarea {
  resize: vertical;
  padding: 10px;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 19px;
}

.spacer {
  flex: 1;
}

.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 200;
  display: flex;
  width: min(390px, calc(100vw - 44px));
  flex-direction: column;
  gap: 9px;
}

.toast {
  border: 1px solid #dce0e2;
  border-left: 4px solid var(--teal);
  border-radius: 11px;
  background: #fff;
  color: #4f596a;
  padding: 12px 14px;
  box-shadow: 0 14px 40px rgba(16, 24, 44, 0.18);
  animation: toast-in 180ms ease-out;
}

.toast.error {
  border-left-color: var(--red);
}

.toast strong,
.toast span {
  display: block;
}

.toast strong {
  color: var(--ink);
  font-size: 11px;
}

.toast span {
  margin-top: 2px;
  font-size: 9px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.loading-page {
  padding-top: 5px;
}

.skeleton {
  overflow: hidden;
  border-radius: 10px;
  background: #e6e7e5;
}

.skeleton::after {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.62),
    transparent
  );
  content: "";
  animation: shimmer 1.3s infinite;
  transform: translateX(-100%);
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

.skeleton.line {
  height: 18px;
  margin-bottom: 10px;
}

.skeleton.line.lg {
  width: 260px;
}

.skeleton.line.sm {
  width: 420px;
  height: 11px;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 13px;
  margin: 26px 0 18px;
}

.skeleton.card {
  height: 126px;
}

.skeleton.table {
  height: 410px;
}

.backup-button {
  margin-top: 16px;
}

.help-callout {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px 18px;
  border: 1px solid #bfe5df;
  border-radius: 14px;
  background: #edf9f7;
  color: #285450;
}

.help-callout .decision-icon {
  flex: 0 0 auto;
  background: #d4f0eb;
  color: #14796f;
}

.help-callout strong,
.help-callout p {
  display: block;
}

.help-callout p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.55;
}

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

.help-step {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  padding: 20px;
}

.help-number {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: #e5f6f3;
  color: #087b74;
  font-size: 15px;
  font-weight: 800;
}

.help-step h2 {
  margin: 1px 0 8px;
  font-size: 14px;
}

.help-step p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.help-step small {
  display: block;
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: #6e7889;
  font-size: 10px;
  line-height: 1.5;
}

.help-routine {
  margin-top: 16px;
}

.help-routine ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 4px 24px 22px 46px;
  color: var(--muted);
  font-size: 12px;
}

.help-routine li {
  padding-left: 5px;
}

.help-routine strong {
  color: var(--ink);
}

.spin {
  animation: spin 850ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1240px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .dashboard-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .sync-meta {
    display: none;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .sidebar {
    width: 74px;
    padding: 18px 9px;
  }

  .brand {
    justify-content: center;
    padding: 0 0 22px;
  }

  .brand > div:last-child,
  .nav-item:not(.active) em,
  .nav-item {
    font-size: 0;
  }

  .nav-label,
  .connection-card {
    display: none;
  }

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 0;
  }

  .nav-item span {
    font-size: 18px;
  }

  .nav-item em {
    position: absolute;
    margin: -27px 0 0 28px;
    min-width: 18px;
    padding: 1px 5px;
    font-size: 8px;
  }

  .main {
    grid-column: 2;
  }

  .topbar {
    padding: 12px 16px;
  }

  .search-wrap {
    width: 100%;
  }

  .top-actions .btn {
    width: 42px;
    overflow: hidden;
    padding: 0;
    font-size: 0;
  }

  .top-actions .btn span {
    font-size: 17px;
  }

  .page {
    padding: 22px 17px 38px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail-grid,
  .summary-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 620px) {
  .topbar {
    gap: 8px;
  }

  .avatar,
  kbd {
    display: none;
  }

  .search-wrap {
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-heading .heading-actions {
    width: 100%;
    margin-left: 0;
  }

  .kpi-grid,
  .skeleton-grid,
  .help-grid,
  .settings-form,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .settings-form .span-2,
  .form-grid .span-2 {
    grid-column: span 1;
  }

  .drawer {
    width: 100%;
  }

  .drawer-hero {
    grid-template-columns: 1fr;
  }

  .drawer-actions {
    flex-wrap: wrap;
  }

  .detail-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .modal-actions .spacer {
    display: none;
  }
}

/* PCP Central v0.5 — importação, rascunhos e leitura ampliada */
.drawer {
  width: min(1320px, 97vw);
  max-width: 97vw;
}

.drawer-head { padding: 24px 30px; }
.drawer-head h2 { font-size: 30px; }
.drawer-head .eyebrow { font-size: 11px; }
.drawer-content { padding: 28px 34px 52px; font-size: 14px; }
.drawer-actions { margin: 14px 0 18px; }
.drawer-actions .btn { min-height: 46px; font-size: 14px; padding-inline: 20px; }
.drawer-section { padding: 22px 24px; margin-top: 16px; border-radius: 18px; }
.drawer-section > h4,
.section-title h4 { font-size: 18px; }
.section-title > span { font-size: 12px; }
.drawer-summary { gap: 12px; }
.drawer-summary > div { min-height: 94px; padding: 15px; border-radius: 13px; }
.drawer-summary > div > span:first-child { font-size: 10px; margin-bottom: 10px; }
.drawer-summary strong,
.drawer-summary .tag { font-size: 14px; }
.detail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.detail-box { min-height: 96px; padding: 14px 15px; border-radius: 12px; }
.detail-box span { font-size: 10px; }
.detail-box strong { margin-top: 7px; font-size: 14px; line-height: 1.45; }
.refresh-banner { padding: 13px 15px; font-size: 13px; }
.mini-table > div { padding: 12px 13px; font-size: 12px; gap: 11px; }
.mini-table > .mini-head { font-size: 10px; }
.mini-table strong { font-size: 13px; }
.mini-table small { font-size: 10px; }
.picking-mini > div { grid-template-columns: 1fr 1fr 2.1fr 1fr .45fr; }
.parts-mini > div { grid-template-columns: .9fr 1fr 2fr 1fr .7fr; min-width: 920px; }
.purchase-mini > div { grid-template-columns: .8fr .9fr 1.8fr 1fr 1fr .7fr; min-width: 1080px; }
.timeline strong { font-size: 14px; }
.timeline small,
.timeline b { font-size: 11px; }
.timeline > div { padding: 12px 4px; }
.history-list > div { grid-template-columns: 145px minmax(0, 1.55fr) minmax(220px, .85fr); padding: 13px 14px; gap: 14px; }
.history-list time,
.history-list span { font-size: 11px; }
.history-list strong { display: grid; gap: 3px; font-size: 13px; }
.history-list strong small { color: #52637a; font-size: 10px; }
.history-list > .history-repeat-old { background: #fff0f2; border-left: 5px solid #d74859; }
.history-list > .history-repeat-old strong,
.history-list > .history-repeat-old time { color: #ad3042; }

.client-picking-cards {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  margin: -2px 0 14px;
  padding: 2px 2px 7px;
}
.client-picking-cards article {
  display: grid;
  min-width: 170px;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  border: 1px solid #d9e5ed;
  border-radius: 13px;
  background: linear-gradient(145deg, #fff, #f1fbfa);
  padding: 11px 13px;
}
.client-picking-cards span { overflow: hidden; color: #52637a; font-size: 10px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.client-picking-cards strong { grid-row: 1 / 3; grid-column: 2; align-self: center; color: #0d8179; font-size: 23px; }
.client-picking-cards small { color: #8490a1; font-size: 9px; }

.multi-filter { position: relative; min-width: 0; }
.multi-filter > summary {
  display: flex;
  height: 40px;
  align-items: center;
  border: 1px solid #dfe2e5;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 34px 0 11px;
  cursor: pointer;
  list-style: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.multi-filter > summary::after { content: "⌄"; position: absolute; right: 12px; color: #718096; }
.multi-filter > div {
  position: absolute;
  z-index: 30;
  top: 44px;
  left: 0;
  width: min(430px, 75vw);
  max-height: 360px;
  overflow: auto;
  border: 1px solid #d8e0e8;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
  box-shadow: 0 18px 45px rgba(20, 37, 63, .18);
}
.multi-filter label { display: flex; align-items: center; gap: 9px; padding: 8px 9px; border-radius: 8px; cursor: pointer; font-size: 11px; }
.multi-filter label:hover { background: #edf8f7; }
.multi-filter input { width: 16px; height: 16px; accent-color: var(--teal); }
.multi-actions { display: flex; position: sticky; top: -8px; justify-content: space-between; gap: 8px; background: #fff; padding: 6px; }
.multi-actions button { border: 0; border-radius: 7px; background: #e8f6f4; color: #0a756e; padding: 7px 12px; cursor: pointer; font-weight: 800; }

.audit-explainer { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.audit-explainer article { display: grid; gap: 5px; border-left: 4px solid #e49d31; border-radius: 10px; background: #fff8e9; padding: 13px 15px; }
.audit-explainer span { color: #6f6048; line-height: 1.45; }

.program-type-manager { margin-bottom: 18px; overflow: hidden; }
.program-type-manager > summary { display: flex; justify-content: space-between; gap: 18px; padding: 17px 20px; cursor: pointer; }
.program-type-manager > summary span { color: #6f7d90; }
.program-type-manager form { display: grid; gap: 16px; border-top: 1px solid #e3e8ee; background: #f9fbfd; padding: 18px 20px; }
.saved-types { display: flex; gap: 10px; overflow-x: auto; border-top: 1px solid #e3e8ee; padding: 15px 20px; }
.saved-types article { display: grid; min-width: 210px; gap: 3px; border: 1px solid #dce5ed; border-radius: 11px; background: #fff; padding: 11px; }
.saved-types span,
.saved-types small { color: #718096; font-size: 10px; }
.batch-card.draft { border-color: #e7bd6f; background: linear-gradient(145deg, #fff, #fff9ec); }
.fixed-columns-note { display: grid; gap: 4px; border: 1px solid #bfe0d9; border-radius: 11px; background: #effaf7; padding: 13px 15px; }
.fixed-columns-note span { color: #52756f; }
.form-grid select,
#exportBase { width: 100%; min-height: 42px; border: 1px solid #dfe2e5; border-radius: 9px; background: #fff; padding: 0 11px; }

@media (max-width: 850px) {
  .drawer { width: 100vw; max-width: 100vw; }
  .drawer-content { padding: 18px 14px 40px; }
  .detail-grid { grid-template-columns: 1fr; }
  .audit-explainer { grid-template-columns: 1fr; }
}

/* PCP Central v0.4 — visual executivo, acessos granulares e auditoria */
:root {
  --v4-cyan: #10b7b2;
  --v4-blue: #3974f6;
  --v4-purple: #7c4dff;
  --v4-green: #16a66d;
  --v4-amber: #ef9d25;
  --v4-red: #df4b5f;
}

body {
  background:
    radial-gradient(circle at 85% 5%, rgba(57, 116, 246, .11), transparent 28%),
    radial-gradient(circle at 55% 0%, rgba(16, 183, 178, .10), transparent 24%),
    #f4f7fb;
}

.sidebar {
  background: linear-gradient(165deg, #101a35 0%, #172a4a 55%, #103f53 100%);
  box-shadow: 18px 0 45px rgba(14, 30, 58, .12);
}

.brand-mark {
  background: linear-gradient(135deg, #24d4c8, #5e82ff 58%, #9c5cff);
  box-shadow: 0 10px 28px rgba(60, 127, 238, .34);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(31, 208, 193, .21), rgba(91, 117, 255, .16));
  border-color: rgba(80, 222, 211, .25);
  color: #fff;
}

.nav-item.active::before {
  background: linear-gradient(#27d5c8, #7691ff);
  box-shadow: 0 0 16px rgba(39, 213, 200, .72);
}

.topbar {
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(16px);
  border-bottom-color: rgba(188, 201, 219, .6);
}

.page-heading {
  padding: 8px 2px;
}

.page-heading h1 {
  color: #132446;
  letter-spacing: -.035em;
}

.kpi-card {
  min-height: 145px;
  overflow: hidden;
  box-shadow: 0 16px 32px rgba(24, 45, 75, .08);
  transition: transform .18s ease, box-shadow .18s ease;
}

.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 42px rgba(24, 45, 75, .14);
}

.kpi-card.teal { background: linear-gradient(145deg, #ecfffd, #fff); border-top: 4px solid var(--v4-cyan); }
.kpi-card.blue { background: linear-gradient(145deg, #eef4ff, #fff); border-top: 4px solid var(--v4-blue); }
.kpi-card.purple { background: linear-gradient(145deg, #f5f0ff, #fff); border-top: 4px solid var(--v4-purple); }
.kpi-card.green { background: linear-gradient(145deg, #ecfbf4, #fff); border-top: 4px solid var(--v4-green); }
.kpi-card.amber { background: linear-gradient(145deg, #fff8ea, #fff); border-top: 4px solid var(--v4-amber); }

.btn-excel {
  color: #08783f;
  border: 1px solid #9dd8ba;
  background: #e9f8f0;
}

.btn-excel:hover { background: #d9f2e5; }

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

.chart-panel { min-height: 330px; }
.compact-chart { min-height: 250px; }

.metric-bars {
  display: grid;
  gap: 14px;
  padding: 4px 0;
}

.metric-bars > div > span {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 7px;
  color: #44536a;
}

.metric-bars b { font-size: 13px; }
.metric-bars em { font-style: normal; font-weight: 800; color: #152849; }
.metric-bars i { display: block; height: 9px; overflow: hidden; background: #e9eef5; border-radius: 999px; }
.metric-bars u { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--v4-cyan), #4b8cf7); text-decoration: none; }
.metric-bars.purple u { background: linear-gradient(90deg, #7655f8, #b26cf6); }
.metric-bars.amber u { background: linear-gradient(90deg, #ef9b25, #f3c34c); }
.metric-bars.blue u { background: linear-gradient(90deg, #3f79ef, #53b6ed); }
.metric-bars.green u { background: linear-gradient(90deg, #16a66d, #49c798); }

.insight-card {
  color: #fff;
  background: linear-gradient(145deg, #152b53, #174e61 60%, #157d78);
  border: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 250px;
}

.insight-card h2 { color: #fff; font-size: 30px; margin: 10px 0; }
.insight-card p { color: #d5e7ee; line-height: 1.6; }
.insight-card .btn { align-self: flex-start; margin-top: 14px; }

.coverage-banner,
.program-guard,
.rule-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 16px 20px;
  border: 1px solid #c8ddd9;
  border-radius: 16px;
  background: linear-gradient(90deg, #eafaf7, #f7fbff);
  margin-bottom: 16px;
}

.coverage-banner div:first-child { display: grid; gap: 4px; }
.coverage-banner span, .program-guard span { color: #607087; }
.coverage-track { width: min(360px, 34vw); height: 11px; background: #dfe9ec; border-radius: 999px; overflow: hidden; }
.coverage-track i { display: block; height: 100%; background: linear-gradient(90deg, #12b5aa, #477cf5); border-radius: inherit; }
.program-guard { border-color: #c9d6f4; background: #eef3ff; }
.rule-note { justify-content: flex-start; border-color: #ead8ab; background: #fff9eb; }

.alert-kpis,
.role-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.alert-kpis article,
.role-guide article {
  display: grid;
  gap: 6px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid #dbe2ec;
  background: #fff;
  box-shadow: 0 9px 22px rgba(28, 47, 77, .05);
}

.alert-kpis strong { font-size: 30px; color: #193052; }
.alert-kpis span, .role-guide span { color: #647189; line-height: 1.45; }
.role-guide em { color: #0c8566; font-style: normal; font-weight: 800; font-size: 12px; }

.print-profile { padding: 0; overflow: hidden; }
.print-profile summary { display: flex; justify-content: space-between; gap: 20px; padding: 16px 20px; cursor: pointer; }
.print-profile summary span { color: #68758a; }
.print-profile form { padding: 4px 20px 20px; display: grid; gap: 18px; }
.print-profile h3, .user-form h3 { margin: 0 0 10px; color: #263650; }

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

.permission-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #dfe5ed;
  border-radius: 10px;
  background: #f9fbfd;
  color: #405069;
  font-size: 12px;
  font-weight: 700;
}

.permission-grid label:has(input:checked) { border-color: #79c9bf; background: #ebfaf6; color: #0d776e; }
.permission-grid input { width: auto; accent-color: #119f99; }

.user-form-wide { margin-bottom: 18px; }
.user-base-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.access-user-list { gap: 10px; }
.user-access { border: 1px solid #dfe5ed; border-radius: 14px; background: #fff; overflow: hidden; }
.user-access summary { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 14px; cursor: pointer; }
.user-access summary > div:nth-child(2) { display: grid; gap: 2px; min-width: 0; }
.user-access summary span, .user-access summary small { color: #718096; }
.user-access summary > b { color: #178d87; font-size: 12px; }
.user-access-form { padding: 16px; border-top: 1px solid #e2e7ee; background: #f9fbfd; display: grid; gap: 16px; }

.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.eligibility-note { padding: 11px 14px; border-radius: 10px; background: #fff5df; color: #986515; font-weight: 800; }

.drawer {
  width: min(1220px, 96vw);
  max-width: 96vw;
}

.drawer-content { padding: 26px 30px 44px; }
.drawer-section { padding: 18px 20px; }
.detail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.detail-box { min-height: 82px; align-items: flex-start; }
.detail-box strong {
  display: block;
  width: 100%;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.mini-table > div { min-width: 0; }
.mini-table span { min-width: 0; overflow-wrap: anywhere; }
.mini-table small { display: block; margin-top: 3px; color: #7a8799; }
.picking-mini > div { grid-template-columns: 1.1fr 1fr 2.2fr 1fr .45fr; }

.tag-red { background: #ffe9ed; border-color: #f5bdc6; color: #ae2e42; }

@media (max-width: 1080px) {
  .analytics-grid { grid-template-columns: 1fr; }
  .permission-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-base-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .detail-grid, .alert-kpis, .role-guide, .permission-grid, .user-base-fields { grid-template-columns: 1fr; }
  .coverage-banner, .program-guard { align-items: stretch; flex-direction: column; }
  .coverage-track { width: 100%; }
  .user-access summary { grid-template-columns: 42px minmax(0, 1fr) auto; }
  .user-access summary > b { grid-column: 2 / -1; }
}

@media print {
  .sidebar,
  .topbar,
  .filters,
  .page-heading .heading-actions,
  .table-footer {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .main,
  .page {
    width: 100%;
    max-width: none;
    padding: 0;
  }

  .card,
  .kpi-card {
    box-shadow: none;
  }
}

/* PCP Central v0.3 — programação imediata, equipe e grandes volumes */
.app-locked {
  pointer-events: none;
  user-select: none;
  filter: blur(5px);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.panel + .panel,
.panel + .batch-grid {
  margin-top: 16px;
}

.panel-head {
  display: flex;
  min-height: 62px;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #eceeef;
  padding: 13px 17px;
}

.panel-head h2,
.panel-head p {
  margin: 0;
}

.panel-head h2 {
  font-size: 14px;
}

.panel-head p {
  margin-top: 2px;
  color: var(--soft);
  font-size: 10px;
}

.kpi-card > div,
.kpi-card > b {
  position: relative;
  z-index: 1;
}

.kpi-card > div > span,
.kpi-card > div > strong,
.kpi-card > div > small {
  display: block;
}

.kpi-card > div > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.kpi-card > div > strong {
  margin-top: 12px;
  font-size: 30px;
  letter-spacing: -0.04em;
  line-height: 1;
}

.kpi-card > div > small {
  margin-top: 9px;
  color: var(--soft);
  font-size: 10px;
}

.kpi-card > b {
  position: absolute;
  top: 17px;
  right: 17px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: var(--tone, var(--teal-soft));
  color: var(--tone-strong, var(--teal-dark));
  font-size: 16px;
}

.kpi-card.teal { --tone: var(--teal-soft); --tone-strong: var(--teal-dark); }
.kpi-card.blue { --tone: var(--blue-soft); --tone-strong: var(--blue); }
.kpi-card.green { --tone: var(--green-soft); --tone-strong: var(--green); }
.kpi-card.amber { --tone: var(--amber-soft); --tone-strong: #a66d0e; }
.kpi-card.purple { --tone: var(--purple-soft); --tone-strong: var(--purple); }

.decision-item {
  grid-template-columns: minmax(0, 1fr) auto;
  cursor: pointer;
  text-align: left;
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.decision-item:hover {
  border-color: #bfdeda;
  box-shadow: 0 7px 18px rgba(16, 24, 44, 0.06);
  transform: translateY(-1px);
}

.decision-item > span strong,
.decision-item > span small {
  display: block;
}

.decision-item > span small {
  margin-top: 2px;
  color: var(--soft);
  font-size: 10px;
}

.status-bars {
  display: grid;
  gap: 9px;
  padding: 15px;
}

.status-bars > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px dashed #e4e7e8;
  padding: 8px 2px;
}

.status-bars span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-bars strong {
  color: var(--teal-dark);
}

.data-table td > small,
.mini-table small {
  display: block;
  margin-top: 3px;
  color: var(--soft);
  font-size: 9px;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--teal-dark);
  padding: 0;
  cursor: pointer;
  font-weight: 850;
}

.link-button:hover {
  text-decoration: underline;
}

.check-cell {
  width: 42px;
  text-align: center !important;
}

.check-cell input,
.report-columns input,
.switch-row input {
  width: 17px;
  height: 17px;
  accent-color: var(--teal);
  cursor: pointer;
}

.filter-bar {
  display: grid;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafaf8;
  padding: 10px;
}

.wide-filters {
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(150px, 0.7fr));
}

.filter-bar input,
.filter-bar select,
.pagination select,
.user-form input,
.user-form select,
.auth-form input {
  min-width: 0;
  height: 40px;
  border: 1px solid #dfe2e5;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 11px;
  outline: 0;
}

.filter-bar input:focus,
.filter-bar select:focus,
.pagination select:focus,
.user-form input:focus,
.user-form select:focus,
.auth-form input:focus {
  border-color: #55bdb8;
  box-shadow: 0 0 0 3px rgba(17, 159, 153, 0.1);
}

.mass-toolbar {
  display: flex;
  min-height: 64px;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  border: 1px solid #dadddf;
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
  box-shadow: 0 4px 14px rgba(16, 24, 44, 0.04);
}

.mass-toolbar.active {
  border-color: #90cec9;
  background: linear-gradient(90deg, #eef9f8, #fff 42%);
}

.mass-toolbar > div {
  min-width: 210px;
  margin-right: auto;
}

.mass-toolbar strong,
.mass-toolbar span {
  display: block;
}

.mass-toolbar strong {
  font-size: 12px;
}

.mass-toolbar span {
  margin-top: 2px;
  color: var(--soft);
  font-size: 9px;
}

.pagination {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-top: 1px solid #eceeef;
  background: #fafaf8;
  color: var(--muted);
  padding: 9px 14px;
  font-size: 10px;
}

.pagination label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pagination select {
  height: 32px;
  padding: 0 8px;
}

.purchase-tabs {
  display: inline-flex;
  gap: 3px;
  margin-bottom: 10px;
  border: 1px solid #dde0e2;
  border-radius: 10px;
  background: #e9eae8;
  padding: 3px;
}

.purchase-tabs button {
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 0 17px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
}

.purchase-tabs button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 7px rgba(16, 24, 44, 0.08);
}

.purchase-filter {
  grid-template-columns: minmax(240px, 1fr) auto auto auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 8px;
}

.purchase-filter label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.period-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  border-left: 3px solid var(--teal);
  border-radius: 7px;
  background: var(--teal-soft);
  color: #315d5a;
  padding: 8px 11px;
  font-size: 10px;
}

.period-banner span {
  margin-left: auto;
  color: #5f817e;
}

.batch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.batch-card {
  display: grid;
  min-height: 210px;
  grid-template-rows: 1fr auto auto;
  gap: 14px;
  border: 1px solid var(--line);
  border-top: 4px solid #aab1ba;
  border-radius: var(--radius);
  background: #fff;
  padding: 18px;
  box-shadow: var(--shadow);
}

.batch-card.active {
  border-top-color: var(--teal);
}

.batch-card h2,
.batch-card p {
  margin: 0;
}

.batch-card h2 {
  margin-top: 5px;
  font-size: 17px;
}

.batch-card p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.batch-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  border-top: 1px solid #eceeef;
  padding-top: 12px;
}

.batch-meta span:not(.tag) {
  margin-right: auto;
  color: var(--soft);
  font-size: 9px;
}

.batch-actions {
  display: flex;
  gap: 7px;
}

.modal-wide {
  width: min(920px, calc(100vw - 34px));
}

.report-columns {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 8px;
  border: 1px solid #e0e3e5;
  border-radius: 10px;
  background: #fafaf8;
  padding: 14px;
}

.report-columns legend {
  color: #596375;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 800;
}

.report-columns label {
  display: flex;
  align-items: center;
  flex-direction: row;
  gap: 7px;
  border: 1px solid #e7e9ea;
  border-radius: 8px;
  background: #fff;
  padding: 7px 8px;
}

.report-columns input {
  flex: 0 0 auto;
}

.settings-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0 18px 18px;
}

.settings-form .panel-head {
  grid-column: 1 / -1;
  margin: 0 -18px 4px;
}

.settings-form input,
.settings-form select {
  width: 100%;
  height: 40px;
  border: 1px solid #dfe2e5;
  border-radius: 8px;
  background: #fff;
  padding: 0 11px;
}

.settings-actions {
  display: flex;
  grid-column: 1 / -1;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 5px;
}

.switch-row {
  grid-column: 1 / -1;
  display: flex !important;
  align-items: center;
  flex-direction: row !important;
  gap: 9px !important;
  border: 1px solid #dce7e5;
  border-radius: 9px;
  background: var(--teal-soft);
  padding: 10px 12px;
}

.settings-form .switch-row input {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  padding: 0;
}

.scope-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  padding: 17px;
}

.scope-list > div {
  border: 1px solid #e6e8e9;
  border-radius: 9px;
  background: #fafaf8;
  padding: 11px;
}

.scope-list span,
.scope-list strong {
  display: block;
}

.settings-side {
  display: grid;
  gap: 18px;
}

.product-card {
  overflow: hidden;
  position: relative;
  color: #fff;
  background: linear-gradient(135deg, #0b766e 0%, #1166a8 58%, #603cba 100%);
  border: 0;
}

.product-card::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -65px;
  top: -80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}

.product-card .eyebrow,
.product-card p,
.product-card small {
  color: rgba(255, 255, 255, .78);
}

.product-card h2,
.product-card strong {
  color: #fff;
}

.product-card small,
.product-card strong {
  display: block;
  margin-top: 12px;
  overflow-wrap: anywhere;
}

.scope-list span {
  color: var(--soft);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.scope-list strong {
  margin-top: 4px;
  font-size: 15px;
}

.settings-note {
  margin: 0 17px 17px;
  border-left: 3px solid var(--amber);
  background: var(--amber-soft);
  color: #77541c;
  padding: 9px 11px;
  font-size: 10px;
}

.team-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.45fr) minmax(420px, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.user-form {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 0 17px 17px;
}

.user-form .panel-head {
  margin: 0 -17px;
}

.user-form label,
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #596375;
  font-size: 10px;
  font-weight: 750;
}

.user-list,
.activity-list {
  display: grid;
}

.user-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #eceeef;
  padding: 12px 16px;
}

.user-row:last-child,
.activity-row:last-child {
  border-bottom: 0;
}

.user-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 10px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 10px;
  font-weight: 900;
}

.user-row strong,
.user-row span:not(.tag),
.user-row small {
  display: block;
}

.user-row span:not(.tag),
.user-row small {
  color: var(--soft);
  font-size: 9px;
}

.activity-panel {
  max-height: 560px;
}

.activity-list {
  max-height: 490px;
  overflow: auto;
}

.activity-row {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid #eceeef;
  padding: 11px 17px;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px var(--teal-soft);
}

.activity-row strong,
.activity-row span,
.activity-row time {
  display: block;
}

.activity-row strong {
  font-size: 10px;
  text-transform: capitalize;
}

.activity-row span,
.activity-row time {
  color: var(--soft);
  font-size: 9px;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  overflow: auto;
  background:
    radial-gradient(circle at 20% 15%, rgba(37, 205, 195, 0.2), transparent 28%),
    linear-gradient(145deg, rgba(16, 24, 44, 0.97), rgba(23, 35, 61, 0.96));
  padding: 24px;
}

.auth-screen[hidden] {
  display: none;
}

.auth-card {
  width: min(430px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.98);
  padding: 30px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.33);
}

.auth-brand {
  border-bottom: 1px solid #e8eaeb;
  margin-bottom: 24px;
  padding: 0 0 20px;
}

.auth-brand strong {
  color: var(--ink);
}

.auth-brand span {
  color: var(--soft);
}

.auth-card h1 {
  margin: 6px 0;
  font-size: 25px;
  letter-spacing: -0.035em;
}

.auth-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.auth-form {
  display: grid;
  gap: 13px;
  margin-top: 20px;
}

.auth-form .btn {
  margin-top: 5px;
}

.auth-error {
  margin-top: 14px !important;
  border: 1px solid #efc6cb;
  border-radius: 8px;
  background: var(--red-soft);
  color: #a23c48 !important;
  padding: 9px 10px;
}

.refresh-banner {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #cfdbea;
  border-radius: 9px;
  background: var(--blue-soft);
  color: #3d5d8f;
  padding: 9px 11px;
  font-size: 10px;
  font-weight: 750;
}

.refresh-banner.success {
  border-color: #bfdecf;
  background: var(--green-soft);
  color: var(--green);
}

.refresh-banner.warning {
  margin-top: 7px;
  border-color: #ead3a8;
  background: var(--amber-soft);
  color: #7a571f;
}

.drawer-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.drawer-summary > div {
  border: 1px solid #e5e8e9;
  border-radius: 9px;
  background: #fafaf8;
  padding: 9px;
}

.drawer-summary > div > span:first-child {
  display: block;
  margin-bottom: 6px;
  color: var(--soft);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.drawer-section > h4,
.section-title h4 {
  margin: 0;
  font-size: 12px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-title > span {
  color: var(--soft);
  font-size: 9px;
}

.program-strip {
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-left: 4px solid var(--teal);
  background: var(--teal-soft);
}

.program-strip span {
  color: #5f817e;
  font-size: 9px;
}

.detail-grid {
  margin-top: 10px;
}

.detail-box {
  min-width: 0;
  border: 1px solid #e7e9ea;
  border-radius: 8px;
  background: #fafaf8;
  padding: 8px;
}

.detail-box span,
.detail-box strong {
  display: block;
}

.detail-box span {
  color: var(--soft);
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-box strong {
  overflow-wrap: anywhere;
  margin-top: 3px;
  font-size: 10px;
}

.mini-table {
  display: grid;
  gap: 0;
  overflow-x: auto;
  border: 1px solid #e5e8e9;
  border-radius: 9px;
}

.mini-table > div {
  display: grid;
  min-width: 610px;
  grid-template-columns: 0.8fr 1.8fr 1fr 0.55fr;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #eceeef;
  padding: 8px 10px;
  font-size: 9px;
}

.mini-table > div:last-child {
  border-bottom: 0;
}

.mini-table > .mini-head {
  background: #f1f3f3;
  color: var(--soft);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.empty-inline {
  border: 1px dashed #d9dddf;
  border-radius: 9px;
  background: #fafaf8;
  color: var(--soft);
  padding: 13px;
  font-size: 10px;
  text-align: center;
}

.timeline {
  display: grid;
}

.timeline > div {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: start;
  gap: 9px;
  padding: 8px 2px;
}

.timeline > div > span {
  width: 10px;
  height: 10px;
  margin-top: 3px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 2px #a9d8d4;
}

.timeline strong,
.timeline small {
  display: block;
}

.timeline strong {
  font-size: 10px;
}

.timeline small,
.timeline b {
  color: var(--soft);
  font-size: 8px;
}

.history-list {
  display: grid;
  max-height: 410px;
  overflow: auto;
  border: 1px solid #e5e8e9;
  border-radius: 9px;
}

.history-list > div {
  display: grid;
  grid-template-columns: 105px minmax(0, 1.4fr) minmax(170px, 0.8fr);
  gap: 9px;
  border-bottom: 1px solid #eceeef;
  padding: 8px 10px;
}

.history-list > div:last-child {
  border-bottom: 0;
}

.history-list time,
.history-list span {
  color: var(--soft);
  font-size: 8px;
}

.history-list strong {
  font-size: 9px;
}

.exclusion-alert {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 9px;
  border: 1px solid #efc6cb;
  border-radius: 9px;
  background: var(--red-soft);
  color: #a23c48;
  padding: 10px;
  font-size: 9px;
}

.drawer-loading {
  display: grid;
  min-height: 240px;
  place-items: center;
  color: var(--soft);
}

.help-step {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: start;
  gap: 13px;
}

.help-step > span {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-weight: 900;
}

@media (max-width: 1150px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .wide-filters {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .report-columns {
    grid-template-columns: repeat(3, minmax(130px, 1fr));
  }

  .team-layout {
    grid-template-columns: minmax(260px, 0.55fr) minmax(360px, 1fr);
  }
}

@media (max-width: 850px) {
  .page-actions {
    width: 100%;
    margin-left: 0;
  }

  .mass-toolbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .mass-toolbar > div {
    width: 100%;
    flex-basis: 100%;
  }

  .purchase-filter,
  .settings-grid,
  .team-layout {
    grid-template-columns: 1fr;
  }

  .report-columns {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .drawer-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .wide-filters,
  .settings-form,
  .report-columns,
  .scope-list,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .pagination {
    align-items: stretch;
    flex-direction: column;
    text-align: center;
  }

  .pagination label {
    justify-content: center;
  }

  .user-row {
    grid-template-columns: 38px minmax(0, 1fr) auto;
  }

  .user-row .btn {
    grid-column: 1 / -1;
  }

  .history-list > div {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: 22px;
  }
}
