/* ============================================================
   PANCHAMI ERP — DESIGN SYSTEM
   Premium dark interface · derived from panchamihub.com
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root{
  /* ---- Canvas ---- */
  --bg:            #0B0B0E;
  --bg-soft:       #111116;
  --surface:       #16161D;
  --surface-2:     #1D1D26;
  --surface-3:     #25252F;
  --line:          #2A2A35;
  --line-soft:     #1F1F28;

  /* ---- Ink ---- */
  --text:          #F3F1EC;
  --text-soft:     #B6B4AE;
  --text-mute:     #76746E;
  --text-faint:    #4A4A52;

  /* ---- Signature gold ---- */
  --gold:          #C6A15B;
  --gold-bright:   #E0C27E;
  --gold-deep:     #9A7B3F;
  --gold-glow:     rgba(198,161,91,0.18);

  /* ---- Status ---- */
  --green:         #34D399;
  --green-bg:      rgba(52,211,153,0.12);
  --red:           #F87171;
  --red-bg:        rgba(248,113,113,0.12);
  --amber:         #FBBF24;
  --amber-bg:      rgba(251,191,36,0.12);
  --blue:          #60A5FA;
  --blue-bg:       rgba(96,165,250,0.12);
  --violet:        #A78BFA;
  --violet-bg:     rgba(167,139,250,0.12);

  /* ---- Type ---- */
  --display: 'Fraunces', Georgia, serif;
  --body:    'Inter', system-ui, -apple-system, sans-serif;
  --mono:    'JetBrains Mono', monospace;

  /* ---- Geometry ---- */
  --r-sm: 8px;
  --r:    14px;
  --r-lg: 20px;
  --r-xl: 28px;

  /* ---- Motion ---- */
  --ease:      cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --spring:    cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ---- Shadow ---- */
  --shadow:    0 10px 40px -12px rgba(0,0,0,0.6);
  --shadow-lg: 0 30px 80px -20px rgba(0,0,0,0.7);

  --sidebar-w: 264px;
}

*{ margin:0; padding:0; box-sizing:border-box; }

html{ scroll-behavior:smooth; }

body{
  font-family: var(--body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

/* Ambient background texture */
body::before{
  content:'';
  position: fixed; inset: 0;
  background:
    radial-gradient(900px 600px at 85% -5%, rgba(198,161,91,0.06), transparent 60%),
    radial-gradient(700px 500px at 5% 100%, rgba(198,161,91,0.04), transparent 55%);
  pointer-events: none; z-index: 0;
}

::selection{ background: var(--gold-glow); color: var(--gold-bright); }

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

/* ---- Scrollbar ---- */
::-webkit-scrollbar{ width:10px; height:10px; }
::-webkit-scrollbar-track{ background: transparent; }
::-webkit-scrollbar-thumb{ background: var(--surface-3); border-radius: 10px; border:2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover{ background: var(--text-faint); }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
.display{ font-family: var(--display); font-weight: 600; letter-spacing:-0.02em; line-height: 1.05; }
h1,h2,h3{ font-family: var(--display); font-weight: 600; letter-spacing:-0.02em; line-height: 1.1; }

.eyebrow{
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 500;
}

.mono{ font-family: var(--mono); }

/* ============================================================
   LAYOUT SHELL
   ============================================================ */
.app{ display:flex; min-height:100vh; position:relative; z-index:1; }

/* ---- Sidebar ---- */
.sidebar{
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-soft);
  border-right: 1px solid var(--line-soft);
  display:flex; flex-direction:column;
  position: sticky; top:0; height:100vh;
  z-index: 40;
}
.sidebar-brand{
  padding: 24px 22px 20px;
  display:flex; align-items:center; gap:11px;
  border-bottom: 1px solid var(--line-soft);
}
.brand-mark{
  width: 34px; height:34px; border-radius:9px;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-deep));
  display:grid; place-items:center;
  font-family: var(--display); font-weight:700; font-size:18px; color:#1a1407;
  box-shadow: 0 4px 16px -4px var(--gold-glow);
  flex-shrink:0;
}
.brand-text{ display:flex; flex-direction:column; line-height:1.1; }
.brand-name{ font-family: var(--display); font-weight:600; font-size:16px; letter-spacing:-0.01em; }
.brand-sub{ font-family: var(--mono); font-size:9px; letter-spacing:0.16em; text-transform:uppercase; color: var(--text-mute); margin-top:2px; }

.nav{ flex:1; overflow-y:auto; padding: 14px 12px; display:flex; flex-direction:column; gap:2px; }
.nav-section{ font-family: var(--mono); font-size:10px; letter-spacing:0.14em; text-transform:uppercase; color: var(--text-faint); padding: 16px 12px 6px; }
.nav-item{
  display:flex; align-items:center; gap:12px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--text-soft); font-size: 14px; font-weight: 500;
  transition: all .18s var(--ease); position:relative; cursor:pointer;
}
.nav-item svg{ width:18px; height:18px; stroke-width:1.8; flex-shrink:0; opacity:.85; }
.nav-item:hover{ background: var(--surface); color: var(--text); }
.nav-item.active{ background: var(--surface-2); color: var(--text); }
.nav-item.active::before{
  content:''; position:absolute; left:-12px; top:50%; transform:translateY(-50%);
  width:3px; height:20px; border-radius:0 3px 3px 0;
  background: linear-gradient(var(--gold-bright), var(--gold-deep));
}
.nav-item.active svg{ opacity:1; color: var(--gold); }
.nav-badge{ margin-left:auto; font-size:11px; font-weight:600; background: var(--gold); color:#1a1407; padding:1px 7px; border-radius:20px; }

.sidebar-foot{ padding: 14px; border-top: 1px solid var(--line-soft); }
.user-chip{
  display:flex; align-items:center; gap:11px; padding:8px; border-radius:12px;
  transition: background .18s var(--ease); cursor:pointer;
}
.user-chip:hover{ background: var(--surface); }
.avatar{
  width:36px; height:36px; border-radius:10px; flex-shrink:0;
  display:grid; place-items:center; font-weight:600; font-size:13px;
  background: var(--surface-3); color: var(--gold-bright);
  border:1px solid var(--line);
}
.user-meta{ flex:1; min-width:0; }
.user-name{ font-size:13px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.user-role{ font-size:11px; color: var(--text-mute); }

/* ---- Main ---- */
.main{ flex:1; min-width:0; display:flex; flex-direction:column; }
.topbar{
  height: 68px; flex-shrink:0;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(11,11,14,0.7); backdrop-filter: blur(16px);
  display:flex; align-items:center; gap:18px; padding: 0 28px;
  position: sticky; top:0; z-index:30;
}
.page-title{ font-family: var(--display); font-size:21px; font-weight:600; }
.topbar-spacer{ flex:1; }

.content{ padding: 28px; max-width: 1400px; width:100%; }

/* ============================================================
   COMPONENTS
   ============================================================ */

/* ---- Cards ---- */
.card{
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: 22px;
  position: relative;
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.card-pad-lg{ padding: 26px; }
.card-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; }
.card-title{ font-family: var(--display); font-size:17px; font-weight:600; }
.card-sub{ font-size:13px; color: var(--text-mute); margin-top:2px; }

/* ---- Stat cards ---- */
.stat-grid{ display:grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap:16px; margin-bottom:24px; }
.stat{
  background: var(--surface); border:1px solid var(--line-soft);
  border-radius: var(--r-lg); padding: 20px; position:relative; overflow:hidden;
  transition: transform .25s var(--ease), border-color .25s var(--ease);
}
.stat:hover{ transform: translateY(-3px); border-color: var(--line); }
.stat::after{
  content:''; position:absolute; top:0; right:0; width:80px; height:80px;
  background: radial-gradient(circle at top right, var(--accent, var(--gold-glow)), transparent 70%);
  opacity:.5;
}
.stat-icon{
  width:38px; height:38px; border-radius:11px; display:grid; place-items:center;
  background: var(--surface-2); margin-bottom:14px; color: var(--gold);
  border:1px solid var(--line);
}
.stat-icon svg{ width:19px; height:19px; stroke-width:1.8; }
.stat-label{ font-size:12px; color: var(--text-mute); font-weight:500; letter-spacing:0.02em; }
.stat-value{ font-family: var(--display); font-size:30px; font-weight:600; margin-top:4px; letter-spacing:-0.02em; }
.stat-delta{ font-size:12px; margin-top:6px; display:inline-flex; align-items:center; gap:4px; font-weight:500; }
.stat-delta.up{ color: var(--green); }
.stat-delta.down{ color: var(--red); }

/* ---- Buttons ---- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  font-family: var(--body); font-size:13.5px; font-weight:600;
  padding: 9px 16px; border-radius: 10px; border:1px solid transparent;
  cursor:pointer; transition: all .18s var(--ease); white-space:nowrap;
  background: var(--surface-2); color: var(--text); border-color: var(--line);
}
.btn:hover{ background: var(--surface-3); transform: translateY(-1px); }
.btn:active{ transform: translateY(0); }
.btn svg{ width:16px; height:16px; stroke-width:2; }
.btn-primary{
  background: linear-gradient(135deg, var(--gold-bright), var(--gold)); color:#1a1407;
  border-color: transparent; box-shadow: 0 4px 18px -6px var(--gold-glow);
}
.btn-primary:hover{ background: linear-gradient(135deg, var(--gold-bright), var(--gold-bright)); box-shadow: 0 6px 24px -6px var(--gold-glow); }
.btn-ghost{ background: transparent; border-color: var(--line); }
.btn-ghost:hover{ background: var(--surface); }
.btn-danger{ background: var(--red-bg); color: var(--red); border-color: transparent; }
.btn-danger:hover{ background: rgba(248,113,113,0.2); }
.btn-success{ background: var(--green-bg); color: var(--green); border-color:transparent; }
.btn-success:hover{ background: rgba(52,211,153,0.2); }
.btn-sm{ padding: 6px 12px; font-size:12.5px; border-radius:9px; }
.btn-icon{ padding:9px; width:38px; }
.btn-block{ width:100%; }

/* ---- Badges / pills ---- */
.badge{
  display:inline-flex; align-items:center; gap:5px;
  font-size:11.5px; font-weight:600; padding:3px 10px; border-radius:20px;
  letter-spacing:0.01em;
}
.badge-dot{ width:6px; height:6px; border-radius:50%; background:currentColor; }
.badge.green{ color: var(--green); background: var(--green-bg); }
.badge.red{ color: var(--red); background: var(--red-bg); }
.badge.amber{ color: var(--amber); background: var(--amber-bg); }
.badge.blue{ color: var(--blue); background: var(--blue-bg); }
.badge.violet{ color: var(--violet); background: var(--violet-bg); }
.badge.gold{ color: var(--gold-bright); background: var(--gold-glow); }
.badge.gray{ color: var(--text-mute); background: var(--surface-2); }

/* ---- Tables ---- */
.table-wrap{ overflow-x:auto; border-radius: var(--r-lg); border:1px solid var(--line-soft); }
table{ width:100%; border-collapse:collapse; font-size:13.5px; }
thead th{
  text-align:left; font-family: var(--mono); font-size:10.5px; letter-spacing:0.1em;
  text-transform:uppercase; color: var(--text-mute); font-weight:500;
  padding: 13px 16px; background: var(--bg-soft); border-bottom:1px solid var(--line);
  white-space:nowrap;
}
tbody td{ padding: 13px 16px; border-bottom:1px solid var(--line-soft); color: var(--text-soft); vertical-align:middle; }
tbody tr{ transition: background .15s var(--ease); }
tbody tr:hover{ background: var(--surface); }
tbody tr:last-child td{ border-bottom:none; }
td .strong{ color: var(--text); font-weight:600; }
.cell-user{ display:flex; align-items:center; gap:10px; }
.cell-avatar{ width:32px; height:32px; border-radius:9px; display:grid; place-items:center; font-size:12px; font-weight:600; background: var(--surface-3); color: var(--gold-bright); flex-shrink:0; }

/* ---- Forms ---- */
.form-grid{ display:grid; gap:16px; }
.form-grid.cols-2{ grid-template-columns: 1fr 1fr; }
.form-grid.cols-3{ grid-template-columns: 1fr 1fr 1fr; }
.field{ display:flex; flex-direction:column; gap:7px; }
.field label{ font-size:12.5px; font-weight:600; color: var(--text-soft); }
.field label .req{ color: var(--gold); }
.input, .select, .textarea{
  font-family: var(--body); font-size:14px; color: var(--text);
  background: var(--bg-soft); border:1px solid var(--line); border-radius:10px;
  padding: 10px 13px; transition: all .18s var(--ease); width:100%;
}
.input:focus, .select:focus, .textarea:focus{
  outline:none; border-color: var(--gold-deep);
  box-shadow: 0 0 0 3px var(--gold-glow); background: var(--surface);
}
.input::placeholder, .textarea::placeholder{ color: var(--text-faint); }
.textarea{ resize:vertical; min-height:90px; }
select.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 24 24' fill='none' stroke='%2376746E' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 12px center; padding-right:36px; }
.field-hint{ font-size:11.5px; color: var(--text-mute); }

/* ---- Empty state ---- */
.empty{ text-align:center; padding: 56px 24px; color: var(--text-mute); }
.empty-icon{ width:52px; height:52px; border-radius:14px; background: var(--surface-2); display:grid; place-items:center; margin:0 auto 16px; color: var(--text-faint); }
.empty-icon svg{ width:24px; height:24px; }
.empty h3{ font-size:16px; color: var(--text-soft); margin-bottom:6px; }
.empty p{ font-size:13.5px; max-width:340px; margin:0 auto 18px; }

/* ---- Section header ---- */
.section-head{ display:flex; align-items:flex-end; justify-content:space-between; margin-bottom:22px; gap:16px; flex-wrap:wrap; }
.section-head .eyebrow{ margin-bottom:8px; display:block; }
.section-head h1{ font-size:28px; }
.section-head p{ color: var(--text-mute); font-size:14px; margin-top:4px; }
.head-actions{ display:flex; gap:10px; align-items:center; }

/* ---- Search input ---- */
.search{ position:relative; }
.search svg{ position:absolute; left:13px; top:50%; transform:translateY(-50%); width:16px; height:16px; color: var(--text-faint); pointer-events:none; }
.search input{ padding-left:38px; background: var(--surface); border:1px solid var(--line); border-radius:10px; font-size:13.5px; color: var(--text); padding-top:9px; padding-bottom:9px; padding-right:14px; width:240px; transition: all .18s var(--ease); }
.search input:focus{ outline:none; border-color: var(--gold-deep); box-shadow:0 0 0 3px var(--gold-glow); width:280px; }

/* ---- Tabs ---- */
.tabs{ display:flex; gap:4px; border-bottom:1px solid var(--line); margin-bottom:24px; }
.tab{ padding:10px 16px; font-size:13.5px; font-weight:600; color: var(--text-mute); cursor:pointer; border-bottom:2px solid transparent; transition: all .18s var(--ease); margin-bottom:-1px; }
.tab:hover{ color: var(--text-soft); }
.tab.active{ color: var(--gold-bright); border-bottom-color: var(--gold); }

/* ---- Progress ---- */
.progress{ height:7px; background: var(--surface-2); border-radius:20px; overflow:hidden; }
.progress-bar{ height:100%; border-radius:20px; background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright)); transition: width .6s var(--ease); }

/* ---- Divider ---- */
.divider{ height:1px; background: var(--line-soft); margin:20px 0; border:none; }

/* ---- Grid utility ---- */
.grid{ display:grid; gap:16px; }
.grid-2{ grid-template-columns: 1fr 1fr; }
.grid-3{ grid-template-columns: repeat(3,1fr); }
.col-span-2{ grid-column: span 2; }

.flex{ display:flex; }
.items-center{ align-items:center; }
.justify-between{ justify-content:space-between; }
.gap-2{ gap:8px; } .gap-3{ gap:12px; } .gap-4{ gap:16px; }
.mt-2{ margin-top:8px; } .mt-3{ margin-top:12px; } .mt-4{ margin-top:16px; } .mt-6{ margin-top:24px; }
.mb-2{ margin-bottom:8px; } .mb-4{ margin-bottom:16px; }
.text-mute{ color: var(--text-mute); } .text-soft{ color: var(--text-soft); }
.text-sm{ font-size:13px; } .text-xs{ font-size:11.5px; }
.fw-600{ font-weight:600; }
.text-right{ text-align:right; }
.text-gold{ color: var(--gold-bright); }
.text-green{ color: var(--green); } .text-red{ color: var(--red); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeUp{ from{ opacity:0; transform: translateY(14px); } to{ opacity:1; transform:none; } }
@keyframes fadeIn{ from{ opacity:0; } to{ opacity:1; } }
@keyframes scaleIn{ from{ opacity:0; transform: scale(.96); } to{ opacity:1; transform:none; } }
@keyframes slideInRight{ from{ opacity:0; transform: translateX(20px); } to{ opacity:1; transform:none; } }
@keyframes shimmer{ 0%{ background-position:-400px 0; } 100%{ background-position:400px 0; } }
@keyframes pulse-gold{ 0%,100%{ box-shadow:0 0 0 0 var(--gold-glow); } 50%{ box-shadow:0 0 0 8px transparent; } }
@keyframes countUp{ from{ opacity:0; transform: translateY(8px); } to{ opacity:1; transform:none; } }
@keyframes ringDash{ from{ stroke-dashoffset: var(--circ); } }

.animate-in{ animation: fadeUp .5s var(--ease) both; }
.stagger > *{ animation: fadeUp .5s var(--ease) both; }
.stagger > *:nth-child(1){ animation-delay:.03s; }
.stagger > *:nth-child(2){ animation-delay:.07s; }
.stagger > *:nth-child(3){ animation-delay:.11s; }
.stagger > *:nth-child(4){ animation-delay:.15s; }
.stagger > *:nth-child(5){ animation-delay:.19s; }
.stagger > *:nth-child(6){ animation-delay:.23s; }
.stagger > *:nth-child(7){ animation-delay:.27s; }
.stagger > *:nth-child(8){ animation-delay:.31s; }

/* ---- Toast ---- */
.toast-wrap{ position:fixed; top:20px; right:20px; z-index:1000; display:flex; flex-direction:column; gap:10px; }
.toast{
  background: var(--surface-2); border:1px solid var(--line); border-radius:12px;
  padding:13px 16px; min-width:280px; box-shadow: var(--shadow-lg);
  display:flex; align-items:center; gap:11px; animation: slideInRight .4s var(--spring) both;
  font-size:13.5px; font-weight:500;
}
.toast.success{ border-left:3px solid var(--green); }
.toast.error{ border-left:3px solid var(--red); }
.toast-icon{ width:20px; height:20px; flex-shrink:0; }

/* ---- Modal ---- */
.modal-overlay{
  position:fixed; inset:0; background:rgba(5,5,8,0.72); backdrop-filter:blur(6px);
  z-index:200; display:none; align-items:center; justify-content:center; padding:24px;
  animation: fadeIn .2s ease both;
}
.modal-overlay.open{ display:flex; }
.modal{
  background: var(--surface); border:1px solid var(--line); border-radius: var(--r-xl);
  width:100%; max-width:560px; max-height:90vh; overflow-y:auto;
  box-shadow: var(--shadow-lg); animation: scaleIn .3s var(--spring) both;
}
.modal-lg{ max-width:760px; }
.modal-head{ padding:22px 24px; border-bottom:1px solid var(--line-soft); display:flex; align-items:center; justify-content:space-between; position:sticky; top:0; background:var(--surface); z-index:2; }
.modal-head h2{ font-size:19px; }
.modal-body{ padding:24px; }
.modal-foot{ padding:18px 24px; border-top:1px solid var(--line-soft); display:flex; justify-content:flex-end; gap:10px; position:sticky; bottom:0; background:var(--surface); }
.modal-close{ width:32px; height:32px; border-radius:9px; display:grid; place-items:center; cursor:pointer; color:var(--text-mute); transition: all .18s var(--ease); border:1px solid transparent; }
.modal-close:hover{ background: var(--surface-2); color:var(--text); }

/* ---- Mobile menu toggle ---- */
.menu-toggle{ display:none; width:38px; height:38px; border-radius:10px; background:var(--surface-2); border:1px solid var(--line); place-items:center; cursor:pointer; color:var(--text); }
.menu-toggle svg{ width:20px; height:20px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px){
  .grid-3{ grid-template-columns:1fr 1fr; }
  .form-grid.cols-3{ grid-template-columns:1fr 1fr; }
}
@media (max-width: 860px){
  .sidebar{
    position:fixed; left:0; top:0; transform:translateX(-100%);
    transition: transform .3s var(--ease); box-shadow: var(--shadow-lg);
  }
  .sidebar.open{ transform:translateX(0); }
  .menu-toggle{ display:grid; }
  .grid-2, .grid-3, .form-grid.cols-2, .form-grid.cols-3{ grid-template-columns:1fr; }
  .col-span-2{ grid-column:auto; }
  .content{ padding:18px; }
  .topbar{ padding:0 18px; }
  .search input{ width:150px; }
  .search input:focus{ width:180px; }
  .sidebar-backdrop{ position:fixed; inset:0; background:rgba(0,0,0,.5); z-index:39; display:none; }
  .sidebar-backdrop.show{ display:block; }
}

@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{ animation-duration:.01ms !important; transition-duration:.01ms !important; }
  html{ scroll-behavior:auto; }
}
