/* ============================================================
   Cooper Surgical DAM — Brand tokens
   Foundry Sterling typeface + watercolour accent palette.
   All other stylesheets inherit from these custom properties.
   ============================================================ */

/* ── Foundry Sterling ── */
@font-face {
  font-family: 'Foundry Sterling';
  src: url('../fonts/FoundrySterling-Light.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Foundry Sterling';
  src: url('../fonts/FoundrySterling-Book.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Foundry Sterling';
  src: url('../fonts/FoundrySterling-Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Foundry Sterling';
  src: url('../fonts/FoundrySterling-Demi.otf') format('opentype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Foundry Sterling';
  src: url('../fonts/FoundrySterling-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ── Neutrals — grey values darkened ~20% for readability ── */
  --cs-ink: #1f1f1f;
  --cs-ink-2: #484848;
  --cs-ink-3: #6f6f6f;
  --cs-ink-4: #9c9c9c;
  --cs-paper: #ffffff;
  --cs-paper-2: #f6f7f9;
  --cs-paper-3: #eef0f3;
  --cs-line: #e2e5ea;
  --cs-line-2: #cdd1d8;

  /* ── Brand blues ── */
  --cs-blue-deep: #1e3f8a;
  --cs-blue: #2e5fb5;
  --cs-blue-mid: #5380c4;
  --cs-blue-light: #b4cce5;
  --cs-blue-soft: #e6eef8;

  /* ── Watercolour accents ── */
  --cs-aqua: #4ec3d7;
  --cs-emerald: #2da589;
  --cs-green: #7fb83b;
  --cs-yellow: #f5c842;
  --cs-orange: #e88937;
  --cs-magenta: #c93f7c;
  --cs-purple: #6e4ba6;

  /* Soft tints */
  --cs-aqua-soft: #e0f3f7;
  --cs-emerald-soft: #d9f0e8;
  --cs-green-soft: #ecf5db;
  --cs-yellow-soft: #fcefcc;
  --cs-orange-soft: #fbe4d1;
  --cs-magenta-soft: #f6dde8;
  --cs-purple-soft: #e7e0f2;

  /* Deep tints (accessible text on soft backgrounds) */
  --cs-emerald-deep: #1c6e5c;
  --cs-blue-deep-tx: #1a3570;

  /* ── Status ── */
  --cs-success: #2da589;
  --cs-warn: #e88937;
  --cs-danger: #c93f7c;

  /* ── Radii ── */
  --cs-r-sm: 8px;
  --cs-r-md: 12px;
  --cs-r-lg: 18px;
  --cs-r-pill: 999px;

  /* ── Shadows ── */
  --cs-shadow-sm: 0 1px 2px rgba(20, 30, 60, 0.06), 0 2px 6px rgba(20, 30, 60, 0.04);
  --cs-shadow-md: 0 4px 12px rgba(20, 30, 60, 0.08), 0 2px 4px rgba(20, 30, 60, 0.04);
  --cs-shadow-lg: 0 12px 32px rgba(20, 30, 60, 0.10), 0 4px 8px rgba(20, 30, 60, 0.04);

  /* ── Transitions ── */
  --cs-transition: 0.15s ease;
}

/* ── Base reset applied inside .cs scope ── */
.cs,
.dam-auth-page,
.dam-portal-page,
.dam-public-page {
  font-family: 'Foundry Sterling', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, Helvetica, Arial, sans-serif;
  color: var(--cs-ink);
  background: var(--cs-paper);
  line-height: 1.5;
  font-size: 17px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.cs *,
.dam-auth-page *,
.dam-portal-page *,
.dam-public-page *,
.cs *::before,
.cs *::after {
  box-sizing: border-box;
}

.cs h1,
.cs h2,
.cs h3,
.cs h4,
.dam-auth-page h1,
.dam-auth-page h2,
.dam-auth-page h3,
.dam-portal-page h1,
.dam-portal-page h2,
.dam-portal-page h3,
.dam-public-page h1,
.dam-public-page h2,
.dam-public-page h3,
.dam-public-page h4 {
  /*margin: 0;*/
  font-weight: 600;
  /*letter-spacing: -0.01em;*/
  line-height: 1.2;
}

h1 {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 26px;
}

h3 {
  font-size: 20px;
}

h4 {
  font-size: 17px;
}

.dam-auth-page a,
.dam-portal-page a,
.dam-public-page a {
  text-decoration: none;
}

.dam-auth-page a:hover,
.dam-portal-page a:hover,
.dam-public-page a:hover {
  text-decoration: underline;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ── Buttons ── */
.cs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--cs-r-pill);
  font-family: inherit;
  font-weight: 500;
  font-size: 16px;
  border: 1px solid transparent;
  background: var(--cs-paper);
  color: var(--cs-ink);
  transition: all var(--cs-transition);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

.cs-btn:hover {
  text-decoration: none;
}

.cs-btn-primary {
  background: var(--cs-blue);
  color: white;
  box-shadow: 0 1px 2px rgba(30, 63, 138, 0.3);
}

.cs-btn-primary:hover {
  background: var(--cs-blue-deep);
}

.cs-btn-primary:focus {
  outline: 3px solid var(--cs-blue-soft);
  outline-offset: 2px;
}

.cs-btn[disabled],
.cs-btn[aria-disabled="true"] {
  background: var(--cs-paper-3);
  color: var(--cs-ink-3);
  border-color: transparent;
  box-shadow: none;
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.6;
}

.cs-btn-secondary {
  background: var(--cs-paper);
  border-color: var(--cs-line-2);
  color: var(--cs-ink);
}

.cs-btn-secondary:hover {
  background: var(--cs-paper-2);
}

.cs-btn-ghost {
  background: transparent;
  color: var(--cs-blue);
}

.cs-btn-ghost:hover {
  background: var(--cs-blue-soft);
}

.cs-btn-sm {
  padding: 7px 14px;
  font-size: 15px;
}

.cs-btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--cs-r-pill);
  background: var(--cs-paper);
  border: 1px solid var(--cs-line);
  color: var(--cs-ink-2);
}

.cs-btn-icon:hover {
  background: var(--cs-paper-2);
  color: var(--cs-ink);
}

/* ── Inputs ── */
.cs-input {
  width: 100%;
  padding: 11px 16px;
  border: 1px solid var(--cs-line-2);
  border-radius: var(--cs-r-pill);
  background: var(--cs-paper);
  font-family: inherit;
  font-size: 17px;
  color: var(--cs-ink);
  outline: none;
  transition: border-color var(--cs-transition), box-shadow var(--cs-transition);
}

.cs-input:focus {
  border-color: var(--cs-blue);
  box-shadow: 0 0 0 3px var(--cs-blue-soft);
}

.cs-input:disabled,
.cs-input[readonly] {
  background: var(--cs-paper-2);
  color: var(--cs-ink-3);
  cursor: not-allowed;
}

.cs-input.cs-input-error {
  border-color: var(--cs-danger);
}

.cs-input.cs-input-error:focus {
  box-shadow: 0 0 0 3px var(--cs-magenta-soft);
}

textarea.cs-input {
  border-radius: var(--cs-r-md);
  resize: vertical;
}

select.cs-input {
  appearance: none;
  cursor: pointer;
}

/* ── Field wrapper ── */
.cs-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cs-field-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--cs-ink);
}

.cs-field-label .cs-required {
  color: var(--cs-magenta);
  font-weight: 500;
}

.cs-field-hint {
  font-size: 14px;
  color: var(--cs-ink-3);
  margin-top: 2px;
}

.cs-field-error {
  font-size: 14px;
  color: var(--cs-danger);
  margin-top: 3px;
}

/* ── Checkbox ── */
.cs-checkbox {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--cs-line-2);
  border-radius: 4px;
  background: var(--cs-paper);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all 0.12s;
}

.cs-checkbox:checked {
  background: var(--cs-blue);
  border-color: var(--cs-blue);
}

.cs-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.cs-checkbox:focus {
  outline: 3px solid var(--cs-blue-soft);
  outline-offset: 2px;
}

/* ── Card ── */
.cs-card {
  background: var(--cs-paper);
  border: 1px solid var(--cs-line);
  border-radius: var(--cs-r-md);
  overflow: hidden;
}

.cs-card-hover {
  transition: box-shadow var(--cs-transition), transform var(--cs-transition);
}

.cs-card-hover:hover {
  box-shadow: var(--cs-shadow-md);
  border-color: var(--cs-line-2);
}

/* ── Chip / tag ── */
.cs-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 13px;
  border-radius: var(--cs-r-pill);
  font-size: 14px;
  font-weight: 500;
  background: var(--cs-paper-3);
  color: var(--cs-ink-2);
  border: 1px solid transparent;
  white-space: nowrap;
}

.cs-chip-blue {
  background: var(--cs-blue-soft);
  color: var(--cs-blue-deep);
}

.cs-chip-aqua {
  background: var(--cs-aqua-soft);
  color: #1d6b78;
}

.cs-chip-emerald {
  background: var(--cs-emerald-soft);
  color: #1c6e5c;
}

.cs-chip-green {
  background: var(--cs-green-soft);
  color: #4d6e23;
}

.cs-chip-orange {
  background: var(--cs-orange-soft);
  color: #9a4f1d;
}

.cs-chip-magenta {
  background: var(--cs-magenta-soft);
  color: #882a55;
}

.cs-chip-purple {
  background: var(--cs-purple-soft);
  color: #4d3279;
}

.cs-chip-active {
  background: var(--cs-blue);
  color: white;
}

/* ── Avatar ── */
.cs-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--cs-blue);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

/* ── Divider ── */
.cs-divider {
  height: 1px;
  background: var(--cs-line);
  margin: 16px 0;
}

/* ── Meta text ── */
.cs-meta {
  font-size: 14px;
  color: var(--cs-ink-3);
}

/* ── Alert / notice blocks ── */
.cs-notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 18px;
  border-radius: var(--cs-r-md);
  font-size: 16px;
  line-height: 1.55;
}

.cs-notice-info {
  background: var(--cs-blue-soft);
  color: var(--cs-blue-deep);
}

.cs-notice-success {
  background: var(--cs-emerald-soft);
  color: var(--cs-emerald-deep);
}

.cs-notice-warn {
  background: var(--cs-orange-soft);
  color: #9a4f1d;
}

.cs-notice-danger {
  background: var(--cs-magenta-soft);
  color: #882a55;
}

/* ── Password strength bar ── */
.cs-strength-bar {
  display: flex;
  gap: 4px;
  margin: 6px 0 4px;
}

.cs-strength-bar span {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--cs-paper-3);
  transition: background var(--cs-transition);
}

.cs-strength-bar[data-level="1"] span:nth-child(1) {
  background: var(--cs-danger);
}

.cs-strength-bar[data-level="2"] span:nth-child(-n+2) {
  background: var(--cs-warn);
}

.cs-strength-bar[data-level="3"] span:nth-child(-n+3) {
  background: var(--cs-orange);
}

.cs-strength-bar[data-level="4"] span {
  background: var(--cs-emerald);
}

/* ── Site footer (public + auth + portal) ─────────────────────────────────
   Horizontal inset matches .dam-header__inner / .dam-public-header__inner
   so footer lines up with the portal header edge-to-edge. */
.dam-site-footer {
  border-top: 1px solid var(--cs-line);
  background: var(--cs-white, #fff);
  padding: 16px 0 20px;
  flex-shrink: 0;
}

.dam-site-footer__inner {
  width: 100%;
  box-sizing: border-box;
  padding: 0 20px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--cs-ink-3);
}

@media (min-width: 768px) {
  .dam-site-footer__inner {
    padding: 0 28px;
  }
}

.dam-site-footer__nav {
  display: flex;
  gap: 20px;
}

.dam-site-footer__nav a {
  color: var(--cs-ink-3);
  text-decoration: none;
  font-size: 14px;
}

.dam-site-footer__nav a:hover {
  color: var(--cs-ink);
  text-decoration: underline;
}

.dam-site-footer__nav .dam-site-footer__contact {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 14px;
  font-family: inherit;
  color: var(--cs-ink-3);
  cursor: pointer;
  text-decoration: none;
}

.dam-site-footer__nav .dam-site-footer__contact:hover {
  color: var(--cs-ink);
  text-decoration: underline;
}

/* Sticky footer shell on auth + portal */
body.dam-auth-page,
body.dam-portal-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.dam-page-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.dam-auth-page #dam-auth-root,
.dam-portal-page #dam-portal-root {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Auth grid already uses min-height on shell — let root fill shell */
.dam-auth-page #dam-auth-root .dam-auth-shell {
  flex: 1;
  min-height: 0;
}