:root {
  --bg-cream: #f8f0e4;
  --bg-sky: #dceef2;
  --ink: #1f3440;
  --muted: #5b7077;
  --panel: #ffffffd9;
  --border: #d0dde1;
  --brand: #0f7f8d;
  --brand-soft: #d9f4f2;
  --accent: #f4b942;
  --danger: #d14a4a;
  --shadow: 0 20px 45px rgba(16, 42, 51, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 10%, #ffffffab 0 16%, transparent 44%),
    radial-gradient(circle at 82% 18%, #f6d9a461 0 14%, transparent 45%),
    linear-gradient(160deg, var(--bg-cream) 0%, #edf9f3 52%, var(--bg-sky) 100%);
  min-height: 100vh;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: "Fraunces", "Times New Roman", serif;
}

p {
  margin: 0;
}

.app-shell,
.reporting-shell {
  max-width: 1760px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.eyebrow {
  color: var(--brand);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
  margin-bottom: 5px;
}

.topbar h1 {
  font-size: clamp(1.4rem, 2.7vw, 2.1rem);
}

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

.button {
  border: 1px solid transparent;
  background: linear-gradient(120deg, #0f7f8d, #1fa8a0);
  color: #fff;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 127, 141, 0.24);
}

.button:disabled {
  cursor: wait;
  opacity: 0.7;
}

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

.button.ghost.is-active {
  background: #eaf7ff;
  border-color: #9cc4d8;
  color: #0f5664;
}

.button.danger {
  background: linear-gradient(120deg, #b52a2a, #d14a4a);
}

.button.small {
  padding: 0.4rem 0.78rem;
  font-size: 0.78rem;
}

.pill {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 0.35rem 0.72rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.pill.small {
  padding: 0.18rem 0.5rem;
  font-size: 0.73rem;
}

.tabs-wrap {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.demo-consult-cta {
  margin-top: 14px;
  border: 1px dashed #8bc2cd;
  border-radius: 16px;
  background: linear-gradient(130deg, #f9fffd, #e7f6f9);
  padding: 20px;
  display: grid;
  justify-items: center;
  gap: 8px;
}

html.public-demo-boot .demo-consult-cta {
  display: grid !important;
}

.consult-main {
  font-size: 1rem;
  padding: 0.7rem 1.4rem;
}

.consult-subline {
  font-size: 0.84rem;
  font-weight: 700;
  color: #517180;
}

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

.tab-mode-pill {
  border: 1px solid #d7e4e9;
  border-radius: 999px;
  background: #fff;
  padding: 0.42rem 0.84rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.tab-button {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

.tab-button.is-active {
  background: linear-gradient(120deg, #fffef5, #ffecc3);
  border-color: #f0cf80;
}

.sync-stamp {
  margin-top: 8px;
  font-size: 0.83rem;
  color: var(--muted);
}

.tasks-admin-controls {
  display: none;
  margin-top: 10px;
  border: 1px dashed #b8cbd2;
  border-radius: 10px;
  background: #f7fcfe;
  padding: 8px 10px;
}

.tasks-admin-controls.is-open {
  display: block;
}

.tasks-admin-title {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #4d6d77;
}

.tasks-admin-options {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.tasks-admin-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
}

.board-controls {
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) repeat(2, minmax(140px, 1fr)) auto auto;
  gap: 8px;
  align-items: end;
}

.board-controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.board-controls input,
.board-controls select {
  border: 1px solid #c5d4d9;
  background: #fff;
  border-radius: 9px;
  padding: 0.46rem 0.58rem;
  color: var(--ink);
  font-size: 0.84rem;
}

.board-controls select,
.priority-select,
.login-form select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image:
    linear-gradient(180deg, #ffffff, #f3f8fa),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'%3E%3Cpath fill='%235b7077' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-size: auto, 14px;
  background-position: center, right 0.5rem center;
  padding-right: 1.7rem;
  border-color: #a9c0c8;
  box-shadow: inset 0 1px 2px rgba(16, 42, 51, 0.06);
}

.board-controls select:focus,
.priority-select:focus,
.login-form select:focus {
  outline: none;
  border-color: #0f7f8d;
  box-shadow: 0 0 0 3px rgba(15, 127, 141, 0.16);
}

.checkbox-control {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  margin-bottom: 5px;
}

.checkbox-control input {
  width: 16px;
  height: 16px;
}

.filter-summary {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  justify-self: end;
  align-self: center;
}

.layout {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
}

.board-wrap {
  min-width: 0;
}

.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 1fr);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.board-column {
  min-height: 68vh;
  background: linear-gradient(180deg, #fffdfa 0%, #f7fbff 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 10px 24px rgba(26, 42, 55, 0.08);
}

.column-header {
  border-bottom: 1px solid #d8e4e8;
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.column-header h3 {
  font-size: 1.04rem;
}

.column-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.column-dropzone {
  min-height: 62vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-radius: 10px;
  transition: background-color 100ms ease;
}

.column-dropzone.is-over {
  background: var(--brand-soft);
}

.opportunity-card {
  border: 1px solid #c5d8de;
  border-left: 6px solid var(--brand);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  box-shadow: 0 10px 18px rgba(14, 48, 57, 0.09);
  cursor: grab;
}

.opportunity-card.is-dragging {
  opacity: 0.5;
}

.opportunity-card.is-stale {
  border-color: #df8f8f;
  border-left-color: var(--danger);
  box-shadow: 0 0 0 2px #df8f8f4d;
  animation: pulse-border 1.7s ease-in-out infinite;
}

@keyframes pulse-border {
  0% {
    box-shadow: 0 0 0 1px #df8f8f4d;
  }
  50% {
    box-shadow: 0 0 0 4px #df8f8f80;
  }
  100% {
    box-shadow: 0 0 0 1px #df8f8f4d;
  }
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.card-head h4 {
  font-size: 1rem;
}

.lease-number {
  font-weight: 700;
  color: #0f606c;
  font-size: 0.84rem;
  white-space: nowrap;
}

.meta-row {
  margin-top: 5px;
  font-size: 0.83rem;
  color: var(--muted);
}

.priority-control {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.82rem;
  font-weight: 700;
}

.priority-select {
  border: 1px solid #a8c0c9;
  border-radius: 9px;
  background: linear-gradient(180deg, #ffffff, #f3f8fa);
  color: var(--ink);
  padding: 0.34rem 1.72rem 0.34rem 0.5rem;
  font-weight: 700;
  font-size: 0.8rem;
}

.stale-warning {
  margin-top: 8px;
  padding: 0.26rem 0.5rem;
  border-radius: 8px;
  background: #fff0f0;
  color: #8b2b2b;
  font-size: 0.78rem;
  font-weight: 700;
}

.advance-button {
  width: 100%;
  margin-top: 9px;
  border: 1px solid #f0cf80;
  border-radius: 8px;
  background: #fff6df;
  color: #6c4a00;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.42rem 0.5rem;
  cursor: pointer;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 12px;
}

.panel h2 {
  font-size: 1.06rem;
  margin-bottom: 8px;
}

.panel p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
  margin-bottom: 8px;
}

.outbox-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 350px;
  overflow: auto;
}

.outbox-item {
  border: 1px solid #d4e1e5;
  background: #fff;
  border-radius: 10px;
  padding: 8px;
  font-size: 0.79rem;
  line-height: 1.35;
}

.outbox-item .timestamp {
  margin-top: 3px;
  color: #687d85;
  font-size: 0.73rem;
}

.empty-state {
  color: var(--muted);
  font-size: 0.8rem;
}

.settings-panel {
  display: none;
}

.settings-panel.is-open {
  display: block;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 700;
}

.settings-form input,
.login-form input,
.login-form select,
.login-form textarea {
  border: 1px solid #c5d4d9;
  background: #fff;
  border-radius: 10px;
  padding: 0.53rem 0.65rem;
  color: var(--ink);
  font-size: 0.87rem;
}

.login-form textarea {
  resize: vertical;
  min-height: 92px;
}

.modal {
  position: fixed;
  inset: 0;
  background: #0f303966;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal.is-open {
  display: flex;
}

.modal-card {
  width: min(430px, 100%);
  border-radius: 16px;
  border: 1px solid #d5e3e8;
  background: #fff;
  padding: 20px;
  box-shadow: var(--shadow);
}

.modal-card h2 {
  margin-bottom: 12px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.84rem;
  font-weight: 700;
}

.error-text {
  color: #a12828;
  min-height: 1.1em;
  font-size: 0.78rem;
}

.is-hidden {
  display: none !important;
}

.app-shell.is-locked {
  filter: blur(2px);
  pointer-events: none;
}

body.mode-public-demo .app-shell.is-locked {
  filter: none;
  pointer-events: auto;
}

html.public-demo-boot #login-modal {
  display: none !important;
}

html.public-demo-boot .app-shell.is-locked {
  filter: none;
  pointer-events: auto;
}

html.public-demo-boot .layout {
  grid-template-columns: 1fr;
}

html.public-demo-boot .sidebar {
  display: none;
}

html.public-demo-boot #my-tasks-toggle,
html.public-demo-boot #settings-toggle,
html.public-demo-boot #sync-button,
html.public-demo-boot #logout-button {
  display: none;
}

body.mode-public-demo .layout {
  grid-template-columns: 1fr;
}

body.mode-public-demo .sidebar {
  display: none;
}

body.mode-public-demo #my-tasks-toggle,
body.mode-public-demo #settings-toggle,
body.mode-public-demo #sync-button,
body.mode-public-demo #logout-button {
  display: none;
}

body.mode-public-demo #current-user {
  background: #e8f9ef;
  border-color: #a9d8bb;
  color: #1f5d3a;
}

body.mode-public-demo .tabs-wrap {
  margin-bottom: 2px;
}

.consultation-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.toast-container {
  position: fixed;
  right: 18px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 40;
}

.toast {
  background: #13353a;
  color: #fff;
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  font-size: 0.82rem;
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.2);
}

.toast.is-error {
  background: #9f2f2f;
}

.metric-grid {
  margin-top: 16px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.metric-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 14px;
}

.metric-card h2 {
  font-size: 1.02rem;
  color: var(--muted);
}

.metric-value {
  margin-top: 10px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--ink);
}

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

.visual-card {
  border: 1px solid #d5e3e8;
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  box-shadow: 0 10px 20px rgba(15, 46, 56, 0.08);
}

.visual-card h3 {
  font-size: 0.98rem;
  margin-bottom: 10px;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  align-items: center;
}

.donut-chart {
  width: 130px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 1px solid #d0dde1;
  position: relative;
}

.donut-chart::after {
  content: "";
  position: absolute;
  inset: 26%;
  background: #fff;
  border-radius: 50%;
  border: 1px solid #e6eff2;
}

.donut-legend {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.donut-legend li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.legend-label {
  flex: 1;
}

.legend-value {
  color: var(--ink);
  font-weight: 700;
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bar-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
}

.bar-label {
  color: var(--muted);
}

.bar-value {
  color: var(--ink);
  font-weight: 700;
}

.bar-track {
  width: 100%;
  height: 10px;
  background: #edf3f6;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(120deg, #0f7f8d, #31b3a9);
}

.bar-fill.is-danger {
  background: linear-gradient(120deg, #c44848, #df6a6a);
}

.chart-empty {
  font-size: 0.8rem;
  color: var(--muted);
}

.panel.full {
  margin-top: 14px;
}

.table-wrap {
  margin-top: 10px;
  overflow: auto;
}

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

th,
td {
  border-bottom: 1px solid #d8e5e9;
  text-align: left;
  padding: 0.52rem 0.4rem;
  font-size: 0.84rem;
}

th {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.department-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
}

.department-card {
  border: 1px solid #d4e2e7;
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  box-shadow: 0 10px 20px rgba(15, 46, 56, 0.08);
}

.department-card h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.department-card p {
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--muted);
}

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

  .board-column {
    min-height: 50vh;
  }

  .column-dropzone {
    min-height: 45vh;
  }

  .sidebar {
    order: -1;
  }

  .board-controls {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .filter-summary {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (max-width: 700px) {
  .app-shell,
  .reporting-shell {
    padding: 12px;
  }

  .topbar {
    padding: 14px;
  }

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

  .tabs-wrap {
    padding: 10px;
  }

  .board-controls {
    grid-template-columns: 1fr;
  }

  .filter-summary {
    justify-self: start;
  }

  .donut-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .donut-legend {
    width: 100%;
  }

  .board {
    grid-auto-columns: minmax(240px, 1fr);
  }

  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
}
