:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #67738a;
  --line: #e1e6ef;
  --accent: #d71920;
  --accent-dark: #a90f15;
  --soft: #fff1f1;
  --ok: #138a49;
  --warn: #b86b00;
}

.data-update-button {
  border-color: #0f766e;
  color: #0f766e;
}

.update-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.update-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

.update-panel input[type="file"],
.update-panel input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.primary-update-button {
  border: 0;
  border-radius: 8px;
  padding: 14px 18px;
  background: #e30613;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.secondary-update-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.update-status {
  min-height: 24px;
  color: var(--muted);
  line-height: 1.45;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.hidden { display: none !important; }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #f7f9fc 0%, #eef2f8 100%);
}

.login-panel {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 18px 50px rgba(23, 32, 51, 0.10);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}

.brand.small { margin-bottom: 18px; }

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--accent);
  font-weight: 700;
  font-size: 24px;
}

h1, h2, h3, p { margin: 0; }

.brand h1, .brand h2 { line-height: 1.1; }
.brand p, .eyebrow, .user-box, .demo-access, .date-chip { color: var(--muted); }

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

label { display: grid; gap: 7px; font-size: 14px; font-weight: 600; }

input, select, button {
  font: inherit;
  border-radius: 8px;
}

input, select {
  border: 1px solid var(--line);
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

button {
  border: 0;
  background: var(--accent);
  color: #fff;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 700;
}

button:hover { background: var(--accent-dark); }

.outline-button {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.outline-button:hover {
  background: var(--soft);
}

.ghost {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--line);
}

.ghost:hover { background: var(--soft); }

.login-error {
  min-height: 20px;
  color: var(--accent);
  font-size: 14px;
}

.demo-access {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 7px;
  font-size: 13px;
}

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

.sidebar {
  background: #101827;
  color: #fff;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar .brand p, .sidebar .user-box { color: #aeb8c9; }

.user-box {
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
}

nav {
  display: grid;
  gap: 6px;
  overflow: auto;
}

.nav-item {
  width: 100%;
  text-align: left;
  background: transparent;
  color: #dce4f2;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 600;
}

.nav-item.active, .nav-item:hover {
  background: rgba(255,255,255,0.10);
}

.content {
  padding: 26px;
  display: grid;
  gap: 20px;
  align-content: start;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 5px;
}

.date-chip {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

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

.metric, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric {
  padding: 16px;
  display: grid;
  gap: 8px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  font-size: 24px;
}

.metric small {
  color: var(--muted);
}

.income-panel {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.income-panel p {
  color: var(--muted);
  margin-top: 5px;
}

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

.income-line {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 7px;
  background: #fbfcff;
}

.income-line span {
  color: var(--muted);
  font-size: 12px;
}

.income-line strong {
  font-size: 18px;
}

.income-line.total {
  border-color: rgba(19, 138, 73, .25);
  background: #e9f7ef;
}

.income-line.minus strong {
  color: var(--warn);
}

.income-note {
  font-size: 13px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 39, .56);
}

.modal-panel {
  position: relative;
  width: min(1080px, 100%);
  max-height: min(86vh, 860px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(16, 24, 39, .25);
}

.modal.wide-task-modal .modal-panel {
  width: min(1480px, calc(100vw - 32px));
}

.close-button {
  padding: 8px 10px;
}

.grt-block {
  display: grid;
  gap: 8px;
}

.grt-block h4 {
  margin: 0;
}

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

.grt-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 6px;
  cursor: default;
}

.grt-card span,
.grt-card small {
  color: var(--muted);
}

.zone-red {
  border-color: rgba(215, 25, 32, .3);
  background: #fff5f5;
}

.zone-white {
  border-color: #d8dee9;
  background: #fff;
}

.zone-blue {
  border-color: rgba(25, 90, 168, .25);
  background: #f1f6ff;
}

.grt-tooltip {
  position: absolute;
  left: 12px;
  right: 12px;
  top: calc(100% + 8px);
  z-index: 5;
  display: none;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(23, 32, 51, .16);
  font-size: 13px;
}

.grt-tooltip span {
  color: var(--ink);
}

.grt-card:hover .grt-tooltip {
  display: grid;
}

.pdz-penalty {
  display: grid;
  gap: 10px;
}

.pdz-penalty h4 {
  margin: 0;
}

.penalty-formula {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.penalty-formula span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fffdf8;
}

.pdz-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.pdz-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px minmax(180px, .45fr);
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.pdz-row:last-child {
  border-bottom: 0;
}

.pdz-row span {
  font-weight: 700;
  color: var(--warn);
}

.pdz-row small {
  color: var(--muted);
}

.planning-panel {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.planning-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 12px;
}

.planning-card h4 {
  margin: 0;
}

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

.planning-grid div {
  background: #fbfcff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 5px;
}

.planning-grid span,
.planning-grid small {
  color: var(--muted);
  font-size: 12px;
}

.planning-grid strong {
  font-size: 18px;
}

.progress {
  height: 6px;
  border-radius: 999px;
  background: #e8edf5;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.planning-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.planning-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 190px 190px;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.planning-row:last-child {
  border-bottom: 0;
}

.sales-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.sales-table-row {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) repeat(6, minmax(96px, .55fr));
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.sales-table-row:last-child {
  border-bottom: 0;
}

.sales-table-row:not(.sales-table-head):hover {
  background: #f3f6fb;
}

.sales-table-row strong small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 500;
}

.sales-table-head {
  background: #fbfcff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.sales-total-row {
  background: #f7faff;
  font-weight: 700;
}

.sales-table-row.ok span:last-child {
  color: var(--ok);
  font-weight: 700;
}

.sales-table-row.warn span:last-child {
  color: var(--warn);
  font-weight: 700;
}

.sales-table-row.info span:last-child {
  color: #195aa8;
  font-weight: 700;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  gap: 16px;
}

.branch-dashboard .two-col {
  grid-template-columns: 1fr;
}

.branch-dashboard .two-col > .panel:last-child,
.route-cabinet-dashboard .two-col > .panel:last-child {
  display: none;
}

.route-cabinet-dashboard .two-col {
  grid-template-columns: 1fr;
}

.route-cabinet-dashboard .metrics,
.manager-cabinet-dashboard .metrics {
  display: none;
}

.manager-cabinet-dashboard .two-col {
  grid-template-columns: 1fr;
}

.manager-cabinet-dashboard .two-col > .panel:last-child {
  display: none;
}

.manager-work-dashboard {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.manager-work-table {
  display: grid;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.manager-work-row {
  display: grid;
  grid-template-columns: minmax(100px, .35fr) minmax(260px, 1fr) minmax(170px, .55fr) minmax(300px, 1.1fr) minmax(300px, 1fr);
  min-width: 1160px;
  border-bottom: 1px solid var(--line);
}

.manager-work-row:last-child {
  border-bottom: 0;
}

.manager-work-row > div,
.manager-work-row > strong {
  padding: 12px;
  border-right: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.35;
}

.manager-work-row > div:last-child,
.manager-work-row > strong:last-child {
  border-right: 0;
}

.manager-work-head {
  background: #f7f9fd;
  color: var(--muted);
}

.manager-work-row small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.branch-dashboard .panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
}

.branch-dashboard .panel-head {
  padding: 18px 20px;
}

.branch-dashboard .panel-head h3 {
  font-size: 22px;
}

.branch-dashboard .panel-head span {
  color: var(--muted);
}

.panel { min-width: 0; }

.panel-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.task-list {
  max-height: 620px;
  overflow: auto;
}

.branch-dashboard .task-list {
  max-height: none;
  overflow: visible;
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 14px;
  padding: 16px;
}

.client-card {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
}

.client-card:last-child {
  border-bottom: 0;
}

.client-card-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.client-card-main p {
  color: var(--muted);
  margin-top: 4px;
  font-size: 13px;
}

.task-type-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.task-type-button {
  padding: 8px 10px;
  background: #eef2f8;
  color: #354158;
  border: 1px solid transparent;
  font-size: 13px;
}

.task-type-button:hover {
  background: #e1e7f2;
}

.task-type-button span {
  margin-left: 5px;
  font-weight: 700;
}

.task-type-button.warn {
  background: #fff6e8;
  color: var(--warn);
}

.task-type-button.smart {
  background: #eef7f1;
  color: #14733f;
}

.task-type-button.vip {
  background: var(--soft);
  color: var(--accent-dark);
}

.task-type-button.info {
  background: #e8f1ff;
  color: #195aa8;
}

.client-task-body {
  display: grid;
}

.route-dashboard {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.route-dashboard-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcff;
}

.route-dashboard-head strong {
  font-size: 20px;
}

.route-dashboard-head p {
  margin-top: 5px;
  color: var(--muted);
}

.route-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.route-date-picker {
  display: grid;
  gap: 4px;
  min-width: 210px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.route-date-picker select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.route-point-list {
  display: grid;
  gap: 12px;
}

.route-work-table {
  display: grid;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.route-work-row {
  display: grid;
  grid-template-columns: 56px minmax(280px, .9fr) minmax(260px, .8fr) minmax(420px, 1.3fr);
  min-width: 1040px;
  border-bottom: 1px solid var(--line);
}

.route-work-row:last-child {
  border-bottom: 0;
}

.route-work-row > div,
.route-work-row > strong {
  padding: 12px;
  border-right: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.35;
}

.route-work-row > div:last-child,
.route-work-row > strong:last-child {
  border-right: 0;
}

.route-work-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f7f9fd;
  color: var(--muted);
}

.route-work-num {
  font-size: 18px;
  font-weight: 800;
  text-align: center;
}

.route-work-row small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.route-work-meta {
  display: grid;
  gap: 5px;
}

.route-work-tasks {
  display: grid;
  gap: 10px;
}

.route-table-task-group {
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid #e8edf6;
  border-radius: 8px;
  background: #fbfcff;
}

.route-table-task-group h4 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.route-table-task {
  display: grid;
  gap: 7px;
  padding-top: 7px;
  border-top: 1px solid #edf1f7;
}

.route-table-task:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.route-table-task-main {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.route-table-task-main span:last-child {
  font-weight: 700;
}

.task-followup {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  padding: 9px;
  border: 1px dashed #d7deea;
  border-radius: 8px;
  background: #fffdf8;
}

.task-followup label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.task-followup input,
.task-followup select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 9px;
  font: inherit;
  font-size: 13px;
}

.task-followup small {
  color: var(--warn);
  font-weight: 700;
}

.route-no-task {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f1f4f8;
  color: var(--muted);
  font-weight: 700;
}

.route-point-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(23, 32, 51, .04);
}

.route-point-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.route-point-head strong {
  font-size: 18px;
}

.route-point-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.route-point-details {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.route-point-details span {
  max-width: 100%;
}

.route-point-details b {
  color: var(--ink);
}

.route-point-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.route-point-tasks {
  display: grid;
  gap: 12px;
}

.route-task-group {
  display: grid;
  gap: 8px;
}

.route-task-group h4 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.manager-control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.manager-control-card {
  box-shadow: 0 10px 24px rgba(23, 32, 51, .04);
}

.route-registry-list {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.branch-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid transparent;
  border-radius: 10px;
  display: grid;
  gap: 12px;
  width: 100%;
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 10px 24px rgba(23, 32, 51, .05);
}

.branch-card:last-child {
  border-bottom: 0;
}

.branch-action-card {
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}

.branch-action-card:hover {
  background: #ffffff;
  border-color: #cfd8e8;
  box-shadow: 0 18px 34px rgba(23, 32, 51, .10);
  transform: translateY(-2px);
}

.branch-action-card:focus {
  outline: 2px solid rgba(47, 111, 237, .22);
  outline-offset: -2px;
}

.branch-card.smart {
  border-left-color: #1f8a4c;
}

.branch-card.info {
  border-left-color: #4c8ddf;
}

.branch-card.vip {
  border-left-color: var(--accent);
}

.branch-card.warn {
  border-left-color: var(--warn);
}

.branch-card.sales {
  border-left-color: #2f6fed;
}

.branch-card.tainiki {
  border-left-color: #7c3aed;
}

.branch-card .client-card-main {
  min-height: 74px;
  align-items: center;
}

.branch-card .client-card-main p {
  margin-top: 4px;
}

.branch-card-copy {
  min-width: 0;
}

.branch-card-copy strong {
  font-size: 20px;
}

.branch-card-copy small {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  font-weight: 700;
}

.branch-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #eef4ff;
  color: #2f6fed;
  font-weight: 800;
  font-size: 18px;
}

.branch-card.smart .branch-icon {
  background: #eaf7ef;
  color: #14733f;
}

.branch-card.info .branch-icon {
  background: #e8f1ff;
  color: #195aa8;
}

.branch-card.vip .branch-icon {
  background: var(--soft);
  color: var(--accent-dark);
}

.branch-card.warn .branch-icon {
  background: #fff6e8;
  color: var(--warn);
}

.branch-card.tainiki .branch-icon {
  background: #f1ebff;
  color: #6d28d9;
}

.branch-action-label,
.branch-total-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  color: var(--ink);
  padding: 8px 12px;
  white-space: nowrap;
  font-weight: 700;
}

.branch-task-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.branch-task-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(90px, .55fr));
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.branch-task-row:last-child {
  border-bottom: 0;
}

.branch-task-row:not(.branch-task-head):hover {
  background: #f3f6fb;
}

.branch-task-head {
  background: #fbfcff;
  color: var(--muted);
  font-size: 12px;
}

.branch-rop-row {
  font-weight: 700;
  background: #fbfcff;
}

.branch-task-row.warn,
.branch-total-button.warn,
.branch-action-label.warn {
  color: var(--warn);
}

.branch-task-row.smart,
.branch-total-button.smart,
.branch-action-label.smart {
  color: #14733f;
}

.branch-task-row.vip,
.branch-total-button.vip,
.branch-action-label.vip {
  color: var(--accent-dark);
}

.branch-task-row.info,
.branch-total-button.info,
.branch-action-label.info {
  color: #195aa8;
}

.branch-total-button.sales,
.branch-action-label.sales {
  color: #2f6fed;
}

.branch-action-label.tainiki {
  color: #6d28d9;
}

.branch-result-row {
  grid-template-columns: minmax(0, 1fr) minmax(120px, .45fr);
}

.branch-result-row.ok,
.badge.ok {
  color: var(--ok);
}

.branch-result-row.warn,
.badge.warn {
  color: var(--warn);
}

.branch-result-row.info,
.badge.info {
  color: #195aa8;
}

.branch-grt-card {
  border-left: 4px solid #1f8a4c;
}

.branch-grt-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.branch-grt-row {
  display: grid;
  grid-template-columns: minmax(150px, .8fr) minmax(210px, 1.2fr) minmax(210px, 1.2fr) minmax(70px, .35fr) minmax(90px, .4fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.branch-grt-row:last-child {
  border-bottom: 0;
}

.branch-grt-row:not(.branch-task-head):hover {
  background: #f3f6fb;
}

.branch-grt-row > span {
  display: grid;
  gap: 3px;
}

.branch-grt-row small {
  color: var(--muted);
  font-size: 12px;
}

.branch-grt-row.smart {
  color: #14733f;
}

.branch-grt-row.warn {
  color: var(--warn);
}

.branch-grt-modal-table {
  width: 100%;
  overflow-x: auto;
}

.branch-grt-result-row {
  display: grid;
  grid-template-columns: minmax(240px, 1.3fr) minmax(130px, .65fr) minmax(70px, .35fr) minmax(240px, 1fr) minmax(90px, .42fr) minmax(220px, .95fr) minmax(90px, .42fr);
  min-width: 1080px;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.branch-grt-result-row:last-child {
  border-bottom: 0;
}

.branch-grt-result-row.zone-red {
  background: #fff4f4;
}

.branch-grt-result-row.zone-white {
  background: #fff;
}

.branch-grt-result-row.zone-blue {
  background: #f0f6ff;
}

.branch-grt-result-row .zone-red {
  color: #b3261e;
  font-weight: 700;
}

.branch-grt-result-row .zone-white {
  color: var(--ink);
  font-weight: 700;
}

.branch-grt-result-row .zone-blue {
  color: #195aa8;
  font-weight: 700;
}

.grt-boundary-row {
  font-weight: 700;
}

.grt-excel-table {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #aeb6a0;
  border-radius: 6px;
  background: #fff;
}

.grt-excel-row {
  display: grid;
  grid-template-columns:
    minmax(310px, 1.7fr)
    minmax(145px, .8fr)
    minmax(100px, .55fr)
    minmax(80px, .45fr)
    minmax(150px, .85fr)
    minmax(150px, .85fr)
    minmax(170px, .9fr)
    minmax(170px, .9fr);
  min-width: 1280px;
}

.grt-excel-row > div {
  position: relative;
  min-height: 21px;
  padding: 3px 5px;
  border-right: 1px solid #b7b7b7;
  border-bottom: 1px solid #b7b7b7;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 12px;
  color: #4f3b13;
  background: #f1efcf;
}

.grt-excel-row > div:first-child,
.grt-excel-row > div:nth-child(2) {
  justify-content: flex-start;
  text-align: left;
}

.grt-excel-header > div {
  min-height: 72px;
  font-weight: 700;
  font-size: 14px;
  background: #ecebc8;
}

.grt-excel-leader > div,
.grt-excel-blue > div {
  font-weight: 700;
}

.grt-excel-row .excel-manager-cell {
  background: #b7b7b7;
  color: #3d321f;
}

.grt-excel-row .excel-leader-cell {
  background: #f1efcf;
  font-weight: 700;
}

.grt-excel-row .excel-blue-boundary-cell {
  background: #f1efcf;
  font-weight: 700;
}

.grt-excel-row .excel-zone-red {
  background: #ff9d7f;
}

.grt-excel-row .excel-zone-blue {
  background: #91cdf8;
}

.grt-task-cell {
  position: relative;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font: inherit;
  text-align: center;
}

.grt-task-cell.ok {
  color: var(--ok);
}

.grt-task-cell.info {
  color: #195aa8;
}

.grt-task-cell.warn {
  color: var(--warn);
}

.grt-task-tooltip {
  display: none;
  position: absolute;
  z-index: 40;
  left: 50%;
  top: calc(100% + 6px);
  width: 360px;
  max-height: 360px;
  overflow: auto;
  transform: translateX(-50%);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 35px rgba(21, 31, 51, .18);
  color: var(--ink);
  text-align: left;
  white-space: normal;
}

.grt-task-tooltip p {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.grt-task-tooltip span {
  color: var(--muted);
}

.grt-task-cell:hover .grt-task-tooltip,
.grt-task-cell:focus .grt-task-tooltip {
  display: block;
}

.falling-lost-table {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.falling-lost-sections {
  display: grid;
  gap: 18px;
}

.falling-lost-section {
  display: grid;
  gap: 10px;
}

.falling-lost-section h4 {
  margin: 0;
  font-size: 16px;
  color: var(--ink);
}

.falling-lost-row {
  display: grid;
  grid-template-columns:
    minmax(210px, .9fr)
    minmax(260px, 1.2fr)
    minmax(150px, .65fr)
    minmax(150px, .65fr)
    minmax(380px, 1.8fr)
    minmax(120px, .55fr);
  min-width: 1360px;
  border-bottom: 1px solid var(--line);
}

.falling-lost-row:last-child {
  border-bottom: 0;
}

.falling-lost-row > * {
  padding: 10px;
  border-right: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.35;
}

.falling-lost-row > *:last-child {
  border-right: 0;
  position: sticky;
  right: 0;
  background: #fff;
  box-shadow: -1px 0 0 var(--line);
}

.falling-lost-head {
  background: #fbfcff;
  color: var(--muted);
  font-size: 12px;
}

.falling-lost-head > *:last-child {
  background: #fbfcff;
}

.falling-lost-row:not(.falling-lost-head):hover {
  background: #f6f8fc;
}

.falling-lost-row b {
  display: block;
  margin-bottom: 4px;
}

.falling-lost-row small {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef3fb;
  color: var(--muted);
  font-size: 11px;
}

.falling-lost-row.ok > *:last-child {
  color: var(--ok);
  font-weight: 700;
}

.falling-lost-row.info > *:last-child {
  color: #195aa8;
  font-weight: 700;
}

.falling-lost-row.warn > *:last-child {
  color: var(--warn);
  font-weight: 700;
}

.falling-lost-manager-row {
  min-width: 1360px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  background: #f5f7fb;
  color: var(--ink);
  font-size: 13px;
}

.asz-table {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.asz-row {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(360px, 1.5fr) minmax(190px, .7fr);
  border-bottom: 1px solid var(--line);
}

.asz-row:last-child {
  border-bottom: 0;
}

.asz-row > * {
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.35;
}

.asz-row > *:last-child {
  border-right: 0;
}

.asz-head {
  background: #fbfcff;
  color: var(--muted);
}

.asz-row:not(.asz-head):hover {
  background: #f6f8fc;
}

.asz-row.ok > *:last-child {
  color: var(--ok);
  font-weight: 700;
}

.asz-row.info > *:last-child {
  color: #195aa8;
  font-weight: 700;
}

.asz-row.warn > *:last-child {
  color: var(--warn);
  font-weight: 700;
}

.choice-status {
  display: grid;
  gap: 7px;
}

.choice-status > strong {
  color: var(--ink);
}

.choice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.choice-actions button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  padding: 6px 9px;
  font-weight: 700;
  cursor: pointer;
}

.choice-actions button:hover {
  border-color: #c8d3e4;
  background: #f8fafc;
}

.choice-actions button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.vip-table {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.vip-row {
  display: grid;
  grid-template-columns: minmax(220px, .75fr) minmax(300px, 1fr) minmax(420px, 1.35fr) minmax(290px, .9fr);
  min-width: 1230px;
  border-bottom: 1px solid var(--line);
}

.vip-row:last-child {
  border-bottom: 0;
}

.vip-row > * {
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.35;
}

.vip-row > *:last-child {
  border-right: 0;
}

.vip-head {
  background: #fbfcff;
  color: var(--muted);
}

.vip-row:not(.vip-head):hover {
  background: #f6f8fc;
}

.vip-row p {
  margin: 0 0 6px;
}

.vip-row p:last-child {
  margin-bottom: 0;
}

.vip-row.ok > *:last-child {
  color: var(--ok);
  font-weight: 700;
}

.vip-row.info > *:last-child {
  color: #195aa8;
  font-weight: 700;
}

.vip-row.warn > *:last-child {
  color: var(--warn);
  font-weight: 700;
}

.lp-training-table {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.lp-training-row {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(320px, 1.2fr) minmax(150px, .55fr) minmax(145px, .55fr) minmax(145px, .55fr) minmax(130px, .5fr) minmax(170px, .65fr) minmax(330px, 1.25fr) minmax(130px, .5fr) minmax(145px, .55fr);
  min-width: 1880px;
  border-bottom: 1px solid var(--line);
}

.lp-training-row:last-child {
  border-bottom: 0;
}

.lp-training-row > * {
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.35;
}

.lp-training-row > *:last-child {
  border-right: 0;
}

.lp-training-head {
  background: #f5f9ff;
  color: var(--muted);
}

.lp-training-row:not(.lp-training-head):hover {
  background: #f7fbff;
}

.lp-training-row small {
  display: inline-flex;
  margin: 0 4px 4px 0;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef4ff;
  color: #195aa8;
}

.lp-training-row p {
  margin: 0 0 6px;
}

.lp-training-row p:last-child {
  margin-bottom: 0;
}

.lp-training-row .fact-cell.ok {
  color: var(--ok);
  font-weight: 800;
}

.lp-training-row .fact-cell.info {
  color: #195aa8;
  font-weight: 800;
}

.lp-training-row .fact-cell.warn {
  color: var(--warn);
  font-weight: 800;
}

.pdz-branch-table {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.pdz-branch-row {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(300px, 1.1fr) minmax(130px, .5fr) minmax(130px, .5fr) minmax(360px, 1.4fr) minmax(140px, .5fr);
  min-width: 1320px;
  border-bottom: 1px solid var(--line);
}

.pdz-branch-row:last-child {
  border-bottom: 0;
}

.pdz-branch-row > * {
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.35;
}

.pdz-branch-row > *:last-child {
  border-right: 0;
}

.pdz-branch-head {
  background: #fffaf2;
  color: var(--muted);
}

.pdz-branch-row:not(.pdz-branch-head):hover {
  background: #fffdf8;
}

.pdz-branch-row p {
  margin: 0 0 6px;
}

.pdz-branch-row p:last-child {
  margin-bottom: 0;
}

.pdz-detail-list {
  display: grid;
  gap: 8px;
}

.pdz-detail-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 9px;
  border: 1px solid #f4d6bd;
  border-radius: 8px;
  background: #fffaf2;
}

.pdz-detail-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.pdz-detail-info span {
  color: var(--text);
  line-height: 1.25;
}

.pdz-detail-info b {
  color: var(--muted);
  font-weight: 700;
}

.pdz-detail-line strong {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: #ffe1d6;
  color: #b3261e;
  box-shadow: inset 0 0 0 1px rgba(179, 38, 30, .18);
}

.pdz-overdue-amount {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 8px;
  background: #ffe1d6;
  color: #b3261e;
  box-shadow: inset 0 0 0 1px rgba(179, 38, 30, .18);
  font-size: 14px;
  font-weight: 800;
}

.pdz-branch-row.ok > *:last-child {
  color: var(--ok);
  font-weight: 700;
}

.pdz-branch-row.info > *:last-child {
  color: #195aa8;
  font-weight: 700;
}

.pdz-branch-row.warn > *:last-child {
  color: var(--warn);
  font-weight: 700;
}

.tainiki-table {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.tainiki-row {
  display: grid;
  grid-template-columns:
    minmax(0, 1.05fr)
    minmax(0, .55fr)
    minmax(0, 1fr)
    minmax(0, 1.35fr)
    minmax(0, .45fr)
    minmax(0, .5fr)
    minmax(0, .5fr)
    minmax(0, 1.45fr)
    minmax(0, 1.7fr)
    minmax(0, 1.25fr);
  min-width: 0;
  border-bottom: 1px solid var(--line);
}

.tainiki-row:last-child {
  border-bottom: 0;
}

.tainiki-row > * {
  min-width: 0;
  padding: 9px 10px;
  border-right: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.tainiki-row > *:last-child {
  border-right: 0;
}

.tainiki-head {
  background: #f7f3ff;
  color: var(--muted);
}

.tainiki-row:not(.tainiki-head):hover {
  background: #fbf9ff;
}

.tainiki-row.ok > *:last-child {
  color: var(--ok);
  font-weight: 800;
}

.tainiki-row.info > *:last-child {
  color: #195aa8;
  font-weight: 800;
}

.tainiki-row.warn > *:last-child {
  color: #b3261e;
  font-weight: 800;
}

.tainiki-row .choice-actions {
  display: grid;
  grid-template-columns: 1fr;
}

.tainiki-row .choice-actions button {
  width: 100%;
  justify-content: center;
}

.task {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 7px;
}

.task-status-panel {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.task:last-child { border-bottom: 0; }

.task-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  border-radius: 999px;
  padding: 4px 8px;
  background: #eef2f8;
  color: #354158;
}

.badge.vip { background: var(--soft); color: var(--accent-dark); }
.badge.ok { background: #e9f7ef; color: var(--ok); }
.badge.warn { background: #fff6e8; color: var(--warn); }
.badge.info { background: #e8f1ff; color: #195aa8; }
.badge.smart { background: #eef7f1; color: #14733f; }

.task-debt {
  background: #fffdf8;
}

.task:has(.badge.smart) {
  background: #fbfffc;
}

.task-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 12px;
  padding: 10px;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 13px;
}

.task-details .wide {
  grid-column: 1 / -1;
}

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

.task-actions button {
  padding: 8px 10px;
  font-size: 13px;
}

.ghost-action {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--line);
}

.ghost-action:hover {
  background: var(--soft);
}

.team-table { display: grid; }

.team-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.team-row:hover { background: #fafbfe; }
.team-row:last-child { border-bottom: 0; }

.team-row small { color: var(--muted); display: block; margin-top: 3px; }

@media (max-width: 900px) {
  .dashboard { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .income-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grt-grid { grid-template-columns: 1fr; }
  .penalty-formula { grid-template-columns: 1fr; }
  .pdz-row { grid-template-columns: 1fr; }
  .branch-task-row { grid-template-columns: minmax(0, 1.2fr) repeat(3, minmax(70px, .5fr)); }
  .branch-result-row { grid-template-columns: minmax(0, 1fr) minmax(110px, .45fr); }
  .branch-grt-row { grid-template-columns: minmax(130px, .8fr) repeat(4, minmax(110px, 1fr)); }
  .branch-grt-result-row { grid-template-columns: minmax(220px, 1.3fr) minmax(120px, .65fr) minmax(70px, .35fr) minmax(220px, 1fr) minmax(80px, .42fr) minmax(200px, .95fr) minmax(80px, .42fr); }
  .planning-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .planning-row { grid-template-columns: 1fr; }
  .sales-table-row { grid-template-columns: minmax(150px, 1fr) repeat(6, minmax(86px, .55fr)); }
  .two-col { grid-template-columns: 1fr; }
  .branch-dashboard .task-list { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .content { padding: 16px; }
  .metrics { grid-template-columns: 1fr; }
  .income-grid, .task-details { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .client-card-main { flex-direction: column; }
  .branch-card .client-card-main { align-items: flex-start; }
  .branch-total-button { width: 100%; }
  .branch-task-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .branch-result-row {
    grid-template-columns: 1fr;
  }
  .branch-grt-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .branch-grt-result-row {
    min-width: 860px;
  }
  .planning-grid { grid-template-columns: 1fr; }
  .sales-table { overflow-x: auto; }
  .sales-table-row { min-width: 860px; }
}
/* card-left-alignment 2026-08-12 */
.branch-action-card .client-card-main{display:grid!important;grid-template-columns:56px minmax(0,1fr) auto!important;column-gap:16px!important;align-items:center!important;width:100%!important;text-align:left!important}
.branch-action-card .branch-card-copy{grid-column:2;text-align:left!important;justify-self:stretch!important;margin:0!important;min-width:0}
.branch-action-card .branch-card-copy>*{text-align:left!important;margin-left:0!important}
.branch-action-card .branch-action-label{grid-column:3;justify-self:end}
@media(max-width:640px){.branch-action-card .client-card-main{grid-template-columns:56px minmax(0,1fr)!important}.branch-action-card .branch-action-label{grid-column:2;justify-self:start;margin-top:10px}}