:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --text: #172026;
  --muted: #63717a;
  --line: #dce3e7;
  --primary: #176b5b;
  --primary-strong: #0f5749;
  --accent: #b43757;
  --amber: #a66300;
  --green: #17834f;
  --orange: #c45d1b;
  --red: #b42318;
  --blue: #2867b2;
  --shadow: 0 10px 30px rgba(23, 32, 38, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

button {
  border: 0;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  min-height: 38px;
  padding: 0 14px;
}

button:hover {
  background: var(--primary-strong);
}

button.secondary {
  background: #eef4f2;
  color: var(--primary-strong);
}

button.secondary:hover {
  background: #dcebe7;
}

button.danger {
  background: #fde7e5;
  color: var(--red);
}

button.danger:hover {
  background: #fbd0cc;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #102521;
  color: #f3fbf8;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px;
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
}

.brand-mark {
  align-items: center;
  background: #f4c95d;
  border-radius: 7px;
  color: #102521;
  display: flex;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.brand span,
.tenant-card span,
.tenant-card small {
  color: #b9cbc5;
  display: block;
  font-size: 12px;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  background: transparent;
  color: #d7e4df;
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  padding: 10px 12px;
  text-align: left;
}

.nav button.active,
.nav button:hover {
  background: #1d3a34;
  color: #fff;
}

.tenant-card {
  background: #18332e;
  border: 1px solid #284841;
  border-radius: 8px;
  margin-top: auto;
  padding: 14px;
}

.main {
  min-width: 0;
  padding: 26px;
}

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

.topbar h1 {
  font-size: 28px;
  letter-spacing: 0;
  margin: 0;
}

.topbar p {
  color: var(--muted);
  margin: 4px 0 0;
}

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

.icon-button {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  height: 42px;
  justify-content: center;
  padding: 0;
  position: relative;
  width: 42px;
}

.icon-button em {
  background: var(--accent);
  border: 2px solid #fff;
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  line-height: 18px;
  min-width: 22px;
  padding: 0 4px;
  position: absolute;
  right: -8px;
  top: -6px;
}

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

.grid {
  display: grid;
  gap: 14px;
}

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

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

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

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

.panel {
  padding: 18px;
}

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

.panel-header h2,
.panel h2 {
  font-size: 18px;
  letter-spacing: 0;
  margin: 0;
}

.panel-header p,
.panel p {
  color: var(--muted);
  margin: 4px 0 0;
}

.stat {
  border-left: 4px solid var(--primary);
  min-height: 112px;
  padding: 16px;
}

.stat strong {
  display: block;
  font-size: 30px;
}

.stat span {
  color: var(--muted);
  display: block;
  margin-top: 4px;
}

.toolbar {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: #3c4a51;
  font-size: 13px;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  background: #fff;
  border: 1px solid #cfd9de;
  border-radius: 6px;
  color: var(--text);
  min-height: 38px;
  padding: 8px 10px;
  width: 100%;
}

.field textarea {
  min-height: 82px;
  resize: vertical;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 780px;
  width: 100%;
}

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

th {
  color: #4a5960;
  font-size: 12px;
  text-transform: uppercase;
}

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

.badge {
  background: #edf1f3;
  border-radius: 999px;
  color: #35454d;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  line-height: 22px;
  padding: 0 9px;
  white-space: nowrap;
}

.badge.green {
  background: #dff5ea;
  color: var(--green);
}

.badge.amber {
  background: #fff1d7;
  color: var(--amber);
}

.badge.orange {
  background: #ffe8dc;
  color: var(--orange);
}

.badge.red {
  background: #fde7e5;
  color: var(--red);
}

.badge.blue {
  background: #e3efff;
  color: var(--blue);
}

.calendar {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(7, minmax(96px, 1fr));
}

.day {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 128px;
  padding: 10px;
}

.day strong {
  color: #526168;
  display: block;
  font-size: 12px;
  margin-bottom: 8px;
}

.appointment-chip {
  border-left: 4px solid var(--muted);
  border-radius: 6px;
  background: #f7f9fa;
  display: grid;
  gap: 2px;
  margin-bottom: 8px;
  padding: 8px;
}

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

.kanban {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  overflow-x: auto;
}

.kanban-col {
  background: #eef2f3;
  border-radius: 8px;
  min-height: 280px;
  padding: 10px;
}

.kanban-col h3 {
  font-size: 14px;
  margin: 4px 4px 10px;
}

.card {
  box-shadow: none;
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 12px;
}

.card h4 {
  font-size: 15px;
  margin: 0;
}

.card p {
  color: var(--muted);
  margin: 0;
}

.message-preview {
  background: #eef7f4;
  border: 1px solid #cae5dd;
  border-radius: 8px;
  color: #173d35;
  line-height: 1.45;
  padding: 14px;
  white-space: pre-wrap;
}

.template-content {
  background: #f7f9fa;
  border: 1px dashed #c4d0d6;
  border-radius: 8px;
  color: #2f3f47;
  padding: 12px;
}

.notification-panel {
  background: #fff8e8;
  border: 1px solid #f1d79d;
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 12px;
}

.notification-item {
  border-bottom: 1px solid #f1d79d;
  padding: 10px 0;
}

.notification-item:last-child {
  border-bottom: 0;
}

.timeline {
  border-left: 3px solid #d6e0e4;
  display: grid;
  gap: 14px;
  margin-left: 8px;
  padding-left: 16px;
}

.timeline-item {
  position: relative;
}

.timeline-item:before {
  background: var(--primary);
  border: 3px solid #fff;
  border-radius: 999px;
  content: "";
  height: 10px;
  left: -23px;
  position: absolute;
  top: 4px;
  width: 10px;
}

.modal-root {
  align-items: center;
  background: rgba(16, 37, 33, 0.52);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 20;
}

.modal {
  max-height: min(760px, 92vh);
  max-width: 820px;
  overflow: auto;
  padding: 18px;
  width: 100%;
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

.hidden {
  display: none !important;
}

.toast {
  background: #102521;
  border-radius: 8px;
  bottom: 20px;
  box-shadow: var(--shadow);
  color: #fff;
  left: 50%;
  max-width: min(520px, calc(100vw - 40px));
  padding: 12px 16px;
  position: fixed;
  transform: translateX(-50%);
  z-index: 30;
}

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

  .sidebar {
    position: static;
  }

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

  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4 {
    grid-template-columns: 1fr;
  }

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

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