/* packages/kasandra_admin/web/styles.css */
:root {
  --bg: #dce6f2;
  --bg-2: #d8edf0;
  --ink: #192126;
  --muted: #5b6870;
  --surface: #f5f8fd;
  --surface-2: #edf4fb;
  --line: #d3dde8;
  --accent: #4f5dff;
  --accent-strong: #3443db;
  --ok: #1f9d55;
  --arch: #7f8c8d;
  --shadow: 0 18px 48px rgba(14, 34, 42, 0.13);
  --module-core-fill: #bfe9c8;
  --module-core-stroke: #2d8a4f;
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 10% 10%, #eff4ff 0%, transparent 40%),
    radial-gradient(circle at 80% 85%, #d6edf8 0%, transparent 38%), var(--bg);
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(40px);
  opacity: 0.26;
  pointer-events: none;
}

.bg-shape-a {
  width: 260px;
  height: 260px;
  background: #beceef;
  top: 30px;
  right: 30px;
}

.bg-shape-b {
  width: 280px;
  height: 280px;
  background: #c4e2eb;
  bottom: 28px;
  left: 18px;
}

.app-shell {
  width: min(1480px, 96vw);
  margin: 26px auto 36px;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 300px;
  gap: 16px;
  animation: shell-in 220ms ease-out;
}

body[data-page="offers"] .app-shell {
  grid-template-columns: 250px minmax(0, 1fr) 300px;
}

.card {
  background: color-mix(in srgb, var(--surface) 86%, white 14%);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.app-sidebar {
  position: sticky;
  top: 12px;
  align-self: start;
  min-height: calc(100vh - 84px);
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 16px;
}

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

.brand-logo.small {
  width: 62px;
  height: 62px;
  border-radius: 14px;
}

.sidebar-title {
  margin: 0;
  font-size: 1.18rem;
}

.kicker {
  margin: 0 0 4px;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.06em;
  color: #3b4d67;
  font-size: 0.76rem;
}

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

.side-nav a {
  text-decoration: none;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--surface-2) 75%, white 25%);
  transition: all 0.2s ease;
}

.side-nav a:hover {
  transform: translateX(1px);
  border-color: #b8c6dc;
}

.side-nav a.is-active {
  background: linear-gradient(140deg, var(--accent), var(--accent-strong));
  color: #fff;
  border-color: var(--accent-strong);
}

.sidebar-footer {
  align-self: end;
  color: var(--muted);
  font-size: 0.88rem;
  display: grid;
  gap: 4px;
}

.sidebar-footer p {
  margin: 0;
}

.sidebar-logout {
  width: 100%;
}

.app-main {
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
}

.app-main > .card {
  min-width: 0;
}

.page-head {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(1.5rem, 2.7vw, 2.2rem);
}

.page-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

.compact-head {
  padding: 14px 18px;
}

.compact-head h1 {
  font-size: clamp(1.2rem, 2vw, 1.8rem);
}

body[data-page="clients"] .page-head {
  min-height: 112px;
}

.app-rail {
  display: grid;
  gap: 14px;
  align-self: start;
  position: sticky;
  top: 12px;
}

.rail-card h3 {
  margin-top: 0;
}

.rail-link {
  display: block;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: color-mix(in srgb, var(--surface-2) 80%, white 20%);
}

.rail-link:hover {
  border-color: #afc0d9;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.offers-head {
  align-items: center;
}

.offers-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.offers-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.offers-meta-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
}

.offers-archived-switch {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.section-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

h2 {
  margin: 0 0 12px;
  font-size: 1.14rem;
}

h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.counter {
  color: var(--muted);
  font-size: 0.92rem;
}

.dashboard-map {
  width: 100%;
  height: 420px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.dashboard-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

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

.settings-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdff;
  padding: 12px;
}

.settings-form {
  display: grid;
  gap: 10px;
}

.settings-template-controls {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 12px;
}

.settings-template-test-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.dashboard-split.is-stacked {
  grid-template-columns: 1fr;
}

.dashboard-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.chart-card {
  min-height: 320px;
}

.hint-inline {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-ok {
  color: #0f5132;
}

.status-error {
  color: #8b1e1e;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-shell {
  width: min(560px, 94vw);
}

.login-card {
  display: grid;
  gap: 18px;
}

.login-title {
  margin: 0;
  font-size: clamp(1.4rem, 2.2vw, 1.9rem);
}

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

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.8rem;
  color: var(--muted);
  background: #fff;
}

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

.chart-wrap {
  position: relative;
  width: 100%;
  height: 240px;
}

.chart-empty-note {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 12px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.chart-wrap.compact {
  height: 220px;
}

.module-legend {
  margin-bottom: 10px;
}

.module-puzzle-board {
  position: relative;
  width: 100%;
  min-height: 760px;
  border: 1px dashed #bfd0e2;
  border-radius: 18px;
  background:
    radial-gradient(circle at 20% 12%, rgba(79, 93, 255, 0.06), transparent 34%),
    radial-gradient(circle at 82% 84%, rgba(50, 150, 190, 0.09), transparent 38%),
    #f6fbff;
  overflow: hidden;
}

.module-core {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 332px;
  height: 560px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.module-core svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.module-core path {
  fill: var(--module-core-fill);
  stroke: var(--module-core-stroke);
  stroke-width: 2.2;
  filter: none;
}

.core-label {
  font-size: 1.16rem;
  font-weight: 700;
  color: #1f5d36;
  z-index: 2;
  pointer-events: none;
}

.module-pieces-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
}

.module-piece {
  position: absolute;
  width: 206px;
  height: 86px;
  border: none;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0;
  font-weight: 600;
  color: #1d2834;
  line-height: 1.2;
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: left 220ms cubic-bezier(0.2, 0.72, 0.2, 1), border-color 0.18s ease,
    box-shadow 0.18s ease, background 0.18s ease, transform 0.1s ease;
}

.module-piece:active {
  cursor: grabbing;
}

.module-piece svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.module-piece path {
  fill: #f1f5fa;
  stroke: #5f7288;
  stroke-width: 2.2;
  filter: none;
  transition: fill 0.16s ease, stroke 0.16s ease, filter 0.16s ease;
}

.module-piece-label {
  position: relative;
  z-index: 2;
  max-width: 146px;
  pointer-events: none;
}

.module-piece.unconfigured path {
  fill: #eef3fa;
  stroke: #7e8ea3;
}

.module-piece.configured path {
  fill: #adc7f2;
  stroke: #1f3e73;
  filter: none;
}

.module-piece.connected {
  color: #174f2d;
  font-weight: 700;
}

.module-piece.connected path {
  fill: var(--module-core-fill);
  stroke: var(--module-core-stroke);
  filter: none;
}

.module-piece.connected.pending-employee-calendar {
  color: #6a4d00;
}

.module-piece.connected.pending-employee-calendar path {
  fill: #ffe6a8;
  stroke: #a87500;
}

.module-piece.selected {
  outline: none;
}

.module-piece.selected path {
  stroke: #1e2b3c;
  stroke-width: 3.2;
  filter: none;
}

.module-piece.future {
  opacity: 0.88;
}

.module-piece.future path {
  fill: #edf1f6;
  stroke: #7e8ea3;
  stroke-dasharray: 8 5;
}

.module-piece.dragging {
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease,
    transform 0.1s ease;
  transform: scale(1.02);
}

.module-config-form.hidden {
  display: none;
}

.module-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.module-config-grid label {
  margin: 0;
}

.module-config-help {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.35;
}

.module-config-label-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.module-field-hint {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.module-field-hint-icon {
  all: unset;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid #aebdd1;
  background: #fff;
  color: #41566f;
  font-size: 0.72rem;
  line-height: 1;
  font-weight: 700;
  text-align: center;
  cursor: help;
  display: inline-grid;
  place-items: center;
}

.module-field-hint-icon:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 1px;
}

.module-field-hint-tooltip {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  width: min(320px, 70vw);
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #b8c8dc;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(20, 35, 50, 0.12);
  font-size: 0.82rem;
  line-height: 1.35;
  opacity: 0;
  transform: translateY(-2px);
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.module-field-hint:hover .module-field-hint-tooltip,
.module-field-hint:focus-within .module-field-hint-tooltip {
  opacity: 1;
  transform: translateY(0);
}

.module-config-layout-inbox {
  display: block;
}

.module-config-priority {
  display: grid;
  gap: 10px 12px;
}

.module-config-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.module-config-row > .module-config-cell:only-child {
  grid-column: 1 / -1;
}

.module-config-advanced {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-2) 76%, white 24%);
}

.module-config-advanced > summary {
  cursor: pointer;
  list-style: none;
  margin: 0;
  padding: 10px 12px;
  font-weight: 600;
}

.module-config-advanced > summary::-webkit-details-marker {
  display: none;
}

.module-config-advanced[open] > summary {
  border-bottom: 1px solid var(--line);
}

.module-config-advanced-grid {
  padding: 10px 12px 12px;
}

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

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

.client-detail-window {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fbfdff;
}

.clients-form-grid .actions {
  align-self: end;
}

.client-additional-info {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-2) 76%, white 24%);
}

.client-additional-info > summary {
  cursor: pointer;
  list-style: none;
  margin: 0;
  padding: 10px 12px;
  font-weight: 600;
}

.client-additional-info > summary::-webkit-details-marker {
  display: none;
}

.client-additional-info[open] > summary {
  border-bottom: 1px solid var(--line);
}

.client-additional-info-label {
  display: grid;
  gap: 6px;
  padding: 10px 12px 12px;
}

.client-additional-info textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
}

.client-timeline {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 10px 0;
  min-height: 120px;
}

.client-timeline::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, #9bb2d1, #c7d8ea);
  transform: translateX(-1px);
}

.timeline-item {
  position: relative;
  width: calc(50% - 20px);
}

.timeline-item.left {
  justify-self: start;
  padding-right: 18px;
}

.timeline-item.right {
  justify-self: end;
  padding-left: 18px;
}

.timeline-dot {
  position: absolute;
  top: 14px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #4f5dff;
  border: 2px solid #eef3ff;
  box-shadow: 0 0 0 2px rgba(79, 93, 255, 0.2);
}

.timeline-item.left .timeline-dot {
  right: -24px;
}

.timeline-item.right .timeline-dot {
  left: -24px;
}

.timeline-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
  box-shadow: 0 4px 12px rgba(12, 26, 38, 0.08);
}

.timeline-card h4 {
  margin: 0;
  font-size: 0.96rem;
}

.timeline-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.timeline-card .timeline-meta {
  margin: 0;
  font-size: 0.78rem;
  color: #6c7a87;
  font-family: "IBM Plex Mono", monospace;
}

.timeline-actions {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.timeline-action-btn {
  border: 1px solid #b8c7dd;
  background: #f4f8ff;
  color: #20324a;
  border-radius: 999px;
  font-size: 0.75rem;
  padding: 3px 10px;
  cursor: pointer;
}

.timeline-action-btn:hover {
  background: #e8f0ff;
}

.timeline-empty {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 16px;
  color: var(--muted);
  background: #fbfdff;
}

.dnd-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0 14px;
}

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

.dnd-lane {
  border: 1px dashed #c1cde1;
  border-radius: 14px;
  padding: 10px;
  background: #f7fbff;
  min-height: 130px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.dnd-lane h3 {
  margin-bottom: 8px;
}

.dnd-lane.is-over {
  border-color: var(--accent);
  background: #edf1ff;
}

.lane-cards {
  display: grid;
  gap: 8px;
}

.drag-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 50, 60, 0.08);
  cursor: grab;
}

.drag-card:active {
  cursor: grabbing;
}

.drag-card .title {
  font-weight: 600;
}

.drag-card .meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

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

.employees-table {
  min-width: 680px;
}

.employee-calendar-send-panel {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
}


.offers-table {
  min-width: 860px;
}

.offers-table th,
.offers-table td {
  vertical-align: middle;
}

.offers-table th:last-child,
.offers-table td:last-child {
  text-align: right;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  font-size: 0.92rem;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-active {
  color: #0f5132;
  background: #d4f4e4;
}

.badge-archived {
  color: #3d4b52;
  background: #e8edf0;
}

.badge-future {
  color: #5c3b00;
  background: #fde6b0;
}

form {
  display: grid;
  gap: 8px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.95rem;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-color: var(--accent);
}

.editor-shell {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: #f8fafb;
}

button.editor-btn {
  min-width: 34px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 600;
  transform: none;
}

button.editor-btn:hover {
  background: #eef5f6;
  transform: none;
}

button.editor-btn:focus,
button.editor-btn:focus-visible,
button.editor-btn:active {
  outline: 2px solid color-mix(in srgb, var(--accent) 20%, transparent);
  outline-offset: 1px;
  background: #fff;
  color: var(--ink);
  box-shadow: none;
  transform: none;
}

button.editor-btn.is-active {
  border-color: color-mix(in srgb, var(--accent) 55%, #5e7998);
  background: color-mix(in srgb, var(--accent) 18%, #ffffff);
  color: color-mix(in srgb, var(--accent) 72%, #1e3556);
}

.color-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 0.85rem;
}

.color-picker input[type="color"] {
  width: 34px;
  height: 28px;
  padding: 2px;
  border-radius: 8px;
}

.mail-content-editor {
  min-height: 220px;
  padding: 12px;
  outline: none;
  line-height: 1.5;
}

.mail-content-editor:empty::before {
  content: attr(data-placeholder);
  color: #8a949b;
  pointer-events: none;
}

.attachment-box {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 10px;
  margin-bottom: 4px;
  background: #fbfcfd;
}

.attachment-current {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--muted);
}

.attachment-current strong {
  color: var(--ink);
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.switch-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.switch-field > span:first-child {
  color: var(--ink);
}

.switch-field.compact {
  display: inline-flex;
  justify-content: flex-start;
  gap: 8px;
  margin: 0;
}

.switch-field.compact > span:first-child {
  font-size: 0.82rem;
  color: var(--muted);
}

.switch-field.compact .ios-switch {
  width: 44px;
  height: 25px;
}

.switch-field.compact .ios-slider::before {
  left: 2px;
  top: 2px;
  width: 19px;
  height: 19px;
}

.switch-field.compact .ios-switch input:checked + .ios-slider::before {
  transform: translateX(18px);
}

.ios-switch {
  position: relative;
  width: 54px;
  height: 32px;
  flex: 0 0 auto;
  display: inline-block;
}

.ios-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.ios-slider {
  position: absolute;
  inset: 0;
  background: #d8dee6;
  border: 1px solid #bfc9d6;
  border-radius: 999px;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.ios-slider::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 24px;
  height: 24px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(12, 28, 40, 0.35);
  transition: transform 0.2s ease;
}

.ios-switch input:checked + .ios-slider {
  background: #59c978;
  border-color: #3ea861;
}

.ios-switch input:checked + .ios-slider::before {
  transform: translateX(22px);
}

.ios-switch input:focus-visible + .ios-slider {
  outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent);
  outline-offset: 2px;
}

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

button {
  border: 1px solid var(--accent-strong);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font: 600 0.93rem "Space Grotesk", sans-serif;
  color: #fff;
  background: linear-gradient(160deg, var(--accent), var(--accent-strong));
}

button.alt {
  border-color: var(--line);
  color: var(--ink);
  background: #fff;
}

button.danger {
  border-color: #9f1f2d;
  color: #fff;
  background: linear-gradient(160deg, #dc3545, #b51f2e);
}

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

.row-actions {
  white-space: nowrap;
  text-align: right;
}

.row-actions > * + * {
  margin-left: 6px;
}

.pill {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  color: var(--muted);
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill-category {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #22374b;
  background: #dbe8f7;
  border: 1px solid #b5cbe4;
}

.inline-label {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.inline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.offer-match-phrase-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 8px;
}

.choice-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
  color: var(--ink);
  font-size: 0.86rem;
}

.choice-chip input {
  margin: 0;
}

.choice-chip-removable {
  cursor: pointer;
  font: 500 0.86rem "Space Grotesk", sans-serif;
  transform: none;
}

.choice-chip-removable:hover {
  transform: none;
  background: #f3f7fc;
}

.choice-chip-removable:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 28%, transparent);
  outline-offset: 1px;
}

.choice-chip-removable span {
  pointer-events: none;
}

.choice-chip-remove {
  font-weight: 700;
  color: var(--muted);
}

.small-btn {
  padding: 8px 10px;
  font-size: 0.84rem;
}

.category-manage-btn {
  border-color: var(--accent-strong);
  color: #fff;
  background: linear-gradient(160deg, var(--accent), var(--accent-strong));
}

.test-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto;
  align-items: end;
}

.pagination {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 14px;
  background: rgba(18, 28, 40, 0.38);
  backdrop-filter: blur(2px);
}

.modal-card {
  width: min(860px, 100%);
  max-height: calc(100vh - 64px);
  overflow: auto;
  background: color-mix(in srgb, var(--surface) 90%, white 10%);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 16px;
}

#offer-detail-modal {
  z-index: 990;
}

#offer-detail-modal .modal-card {
  width: min(980px, 100%);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#offer-detail-modal .offer-detail-header {
  position: relative;
  z-index: 20;
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  background: #edf3fb;
  background: color-mix(in srgb, var(--surface) 92%, white 8%);
}

#offer-detail-modal .offer-detail-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 12px 16px 16px;
}

#offer-categories-modal {
  z-index: 1000;
}

#offer-transaction-types-modal {
  z-index: 1000;
}

#client-detail-modal .modal-card {
  width: min(1320px, 100%);
}

#client-reply-preview-modal .modal-card {
  width: min(860px, 100%);
}

.reply-preview-card textarea {
  min-height: 220px;
  resize: vertical;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.9rem;
}

.reply-preview-meta {
  margin: 4px 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  background: #fbfdff;
}

.reply-preview-meta p {
  margin: 4px 0;
  font-size: 0.88rem;
}

.modal-divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 14px 0;
}

.modal-card table {
  min-width: 0;
}

@keyframes shell-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1240px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .app-rail {
    position: static;
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }
}

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

  .app-sidebar {
    position: static;
    min-height: auto;
  }

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

  .app-rail {
    grid-template-columns: 1fr;
  }

  .dnd-board,
  .dnd-board-three {
    grid-template-columns: 1fr;
  }

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

  .offers-toolbar {
    width: 100%;
    justify-content: flex-start;
  }

  .dashboard-map {
    height: 300px;
  }

  .dashboard-split {
    grid-template-columns: 1fr;
  }

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

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

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

  .module-puzzle-board {
    min-height: 700px;
  }

  .module-config-grid {
    grid-template-columns: 1fr;
  }

  .module-config-row {
    grid-template-columns: 1fr;
  }

  .employees-bottom-grid {
    grid-template-columns: 1fr;
  }

  .clients-form-grid {
    grid-template-columns: 1fr;
  }

  .client-timeline::before {
    left: 14px;
  }

  .timeline-item {
    width: 100%;
    padding-left: 34px !important;
    padding-right: 0 !important;
  }

  .timeline-item.left .timeline-dot,
  .timeline-item.right .timeline-dot {
    left: 8px;
    right: auto;
  }

  .chart-wrap,
  .chart-wrap.compact {
    height: 220px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100%, 100vw);
    margin: 12px auto 20px;
    gap: 10px;
    padding: 0 8px;
  }

  .card {
    padding: 14px;
    border-radius: 16px;
  }

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

  table {
    min-width: 700px;
  }
}
