@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400..900&display=swap");

:root {
  --ink: #242821;
  --base: #f3f5ef;
  --surface: #ffffff;
  --line: #d7ddcf;
  --soft-line: #ebefe6;
  --muted: #667064;
  --green: #2f5a43;
  --bronze: #b7833c;
  --blue: #386f88;
  --blue-soft: #e9f3f7;
  --charcoal: #2b2f2c;
  --terracotta: #a45b45;
  --red: #9e3f35;
  --gray: #858b82;
  --shadow: 0 16px 38px rgba(36, 40, 33, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--base);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: grid;
  align-content: start;
  gap: 18px;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 22px;
}

.brand-lockup {
  color: inherit;
  text-decoration: none;
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 13px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--soft-line);
}

.brand-logo {
  display: block;
  width: 68px;
  height: auto;
}

.eyebrow {
  display: block;
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-lockup h1 {
  margin-bottom: 0;
  font-size: 1.06rem;
  line-height: 1.15;
}

.mode-switch,
.view-switch,
.property-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf6;
  padding: 3px;
}

.mode-switch {
  width: 100%;
}

.mode-button,
.view-button,
.property-tab,
.nav-button,
.ghost-button,
.primary-button,
.sync-button,
.icon-button,
.table-action,
.filter-chip {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 760;
}

.mode-button,
.view-button,
.property-tab {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  white-space: nowrap;
}

.mode-button {
  flex: 1;
}

.mode-button.is-active,
.view-button.is-active,
.property-tab.is-active,
.nav-button.is-active,
.filter-chip.is-active {
  background: var(--ink);
  color: #fff;
}

.side-nav {
  display: grid;
  gap: 7px;
}

.nav-button {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  text-align: left;
}

.side-section {
  display: grid;
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--soft-line);
}

.side-summary {
  display: grid;
  gap: 10px;
}

.side-summary div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--soft-line);
  padding-bottom: 9px;
}

.side-summary strong {
  font-size: 1.05rem;
}

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

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 82px;
  border-bottom: 1px solid var(--line);
  background: rgba(243, 245, 239, 0.94);
  backdrop-filter: blur(18px);
  padding: 14px 22px;
}

.topbar-copy h2 {
  margin-bottom: 4px;
  font-size: 1.45rem;
  line-height: 1.1;
}

.topbar-copy p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.35;
}

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

.header-range {
  display: grid;
  grid-template-columns: 34px minmax(170px, auto) 34px;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 760;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: #fff;
  padding: 0;
}

.sync-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 38px;
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
  padding: 0 13px;
  white-space: nowrap;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--bronze);
  box-shadow: 0 0 0 3px rgba(183, 131, 60, 0.22);
}

.sync-button.is-syncing .sync-dot {
  background: var(--blue);
  box-shadow: 0 0 0 3px rgba(56, 111, 136, 0.22);
}

.sync-status {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.3;
}

.main-shell {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px 22px 34px;
}

.module-view {
  min-width: 0;
}

.module-head,
.section-head,
.panel-heading,
.detail-head,
.request-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.module-head {
  margin-bottom: 14px;
}

.module-head h2,
.section-head h2,
.panel-heading h3,
.request-item h3 {
  margin-bottom: 0;
  font-size: 1.08rem;
  line-height: 1.2;
}

.metrics-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.metric {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  padding: 7px 11px;
}

.metric strong {
  font-size: 1rem;
  line-height: 1;
}

.metric span {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.calendar-card,
.panel-card,
.request-item,
.form-card,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.calendar-card {
  overflow: hidden;
}

.section-head {
  align-items: center;
  border-bottom: 1px solid var(--soft-line);
  padding: 15px 16px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  max-width: 520px;
}

.legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  border: 1px solid var(--soft-line);
  border-radius: 999px;
  background: #f8faf5;
  padding: 0 9px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 760;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) minmax(170px, 210px) auto auto;
  gap: 10px;
  align-items: end;
  border-bottom: 1px solid var(--soft-line);
  background: #fbfcf8;
  padding: 12px 16px;
}

.property-tabs {
  overflow-x: auto;
  scrollbar-width: thin;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.toolbar-field {
  margin-top: 0;
}

.field span,
.detail-label,
.compact-list dt {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 760;
}

select,
input,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
}

select:focus,
input:focus,
textarea:focus,
button:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(56, 111, 136, 0.16);
  outline: none;
}

.ghost-button,
.table-action,
.filter-chip {
  min-height: 34px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

.primary-button {
  width: 100%;
  min-height: 40px;
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
  padding: 0 14px;
}

.compact-primary {
  width: auto;
  white-space: nowrap;
}

.calendar-scroll,
.table-wrap {
  overflow-x: auto;
  scrollbar-color: rgba(36, 40, 33, 0.32) transparent;
}

.calendar-grid {
  display: grid;
  grid-template-columns: minmax(148px, 170px) minmax(900px, 1fr);
  min-width: 1040px;
}

.property-head,
.property-cell {
  position: sticky;
  left: 0;
  z-index: 5;
  border-right: 1px solid var(--line);
  background: #fbfcf8;
}

.property-head {
  min-height: 56px;
  border-bottom: 1px solid var(--line);
  padding: 15px 14px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.days-header {
  display: grid;
  grid-template-columns: repeat(15, minmax(58px, 1fr));
  min-height: 56px;
  border-bottom: 1px solid var(--line);
  background: #fbfcf8;
}

.day-head {
  display: grid;
  align-content: center;
  gap: 2px;
  min-width: 0;
  border-right: 1px solid var(--soft-line);
  padding: 8px 7px;
}

.day-head strong {
  font-size: 0.9rem;
  line-height: 1;
}

.day-head span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 760;
}

.day-head.is-weekend,
.day-bg.is-weekend {
  background: rgba(47, 90, 67, 0.055);
}

.property-cell {
  display: grid;
  align-content: center;
  gap: 5px;
  min-height: 88px;
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

.property-title {
  font-weight: 820;
}

.property-subtitle {
  color: var(--muted);
  font-size: 0.74rem;
}

.row-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(15, minmax(58px, 1fr));
  grid-template-rows: repeat(var(--lanes, 1), 34px);
  gap: 7px 0;
  min-height: calc((var(--lanes, 1) * 34px) + ((var(--lanes, 1) - 1) * 7px) + 28px);
  border-bottom: 1px solid var(--line);
  padding: 14px 8px;
  background: #fff;
}

.day-bg {
  grid-row: 1 / -1;
  min-width: 0;
  border-right: 1px solid var(--soft-line);
}

.reservation {
  position: relative;
  z-index: 2;
  display: grid;
  align-content: center;
  min-width: 0;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 8px;
  color: #fff;
  text-align: left;
}

.reservation-title,
.reservation-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reservation-title {
  font-size: 0.76rem;
  font-weight: 820;
  line-height: 1.1;
}

.reservation-meta {
  margin-top: 1px;
  font-size: 0.64rem;
  opacity: 0.82;
}

.reservation.is-selected {
  box-shadow: 0 0 0 3px rgba(56, 111, 136, 0.24);
}

.has-conflict {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.matrix-calendar-grid .property-cell {
  min-height: 70px;
}

.matrix-row {
  display: grid;
  grid-template-columns: repeat(15, minmax(58px, 1fr));
  min-height: 70px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.matrix-cell {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 2px;
  min-width: 0;
  min-height: 70px;
  border: 0;
  border-right: 1px solid var(--soft-line);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  padding: 7px 8px;
  text-align: left;
}

.matrix-cell span {
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 820;
}

.matrix-cell small {
  overflow: hidden;
  max-width: 100%;
  color: inherit;
  font-size: 0.62rem;
  opacity: 0.78;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matrix-available {
  background: #f5fbf3;
  color: var(--green);
}

.state-confirmed,
.public-noavailable {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.state-hold,
.public-consult {
  background: var(--bronze);
  border-color: var(--bronze);
  color: #231b10;
}

.state-request,
.public-pending {
  background: var(--blue-soft);
  border-color: var(--blue);
  color: #284f62;
}

.state-blocked {
  background: var(--charcoal);
  border-color: var(--charcoal);
  color: #fff;
}

.state-maintenance {
  background: var(--terracotta);
  border-color: var(--terracotta);
  color: #fff;
}

.state-rejected,
.public-rejected {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.state-cancelled,
.state-expired,
.public-muted {
  background: var(--gray);
  border-color: var(--gray);
  color: #fff;
}

.data-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  background: #fff;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--soft-line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
  font-size: 0.86rem;
}

.data-table th {
  background: #fbfcf8;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 820;
  text-transform: uppercase;
}

.empty-cell,
.empty-state {
  color: var(--muted);
  text-align: center;
}

.empty-state {
  padding: 18px;
}

.status-pill,
.sync-pill,
.detail-status,
.warning-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 0.72rem;
  font-weight: 820;
  white-space: nowrap;
}

.sync-ok {
  background: #e8f4ec;
  color: var(--green);
}

.sync-pending {
  background: #fbf0dd;
  color: #74501c;
}

.sync-error {
  background: #f8e8e5;
  color: var(--red);
}

.sync-muted {
  background: #ecefed;
  color: var(--muted);
}

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

.request-item,
.panel-card,
.form-card {
  padding: 15px;
}

.request-item.has-conflict {
  border-color: rgba(158, 63, 53, 0.42);
}

.compact-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
}

.compact-list div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 10px;
  border-bottom: 1px solid var(--soft-line);
  padding-bottom: 8px;
}

.compact-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.compact-list dt,
.compact-list dd {
  margin: 0;
}

.compact-list dd {
  min-width: 0;
  overflow-wrap: anywhere;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 13px;
}

.table-action {
  background: #fff;
}

.table-action.danger {
  border-color: rgba(158, 63, 53, 0.42);
  color: var(--red);
}

.warning-badge {
  margin-top: 12px;
  background: #f8e8e5;
  color: var(--red);
}

.filter-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.filter-chip span {
  opacity: 0.74;
}

.form-card {
  max-width: 620px;
}

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

.request-form .primary-button {
  margin-top: 14px;
}

.form-feedback {
  min-height: 18px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.form-feedback.is-error {
  color: var(--red);
  font-weight: 760;
}

.form-feedback.is-ok {
  color: var(--green);
  font-weight: 760;
}

.context-panel {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 60;
  width: min(460px, 100vw);
  background: rgba(36, 40, 33, 0.16);
}

.context-panel-inner {
  display: grid;
  align-content: start;
  gap: 12px;
  width: min(460px, 100vw);
  height: 100vh;
  margin-left: auto;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--surface);
  padding: 16px;
  box-shadow: -18px 0 44px rgba(36, 40, 33, 0.12);
}

.context-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--soft-line);
  padding-bottom: 12px;
}

.context-head h2 {
  margin: 0;
  font-size: 1.08rem;
}

.detail-card.empty {
  color: var(--muted);
}

.detail-section {
  margin-top: 15px;
  border-top: 1px solid var(--soft-line);
  padding-top: 13px;
}

.detail-section h4 {
  margin-bottom: 9px;
  font-size: 0.88rem;
}

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

.detail-row {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid var(--soft-line);
  padding-bottom: 9px;
}

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

.detail-value {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
  line-height: 1.35;
}

.audit-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.audit-item {
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 10px;
}

.audit-item span,
.audit-item small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

.audit-item strong {
  display: block;
  margin-top: 4px;
  font-size: 0.86rem;
}

.audit-item p {
  margin: 5px 0;
  font-size: 0.84rem;
  line-height: 1.35;
}

.sync-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  max-width: min(360px, calc(100vw - 36px));
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.mode-agency .reservation-meta {
  display: none;
}

.mode-agency .row-track {
  grid-template-rows: repeat(var(--lanes, 1), 31px);
  min-height: calc((var(--lanes, 1) * 31px) + ((var(--lanes, 1) - 1) * 7px) + 26px);
}

.mode-agency .reservation {
  height: 31px;
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

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

  .topbar-actions {
    justify-content: flex-start;
  }

  .calendar-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .requests-grid,
  .sync-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .sidebar,
  .main-shell,
  .topbar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .brand-lockup {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .brand-logo {
    width: 56px;
  }

  .side-nav,
  .side-summary,
  .calendar-toolbar,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar-copy h2 {
    font-size: 1.25rem;
  }

  .header-range {
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    width: 100%;
  }

  .topbar-actions,
  .sync-button,
  .sync-status,
  .view-switch,
  .property-tabs,
  .ghost-button,
  .compact-primary {
    width: 100%;
  }

  .sync-button {
    justify-content: center;
  }

  .metrics-strip {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .metric {
    flex: 0 0 auto;
  }

  .section-head,
  .module-head,
  .detail-head,
  .request-item-head {
    display: grid;
  }

  .legend {
    justify-content: flex-start;
  }

  .calendar-grid {
    grid-template-columns: minmax(128px, 142px) minmax(760px, 1fr);
    min-width: 900px;
  }

  .data-table {
    min-width: 720px;
  }

  .context-panel,
  .context-panel-inner {
    width: 100vw;
  }
}

/* H&H Outfitters design system fidelity pass
   Source: /home/ubuntu/hyh-design-system tokens + calendario UI kit.
   This preserves the app functionality and only owns presentation. */
:root {
  --ink: #242821;
  --base: #f3f5ef;
  --surface: #ffffff;
  --line: #d7ddcf;
  --soft-line: #ebefe6;
  --muted: #667064;
  --green: #2f5a43;
  --bronze: #b7833c;
  --blue: #386f88;
  --blue-soft: #e9f3f7;
  --charcoal: #2b2f2c;
  --terracotta: #a45b45;
  --red: #9e3f35;
  --gray: #858b82;
  --tint-green: #e8f4ec;
  --tint-bronze: #fbf0dd;
  --tint-red: #f8e8e5;
  --tint-gray: #ecefed;
  --surface-sunken: #fbfcf8;
  --surface-rail: #f9fbf6;
  --focus-ring: rgba(56, 111, 136, 0.16);
  --shadow: 0 16px 38px rgba(36, 40, 33, 0.08);
  --shadow-card: 0 16px 38px rgba(36, 40, 33, 0.08);
  --shadow-drawer: -18px 0 44px rgba(36, 40, 33, 0.12);
  --shadow-focus: 0 0 0 3px var(--focus-ring);
  --radius-xs: 2px;
  --radius-sm: 6px;
  --radius-md: 7px;
  --radius-lg: 8px;
  --radius-pill: 999px;
}

body {
  background: var(--base);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  letter-spacing: 0;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--blue);
  box-shadow: var(--shadow-focus);
  outline: none;
}

h1,
h2,
h3,
h4,
.property-title,
.brand-lockup h1,
.month-day header strong,
.day-agenda-head strong,
.day-property-card header strong,
.metric strong,
.side-summary strong {
  font-family: inherit;
  font-weight: 820;
}

.app-shell {
  grid-template-columns: 278px minmax(0, 1fr);
  background: var(--base);
}

.sidebar {
  gap: 18px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 22px;
}

.brand-lockup {
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 13px;
  align-items: center;
  border-bottom-color: var(--soft-line);
  padding-bottom: 18px;
}

.brand-logo {
  width: 64px;
  filter: none;
}

.brand-lockup .eyebrow,
.sidebar .eyebrow,
.sidebar .side-summary span {
  color: var(--muted);
}

.brand-lockup h1 {
  color: var(--ink);
  font-size: 1.06rem;
  line-height: 1.15;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

.mode-switch,
.view-switch,
.property-tabs {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-rail);
  padding: 3px;
}

.mode-button,
.view-button,
.property-tab {
  border-radius: var(--radius-md);
  color: var(--muted);
  font-weight: 760;
}

.mode-button.is-active,
.view-button.is-active,
.property-tab.is-active,
.nav-button.is-active,
.filter-chip.is-active {
  background: var(--ink);
  color: #ffffff;
}

.nav-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
}

.nav-button:hover,
.mode-button:hover,
.view-button:hover,
.property-tab:hover,
.ghost-button:hover,
.table-action:hover {
  border-color: var(--blue);
  color: var(--ink);
}

.nav-button.is-active:hover,
.mode-button.is-active:hover,
.view-button.is-active:hover,
.property-tab.is-active:hover {
  color: #ffffff;
}

.side-section {
  border-top-color: var(--soft-line);
}

.side-summary div {
  border-bottom-color: var(--soft-line);
}

.side-summary strong {
  color: var(--ink);
  font-size: 1.05rem;
}

.topbar {
  min-height: 82px;
  border-bottom-color: var(--line);
  background: rgba(243, 245, 239, 0.94);
  backdrop-filter: blur(18px);
}

.topbar-copy h2 {
  font-size: 1.45rem;
  font-weight: 820;
  line-height: 1.1;
}

.topbar-copy p,
.sync-status {
  color: var(--muted);
}

.main-shell {
  max-width: 1600px;
  padding: 20px 22px 34px;
}

.metric {
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.82);
  border-color: var(--line);
  padding: 8px 12px;
}

.metric strong {
  color: var(--ink);
  font-size: 1rem;
}

.calendar-card,
.panel-card,
.request-item,
.form-card,
.empty-state,
.audit-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.calendar-card {
  overflow: hidden;
}

.section-head,
.calendar-toolbar,
.property-head,
.property-cell,
.days-header,
.day-agenda-head,
.month-weekdays {
  background: var(--surface-sunken);
  border-color: var(--line);
}

.section-head {
  min-height: 64px;
}

.section-head h2,
.module-head h2,
.panel-heading h3 {
  font-size: 1.08rem;
  font-weight: 820;
}

.legend {
  gap: 7px;
}

.legend-pill,
.status-pill,
.sync-pill,
.detail-status,
.warning-badge {
  border-radius: var(--radius-pill);
}

.legend-swatch {
  border-radius: var(--radius-xs);
}

.calendar-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
}

.calendar-toolbar > .view-switch {
  flex: 0 0 auto;
}

.calendar-toolbar > .calendar-period {
  flex: 1 1 460px;
}

.calendar-toolbar > .property-tabs {
  flex: 1 1 330px;
}

.calendar-toolbar > .toolbar-field {
  flex: 0 1 178px;
}

.calendar-toolbar > .ghost-button,
.calendar-toolbar > .compact-primary {
  flex: 0 0 auto;
  min-height: 42px;
  align-self: end;
}

.calendar-period {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 8px;
}

.period-nav {
  display: grid;
  grid-template-columns: 34px minmax(190px, 1fr) 34px auto;
  flex: 1 1 340px;
  align-items: center;
  gap: 7px;
  min-width: 280px;
}

.period-nav #rangeLabel {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 760;
  text-align: center;
  white-space: nowrap;
}

.date-picker-cluster {
  display: flex;
  flex: 1 1 220px;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 7px;
}

.date-field {
  display: grid;
  flex: 1 1 132px;
  gap: 4px;
  min-width: 132px;
}

.date-field span,
.field span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
}

.date-field input,
select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
}

.date-field input {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 0.78rem;
  font-weight: 760;
}

.icon-button,
.ghost-button,
.table-action,
.filter-chip,
.primary-button,
.sync-button {
  border-radius: var(--radius-md);
  font-weight: 760;
}

.primary-button,
.sync-button {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.primary-button:hover,
.sync-button:hover {
  background: #151812;
  border-color: #151812;
}

.sync-dot {
  background: var(--bronze);
  box-shadow: 0 0 0 3px rgba(183, 131, 60, 0.22);
}

.property-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  min-height: 42px;
  overflow-x: auto;
  padding: 4px;
}

.property-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: max-content;
  min-height: 34px;
  height: 34px;
  padding: 0 12px;
  text-align: left;
  white-space: nowrap;
}

.property-tab::before {
  content: "";
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: var(--radius-pill);
  background: var(--blue);
}

.property-tab[data-property="all"]::before {
  background: var(--ink);
}

.property-tab strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 760;
  overflow: hidden;
  text-overflow: ellipsis;
}

.property-tab span,
.property-tab small {
  display: none;
}

.property-tab.is-active::before {
  background: #ffffff;
}

.state-confirmed {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
}

.state-hold,
.public-consult {
  background: var(--bronze);
  border-color: var(--bronze);
  color: #231b10;
}

.state-request,
.public-pending {
  background: var(--blue-soft);
  border-color: var(--blue);
  color: #284f62;
}

.state-blocked,
.public-noavailable {
  background: var(--charcoal);
  border-color: var(--charcoal);
  color: #ffffff;
}

.state-maintenance {
  background: var(--terracotta);
  border-color: var(--terracotta);
  color: #ffffff;
}

.state-rejected,
.public-rejected {
  background: var(--tint-red);
  border-color: var(--red);
  color: var(--red);
}

.state-cancelled,
.state-expired,
.public-muted {
  background: var(--tint-gray);
  border-color: var(--gray);
  color: #4e554d;
}

.matrix-available {
  background: var(--tint-green);
  border-color: rgba(47, 90, 67, 0.18);
  color: var(--green);
}

.reservation,
.matrix-cell,
.month-event,
.day-event {
  border-radius: var(--radius-sm);
}

.has-conflict {
  outline: 2px solid var(--red);
  outline-offset: 1px;
}

.property-head,
.property-cell,
.days-header,
.day-head,
.row-track,
.matrix-row,
.matrix-cell {
  border-color: var(--line);
}

.day-head.is-weekend,
.day-bg.is-weekend,
.month-day.is-weekend {
  background: rgba(47, 90, 67, 0.055);
}

.month-calendar-grid {
  min-width: min(1040px, 100%);
  background: var(--surface);
}

.month-weekdays,
.month-days {
  grid-template-columns: repeat(7, minmax(118px, 1fr));
}

.month-weekdays span {
  border-right: 1px solid var(--soft-line);
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0;
  padding: 11px 12px;
  text-transform: uppercase;
}

.month-day {
  min-height: 132px;
  border-color: var(--soft-line);
  background: var(--surface);
  padding: 10px;
}

.month-day.is-muted {
  background: #f6f8f3;
  color: rgba(36, 40, 33, 0.45);
}

.month-day.has-events {
  background: #ffffff;
}

.month-day.is-today {
  box-shadow: inset 0 0 0 2px var(--blue);
}

.month-day header strong {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
}

.month-day.is-today header strong {
  background: var(--blue);
  color: #ffffff;
}

.month-event,
.day-event {
  border-width: 1px;
  box-shadow: none;
  padding: 6px 8px;
}

.month-event span,
.day-event span {
  font-size: 0.72rem;
  font-weight: 820;
}

.month-event small,
.day-event small {
  font-size: 0.62rem;
  opacity: 0.82;
}

.month-more {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 760;
}

.day-agenda-head strong {
  font-size: 1rem;
}

.day-property-card {
  border-bottom-color: var(--line);
}

.day-property-card header strong {
  font-size: 0.96rem;
}

.day-empty {
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
}

.data-table th {
  background: var(--surface-sunken);
  color: var(--muted);
  font-weight: 820;
}

.context-panel-inner {
  box-shadow: var(--shadow-drawer);
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .calendar-toolbar > .view-switch,
  .calendar-toolbar > .calendar-period,
  .calendar-toolbar > .property-tabs {
    flex-basis: 100%;
  }
}

@media (max-width: 760px) {
  .main-shell {
    padding: 14px 12px 24px;
  }

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

  .side-nav {
    grid-template-columns: 1fr 1fr;
  }

  .calendar-toolbar > .view-switch,
  .calendar-toolbar > .calendar-period,
  .calendar-toolbar > .property-tabs,
  .calendar-toolbar > .toolbar-field,
  .calendar-toolbar > .ghost-button,
  .calendar-toolbar > .compact-primary,
  .calendar-period,
  .period-nav,
  .date-picker-cluster,
  .date-field {
    flex-basis: 100%;
    max-width: none;
    min-width: 0;
    width: 100%;
  }

  .period-nav {
    grid-template-columns: 34px minmax(0, 1fr) 34px;
  }

  .today-button {
    grid-column: 1 / -1;
  }

  .month-calendar-grid {
    min-width: 820px;
  }

  .calendar-grid {
    grid-template-columns: minmax(126px, 142px) minmax(calc(var(--day-count, 7) * 72px), 1fr);
  }

  .days-header,
  .row-track,
  .matrix-row {
    grid-template-columns: repeat(var(--day-count, 7), minmax(72px, 1fr));
  }

  .day-property-card {
    grid-template-columns: 1fr;
  }
}

/* DS toolbar density refinement */
@media (min-width: 1181px) {
  .view-button {
    padding: 0 10px;
  }

  .calendar-toolbar {
    display: grid;
    grid-template-columns: auto minmax(390px, 1fr) minmax(138px, 160px) auto auto;
    align-items: end;
    gap: 10px;
  }

  .calendar-toolbar > .view-switch,
  .calendar-toolbar > .calendar-period,
  .calendar-toolbar > .toolbar-field,
  .calendar-toolbar > .ghost-button,
  .calendar-toolbar > .compact-primary {
    min-width: 0;
    width: auto;
  }

  .calendar-toolbar > .property-tabs {
    grid-column: 1 / -1;
    width: 100%;
  }

  .calendar-period {
    min-width: 0;
  }

  .period-nav {
    min-width: 230px;
  }

  .date-picker-cluster {
    flex: 0 1 auto;
  }

  .date-field {
    min-width: 118px;
  }
}

/* DS toolbar explicit placement */
@media (min-width: 1181px) {
  .calendar-toolbar {
    grid-template-columns: max-content minmax(360px, 1fr) minmax(148px, 170px) max-content max-content;
    grid-auto-rows: auto;
  }

  .calendar-toolbar > .view-switch {
    grid-column: 1;
    grid-row: 1;
  }

  .calendar-toolbar > .calendar-period {
    grid-column: 2;
    grid-row: 1;
  }

  .calendar-toolbar > .toolbar-field:not([hidden]) {
    grid-column: 3;
    grid-row: 1;
  }

  .calendar-toolbar > #clearFilters {
    grid-column: 4;
    grid-row: 1;
    justify-self: start;
    width: max-content;
  }

  .calendar-toolbar > #pipelineButton,
  .calendar-toolbar > #newRequestButtonInline:not([hidden]) {
    grid-column: 5;
    grid-row: 1;
    justify-self: start;
    width: max-content;
  }

  .calendar-toolbar > .property-tabs {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* DS toolbar final desktop fit */
@media (min-width: 1181px) {
  .view-switch {
    gap: 2px;
  }

  .view-button {
    min-height: 32px;
    padding: 0 7px;
  }

  .calendar-toolbar {
    grid-template-columns: max-content minmax(400px, 1fr) minmax(148px, 160px) max-content max-content;
  }

  .period-nav {
    min-width: 224px;
  }

  .date-field {
    min-width: 112px;
  }
}

/* DS date control fit */
@media (min-width: 1181px) {
  .calendar-period {
    flex-wrap: nowrap;
  }

  .period-nav {
    flex: 1 1 0;
    grid-template-columns: 30px minmax(0, 1fr) 30px auto;
    min-width: 0;
  }

  .period-nav #rangeLabel {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .date-picker-cluster {
    flex: 0 0 auto;
  }

  .calendar-period:has(#rangeStartField:not([hidden])) {
    flex-wrap: wrap;
  }

  .calendar-period:has(#rangeStartField:not([hidden])) .period-nav {
    flex-basis: 100%;
  }

  .calendar-period:has(#rangeStartField:not([hidden])) .date-picker-cluster {
    flex: 1 1 100%;
  }
}

