:root {
  --bg: #f7f3f3;
  --panel: #ffffff;
  --panel-2: #fdf7f7;
  --text: #2a1a1a;
  --muted: #6c5b5b;
  --line: #ebd8d8;
  --accent: #b32326;
  --accent-soft: #f9dada;
  --danger: #c62828;
  --warn: #f57f17;
  --ok: #2e7d32;
  --shadow: 0 14px 30px rgba(68, 16, 16, 0.1);
  --yellow-bg: #fff2b8;
  --yellow-text: #8b6b00;
  --orange-bg: #ffd8b5;
  --orange-text: #a55000;
  --blue-bg: #d8e8ff;
  --blue-text: #1f5ca8;
  --purple-bg: #ead9ff;
  --purple-text: #6c32b5;
  --green-bg: #daf4df;
  --green-text: #25724e;
  --red-bg: #ffd9dc;
  --red-text: #a52a36;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 10% 10%, #f7e3e3 0%, var(--bg) 50%), var(--bg);
}

.app-shell {
  max-width: 1500px;
  margin: 0 auto;
  padding: 1.2rem;
}

.login-shell {
  min-height: calc(100vh - 2.4rem);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(480px, 100%);
  background: linear-gradient(180deg, #ffffff 0%, #fff7f7 100%);
  border: 1px solid #f0d7d7;
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.login-logo {
  margin-bottom: 1rem;
}

.login-copy,
.login-hint p {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 0.8rem;
}

.multi-select {
  margin-top: 0.35rem;
  border: 1px solid #ead6d6;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.multi-select summary {
  list-style: none;
  cursor: pointer;
  padding: 0.8rem 0.9rem;
  font-weight: 600;
}

.multi-select summary::-webkit-details-marker {
  display: none;
}

.multi-select[open] summary {
  border-bottom: 1px solid #f0dede;
}

.multi-select input[type="search"] {
  border: 0;
  border-bottom: 1px solid #f3e4e4;
  border-radius: 0;
}

.multi-select-list {
  max-height: 220px;
  overflow: auto;
  padding: 0.4rem;
  display: grid;
  gap: 0.25rem;
}

.multi-select-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.5rem;
  border-radius: 10px;
}

.multi-select-option:hover {
  background: #fff7f7;
}

.multi-select-option input {
  margin: 0;
}

.multi-select-option span {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.multi-select-option small {
  color: var(--muted);
}

.multi-select-empty {
  padding: 0.65rem 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.login-hint {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #f0d7d7;
  font-size: 0.9rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  background: linear-gradient(120deg, #6f1417 0%, #851a1c 55%, #b32326 100%);
  color: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 0.95rem;
}

.brand-logo {
  width: 180px;
  max-width: 48vw;
  height: auto;
  display: block;
  background: #fff;
  border-radius: 10px;
  padding: 0.28rem 0.45rem;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  font-size: 0.72rem;
  opacity: 0.9;
}

h1 {
  margin: 0.25rem 0 0;
  font-size: clamp(1.4rem, 2vw, 2rem);
}

.topbar-kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  justify-content: flex-end;
}

.topbar-side {
  display: grid;
  gap: 0.9rem;
  justify-items: end;
}

.topbar-user,
.view-switch {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.7rem;
}

.kpi-chip {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.09) 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 0.68rem 0.8rem;
  border-radius: 18px;
  min-width: 144px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.kpi-chip b {
  display: block;
  font-size: 1.55rem;
  line-height: 1;
  margin-bottom: 0.28rem;
}

.kpi-chip span {
  font-size: 0.8rem;
  opacity: 0.96;
}

#currentUserBadge {
  display: inline-grid;
  gap: 0.08rem;
  min-width: 0;
  padding: 0.45rem 0.7rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

#currentUserBadge strong {
  font-size: 0.88rem;
  line-height: 1.1;
}

#currentUserBadge small {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.82;
}

.panel {
  margin-top: 1rem;
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  border: 1px solid #e7eff1;
}

.toolbar {
  display: grid;
  grid-template-columns: 2.2fr repeat(5, 1fr);
  gap: 0.8rem;
  padding: 0.9rem;
}

.toolbar-group label {
  display: block;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.62rem 0.72rem;
  font-family: inherit;
  font-size: 0.92rem;
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent-soft);
}

.list-panel,
.detail-panel {
  padding: 1rem;
}

.panel-title-row,
.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.compact-row {
  margin-bottom: 0.5rem;
}

.panel-actions,
.detail-top-actions,
.calendar-controls,
.table-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.calendar-filter {
  display: grid;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.calendar-filter select {
  min-width: 180px;
}

.settings-shell {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(252, 247, 247, 0.98) 100%),
    radial-gradient(circle at top right, rgba(179, 35, 38, 0.06) 0%, transparent 30%);
}

.settings-hero {
  padding: 0.35rem 0 0.9rem;
  border-bottom: 1px solid #f1dfdf;
  margin-bottom: 1.2rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 1rem;
  align-items: start;
}

.settings-card {
  border: 1px solid #efdfdf;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(255, 249, 249, 0.96) 100%);
  box-shadow: 0 10px 24px rgba(78, 22, 22, 0.06);
  overflow: hidden;
}

.settings-card-wide {
  grid-row: span 2;
}

.settings-card-head {
  padding: 1rem 1rem 0.4rem;
}

.settings-card-head h3 {
  font-size: 1.08rem;
}

.settings-kicker {
  margin: 0 0 0.28rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 800;
}

.settings-form {
  margin: 0 1rem 1rem;
  padding: 0.9rem;
  border: 1px solid #f4e5e5;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.settings-table-wrap {
  margin: 0 1rem 1rem;
  border: 1px solid #f1e4e4;
  border-radius: 18px;
  background: #fff;
  max-height: 340px;
}

.settings-table-wrap table th {
  background: #fffdfd;
}

.settings-table-wrap table td,
.settings-table-wrap table th {
  white-space: normal;
}

.visits-grid-wrap {
  overflow: auto;
  border: 1px solid #e8dada;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 249, 249, 0.96) 100%),
    radial-gradient(circle at top left, rgba(179, 35, 38, 0.04) 0%, transparent 36%);
  padding: 0.7rem;
  box-shadow:
    0 10px 22px rgba(73, 24, 24, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.visits-grid-table {
  width: 100%;
  min-width: 820px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  overflow: hidden;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
}

.visits-grid-table th,
.visits-grid-table td {
  border-right: 1px solid rgba(92, 61, 61, 0.24);
  border-bottom: 1px solid rgba(92, 61, 61, 0.24);
  padding: 0;
  text-align: center;
}

.visits-grid-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: transparent;
  color: #6f5b5b;
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 0.28rem 0.3rem;
  backdrop-filter: none;
}

.visits-grid-corner,
.visits-grid-client {
  position: sticky;
  left: 0;
  z-index: 1;
  background: rgba(255, 255, 255, 0.96);
}

.visits-grid-corner {
  background: rgba(255, 255, 255, 0.96);
  color: #5f4a4a;
  font-size: 0.92rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.visits-grid-table thead th:not(.visits-grid-corner) {
  border-right-color: transparent;
  border-bottom-color: transparent;
}

.visits-grid-client {
  min-width: 210px;
  width: 210px;
  max-width: 210px;
  padding: 0.38rem 0.55rem;
  text-align: left;
  font-size: 0.76rem;
  font-weight: 800;
  color: #735f5f;
  text-transform: none;
  letter-spacing: 0.01em;
}

.visits-grid-client span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visits-grid-cell {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 0;
  background-clip: padding-box;
  font: inherit;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.015em;
  cursor: pointer;
  transition: filter 120ms ease, box-shadow 120ms ease;
}

.visits-grid-cell:hover {
  filter: saturate(1.02) brightness(0.985);
  box-shadow: inset 0 0 0 1px rgba(62, 42, 42, 0.14);
}

.visits-grid-empty {
  background: rgba(255, 255, 255, 0.54);
  height: 34px;
}

.visits-grid-table tr:last-child td,
.visits-grid-table tr:last-child th {
  border-bottom: 0;
}

.visits-grid-table tr td:last-child,
.visits-grid-table tr th:last-child {
  border-right: 0;
}

.single-row-grid {
  grid-template-columns: minmax(0, 1fr);
}

.panel-title-row h2,
.panel-title-row h3,
.panel-title-row p,
.section-head p {
  margin: 0;
}

.pill {
  background: var(--panel-2);
  color: var(--accent);
  border: 1px solid #ecc4c4;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
}

.legend-row,
.service-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.legend-row {
  margin-bottom: 0.8rem;
}

.service-row.compact {
  min-width: 88px;
}

.service-badge,
.meeting-type-badge,
.meeting-kind-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0.2rem 0.55rem;
  border: 1px solid transparent;
}

.service-badge.sf {
  background: #f9dada;
  color: #851a1c;
  border-color: #edb6b7;
}

.service-badge.se {
  background: #fbe9d3;
  color: #8f4f10;
  border-color: #f1cfaa;
}

.service-badge.so {
  background: #f6e0e1;
  color: #8b1c1f;
  border-color: #e9bdbe;
}

.yellow {
  background: var(--yellow-bg);
  color: var(--yellow-text);
  --calendar-border-soft: #e5d48d;
  --calendar-border-strong: #8b6b00;
}

.orange {
  background: var(--orange-bg);
  color: var(--orange-text);
  --calendar-border-soft: #efbf92;
  --calendar-border-strong: #a55000;
}

.blue {
  background: var(--blue-bg);
  color: var(--blue-text);
  --calendar-border-soft: #b8d2f5;
  --calendar-border-strong: #1f5ca8;
}

.purple {
  background: var(--purple-bg);
  color: var(--purple-text);
  --calendar-border-soft: #d1b7ef;
  --calendar-border-strong: #6c32b5;
}

.green {
  background: var(--green-bg);
  color: var(--green-text);
  --calendar-border-soft: #b9ddc0;
  --calendar-border-strong: #25724e;
}

.red {
  background: var(--red-bg);
  color: var(--red-text);
  --calendar-border-soft: #efb2b8;
  --calendar-border-strong: #a52a36;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 320px);
}

.table-wrap tbody tr:hover {
  background: #fffaf6;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid #edf2f3;
  padding: 0.56rem;
  white-space: nowrap;
  vertical-align: middle;
}

th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.table-sort-btn {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  padding: 0;
}

.table-sort-btn.active::after {
  margin-left: 0.24rem;
}

.table-sort-btn.active[data-direction="asc"]::after {
  content: "↑";
}

.table-sort-btn.active[data-direction="desc"]::after {
  content: "↓";
}

tr:hover {
  background: #fdf3f4;
  cursor: pointer;
}

.empty-table-cell {
  text-align: center;
  color: var(--muted);
  padding: 1rem;
}

tr.active {
  background: #fbe7e8;
}

.risk {
  font-weight: 700;
}

.risk.alto {
  color: var(--danger);
}

.risk.medio {
  color: var(--warn);
}

.risk.bajo {
  color: var(--ok);
}

.meeting-dot-row {
  display: flex;
  align-items: center;
  gap: 0.24rem;
  min-width: 80px;
}

.meeting-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.muted-inline {
  color: var(--muted);
}

.hidden {
  display: none;
}

.detail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.back-btn,
.secondary-btn,
.primary-btn,
.ghost-btn {
  border-radius: 16px;
  font-weight: 800;
  padding: 0.62rem 1rem;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease, border-color 140ms ease;
}

.back-btn {
  border: 1px solid #e7b3b4;
  color: #7a171a;
  background: #fceced;
}

.primary-btn {
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  background: linear-gradient(180deg, #cd3235 0%, #b32326 100%);
  box-shadow: 0 10px 18px rgba(110, 18, 20, 0.22);
}

.secondary-btn {
  border: 1px solid rgba(255, 255, 255, 0.42);
  color: #8f1f22;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 245, 245, 0.9) 100%);
  box-shadow: 0 6px 14px rgba(76, 20, 20, 0.08);
}

.secondary-btn.active-view {
  background: linear-gradient(180deg, #d12e31 0%, #b32326 100%);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 12px 20px rgba(92, 14, 16, 0.24);
}

.ghost-btn {
  border: 1px solid #f0d7d7;
  color: #7a171a;
  background: #fff;
  padding: 0.42rem 0.75rem;
}

.back-btn:hover,
.secondary-btn:hover,
.primary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
}

.visit-status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 700;
}

.visit-status-badge.agendada {
  background: #eef6ff;
  color: #1d63b5;
}

.visit-status-badge.confirmada {
  background: #fff4dc;
  color: #9a6100;
}

.visit-status-badge.realizada {
  background: #e6f7ec;
  color: #2f7d4f;
}

.inline-visit-status {
  min-width: 132px;
}

#detailMeta,
.section-copy,
#meetingScreenMeta {
  color: var(--muted);
  margin-top: 0.2rem;
  font-size: 0.9rem;
}

#detailServices {
  margin-bottom: 0.8rem;
}

.kpi-grid {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.kpi-box {
  border: 1px solid #f0d7d7;
  background: var(--panel-2);
  border-radius: 12px;
  padding: 0.65rem;
}

.kpi-box span {
  color: var(--muted);
  font-size: 0.78rem;
}

.kpi-box b {
  display: block;
  margin-top: 0.2rem;
  font-size: 1rem;
}

.section-head {
  margin-top: 1.1rem;
  margin-bottom: 0.75rem;
}

.section-head-featured {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid #e7eff1;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.95), transparent 42%),
    linear-gradient(135deg, #fffaf7 0%, #fff 100%);
}

.meetings-head {
  border-color: #d8e7f8;
  background:
    radial-gradient(circle at top left, rgba(215, 233, 255, 0.7), transparent 44%),
    linear-gradient(135deg, #f7fbff 0%, #ffffff 100%);
}

.branches-head {
  border-color: #dbeedf;
  background:
    radial-gradient(circle at top left, rgba(218, 243, 227, 0.75), transparent 44%),
    linear-gradient(135deg, #f8fff9 0%, #ffffff 100%);
}

.section-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(16, 119, 111, 0.1);
  border: 1px solid rgba(16, 119, 111, 0.12);
  margin-bottom: 0.38rem;
}

.branches-head .section-icon-badge {
  color: #25724e;
  background: rgba(74, 163, 110, 0.1);
  border-color: rgba(74, 163, 110, 0.16);
}

.section-title {
  margin: 0 0 0.2rem;
  font-size: 1rem;
}

.section-title-featured {
  font-size: 1.4rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.company-edit-form {
  border: 1px solid #f0d7d7;
  border-radius: 12px;
  background: var(--panel-2);
  padding: 0.85rem;
}

.edit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

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

.company-edit-form label {
  display: block;
  margin: 0.35rem 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.edit-services {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin: 0.45rem 0 0.35rem;
}

.edit-services label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: fit-content;
  font-size: 0.84rem;
  color: var(--text);
}

.edit-actions {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

#saveCompanyBtn,
#saveMeetingBtn {
  min-width: 160px;
}

#saveCompanyBtn:disabled,
#saveMeetingBtn:disabled {
  opacity: 0.7;
  cursor: wait;
}

#editCompanyStatus,
#meetingStatus,
#loginStatus {
  font-size: 0.82rem;
  color: var(--muted);
}

.meeting-list {
  display: grid;
  gap: 0.9rem;
}

.meeting-list-item {
  border: 1px solid #f0d7d7;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #fffafa 100%);
  padding: 0.8rem 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  cursor: pointer;
}

.meeting-list-item:hover {
  background: #fff6f6;
}

.meeting-list-item.done {
  border-color: #cae7d3;
  background: linear-gradient(180deg, #ffffff 0%, #f7fffb 100%);
}

.meeting-list-item-main {
  min-width: 0;
}

.meeting-list-item-title {
  margin: 0;
  font-size: 1rem;
}

.meeting-list-item-meta {
  margin: 0.25rem 0 0;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meeting-list-item-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.meeting-card,
.empty-meeting-state {
  border: 1px solid #f0d7d7;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #fff7f7 100%);
  padding: 0.95rem;
}

.meeting-card-done {
  background: linear-gradient(180deg, #fffefe 0%, #f7fffb 100%);
  border-color: #cae7d3;
}

.meeting-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
}

.meeting-date {
  margin: 0 0 0.2rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.meeting-title {
  margin: 0;
  font-size: 1.02rem;
}

.meeting-head-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.meeting-status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-size: 0.74rem;
  font-weight: 700;
}

.meeting-status-badge.scheduled {
  background: #fff0d8;
  color: #8f4f10;
}

.meeting-status-badge.confirmed {
  background: #e8f1ff;
  color: #245ea8;
}

.meeting-status-badge.done {
  background: #def4e4;
  color: #1c6a36;
}

.meeting-meta {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.branch-meetings {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid #f0d7d7;
}

.branch-meetings-title {
  margin: 0 0 0.65rem;
  font-size: 0.92rem;
}

.compact-empty-state {
  padding: 0.75rem;
  border-radius: 12px;
}

.meeting-body {
  margin-top: 0.85rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

.meeting-body div {
  border: 1px solid #f5e3e3;
  border-radius: 12px;
  padding: 0.7rem;
  background: rgba(255, 255, 255, 0.8);
}

.meeting-body h5,
.empty-meeting-state h4 {
  margin: 0 0 0.35rem;
  font-size: 0.84rem;
}

.meeting-body p,
.empty-meeting-state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  white-space: pre-wrap;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.6rem;
}

.calendar-weekday {
  padding: 0.45rem 0.6rem;
  font-size: 0.76rem;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.calendar-day {
  min-height: 150px;
  border: 1px solid #f0d7d7;
  border-radius: 14px;
  padding: 0.7rem;
  background: linear-gradient(180deg, #ffffff 0%, #fff9f9 100%);
  cursor: pointer;
}

.calendar-day.muted-day {
  opacity: 0.45;
}

.calendar-day-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 0.55rem;
}

.calendar-events {
  display: grid;
  gap: 0.35rem;
}

.calendar-event {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.35rem 0.5rem;
  text-align: left;
  font: inherit;
  font-size: 0.72rem;
  line-height: 1.2;
  cursor: pointer;
}

.calendar-event.calendar-status-completed {
  border-color: transparent;
}

.calendar-event.calendar-status-scheduled,
.calendar-event.calendar-status-confirmed {
  background: #fff;
}

.calendar-event.calendar-status-scheduled {
  border-width: 1px;
}

.calendar-event.calendar-status-confirmed {
  border-width: 2px;
}

.calendar-event.calendar-status-scheduled.yellow,
.calendar-event.calendar-status-confirmed.yellow,
.day-meeting-card.calendar-status-scheduled.yellow,
.day-meeting-card.calendar-status-confirmed.yellow {
  color: var(--yellow-text);
}

.calendar-event.calendar-status-scheduled.orange,
.calendar-event.calendar-status-confirmed.orange,
.day-meeting-card.calendar-status-scheduled.orange,
.day-meeting-card.calendar-status-confirmed.orange {
  color: var(--orange-text);
}

.calendar-event.calendar-status-scheduled.blue,
.calendar-event.calendar-status-confirmed.blue,
.day-meeting-card.calendar-status-scheduled.blue,
.day-meeting-card.calendar-status-confirmed.blue {
  color: var(--blue-text);
}

.calendar-event.calendar-status-scheduled.purple,
.calendar-event.calendar-status-confirmed.purple,
.day-meeting-card.calendar-status-scheduled.purple,
.day-meeting-card.calendar-status-confirmed.purple {
  color: var(--purple-text);
}

.calendar-event.calendar-status-scheduled.green,
.calendar-event.calendar-status-confirmed.green,
.day-meeting-card.calendar-status-scheduled.green,
.day-meeting-card.calendar-status-confirmed.green {
  color: var(--green-text);
}

.calendar-event.calendar-status-scheduled.red,
.calendar-event.calendar-status-confirmed.red,
.day-meeting-card.calendar-status-scheduled.red,
.day-meeting-card.calendar-status-confirmed.red {
  color: var(--red-text);
}

.calendar-event.calendar-status-scheduled.yellow,
.calendar-event.calendar-status-scheduled.orange,
.calendar-event.calendar-status-scheduled.blue,
.calendar-event.calendar-status-scheduled.purple,
.calendar-event.calendar-status-scheduled.green,
.calendar-event.calendar-status-scheduled.red,
.day-meeting-card.calendar-status-scheduled {
  border-color: var(--calendar-border-soft);
}

.calendar-event.calendar-status-confirmed.yellow,
.calendar-event.calendar-status-confirmed.orange,
.calendar-event.calendar-status-confirmed.blue,
.calendar-event.calendar-status-confirmed.purple,
.calendar-event.calendar-status-confirmed.green,
.calendar-event.calendar-status-confirmed.red,
.day-meeting-card.calendar-status-confirmed {
  border-color: var(--calendar-border-strong);
}

.calendar-more {
  border: 0;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: left;
  padding: 0.1rem 0.15rem;
  cursor: pointer;
}

.calendar-day-view {
  margin-top: 1rem;
}

.calendar-day-stack {
  display: grid;
  gap: 0.9rem;
}

.day-meeting-card {
  cursor: pointer;
}

.day-meeting-card.calendar-status-completed {
  border-color: transparent;
}

.day-meeting-card.calendar-status-completed.yellow {
  background: var(--yellow-bg);
  color: var(--yellow-text);
}

.day-meeting-card.calendar-status-completed.orange {
  background: var(--orange-bg);
  color: var(--orange-text);
}

.day-meeting-card.calendar-status-completed.blue {
  background: var(--blue-bg);
  color: var(--blue-text);
}

.day-meeting-card.calendar-status-completed.purple {
  background: var(--purple-bg);
  color: var(--purple-text);
}

.day-meeting-card.calendar-status-completed.green {
  background: var(--green-bg);
  color: var(--green-text);
}

.day-meeting-card.calendar-status-completed.red {
  background: var(--red-bg);
  color: var(--red-text);
}

.day-meeting-card.calendar-status-scheduled,
.day-meeting-card.calendar-status-confirmed {
  background: #fff;
}

.day-meeting-card.calendar-status-scheduled {
  border: 1px solid var(--calendar-border-soft);
}

.day-meeting-card.calendar-status-confirmed {
  border: 2px solid var(--calendar-border-strong);
}

.day-meeting-card .meeting-objective {
  margin-top: 0.8rem;
}

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

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

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

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

  .table-wrap {
    max-height: 500px;
  }

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

  .settings-card-wide {
    grid-row: auto;
  }

  .meeting-list-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .meeting-list-item-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 700px) {
  .app-shell {
    padding: 0.7rem;
  }

  .toolbar,
  .kpi-grid,
  .meeting-body,
  .edit-grid,
  .calendar-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .detail-top,
  .panel-title-row,
  .panel-actions,
  .detail-top-actions,
  .edit-actions,
  .topbar-user,
  .calendar-head,
  .calendar-controls,
  .view-switch {
    flex-direction: column;
    align-items: stretch;
  }

  .brand-block {
    width: 100%;
    justify-content: space-between;
  }

  .brand-logo {
    width: 155px;
  }

  .span-2 {
    grid-column: auto;
  }

  th,
  td {
    padding: 0.45rem;
    font-size: 0.83rem;
  }

  .meeting-head,
  .meeting-head-actions {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 520px) {
  .toolbar {
    grid-template-columns: 1fr;
  }
}
