/* ===========================
   SIPINHAN — Design System
   =========================== */

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

:root {
  --bg: #0d1117;
  --bg2: #161b22;
  --bg3: #1f2937;
  --bg4: #263045;
  --border: rgba(255,255,255,.06);
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --accent: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text: #e2e8f0;
  --text2: #94a3b8;
  --text3: #64748b;
  --sidebar-w: 240px;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,.4);
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* === SIDEBAR === */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  transition: width .3s;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
}
.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.logo-title { font-size: 15px; font-weight: 700; color: #fff; display: block; }
.logo-sub { font-size: 10px; color: var(--text3); display: block; }

.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-group-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text3);
  letter-spacing: 1px;
  padding: 12px 16px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  border-radius: 0;
  transition: all .15s;
  text-decoration: none;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.04); color: var(--text); }
.nav-item.active {
  background: rgba(37,99,235,.15);
  color: var(--primary-light);
  border-right: 2px solid var(--primary);
}
.nav-icon { width: 18px; text-align: center; font-size: 14px; }
.badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
}
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.user-avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text); display: block; }
.user-role { font-size: 11px; color: var(--text3); display: block; }

/* === MAIN === */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 56px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.hamburger {
  background: none; border: none; color: var(--text2);
  font-size: 18px; cursor: pointer; padding: 4px;
}
.breadcrumb { font-size: 14px; font-weight: 600; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
}
.search-box input {
  background: none; border: none; outline: none;
  color: var(--text); font-size: 13px; width: 180px;
}
.search-box input::placeholder { color: var(--text3); }
.notif-bell {
  position: relative; cursor: pointer; font-size: 18px; color: var(--text2);
}
.notif-dot {
  position: absolute; top: -2px; right: -2px;
  width: 8px; height: 8px;
  background: var(--danger); border-radius: 50%;
  border: 2px solid var(--bg2);
}
.page-content {
  flex: 1; overflow-y: auto; padding: 24px;
}

/* === CARDS === */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-sub { font-size: 12px; color: var(--text3); margin-top: 2px; }

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 3px; height: 100%;
}
.stat-card.blue::before { background: var(--primary); }
.stat-card.cyan::before { background: var(--accent); }
.stat-card.green::before { background: var(--success); }
.stat-card.yellow::before { background: var(--warning); }
.stat-card.red::before { background: var(--danger); }
.stat-label { font-size: 12px; color: var(--text3); font-weight: 500; }
.stat-value { font-size: 28px; font-weight: 700; margin: 4px 0; color: #fff; }
.stat-change { font-size: 12px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }
.stat-icon {
  position: absolute; right: 16px; top: 50%;
  transform: translateY(-50%);
  font-size: 32px; opacity: .12;
}

/* Grid Layouts */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-dashboard { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }

/* === TABLE === */
.table-container { overflow-x: auto; border-radius: var(--radius); }
table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
th {
  background: var(--bg3); color: var(--text2);
  padding: 10px 14px; text-align: left;
  font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .5px;
}
td {
  padding: 11px 14px; border-bottom: 1px solid rgba(255,255,255,.04);
  color: var(--text);
}
tr:hover td { background: rgba(255,255,255,.025); }
tr:last-child td { border-bottom: none; }

/* STATUS BADGES */
.status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.status.approved   { background: rgba(16,185,129,.15); color: #34d399; }
.status.pending    { background: rgba(245,158,11,.15);  color: #fbbf24; }
.status.review     { background: rgba(37,99,235,.15);   color: #60a5fa; }
.status.rejected   { background: rgba(239,68,68,.15);   color: #f87171; }
.status.draft      { background: rgba(100,116,139,.15); color: #94a3b8; }
.status.expired    { background: rgba(239,68,68,.1);    color: #ef4444; }
.status.warning    { background: rgba(245,158,11,.15);  color: #f59e0b; }
.status.black      { background: rgba(239,68,68,.2);    color: #ef4444; border: 1px solid rgba(239,68,68,.3); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text2);
}
.btn-outline:hover { background: var(--bg3); color: var(--text); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 11px; }

/* === FORM === */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text2); }
.form-control {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border .15s;
}
.form-control:focus { border-color: var(--primary); }
select.form-control option { background: var(--bg3); }
.form-section { margin-bottom: 24px; }
.form-section-title {
  font-size: 13px; font-weight: 700; color: var(--text2);
  margin-bottom: 14px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}

/* Upload area */
.upload-area {
  border: 2px dashed var(--primary);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: rgba(37,99,235,.04);
}
.upload-area:hover { background: rgba(37,99,235,.08); }
.upload-label { font-size: 13px; color: var(--text2); margin-top: 8px; }
.upload-sub { font-size: 11px; color: var(--text3); }

/* === TIMELINE === */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 4px; bottom: 4px;
  width: 2px; background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-dot {
  position: absolute; left: -24px; top: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--bg2);
}
.timeline-dot.done  { background: var(--success); }
.timeline-dot.active{ background: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.3); }
.timeline-dot.wait  { background: var(--bg3); border-color: var(--border); }
.timeline-title { font-size: 13px; font-weight: 600; }
.timeline-sub   { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* === CHIP / TAGS === */
.chip {
  display: inline-block;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  background: var(--bg3); color: var(--text2);
}
.chip.blue  { background: rgba(37,99,235,.15); color: #60a5fa; }
.chip.green { background: rgba(16,185,129,.15); color: #34d399; }
.chip.red   { background: rgba(239,68,68,.15);  color: #f87171; }

/* === PAGE HEADER === */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px;
}
.page-title { font-size: 20px; font-weight: 700; }
.page-desc  { font-size: 13px; color: var(--text3); margin-top: 2px; }

/* === MISC === */
.pill-tabs {
  display: flex; gap: 4px;
  background: var(--bg3);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 16px;
}
.pill-tab {
  padding: 7px 14px; border-radius: 6px;
  font-size: 12px; font-weight: 600;
  cursor: pointer; color: var(--text3);
  transition: all .15s;
}
.pill-tab.active { background: var(--bg2); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.3); }

.progress-bar {
  height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px; transition: width .3s;
}

.empty-state {
  text-align: center; padding: 40px 20px; color: var(--text3);
}
.empty-state .icon { font-size: 40px; margin-bottom: 10px; }
.empty-state p { font-size: 13px; }

@media (max-width: 900px) {
  .grid-dashboard { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
