/* cink — application styles */
/* ── Variables ──────────────────────────────────────────────── */
:root {
  --navy:     #0f2236;
  --navy-mid: #1a3a5c;
  --navy-lt:  #234b74;
  --teal:     #1ab5a0;
  --teal-lt:  #22d6be;
  --gold:     #e8b84b;
  --white:    #ffffff;
  --off-white:#f0f4f8;
  --gray-100: #e8edf2;
  --gray-300: #b0bec8;
  --gray-500: #6b7f91;
  --gray-700: #3d5166;
  --danger:   #e05252;
  --success:  #2ecc71;
  --warn:     #f0a500;

  --font-display: 'DM Serif Display', serif;
  --font-body:    'DM Sans', sans-serif;
  --radius:       10px;
  --radius-lg:    16px;
  --shadow:       0 4px 24px rgba(0,0,0,0.18);
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.10);
  --transition:   0.2s ease;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--navy);
  color: var(--white);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-lt); }
input, textarea, select {
  font-family: var(--font-body);
  font-size: 14px;
}

/* ── Layout ─────────────────────────────────────────────────── */
#app { min-height: 100vh; }

.page { min-height: 100vh; display: flex; flex-direction: column; }

/* ── Auth Page ──────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 420px;
  background: var(--navy);
}

.auth-hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 60%, var(--navy-lt) 100%);
  position: relative;
  overflow: hidden;
}

.auth-hero::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(26,181,160,0.08) 0%, transparent 70%);
  top: -100px; right: -100px;
}

.auth-hero::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232,184,75,0.06) 0%, transparent 70%);
  bottom: 80px; left: 40px;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 64px;
}
.brand-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--teal), var(--teal-lt));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.brand-name {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--white);
  letter-spacing: 0.02em;
}

.hero-headline {
  font-family: var(--font-display);
  font-size: clamp(36px, 4vw, 54px);
  line-height: 1.15;
  color: var(--white);
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}
.hero-headline em { color: var(--teal); font-style: normal; }

.hero-sub {
  font-size: 16px;
  color: var(--gray-300);
  max-width: 480px;
  line-height: 1.7;
  position: relative;
  z-index: 1;
}

.role-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 40px;
  position: relative;
  z-index: 1;
}
.role-pill {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--gray-300);
  letter-spacing: 0.03em;
}

.auth-panel {
  background: var(--white);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 40px;
  min-height: 100vh;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--navy);
  margin-bottom: 8px;
}
.auth-sub {
  font-size: 14px;
  color: var(--gray-500);
  margin-bottom: 36px;
}

.form-group {
  margin-bottom: 20px;
}
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy-mid);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.form-input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--gray-100);
  border-radius: var(--radius);
  background: var(--off-white);
  color: var(--navy);
  font-size: 15px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(26,181,160,0.12);
}
.form-input.otp-input {
  text-align: center;
  font-size: 28px;
  letter-spacing: 12px;
  font-weight: 600;
  color: var(--navy);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  font-family: var(--font-body);
}
.btn-primary {
  background: linear-gradient(135deg, var(--navy-mid), var(--navy-lt));
  color: var(--white);
  width: 100%;
}
.btn-primary:hover { background: linear-gradient(135deg, var(--navy-lt), var(--teal)); }
.btn-teal {
  background: linear-gradient(135deg, var(--teal), var(--teal-lt));
  color: var(--white);
  width: 100%;
}
.btn-teal:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--teal);
  padding: 8px 0;
  font-size: 13px;
}
.btn-ghost:hover { color: var(--teal-lt); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.link-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gray-500);
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 24px;
}
.link-back:hover { color: var(--navy-mid); }

.otp-timer {
  text-align: center;
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 12px;
}

/* ── App Shell ──────────────────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--navy-mid);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand .brand-icon { width: 36px; height: 36px; font-size: 18px; border-radius: 8px; }
.sidebar-brand span { font-family: var(--font-display); font-size: 17px; }

.sidebar-section {
  padding: 6px 0;
}
.sidebar-section + .sidebar-section { margin-top: 2px; }
.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-500);
  padding: 10px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  cursor: pointer;
  color: var(--gray-300);
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: all var(--transition);
}
.nav-item:hover { color: var(--white); background: rgba(255,255,255,0.05); }
.nav-item.active {
  color: var(--teal-lt);
  background: rgba(26,181,160,0.1);
  border-left-color: var(--teal);
}
.nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--gold, #e0a500);
  color: #1a1a1a;
  font-size: 11px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
}
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  margin-top: auto;
  padding: 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--teal), var(--teal-lt));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--white);
  flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: var(--white); }
.user-role { font-size: 11px; color: var(--gray-500); text-transform: capitalize; }
.btn-logout {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-500);
  font-size: 16px;
  margin-left: auto;
  transition: color var(--transition);
}
.btn-logout:hover { color: var(--danger); }

/* ── Main Content ───────────────────────────────────────────── */
.main-content {
  background: #0d1e2e;
  min-height: 100vh;
  overflow-y: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.2);
}
.topbar-title { font-family: var(--font-display); font-size: 22px; color: var(--white); }
.topbar-sub { font-size: 13px; color: var(--gray-500); margin-top: 2px; }

.content-area { padding: 32px; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--white);
  margin-bottom: 4px;
}
.card-sub { font-size: 13px; color: var(--gray-500); margin-bottom: 20px; }

/* ── Stats row ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  transition: border-color var(--transition);
}
.stat-card:hover { border-color: rgba(26,181,160,0.3); }
.stat-value {
  font-family: var(--font-display);
  font-size: 36px;
  color: var(--teal);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label { font-size: 12px; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.06em; }

/* ── Onboarding Steps ───────────────────────────────────────── */
.steps-container { max-width: 720px; }
.step-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.step-item {
  display: flex;
  gap: 20px;
  position: relative;
}
.step-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 19px;
  top: 44px;
  bottom: -12px;
  width: 2px;
  background: rgba(255,255,255,0.08);
}
.step-number {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--gray-500);
  flex-shrink: 0;
  background: var(--navy);
  z-index: 1;
  transition: all var(--transition);
}
.step-item.done .step-number {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--white);
}
.step-item.active .step-number {
  border-color: var(--teal);
  color: var(--teal);
  box-shadow: 0 0 0 4px rgba(26,181,160,0.15);
}
.step-body { flex: 1; padding-bottom: 28px; }
.step-label {
  font-weight: 600;
  font-size: 15px;
  color: var(--white);
  margin-bottom: 4px;
}
.step-desc { font-size: 13px; color: var(--gray-500); }
.step-action { margin-top: 16px; }

/* ── Forms (dark) ───────────────────────────────────────────── */
.dark-form .form-label { color: var(--gray-300); }
.dark-form .form-input {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
  color: var(--white);
}
.dark-form .form-input:focus {
  border-color: var(--teal);
  background: rgba(26,181,160,0.05);
}
.dark-form .form-input::placeholder { color: var(--gray-500); }
.dark-form select.form-input option { background: var(--navy-mid); color: var(--white); }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Signature Pad ──────────────────────────────────────────── */
.sig-container {
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.03);
  padding: 8px;
  position: relative;
}
.sig-canvas {
  display: block;
  width: 100%;
  height: 180px;
  cursor: crosshair;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
}
.sig-hint {
  text-align: center;
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 8px;
}
.sig-actions { display: flex; gap: 10px; margin-top: 12px; }
.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 8px;
}
.btn-outline {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.2);
  color: var(--gray-300);
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 500;
  transition: all var(--transition);
}
.btn-outline:hover { border-color: var(--teal); color: var(--teal); }

/* ── Badge / Tags ───────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge-teal    { background: rgba(26,181,160,0.15); color: var(--teal-lt); }
.badge-gold    { background: rgba(232,184,75,0.15); color: var(--gold); }
.badge-danger  { background: rgba(224,82,82,0.15);  color: var(--danger); }
.badge-gray    { background: rgba(255,255,255,0.08); color: var(--gray-300); }

/* ── Table ──────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-500);
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 14px;
  color: var(--gray-300);
}
.data-table tr:hover td { background: rgba(255,255,255,0.02); color: var(--white); }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-info    { background: rgba(26,181,160,0.1);  border: 1px solid rgba(26,181,160,0.25); color: var(--teal-lt); }
.alert-warn    { background: rgba(240,165,0,0.1);   border: 1px solid rgba(240,165,0,0.25);  color: var(--gold); }
.alert-danger  { background: rgba(224,82,82,0.1);   border: 1px solid rgba(224,82,82,0.25);  color: var(--danger); }
.alert-success { background: rgba(46,204,113,0.1);  border: 1px solid rgba(46,204,113,0.25); color: #2ecc71; }

/* ── Contract preview ───────────────────────────────────────── */
.contract-preview {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 20px;
  font-family: monospace;
  font-size: 12px;
  color: var(--gray-300);
  white-space: pre-wrap;
  max-height: 260px;
  overflow-y: auto;
  line-height: 1.8;
}

/* ── Users admin ────────────────────────────────────────────── */
.role-select {
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.12);
  color: var(--white);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.role-select:focus { border-color: var(--teal); outline: none; }

/* ── Misc ───────────────────────────────────────────────────── */
.divider { height: 1px; background: rgba(255,255,255,0.08); margin: 20px 0; }
.mt-12 { margin-top: 12px; }
.mt-20 { margin-top: 20px; }
.text-muted { color: var(--gray-500); font-size: 13px; }
.text-teal { color: var(--teal); }
.text-right { text-align: right; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 9999;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: slideIn 0.25s ease;
  max-width: 320px;
}
.toast-success { background: var(--teal); color: var(--white); }
.toast-error   { background: var(--danger); color: var(--white); }
.toast-info    { background: var(--navy-lt); color: var(--white); border: 1px solid var(--teal); }

@keyframes slideIn {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.loading-spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Hamburger (hidden on desktop) ──────────────────────────── */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: var(--white);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  flex-shrink: 0;
}
.mobile-nav-overlay { display: none; }

@media (max-width: 768px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-panel { padding: 40px 24px; }

  /* Single column; sidebar pulled out of flow as a drawer */
  .app-layout { display: block; }
  .form-row { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 270px;
    max-width: 82vw;
    height: 100vh;
    z-index: 1100;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 2px 0 24px rgba(0,0,0,0.4);
  }
  .sidebar.mobile-open { transform: translateX(0); }

  .main-content { width: 100%; min-height: 100vh; }

  .mobile-nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1050;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .mobile-nav-overlay.visible { opacity: 1; pointer-events: auto; }

  .hamburger-btn { display: block; }

  .topbar { padding: 16px 18px; }
  .content-area { padding: 18px 16px; }
  .topbar-title { font-size: 18px; }
  .stats-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .stat-card { padding: 16px 18px; }
  .data-table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  .btn, .nav-item { min-height: 42px; }
  .btn-sm { min-height: 36px; }
}

/* Tablets & small laptops (769–1024px): narrower sidebar, keep two columns */
@media (min-width: 769px) and (max-width: 1024px) {
  .app-layout { grid-template-columns: 200px 1fr; }
  .content-area { padding: 24px 20px; }
  .hamburger-btn { display: none; }
}

/* ── Responsive grid utilities ──────────────────────────────── */
/* Replace fixed inline grid-template-columns with these classes so
   two- and three-column layouts collapse to one column on phones. */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.grid-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 768px) {
  .grid-2col,
  .grid-3col { grid-template-columns: 1fr; }
}

/* ── Extra-small screen polish (≤ 480px) ────────────────────── */
@media (max-width: 480px) {
  .card { padding: 16px; }
  .content-area { padding: 12px 10px; }
  .topbar { padding: 12px 14px; }
  .topbar-title { font-size: 17px; }
  .topbar-sub { font-size: 12px; }
  .stat-value { font-size: 28px; }
  .toast-container { right: 16px; bottom: 16px; }
  .toast { max-width: calc(100vw - 48px); }
}

/* ── File drop zone ─────────────────────────────────────────── */
.file-drop-zone {
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  background: rgba(255,255,255,0.02);
}
.file-drop-zone:hover, .file-drop-zone.drag-over {
  border-color: var(--teal);
  background: rgba(26,181,160,0.05);
}
.file-drop-icon  { font-size: 32px; margin-bottom: 8px; }
.file-drop-text  { font-size: 14px; color: var(--gray-300); margin-bottom: 4px; }
.file-drop-link  { color: var(--teal); text-decoration: underline; cursor: pointer; }
.file-drop-hint  { font-size: 12px; color: var(--gray-500); }

/* ── Accessibility ──────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--teal);
  color: var(--white);
  padding: 8px 16px;
  border-radius: 0 0 var(--radius) 0;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  z-index: 10000;
  transition: top 0.15s;
}
.skip-link:focus {
  top: 0;
  outline: 3px solid var(--white);
  outline-offset: 2px;
}

/* Visible focus ring for keyboard nav */
:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* High-contrast focus for dark backgrounds */
.btn:focus-visible,
.btn-ghost:focus-visible,
.form-input:focus-visible,
.nav-item button:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(26,181,160,0.2);
}