/* ═══════════════════════════════════════════════════════
   AISHWARYAM ADMIN — ENTERPRISE DESIGN SYSTEM v3
   Inspired by: Linear, Stripe, Vercel
   Magenta used SPARINGLY — neutral base with accent touches
   ═══════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400..700;1,400..700&family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap');

/* ─── Premium Cream & Charcoal Theme (Ref Image) ─── */
:root,
[data-theme="dark"],
[data-theme="light"] {
  --bg: #f5f2ec; /* Soft cream beige background */
  --surface: #ffffff; /* White cards */
  --surface2: #faf8f4;
  --surface3: #e8e3d6; /* Taupe card surface */
  --border: rgba(0, 0, 0, 0.05);
  --border2: rgba(0, 0, 0, 0.02);

  --text: #1c1d21; /* Charcoal dark text */
  --text-2: #5c5d64; /* Slate gray subtext */
  --text-3: #8a8b92; /* Medium dim text */

  --accent: #ffd028; /* Golden Yellow Accent */
  --accent-dim: rgba(255, 208, 40, 0.15);
  --accent-glow: rgba(255, 208, 40, 0.3);

  --green: #2ecc71;
  --green-dim: rgba(46, 204, 113, 0.1);
  --red: #e74c3c;
  --red-dim: rgba(231, 76, 60, 0.1);
  --amber: #f39c12;
  --amber-dim: rgba(243, 156, 18, 0.1);
  --blue: #3498db;
  --blue-dim: rgba(52, 152, 219, 0.1);

  --sidebar-bg: #ffffff;
  --topbar-bg: rgba(245, 242, 236, 0.85);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.03), 0 2px 10px rgba(0, 0, 0, 0.02);
  --shadow-sm: 0 4px 20px rgba(0, 0, 0, 0.01);
}

/* ─── Layout vars ─── */
:root {
  --sidebar-w: 240px;
  --radius: 24px; /* Generous modern rounded corners */
}

/* ─── Base ─── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Lora', 'Times New Roman', Times, Georgia, serif;
}

body {
  font-family: 'Montserrat', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  transition: background 0.25s, color 0.25s;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 99px;
}

/* Required fields indicator */
.required::after {
  content: " *";
  color: var(--red);
  font-weight: 700;
}

/* ════════════════════ SIDEBAR ════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-radius: var(--radius);
  margin: 20px;
  height: calc(100vh - 40px);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  border: none;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border2);
}

.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1c1d21; /* Dark charcoal logo back */
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-mark svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--accent); /* Yellow stroke */
  stroke-width: 2.5;
  stroke-linecap: round;
}

.logo-text {
  font-size: 15px;
  font-weight: 800;
  color: #1c1d21;
  letter-spacing: -0.4px;
}

.logo-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 0.5px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 16px 10px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-link:hover {
  background: var(--surface2);
  color: #1c1d21;
  transform: translateX(2px);
}

.nav-link.active {
  background: #1c1d21; /* Dark charcoal active item */
  color: var(--accent); /* Yellow active link */
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border2);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}

.user-chip:hover {
  background: var(--surface2);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #1c1d21;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--accent);
}

.user-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #1c1d21;
}

.user-role {
  font-size: 11px;
  color: var(--text-3);
}

/* ════════════════════ MAIN ════════════════════ */
.main {
  margin-left: calc(var(--sidebar-w) + 20px);
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-right: 20px;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: none;
  background: transparent;
  backdrop-filter: none;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb-sep {
  color: var(--text-3);
  font-size: 15px;
}

.breadcrumb-item {
  font-size: 14px;
  color: var(--text-2);
  font-weight: 600;
}

.breadcrumb-item.current {
  color: #1c1d21;
  font-weight: 800;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Live pill */
.live-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--green);
  background: var(--green-dim);
  padding: 5px 12px;
  border-radius: 99px;
}

.live-dot {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  animation: blink 2s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1 }
  50% { opacity: 0.3 }
}

/* Theme toggle button */
.theme-btn {
  color: var(--text-2);
}

.theme-btn:hover {
  background: var(--surface3);
  border-color: var(--border);
  color: var(--text);
}

.theme-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
}

/* ════════════════════ PAGE ════════════════════ */
.page {
  padding: 28px;
  flex: 1;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-head h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.page-head p {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 2px;
}

/* ════════════════════ KPI CARDS ════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

@media(max-width:1200px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.kpi {
  background: var(--surface);
  border: none;
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.02);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.kpi:nth-child(1) {
  background: var(--surface3); /* Taupe card from reference */
  color: #1c1d21;
}

.kpi:nth-child(1) .kpi-label {
  color: #5c5d64;
}

.kpi:nth-child(2) {
  background: #1c1d21; /* Charcoal dark card from reference */
  color: #ffffff;
}

.kpi:nth-child(2) .kpi-label {
  color: #a1a1b0;
}

.kpi:nth-child(2) .kpi-sub {
  color: #6e6e7d;
}

.kpi:hover {
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(28, 29, 33, 0.04);
}

.kpi:nth-child(2) .kpi-icon {
  background: rgba(255, 255, 255, 0.06);
}

.kpi-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kpi-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 99px;
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.8px;
  line-height: 1.1;
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
}

/* ════════════════════ CARDS ════════════════════ */
.card {
  background: var(--surface);
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border2);
}

.card-title {
  font-size: 14px;
  font-weight: 800;
  color: #1c1d21;
}

.card-body {
  padding: 24px;
}

/* ════════════════════ MODULE GRID ════════════════════ */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.module-card {
  background: var(--surface);
  border: none;
  border-radius: var(--radius);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.module-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.module-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(28, 29, 33, 0.04);
}

.module-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.module-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #1c1d21;
}

.module-desc {
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.4;
}

/* ════════════════════ TABLE ════════════════════ */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 14px 20px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border2);
  transition: all 0.15s ease;
}

tbody tr:last-child {
  border: none;
}

tbody tr:hover {
  background: rgba(28, 29, 33, 0.02); /* Very soft grey highlight */
}

tbody td {
  padding: 14px 20px;
  font-size: 13.5px;
  vertical-align: middle;
}

.table-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-3);
  font-size: 13.5px;
}

/* ════════════════════ BADGES ════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}

.badge-green {
  background: var(--green-dim);
  color: var(--green);
}

.badge-red {
  background: var(--red-dim);
  color: var(--red);
}

.badge-amber {
  background: var(--amber-dim);
  color: var(--amber);
}

.badge-blue {
  background: var(--blue-dim);
  color: var(--blue);
}

.badge-accent {
  background: var(--accent-dim);
  color: var(--accent);
}

/* legacy aliases */
.badge-magenta {
  background: var(--accent-dim);
  color: var(--accent);
}

.badge-purple {
  background: var(--blue-dim);
  color: var(--blue);
}

/* ════════════════════ BUTTONS ════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 99px; /* Rounded pill shapes from reference */
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  white-space: nowrap;
}

.btn svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.btn-primary {
  background: #1c1d21; /* Charcoal black primary button from reference */
  color: #ffffff;
  border-color: #1c1d21;
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(28, 29, 33, 0.15);
}

.btn-outline {
  background: transparent;
  color: #1c1d21;
  border-color: rgba(28, 29, 33, 0.15);
}

.btn-outline:hover {
  background: rgba(28, 29, 33, 0.04);
  color: #1c1d21;
  border-color: rgba(28, 29, 33, 0.3);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}

.btn-ghost:hover {
  background: rgba(28, 29, 33, 0.04);
  color: #1c1d21;
}

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border-color: transparent;
}

.btn-danger:hover {
  background: var(--red);
  color: #fff;
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.2);
}

.btn-success {
  background: var(--green-dim);
  color: var(--green);
  border-color: transparent;
}

.btn-success:hover {
  background: var(--green);
  color: #fff;
  box-shadow: 0 4px 12px rgba(46, 204, 113, 0.2);
}

.btn-sm {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: 7px;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 6px;
}

/* ════════════════════ FORMS ════════════════════ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

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

.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
}

.form-control {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-control::placeholder {
  color: var(--text-3);
}

select.form-control option {
  background: var(--surface2);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.col-2 {
  grid-column: span 2;
}

/* Input with icon */
.input-group {
  position: relative;
}

.input-group .form-control {
  padding-left: 34px;
}

.input-group .input-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  display: flex;
}

.input-group .input-icon svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* ════════════════════ SECTION HEADING ════════════════════ */
.section-head {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
}

/* ════════════════════ TOAST ════════════════════ */
#toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow);
  transform: translateY(48px);
  opacity: 0;
  transition: all 0.22s cubic-bezier(.34, 1.56, .64, 1);
  max-width: 1000px;
  pointer-events: none;
}

#toast.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

#toast.success {
  border-left: 3px solid var(--green);
}

#toast.error {
  border-left: 3px solid var(--red);
}

#toast.info {
  border-left: 3px solid var(--accent);
}

/* ════════════════════ MISC ════════════════════ */
.font-mono {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
}

.text-muted {
  color: var(--text-2);
}

.text-xs {
  font-size: 12px;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.gap-8 {
  gap: 8px;
}

.gap-12 {
  gap: 12px;
}

/* ════════════════════ TABS ════════════════════ */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface2);
  padding: 4px;
  border-radius: 9px;
  width: fit-content;
  margin-bottom: 20px;
}

.tab {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.12s;
  border: none;
  background: transparent;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* ════════════════════ SEARCH HIGHLIGHT ════════════════════ */
.highlight {
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 600;
  padding: 0 2px;
  border-radius: 2px;
}

/* Accordion Utils */
.bonus-accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.bonus-accordion-content.active {
  max-height: 300px;
}
.bonus-accordion-content table td {
  padding: 8px 0;
}
