/* ============================================================================
   CoreKitly design tokens — the ONE place a brand colour is defined.

   Every CoreKitly app links this file: the public site, Platform, Websites,
   Booking, Social, Video and anything built later. Changing a colour here
   changes it everywhere. No app may hard-code a CoreKitly colour.

   The layout, spacing and component shapes below are taken from the
   SetupWizard, which the founder spent months refining. They are copied
   deliberately, not invented.
   ========================================================================== */

:root {
  /* ---- CoreKitly palette (the only place these appear) ------------------ */
  --ck-navy: #0F3B74;
  --ck-sky: #63A0E6;
  --ck-pale: #C7D8ED;
  --ck-ice: #EBF2FA;
  --ck-action: #245B91;
  --ck-action-hover: #1C4773;
  --ck-ivory: #FAF9F5;
  --ck-ink: #202C2C;
  --ck-muted: #4A5958;
  --ck-border: #D5DDE4;
  --ck-footer: #152B43;

  /* ---- Feedback -------------------------------------------------------- */
  --ck-ok-bg: #E7F6EA;
  --ck-ok-ink: #1E5A33;
  --ck-ok-line: #B7D4B7;
  --ck-warn-bg: #FDF1EE;
  --ck-warn-ink: #7A2415;
  --ck-warn-line: #E3B7AC;
  /* One error look, used for every invalid field in every app.
     The border and the words are red, because an error should read as an error. Only the field's fill is a
     pale salmon, so the box never looks like an alarm panel. The text red is a shade deeper than the
     border so it meets contrast on white. */
  --ck-error-red: #EF2A07;      /* border, exactly the red the founder asked for */
  --ck-error-ink: #C2260A;      /* the words: same red family, dark enough to read */
  --ck-error-line: var(--ck-error-red);
  --ck-error-bg: #FEF1EC;       /* pale salmon fill */
  --ck-info-bg: var(--ck-ice);
  --ck-info-ink: var(--ck-navy);

  /* ---- Type ------------------------------------------------------------ */
  --ck-font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  /* One family for the whole system. No serif, no typewriter font, nothing decorative. */
  --ck-font-brand: var(--ck-font-ui);
  --ck-text: 16px;      /* every control, every label, every paragraph */
  --ck-text-sm: 15px;   /* hints and secondary text: never smaller than this */
  --ck-text-xs: 13px;   /* chips and group headings only */
  --ck-text-lg: 19px;   /* a panel or card heading */
  --ck-line: 1.55;

  /* ---- Space and shape (wizard values) --------------------------------- */
  --ck-gap-xs: 6px;
  --ck-gap-sm: 10px;
  --ck-gap: 16px;
  --ck-gap-lg: 24px;
  --ck-radius-sm: 10px;
  --ck-radius: 14px;
  --ck-radius-lg: 18px;
  --ck-shadow-sm: 0 1px 2px rgba(15, 59, 116, 0.04);
  --ck-shadow: 0 1px 3px rgba(15, 59, 116, 0.05);
  --ck-shadow-lift: 0 2px 10px rgba(15, 59, 116, 0.22);

  /* ---- Motion ---------------------------------------------------------- */
  --ck-fast: 160ms ease-out;

  /* ---- Semantic aliases (purpose names; components and pages use these) - */
  --action-primary: var(--ck-navy);
  --action-primary-hover: var(--ck-action-hover);
  --focus-ring-color: var(--ck-navy);
  --focus-ring-width: 3px;
  --focus-ring-offset: 2px;
  --action-primary-shadow: 0 1px 2px rgba(15, 59, 116, 0.16);
}

/* ============================================================================
   Controls. A browser gives a textarea a typewriter font and a button a system font, so a page with no
   rule here renders three families at three sizes. Every control states the one family and size.
   ========================================================================== */

input,
select,
textarea,
button {
  font-family: var(--ck-font-ui);
  font-size: var(--ck-text);
  line-height: var(--ck-line);
  color: var(--ck-ink);
}
/* A long box is a paragraph, so it uses the paragraph size, not the control size. The family is stated
   again here because some browsers and some app sheets give a textarea a fixed-width font by default. */
textarea,
textarea.ck-textarea-wide {
  font-family: var(--ck-font-ui);
  font-size: var(--ck-text);
  line-height: var(--ck-line);
}

/* One invalid look everywhere. */
input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"],
.ql-container:has(> .ql-editor[aria-invalid="true"]) {
  border-color: var(--ck-error-line);
  background: var(--ck-error-bg);
  box-shadow: 0 0 0 3px rgba(232, 168, 143, 0.14);
}

/* ============================================================================
   The card grid — the founder's feature picker, kept exactly.
   Checked cards get a brand border and a filled check; unchecked stay quiet.
   ========================================================================== */

.ck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--ck-gap-sm);
}

.ck-card-choice {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--ck-border);
  border-radius: var(--ck-radius);
  cursor: pointer;
  transition: border-color var(--ck-fast), box-shadow var(--ck-fast), background var(--ck-fast);
}
.ck-card-choice:hover {
  border-color: var(--ck-pale);
  box-shadow: var(--ck-shadow-sm);
}
.ck-card-choice:focus-within {
  outline: 3px solid var(--ck-sky);
  outline-offset: 2px;
}
/* The input stays in the tree for the keyboard and screen reader; the label draws the box. */
.ck-card-choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.ck-card-choice .ck-tick {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 2px solid var(--ck-border);
  border-radius: 6px;
  background: #fff;
  display: grid;
  place-items: center;
  color: transparent;
  font-size: 13px;
  font-weight: 700;
}
.ck-card-choice input:checked ~ .ck-tick {
  background: var(--ck-navy);
  border-color: var(--ck-navy);
  color: #fff;
}
.ck-card-choice:has(input:checked) {
  border-color: var(--ck-navy);
  box-shadow: 0 0 0 1px var(--ck-navy) inset;
}
.ck-card-choice:has(input:disabled) {
  opacity: 0.65;
  cursor: default;
}
.ck-card-label { font-size: 12px; font-weight: 400; color: var(--ck-ink); line-height: 1.35; }
.ck-card-hint { display: block; font-weight: 400; font-size: var(--ck-text-xs); color: var(--ck-muted); margin-top: 3px; }

.ck-group { margin: 0 0 var(--ck-gap-lg); }
.ck-group-title {
  font-family: var(--ck-font-ui);
  font-size: var(--ck-text-xs);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ck-action);
  margin: 0 0 4px;
}
.ck-group-hint { font-size: var(--ck-text-sm); color: var(--ck-muted); margin: 0 0 12px; }

/* ============================================================================
   The record panel — list of cards, then a side panel with view/edit and tabs.
   This is the pattern Services and Team use in the wizard.
   ========================================================================== */

.ck-record-list { display: flex; flex-direction: column; gap: var(--ck-gap-sm); }

.ck-record {
  display: flex;
  align-items: center;
  gap: var(--ck-gap);
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--ck-border);
  border-radius: var(--ck-radius);
  box-shadow: var(--ck-shadow-sm);
}
.ck-record:hover { border-color: var(--ck-pale); }
.ck-record-main { flex: 1 1 auto; min-width: 0; }
.ck-record-name { font-size: var(--ck-text); font-weight: 700; color: var(--ck-ink); margin: 0 0 2px; }
.ck-record-meta { font-size: var(--ck-text-sm); color: var(--ck-muted); margin: 0; }
.ck-record-side { flex: 0 0 auto; display: flex; align-items: center; gap: var(--ck-gap-xs); }
/* A button inside a record row or a panel foot is a small action, not the page's primary button. */
.ck-record-side button,
.ck-panel-foot button,
.ck-panel-head button {
  min-height: 40px;
  margin: 0;
  padding: 8px 16px;
  font-size: var(--ck-text-sm);
}

.ck-dot-unsaved {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ck-action);
  display: inline-block;
}

.ck-panel {
  background: #fff;
  border: 1px solid var(--ck-border);
  border-radius: var(--ck-radius-lg);
  box-shadow: var(--ck-shadow);
  overflow: hidden;
}
.ck-panel-head {
  display: flex;
  align-items: center;
  gap: var(--ck-gap-sm);
  padding: 14px 18px;
  border-bottom: 1px solid var(--ck-border);
}
.ck-panel-title { font-family: var(--ck-font-ui); font-size: var(--ck-text-lg); font-weight: 700; color: var(--ck-navy); margin: 0; flex: 1 1 auto; }
.ck-panel-tabs { display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--ck-border); overflow-x: auto; }

/* Scoped under .ck-panel-tabs on purpose: an app's generic `button` rule would otherwise paint the tab
   navy and the selected label navy too, which is unreadable. These rules state every property that
   matters instead of inheriting any. */
.ck-panel-tabs .ck-panel-tab {
  appearance: none;
  display: inline-flex;
  align-items: center;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--ck-muted);
  font-family: var(--ck-font-ui);
  font-size: var(--ck-text-sm);
  font-weight: 600;
  line-height: 1.2;
  min-height: 44px;
  margin: 0;
  padding: 0 14px;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.ck-panel-tabs .ck-panel-tab:hover {
  background: var(--ck-ivory);
  color: var(--ck-ink);
}
.ck-panel-tabs .ck-panel-tab[aria-selected="true"] {
  background: transparent;
  color: var(--ck-navy);
  border-bottom-color: var(--ck-navy);
}
.ck-panel-tabs .ck-panel-tab:focus-visible {
  outline: 3px solid var(--ck-sky);
  outline-offset: -3px;
}

.ck-panel-body { padding: 18px; }
.ck-panel-section { margin: 0 0 var(--ck-gap-lg); }
.ck-panel-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--ck-gap-sm);
  padding: 14px 18px;
  border-top: 1px solid var(--ck-border);
  background: var(--ck-ivory);
}

/* View mode says so, so nobody edits by accident. */
.ck-view-note { font-size: var(--ck-text-xs); color: var(--ck-muted); margin: 0; }

/* ============================================================================
   Small shared pieces
   ========================================================================== */

.ck-field-label {
  display: block;
  font-size: var(--ck-text-sm);
  font-weight: 700;
  color: var(--ck-ink);
  margin: 0 0 5px;
}
.ck-required { color: var(--ck-warn-ink); }

.ck-chips { display: flex; flex-wrap: wrap; gap: var(--ck-gap-xs); }
.ck-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--ck-ice);
  border: 1px solid var(--ck-pale);
  color: var(--ck-navy);
  font-size: var(--ck-text-xs);
  font-weight: 600;
}

.ck-empty {
  padding: 26px 20px;
  text-align: center;
  background: #fff;
  border: 1px dashed var(--ck-border);
  border-radius: var(--ck-radius);
}
.ck-empty-title { font-weight: 700; color: var(--ck-ink); margin: 0 0 4px; }
.ck-empty-help { font-size: var(--ck-text-sm); color: var(--ck-muted); margin: 0 0 12px; }

.ck-field-error { margin: 6px 0 0; color: var(--ck-error-ink); font-size: var(--ck-text); font-weight: 600; }

/* Drag handle, used wherever a list can be reordered. */
.ck-drag { cursor: grab; color: var(--ck-muted); user-select: none; padding: 0 4px; }
.ck-drag:active { cursor: grabbing; }

/* A long text box that actually fills the width, which was a founder complaint. */
.ck-textarea-wide { width: 100%; min-height: 190px; resize: vertical; line-height: 1.55; }
