/* ===========================================================================
   KYClear — Design Tokens & Global Styles
   Compliance platform for Gibraltar real estate agencies
   =========================================================================== */

:root {
  /* ---- Brand: Navy ---- */
  --navy-900: #0B2545;   /* primary */
  --navy-800: #102E54;
  --navy-700: #163A6B;   /* secondary */
  --navy-600: #1F4C86;
  --navy-500: #2A6098;
  --navy-100: #E7EDF5;
  --navy-050: #F2F5FA;

  /* ---- Brand: Gold ---- */
  --gold-600: #B68C2E;
  --gold-500: #D4A843;   /* accent */
  --gold-400: #E0BD66;
  --gold-100: #F8EECF;
  --gold-050: #FCF7E9;

  /* ---- Neutrals ---- */
  --bg:        #F8F9FB;   /* app background */
  --surface:   #FFFFFF;
  --surface-2: #FBFCFD;
  --ink-900:   #14213A;   /* primary text */
  --ink-700:   #3C4A60;   /* secondary text */
  --ink-500:   #67748B;   /* muted text */
  --ink-400:   #93A0B4;   /* placeholder */
  --line-200:  #E4E8EF;   /* borders */
  --line-100:  #EEF1F5;   /* subtle dividers */

  /* ---- Status: solid / tint / text ---- */
  --amber-500: #E0A82E;  --amber-tint: #FBF1D9;  --amber-text: #8A5A06;   /* awaiting client */
  --blue-500:  #2D6FB8;  --blue-tint:  #E3EDF8;  --blue-text:  #1B4A82;   /* awaiting verification */
  --purple-500:#7A5AA8;  --purple-tint:#ECE6F5;  --purple-text:#523879;   /* in review */
  --green-500: #2F9E6B;  --green-tint: #E1F2EA;  --green-text: #1B6A46;   /* completed */
  --red-500:   #C8483B;  --red-tint:   #FAE7E5;  --red-text:   #8E2B22;   /* overdue */
  --burgundy-500: #7A1F1F;  --burgundy-tint: #6B1A1A;  --burgundy-text: #ffffff;   /* MLRO blocked */
  --slate-500: #6B788E;  --slate-tint: #EDF0F4;  --slate-text: #44506440; /* neutral/draft */

  /* ---- Typography ---- */
  --font-sans:  "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --fs-11: 11px;  --fs-12: 12px;  --fs-13: 13px;  --fs-14: 14px;
  --fs-15: 15px;  --fs-16: 16px;  --fs-18: 18px;  --fs-20: 20px;
  --fs-24: 24px;  --fs-28: 28px;  --fs-32: 32px;  --fs-40: 40px;
  --lh-tight: 1.2;  --lh-snug: 1.35;  --lh-normal: 1.55;

  /* ---- Spacing (4pt) ---- */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px;  --sp-4: 16px;  --sp-5: 20px;
  --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px; --sp-16: 64px;

  /* ---- Radius ---- */
  --r-sm: 5px;  --r-md: 8px;  --r-lg: 12px;  --r-xl: 16px;  --r-full: 999px;

  /* ---- Shadow ---- */
  --sh-xs: 0 1px 2px rgba(16, 34, 64, 0.06);
  --sh-sm: 0 1px 3px rgba(16, 34, 64, 0.08), 0 1px 2px rgba(16, 34, 64, 0.04);
  --sh-md: 0 4px 12px rgba(16, 34, 64, 0.08), 0 1px 3px rgba(16, 34, 64, 0.05);
  --sh-lg: 0 12px 32px rgba(16, 34, 64, 0.12), 0 4px 8px rgba(16, 34, 64, 0.06);
  --sh-xl: 0 24px 60px rgba(11, 37, 69, 0.22);

  --sidebar-w: 232px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--navy-900);
  color: var(--ink-900);
  font-size: var(--fs-14);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
#root { height: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }
h1,h2,h3,h4,h5 { font-family: var(--font-serif); font-weight: 600; margin: 0; color: var(--navy-900); letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--gold-100); }

/* ---- Scrollbars ---- */
.scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-thumb { background: #C7CFDB; border-radius: 999px; border: 3px solid var(--bg); }
.scroll::-webkit-scrollbar-track { background: transparent; }

/* ===========================================================================
   Reusable primitives
   =========================================================================== */

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: 40px; padding: 0 var(--sp-5);
  border-radius: var(--r-md); font-size: var(--fs-14); font-weight: 600;
  white-space: nowrap; transition: all .16s ease; user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn-navy   { background: var(--navy-900); color: #fff; }
.btn-navy:hover { background: var(--navy-700); }
.btn-gold   { background: var(--gold-500); color: var(--navy-900); box-shadow: var(--sh-xs); }
.btn-gold:hover { background: var(--gold-400); }
.btn-ghost  { background: var(--surface); color: var(--navy-900); border: 1px solid var(--line-200); }
.btn-ghost:hover { background: var(--navy-050); border-color: #D3DAE5; }
.btn-quiet  { background: transparent; color: var(--ink-700); }
.btn-quiet:hover { background: var(--navy-050); }
.btn-sm { height: 32px; padding: 0 var(--sp-3); font-size: var(--fs-13); border-radius: var(--r-sm); }
.btn-block { width: 100%; }

/* ---- Inputs ---- */
.field-label { display:block; font-size: var(--fs-13); font-weight: 600; color: var(--ink-700); margin-bottom: var(--sp-2); }
.input, .textarea, .select {
  width: 100%; background: var(--surface); border: 1px solid var(--line-200);
  border-radius: var(--r-md); padding: 0 var(--sp-3); height: 42px;
  font-size: var(--fs-14); color: var(--ink-900); transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; padding: var(--sp-3); line-height: var(--lh-normal); resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--ink-400); }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--navy-600);
  box-shadow: 0 0 0 3px rgba(31,76,134,0.12);
}

/* ---- Card ---- */
.card {
  background: var(--surface); border: 1px solid var(--line-200);
  border-radius: var(--r-lg); box-shadow: var(--sh-xs);
}

/* ---- Badge / pill ---- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 9px; border-radius: var(--r-full);
  font-size: var(--fs-12); font-weight: 600; line-height: 1.4; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* status helpers used inline via data-status */
.eyebrow {
  font-size: var(--fs-11); font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--ink-400);
}

/* utility */
.muted { color: var(--ink-500); }
.mono  { font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--line-100); border: 0; }

@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes pulse   { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.82); } }
.anim-fade { animation: fadeIn .25s ease both; }
.anim-slide { animation: slideUp .28s cubic-bezier(.2,.7,.3,1) both; }

/* ===========================================================================
   Responsive
   =========================================================================== */

/* ---- Table → Cards (≤ 640px) ---- */
@media (max-width: 640px) {
  .resp-table { overflow: visible !important; border: none !important; box-shadow: none !important; background: transparent !important; }
  .resp-table table { display: block; }
  .resp-table thead { display: none; }
  .resp-table tbody { display: flex; flex-direction: column; gap: 8px; padding: 8px 0; }
  .resp-table tr {
    display: block;
    padding: 14px 16px;
    border: 1px solid var(--line-200) !important;
    border-radius: var(--r-lg) !important;
    background: var(--surface);
    box-shadow: var(--sh-xs);
    cursor: pointer;
  }
  .resp-table td {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 9px 0 !important;
    border: none !important;
    border-bottom: 1px solid var(--line-100) !important;
    font-size: var(--fs-13);
  }
  .resp-table td:last-child { border-bottom: none !important; }
  .resp-table td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--ink-500);
    font-size: var(--fs-11);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    flex-shrink: 0;
    min-width: 72px;
  }
  .resp-table td[data-label=""] { justify-content: flex-end; padding-top: 4px !important; padding-bottom: 0 !important; }
}

/* ---- Sidebar backdrop ---- */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11,37,69,0.6);
  z-index: 149;
  backdrop-filter: blur(2px);
  animation: fadeIn .2s ease both;
}
