:root {
  color-scheme: light;
  --bg: #f3f6f4;
  --ink: #17201c;
  --muted: #66706a;
  --line: #dce2d8;
  --panel: #ffffff;
  --green: #1f7a5c;
  --green-dark: #15533f;
  --blue: #2d5f8f;
  --amber: #b7791f;
  --red: #b8453b;
  --shadow: 0 14px 42px rgba(23, 32, 28, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body[data-page="login"] {
  background:
    radial-gradient(circle at top left, rgba(114, 199, 168, 0.32), transparent 34rem),
    linear-gradient(135deg, #17201c, #243b35);
}

button,
select,
input {
  font: inherit;
}

main {
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  gap: 18px;
}

.login-main {
  min-height: 100vh;
  place-items: center;
}

.login-panel {
  width: min(100%, 430px);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.22);
  display: grid;
  gap: 22px;
}

.login-brand {
  justify-content: center;
}

.brand-mark.large {
  width: 62px;
  height: 62px;
}

.brand-mark.large .logo-a {
  font-size: 1.8rem;
}

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

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.app-banner {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
  font-weight: 800;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: linear-gradient(135deg, #72c7a8, #2d5f8f);
  color: #ffffff;
  overflow: hidden;
  flex: 0 0 auto;
}

.logo-a {
  position: relative;
  z-index: 1;
  font-size: 1.35rem;
  font-weight: 900;
}

.logo-path {
  position: absolute;
  right: -9px;
  bottom: 8px;
  width: 38px;
  height: 14px;
  border-top: 4px solid rgba(255, 255, 255, 0.68);
  border-left: 4px solid rgba(255, 255, 255, 0.68);
  transform: rotate(-22deg);
}

.brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

nav a {
  color: #425049;
  text-decoration: none;
  padding: 9px 10px;
  border-radius: 6px;
  font-size: 0.93rem;
  font-weight: 700;
}

nav a:hover,
nav a:focus-visible {
  background: #edf3ef;
  color: var(--green-dark);
  outline: none;
}


button,
.filter select,
.filter input,
.link-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.link-button {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

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

.secondary {
  background: #ffffff;
}

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

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.32rem, 2vw, 1.9rem);
  letter-spacing: 0;
}

h3 {
  margin-bottom: 6px;
  font-size: 1rem;
}

.page-title {
  padding: 20px 2px 4px;
}

.page-title h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1;
  letter-spacing: 0;
}

.eyebrow,
.report-card span {
  color: var(--green);
  text-transform: uppercase;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
}

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

.metrics article,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metrics article {
  padding: 18px;
  display: grid;
  gap: 7px;
}

.metrics span,
small,
.muted {
  color: var(--muted);
  line-height: 1.5;
}

.metrics strong {
  font-size: 2.15rem;
}

.layout {
  display: grid;
  gap: 18px;
}

.two-col {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
}

.panel {
  padding: 20px;
  min-width: 0;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  white-space: nowrap;
  border-radius: 999px;
  padding: 0 10px;
  background: #edf3ef;
  color: var(--green-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

.association-list,
.conversation-list,
.batch-list {
  display: grid;
  gap: 10px;
}

.association-list.compact .association-card:not(.active) {
  display: none;
}

.association-card,
.user-card,
.batch-card,
.conversation {
  width: 100%;
  min-height: 82px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  text-align: left;
  display: grid;
  gap: 6px;
}

.association-card.active,
.conversation.active {
  border-color: var(--green);
  background: #f1faf6;
}

.association-top,
.association-meta,
.conversation-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.association-meta,
.conversation small {
  color: var(--muted);
  font-size: 0.88rem;
}

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

.association-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.association-form input,
.association-form select,
.login-form input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: #ffffff;
}

.association-form button {
  align-self: end;
}

.action-list {
  display: grid;
  gap: 10px;
}

.action-row {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf6;
  color: inherit;
  text-decoration: none;
  display: grid;
  gap: 5px;
}

.action-row span {
  color: #3f4b45;
}

.user-list {
  display: grid;
  gap: 10px;
}

.upload-zone {
  margin: 18px 0 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.upload-zone input {
  max-width: 100%;
  padding: 11px;
  border: 1px dashed #b9c6bd;
  border-radius: 8px;
  background: #f7faf6;
}

.import-result {
  min-height: 96px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #17201c;
  color: #dff5e9;
  font-size: 0.86rem;
  line-height: 1.45;
}

.thread {
  min-height: 344px;
  max-height: 344px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf6;
  display: grid;
  align-content: start;
  gap: 10px;
}

.bubble {
  max-width: 86%;
  padding: 11px 12px;
  border-radius: 8px;
  line-height: 1.45;
  background: #ffffff;
  border: 1px solid var(--line);
}

.bubble.system {
  justify-self: end;
  background: #dcf4ea;
  border-color: #bde5d4;
}

.bubble small {
  display: block;
  margin-top: 6px;
}

.reply-sim {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reply-sim button {
  min-height: 38px;
  font-size: 0.9rem;
}

.reply-sim .link-button {
  min-height: 38px;
  font-size: 0.9rem;
}

.tenant-main {
  max-width: 980px;
}

.tenant-hero {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  display: grid;
  gap: 24px;
}

.tenant-heading {
  display: grid;
  gap: 10px;
}

.tenant-heading h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
  letter-spacing: 0;
}

.tenant-heading p {
  max-width: 680px;
  color: var(--muted);
  line-height: 1.55;
}

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

.tenant-trust span,
.tenant-summary div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf6;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 800;
}

.tenant-trust strong,
.tenant-summary strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 0.98rem;
  overflow-wrap: anywhere;
}

.tenant-summary span {
  color: var(--green);
  text-transform: uppercase;
  font-size: 0.72rem;
}

.tenant-panel {
  display: grid;
  gap: 14px;
}

.calendar-grid {
  margin: 14px 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.slot-card {
  min-height: 148px;
  padding: 14px;
  border-radius: 8px;
  background: #ffffff;
  display: grid;
  align-content: start;
  gap: 7px;
  text-align: left;
}

.slot-card span {
  color: var(--green);
  text-transform: uppercase;
  font-size: 0.74rem;
  font-weight: 900;
}

.slot-card strong {
  font-size: 1.22rem;
}

.slot-card em {
  align-self: end;
  color: var(--blue);
  font-style: normal;
  font-size: 0.83rem;
  font-weight: 800;
}

.slot-card.selected {
  border-color: var(--green);
  background: #e7f7ef;
}

.slot-card:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.empty-calendar {
  margin: 14px 0;
  padding: 18px;
  border: 1px solid #f0d2a3;
  border-radius: 8px;
  background: #fff8ed;
  display: grid;
  gap: 8px;
}

.empty-calendar strong {
  color: var(--amber);
  font-size: 1.05rem;
}

.empty-calendar p {
  margin-bottom: 0;
  color: #5f574b;
  line-height: 1.5;
}

.notes-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.notes-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  resize: vertical;
  font: inherit;
}

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

.filter {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.filter-bar {
  margin: 0 0 14px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 0.5fr) minmax(160px, 0.65fr) auto;
  gap: 10px;
  align-items: end;
}

.filter-bar .pill {
  align-self: end;
  justify-content: center;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  background: #f7faf6;
  color: #4f5b55;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

tr:last-child td {
  border-bottom: 0;
}

.table-action {
  display: block;
  width: max-content;
  min-height: 32px;
  margin-top: 8px;
  padding: 0 10px;
  font-size: 0.82rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.tag.Booked {
  background: #dff5e9;
  color: #146246;
}

.tag.Awaiting {
  background: #eef3f7;
  color: var(--blue);
}

.tag.Needs,
.tag.Failed {
  background: #fff1dc;
  color: var(--amber);
}

.tag.Refused {
  background: #fde8e5;
  color: var(--red);
}

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

.report-card div {
  padding: 14px;
  border-radius: 8px;
  background: #f7faf6;
  display: grid;
  gap: 7px;
}

.check-list {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.check-list.tight {
  margin-top: 4px;
}

.check-list li {
  padding-left: 26px;
  position: relative;
  color: #3f4b45;
  line-height: 1.5;
}

.check-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--green);
}

@media (max-width: 980px) {
  main {
    padding: 18px;
  }

  .app-banner {
    position: static;
    align-items: flex-start;
    display: grid;
  }

  .two-col,
  .metrics,
  .filter-bar,
  .calendar-grid,
  .tenant-trust,
  .tenant-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  main {
    padding: 12px;
  }

  .panel-heading,
  .reply-sim,
  .association-form,
  .booking-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .report-card {
    grid-template-columns: 1fr;
  }
}
/* Operational controls */
.operations-dialog { width:min(620px,94vw); max-height:90vh; overflow:auto; border:1px solid #d5dde5; border-radius:16px; padding:24px; }
.operations-dialog::backdrop { background:rgba(12,24,38,.55); }
.operations-dialog label { display:block; margin:12px 0; }
.operations-dialog input:not([type=checkbox]), .operations-dialog select, .operations-dialog textarea { width:100%; padding:10px; }
.operations-dialog menu { display:flex; gap:10px; padding:0; }
.operation-message { padding:14px 0; border-bottom:1px solid #d5dde5; }
.operation-message button { margin:6px 8px 0 0; }
