/* ═══════════════════════════════════════════════════════════════════════════
   Till King Gateway — Design System
   Brand: ERP Champions Ltd · Frappe Partner
   Inspired by tillking_landing_v4.html
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Google Fonts ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800;900&family=Lato:wght@300;400;700;900&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Variables (ERP Champions brand) ──────────────────────────────────── */
:root {
  /* Purples */
  --purple:       #70277B;
  --purple-deep:  #530D74;
  --purple-dark:  #2E2236;
  --purple-soft:  #ad8bac;
  --purple-light: #F7F2F7;

  /* Golds */
  --gold:         #E3B047;
  --gold-deep:    #CEA148;
  --gold-soft:    #DBAB4A;
  --gold-light:   rgba(227,176,71,0.15);

  /* Neutrals */
  --ink:          #292829;
  --ink-soft:     #2C2A2A;
  --muted:        #7A7A7A;
  --line:         #E2E2E2;
  --paper:        #F5F0F0;
  --paper-2:      #EDEDED;
  --white:        #FFFFFF;

  /* Semantic */
  --danger:       #DC3545;
  --danger-light: #FDE8EA;
  --success:      #198754;
  --success-light:#D1F2E0;
  --warning:      #E3B047;
  --warning-light:#FFF8E7;
  --info:         #70277B;
  --info-light:   #F7F2F7;

  /* Spacing */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 18px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(46,34,54,0.04);
  --shadow-sm:  0 2px 8px rgba(46,34,54,0.06);
  --shadow-md:  0 8px 24px rgba(46,34,54,0.10);
  --shadow-lg:  0 16px 40px rgba(46,34,54,0.14);
  --shadow-xl:  0 28px 60px -20px rgba(112,39,123,0.30);
  --shadow-gold:0 6px 14px rgba(227,176,71,0.40);

  /* Transitions */
  --transition: 0.18s ease;
  --transition-slow: 0.25s ease;
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  height: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Lato", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── Typography ───────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: "Montserrat", sans-serif;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
  font-weight: 800;
  color: var(--purple);
}
h1 em, h2 em, h3 em { font-style: normal; color: var(--gold); font-weight: 800; }
h3, h4, h5, h6 { color: var(--purple-dark); }

p { margin: 0 0 1em; color: var(--ink-soft); line-height: 1.6; }
a { color: var(--purple); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--purple-deep); }

small, .text-sm { font-size: 13px; }
.text-muted { color: var(--muted); }
.text-xs { font-size: 11px; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  font-family: "Montserrat", sans-serif;
  font-weight: 700; font-size: 13px;
  text-decoration: none;
  border-radius: var(--radius-full);
  transition: all var(--transition);
  border: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.01em;
  line-height: 1;
}
.btn .arrow { transition: transform 0.2s; font-weight: 700; }
.btn:hover .arrow { transform: translateX(3px); }

.btn-primary {
  background: var(--gold); color: var(--purple-dark);
  border-color: var(--gold);
}
.btn-primary:hover {
  background: var(--gold-deep); border-color: var(--gold-deep);
  transform: translateY(-1px);
  box-shadow: var(--shadow-gold);
}

.btn-purple {
  background: var(--purple); color: var(--white);
  border-color: var(--purple);
}
.btn-purple:hover { background: var(--purple-deep); border-color: var(--purple-deep); transform: translateY(-1px); }

.btn-ghost {
  background: transparent; color: var(--purple);
  border-color: var(--purple);
}
.btn-ghost:hover { background: var(--purple); color: var(--white); }

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

.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }

.btn:disabled, .btn.disabled {
  opacity: 0.5; pointer-events: none;
}

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-family: "Montserrat", sans-serif;
  font-size: 12px; font-weight: 700;
  color: var(--purple-dark);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  font-family: "Lato", sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  transition: all var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(112,39,123,0.08);
}
.form-input::placeholder { color: var(--muted); }
.form-textarea { min-height: 100px; resize: vertical; }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%2370277B'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-checkbox {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
  font-size: 14px;
}
.form-checkbox input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--purple);
}

.form-error {
  font-size: 12px; color: var(--danger);
  margin-top: 4px;
}
.form-hint {
  font-size: 12px; color: var(--muted);
  margin-top: 4px;
}

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-slow);
}
.card:hover {
  box-shadow: var(--shadow-md);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.card-header h3 { margin: 0; font-size: 18px; }
.card-header h4 { margin: 0; font-size: 16px; }

/* ── Stats Cards ──────────────────────────────────────────────────────────── */
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  border: 1px solid var(--line);
  position: relative;
  transition: all var(--transition-slow);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--purple);
}
.stat-card .stat-icon {
  width: 44px; height: 44px;
  background: var(--purple-light);
  color: var(--purple);
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 20px;
  margin-bottom: 14px;
}
.stat-card .stat-value {
  font-family: "Montserrat", sans-serif;
  font-size: 32px; font-weight: 900;
  color: var(--purple-dark);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card .stat-label {
  font-family: "Montserrat", sans-serif;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}
.stat-card.accent-gold { border-top: 3px solid var(--gold); }
.stat-card.accent-purple { border-top: 3px solid var(--purple); }

/* ── Badges / Tags ────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  font-family: "Montserrat", sans-serif;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: var(--radius-full);
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--gold-deep); }
.badge-info    { background: var(--info-light);    color: var(--purple); }
.badge-neutral { background: var(--paper-2);       color: var(--muted); }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: "Montserrat", sans-serif;
  font-size: 10px; font-weight: 700;
  color: var(--purple);
  padding: 5px 12px;
  background: var(--white);
  border: 1px solid rgba(112,39,123,0.15);
  border-radius: var(--radius-full);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.pill .dot {
  width: 6px; height: 6px; background: var(--gold); border-radius: 50%;
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: 0.35 } }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table-container {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  overflow: hidden;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
thead {
  background: var(--paper);
  border-bottom: 2px solid var(--line);
}
th {
  font-family: "Montserrat", sans-serif;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 12px 16px;
  text-align: left;
  white-space: nowrap;
}
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--paper); }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
  font-family: "Lato", sans-serif;
  border: 1px solid transparent;
}
.alert-success { background: var(--success-light); color: var(--success); border-color: var(--success); }
.alert-danger  { background: var(--danger-light);  color: var(--danger);  border-color: var(--danger); }
.alert-warning { background: var(--warning-light); color: var(--gold-deep); border-color: var(--gold); }
.alert-info    { background: var(--info-light);    color: var(--purple);   border-color: var(--purple); }

/* ── Gold Rule (signature ERP Champions element) ──────────────────────────── */
.gold-rule {
  width: 180px; height: 3px;
  background: var(--gold);
  margin: 16px 0;
  border-radius: 2px;
}

/* ── Nav (landing / public pages) ───────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(245,240,240,0.94);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-in {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  max-width: 1280px; margin: 0 auto;
}
.logo {
  display: flex; align-items: center; gap: 12px;
  font-family: "Montserrat", sans-serif;
  font-weight: 800; font-size: 18px;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.logo-mark {
  width: 34px; height: 34px;
  position: relative;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.logo-mark svg { width: 100%; height: 100%; }
.logo-word {
  display: inline-flex; align-items: baseline; gap: 2px;
  letter-spacing: -0.01em;
}
.logo-word .a { color: var(--purple); }
.logo-word .b { color: var(--gold-deep); }
.nav-links { display: flex; gap: 0; align-items: center; }
.nav-links a {
  text-decoration: none; color: var(--purple-dark);
  font-family: "Montserrat", sans-serif;
  font-size: 13px; font-weight: 600;
  padding: 6px 16px;
  transition: color 0.15s;
}
.nav-links a:hover { color: var(--purple); }
.nav-cta { display: flex; gap: 10px; align-items: center; }
@media (max-width: 880px) { .nav-links { display: none; } }

/* ── Admin Layout ─────────────────────────────────────────────────────────── */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  width: 260px;
  background: linear-gradient(180deg, var(--purple-dark) 0%, #1a0f1f 100%);
  color: var(--white);
  display: flex; flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
  overflow-y: auto;
  transition: transform var(--transition-slow);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 24px 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand .logo-mark {
  width: 36px; height: 36px;
  flex-shrink: 0;
}
.sidebar-brand .logo-word {
  font-family: "Montserrat", sans-serif;
  font-weight: 800; font-size: 18px;
  letter-spacing: -0.02em;
  display: flex; gap: 2px;
}
.sidebar-brand .logo-word .a { color: var(--white); }
.sidebar-brand .logo-word .b { color: var(--gold); }

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
}
.sidebar-section {
  margin-bottom: 8px;
}
.sidebar-section-title {
  font-family: "Montserrat", sans-serif;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255,255,255,0.35);
  padding: 10px 12px 6px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  font-family: "Montserrat", sans-serif;
  font-size: 13px; font-weight: 600;
  color: rgba(255,255,255,0.65);
  border-radius: var(--radius);
  text-decoration: none;
  transition: all var(--transition);
  margin-bottom: 2px;
}
.sidebar-link:hover {
  background: rgba(255,255,255,0.06);
  color: var(--white);
}
.sidebar-link.active {
  background: rgba(227,176,71,0.15);
  color: var(--gold);
}
.sidebar-link .icon { font-size: 16px; width: 22px; text-align: center; }

.sidebar-footer {
  padding: 16px 22px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
}
.sidebar-user .avatar {
  width: 34px; height: 34px;
  background: var(--gold);
  color: var(--purple-dark);
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: "Montserrat", sans-serif;
  font-weight: 900; font-size: 13px;
}
.sidebar-user .info {
  font-family: "Lato", sans-serif;
  font-size: 13px;
  line-height: 1.3;
}
.sidebar-user .info strong {
  display: block;
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  color: var(--white);
  font-size: 12px;
}
.sidebar-user .info span {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
}

/* Main content area */
.admin-main {
  flex: 1;
  margin-left: 260px;
  display: flex; flex-direction: column;
  min-height: 100vh;
}

/* Top bar */
.admin-topbar {
  background: rgba(245,240,240,0.92);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
  position: sticky; top: 0; z-index: 30;
}
.admin-topbar .breadcrumb {
  font-family: "Montserrat", sans-serif;
  font-size: 12px; font-weight: 600;
  color: var(--muted);
  display: flex; align-items: center; gap: 6px;
}
.admin-topbar .breadcrumb a { color: var(--purple); }
.admin-topbar .breadcrumb span { color: var(--ink-soft); }
.admin-topbar .actions { display: flex; gap: 10px; align-items: center; }

/* Content area */
.admin-content {
  padding: 28px 32px;
  flex: 1;
}

/* Page header */
.page-header {
  margin-bottom: 28px;
}
.page-header h2 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--purple-dark);
}
.page-header p {
  color: var(--muted);
  margin: 0;
  font-size: 15px;
}
.page-header .actions { margin-top: 12px; }

/* ── Stats Grid ───────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}
@media (max-width: 900px) { .stats-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .stats-grid { grid-template-columns: 1fr; } }

/* ── Feature Grid (for landing-style cards) ───────────────────────────────── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}
@media (max-width: 1000px) { .feature-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px)  { .feature-grid { grid-template-columns: 1fr; } }

.feature-card {
  background: var(--white);
  padding: 28px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  transition: all var(--transition-slow);
}
.feature-card:hover {
  transform: translateY(-3px);
  border-color: var(--purple);
  box-shadow: var(--shadow-md);
}
.feature-card .feature-icon {
  width: 44px; height: 44px;
  background: var(--purple-light);
  color: var(--purple);
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 18px;
  margin-bottom: 16px;
}
.feature-card h4 {
  font-size: 16px; font-weight: 800;
  margin-bottom: 6px;
}
.feature-card p {
  font-size: 13px; color: var(--muted);
  margin: 0; line-height: 1.55;
}

/* ── Empty State ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
}
.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}
.empty-state h4 {
  font-size: 18px;
  margin-bottom: 8px;
}
.empty-state p {
  color: var(--muted);
  max-width: 40ch;
  margin: 0 auto 20px;
}

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(46,34,54,0.5);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 520px; width: 100%;
  box-shadow: var(--shadow-xl);
  max-height: 90vh;
  overflow-y: auto;
}
.modal h3 { margin-bottom: 16px; }

/* ── Login Page ───────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(800px 400px at 50% 0%, rgba(112,39,123,0.06) 0%, transparent 60%),
    radial-gradient(600px 300px at 80% 100%, rgba(227,176,71,0.08) 0%, transparent 60%),
    var(--paper);
  padding: 20px;
}
.login-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  max-width: 420px; width: 100%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
}
.login-card .brand {
  text-align: center;
  margin-bottom: 32px;
}
.login-card .brand .logo-mark {
  width: 52px; height: 52px;
  margin: 0 auto 14px;
}
.login-card .brand h1 {
  font-size: 24px;
  font-weight: 900;
  margin-bottom: 4px;
}
.login-card .brand p {
  font-size: 14px; color: var(--muted);
  margin: 0;
}
.login-card .partner-badge {
  display: inline-flex; align-items: stretch;
  background: var(--paper);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 10px;
  border: 1px solid var(--line);
  margin-top: 10px;
}
.login-card .partner-badge .f {
  background: #0F0F0F;
  color: var(--white);
  font-family: "Montserrat", sans-serif;
  font-weight: 900; font-size: 20px;
  padding: 4px 10px;
  letter-spacing: -0.06em;
  display: grid; place-items: center;
}
.login-card .partner-badge .label {
  padding: 4px 12px;
  font-family: "Montserrat", sans-serif;
  font-weight: 700; font-size: 11px;
  color: #0F0F0F;
  display: grid; place-items: center;
}
.login-card .form-input {
  padding: 12px 16px;
  font-size: 15px;
}

/* ── Utility ──────────────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.w-full { width: 100%; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  .admin-main {
    margin-left: 0;
  }
  .admin-content {
    padding: 20px 16px;
  }
  .login-card {
    padding: 32px 24px;
  }
}

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(112,39,123,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(112,39,123,0.35); }
