/* ==========================================================================
   Chelkron UI — shared design system
   Used by both mail.chelkron.com (customer portal + admin) and
   mailbox.chelkron.com (webmail). Keep this file identical across both
   apps so the two products feel like one platform.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

:root {
  /* ── Color ── */
  --ink:        #0A2540;   /* headings, high-emphasis text */
  --slate:      #425466;   /* body text, secondary labels */
  --slate-dim:  #6B7C93;   /* placeholder text, muted captions */
  --indigo:     #5B5BF5;   /* primary actions, links, active states */
  --indigo-dark:#4646D6;   /* hover/pressed state for primary */
  --indigo-dim: rgba(91,91,245,0.08); /* tint backgrounds, selected rows */
  --mist:       #F6F9FC;   /* page background */
  --hairline:   #E3E8EE;   /* borders, dividers */
  --surface:    #FFFFFF;   /* cards, panels, modals */
  --success:    #1A9E6B;
  --success-dim:#E3F6EE;
  --danger:     #D64545;
  --danger-dim: #FBE8E8;
  --warning:    #B5780A;
  --warning-dim:#FCF1DD;

  /* ── Type ── */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* ── Spacing (8px grid) ── */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;

  /* ── Radius / elevation ── */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(10,37,64,0.06);
  --shadow-md: 0 4px 16px rgba(10,37,64,0.08);
  --shadow-lg: 0 12px 40px rgba(10,37,64,0.14);
}

html, body { font-family: var(--font); color: var(--slate); background: var(--mist); }

h1, h2, h3, h4 {
  font-family: var(--font);
  color: var(--ink);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
}
h1 { font-size: 2.75rem; font-weight: 300; letter-spacing: -0.03em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em; }

p { margin: 0; line-height: 1.6; }
a { color: var(--indigo); text-decoration: none; }
a:hover { color: var(--indigo-dark); }

/* Tabular figures for any price, balance, or stat — the one consistent
   "signature" detail that should appear everywhere money or counts show up. */
.num, .tabular {
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--indigo);
  background: var(--indigo);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.btn:hover { background: var(--indigo-dark); border-color: var(--indigo-dark); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-outline { background: transparent; color: var(--indigo); border-color: var(--hairline); }
.btn-outline:hover { background: var(--indigo-dim); border-color: var(--indigo); color: var(--indigo-dark); }

.btn-ghost { background: transparent; color: var(--slate); border-color: transparent; }
.btn-ghost:hover { background: var(--mist); color: var(--ink); }

.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #B83838; border-color: #B83838; }

.btn-sm { padding: 7px 14px; font-size: 0.8125rem; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--slate-dim);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { border-color: var(--indigo); color: var(--indigo); }

/* ── Inputs ── */
label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
input, select, textarea {
  width: 100%;
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input::placeholder, textarea::placeholder { color: var(--slate-dim); }
input:focus, select:focus, textarea:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--indigo-dim);
}

/* ── Cards / surfaces ── */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
}
.card h3 { margin-bottom: var(--sp-4); }

/* ── Badges / pills ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.6875rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 3px 9px; border-radius: 999px;
}
.badge-success { background: var(--success-dim); color: var(--success); }
.badge-danger  { background: var(--danger-dim);  color: var(--danger);  }
.badge-warning { background: var(--warning-dim); color: var(--warning); }
.badge-neutral { background: var(--mist); color: var(--slate); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.8125rem;
  color: var(--slate);
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.pill:hover { border-color: var(--indigo); color: var(--indigo); }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--slate-dim);
  padding: 10px 12px; border-bottom: 1px solid var(--hairline);
}
td { padding: 14px 12px; border-bottom: 1px solid var(--hairline); font-size: 0.875rem; color: var(--slate); }
tr:last-child td { border-bottom: none; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(10,37,64,0.32);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 480px;
  padding: var(--sp-6);
}

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 12px 22px; border-radius: var(--radius-md);
  font-size: 0.875rem; font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 9999; opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger);  }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--hairline); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--slate-dim); }

/* ── Focus visibility (accessibility floor) ── */
a:focus-visible, button:focus-visible, .pill:focus-visible, .icon-btn:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
}
