/* KMC VMS Design System */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --brand-orange: #F47A1F;
  --brand-orange-dark: #EA5F12;
  --brand-red: #E2231A;
  --brand-navy: #1A1F2B;
  --brand-green: #15803D;

  --bg: #EEF0F3;
  --surface: #FFFFFF;
  --border: #E7EAEE;
  --border-light: #F0F1F4;
  --surface-subtle: #F6F7F9;
  --surface-form: #F8F9FB;

  --text-primary: #1A1D21;
  --text-secondary: #3A3F47;
  --text-muted: #6B7280;
  --text-placeholder: #9AA1AC;

  --sb: #FFFFFF;
  --sb-border: #E7EAEE;
  --sb-text: #3A3F47;
  --sb-muted: #8A9099;
  --sb-card: #F6F7F9;

  --radius-sm: 8px;
  --radius-md: 11px;
  --radius-lg: 14px;
  --radius-xl: 16px;
  --radius-2xl: 18px;

  --shadow-sm: 0 1px 2px rgba(16,24,40,.04);
  --shadow-md: 0 4px 14px rgba(0,0,0,.08);
  --shadow-orange: 0 4px 14px rgba(244,122,31,.36);
}

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  color: var(--text-primary);
  height: 100%;
}

input, button, textarea, select { font-family: inherit; }
::placeholder { color: var(--text-placeholder); }
a { color: inherit; text-decoration: none; }

/* ── Scrollbar ── */
.vms-scroll::-webkit-scrollbar { width: 7px; height: 7px; }
.vms-scroll::-webkit-scrollbar-thumb { background: #CDD3DB; border-radius: 8px; }

/* ── Animations ── */
@keyframes vmsFade { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
@keyframes vmsPop  { from { opacity:0; transform:scale(.96); } to { opacity:1; transform:none; } }
@keyframes vmsPulse {
  0%   { box-shadow: 0 0 0 0 rgba(22,163,74,.5); }
  70%  { box-shadow: 0 0 0 7px rgba(22,163,74,0); }
  100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); }
}
.vms-anim   { animation: vmsFade .35s ease both; }
.vms-pop    { animation: vmsPop  .25s ease both; }
.pulse-dot  { animation: vmsPulse 2s infinite; }

/* ── Layout shell ── */
.vms-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ── */
.vms-sidebar {
  width: 256px; flex: 0 0 256px;
  background: var(--sb);
  border-right: 1px solid var(--sb-border);
  display: flex; flex-direction: column;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  overflow-y: auto; position: relative; z-index: 40;
}
.vms-sidebar-logo {
  padding: 20px 18px 16px;
  display: flex; align-items: center; gap: 11px;
  border-bottom: 1px solid var(--sb-border);
}
.vms-sidebar-logo-mark {
  width: 40px; height: 40px; border-radius: 11px;
  background: #fff; border: 1px solid var(--sb-border);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 2px rgba(16,24,40,.05); overflow: hidden; flex: 0 0 auto;
}
.vms-sidebar-logo-mark img { width: 30px; height: auto; }
.vms-sidebar-brand { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 14.5px; line-height: 1.1; color: var(--sb-text); }
.vms-sidebar-sub   { font-size: 10.5px; color: var(--sb-muted); letter-spacing: .04em; margin-top: 2px; }

.vms-nav-section-label {
  padding: 14px 12px 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em;
  color: var(--sb-muted); text-transform: uppercase;
}
.vms-nav { display: flex; flex-direction: column; gap: 3px; padding: 2px 12px; }

.nav-btn {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 12px; border-radius: 11px; border: none;
  cursor: pointer; font-size: 13.5px; font-weight: 500;
  background: transparent; color: var(--sb-text);
  transition: background .15s, color .15s;
  text-align: left;
}
.nav-btn:hover  { background: var(--surface-subtle); }
.nav-btn.active {
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-dark));
  color: #fff; font-weight: 600;
  box-shadow: 0 3px 10px rgba(244,122,31,.32);
}
.nav-btn .badge {
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; margin-left: auto;
  background: #FEE2D6; color: #C2410C;
}
.nav-btn.active .badge { background: rgba(255,255,255,.25); color: #fff; }

.vms-user-card {
  margin-top: auto; padding: 14px;
}
.vms-user-card-inner {
  background: var(--sb-card); border: 1px solid var(--sb-border);
  border-radius: 14px; padding: 13px;
}
.vms-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #F47A1F, #E2231A);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex: 0 0 auto;
}
.vms-avatar-lg {
  width: 58px; height: 58px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 20px; font-family: 'Poppins', sans-serif;
  flex: 0 0 auto;
}

/* ── Main area ── */
.vms-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.vms-topbar {
  height: 64px; flex: 0 0 64px; background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px; position: sticky; top: 0; z-index: 30;
}
.vms-search-wrap { position: relative; flex: 1; max-width: 420px; }
.vms-search-wrap svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); }
.vms-search {
  width: 100%; height: 40px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface-subtle);
  padding: 0 14px 0 38px; font-size: 13.5px; outline: none; color: var(--text-primary);
}

.vms-content { flex: 1; overflow-y: auto; padding: 26px 30px 70px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: none; cursor: pointer; font-weight: 600; font-size: 13px;
  border-radius: var(--radius-md); padding: 0 15px; height: 40px;
  transition: filter .15s, box-shadow .15s;
}
.btn:hover { filter: brightness(1.05); }
.btn-primary {
  background: var(--brand-orange); color: #fff;
  box-shadow: 0 1px 2px rgba(244,122,31,.4);
}
.btn-danger  { background: #fff; color: #C0392B; border: 1px solid #F1D5D5; }
.btn-ghost   { background: #fff; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-green   { background: var(--brand-green); color: #fff; }
.btn-approve {
  width: 100%; height: 46px; font-size: 14px; font-weight: 700;
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-dark));
  color: #fff; border: none; border-radius: 12px;
  box-shadow: var(--shadow-orange); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-decline {
  width: 100%; height: 44px; font-size: 14px; font-weight: 600;
  background: #fff; color: #C0392B; border: 1px solid #F1D5D5;
  border-radius: 12px; cursor: pointer; margin-top: 9px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-outline-full {
  width: 100%; height: 42px; font-size: 13.5px; font-weight: 600;
  background: #fff; color: var(--text-secondary); border: 1px solid var(--border);
  border-radius: 12px; cursor: pointer; margin-top: 9px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}

/* ── Stat cards ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 15px; margin-bottom: 18px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 17px 18px; box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, border-color .15s;
}
a.stat-card:hover { box-shadow: var(--shadow-md, 0 4px 14px rgba(0,0,0,.06)); border-color: #D8DBE0; }
.stat-icon {
  width: 40px; height: 40px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
}
.stat-value { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 28px; margin-top: 13px; line-height: 1; }
.stat-label { color: var(--text-muted); font-size: 13px; margin-top: 5px; font-weight: 500; }
.stat-trend { font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 999px; }

/* ── Cards ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-sm);
}
.card-pad  { padding: 18px 20px; }
.card-hd   { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 12px; }
.card-hd h3 { font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 15px; margin: 0; }

/* ── Status chips ── */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.chip-dot { width: 6px; height: 6px; border-radius: 50%; }
.chip-active   { background: #DCFCE7; color: #15803D; }
.chip-approved { background: #DBEAFE; color: #1D4ED8; }
.chip-pending  { background: #FEF3C7; color: #B45309; }
.chip-declined { background: #FEE2E2; color: #B91C1C; }
.chip-previous { background: #F1F5F9; color: #475569; }

.cat-chip {
  display: inline-flex; padding: 3px 9px; border-radius: 7px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}

/* ── Table ── */
.vms-table-wrap { overflow-x: auto; }
table.vms-table { width: 100%; border-collapse: collapse; min-width: 760px; }
table.vms-table thead tr { background: #FAFBFC; }
table.vms-table th {
  text-align: left; padding: 12px 18px;
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  color: var(--text-placeholder); text-transform: uppercase;
}
table.vms-table th:first-child,
table.vms-table td:first-child { padding-left: 18px; }
table.vms-table td { padding: 13px 14px; border-top: 1px solid var(--border-light); }
table.vms-table tbody tr { cursor: pointer; }
table.vms-table tbody tr:hover { background: var(--surface-subtle); }

/* ── Tabs ── */
.tab-bar { display: flex; gap: 7px; margin-bottom: 14px; overflow-x: auto; padding-bottom: 2px; }
.tab-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  color: #5A616B; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.tab-btn.active { border-color: var(--brand-orange); background: #FFF6EF; color: #C2410C; }
.tab-count {
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: #EDEFF2; color: #8A9099;
  font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.tab-btn.active .tab-count { background: var(--brand-orange); color: #fff; }

/* ── Filter bar ── */
.filter-bar {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 13px 14px;
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
.filter-input {
  height: 38px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-subtle);
  padding: 0 12px; font-size: 13px; outline: none; color: var(--text-primary);
}
.filter-select {
  height: 38px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  padding: 0 12px; font-size: 13px; color: var(--text-secondary); cursor: pointer;
}

/* ── Detail page grid ── */
.detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
.detail-fields {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px; background: var(--border-light); border-radius: 12px;
  overflow: hidden; border: 1px solid var(--border-light); margin-bottom: 14px;
}
.detail-field { background: var(--surface); padding: 12px 14px; }
.detail-field-label {
  font-size: 11.5px; color: var(--text-placeholder); font-weight: 600;
  letter-spacing: .02em; text-transform: uppercase; margin-bottom: 4px;
}
.detail-field-value { font-size: 14px; color: var(--text-primary); font-weight: 500; }

/* ── Timeline ── */
.timeline-item { display: flex; gap: 11px; }
.timeline-dot  { width: 10px; height: 10px; border-radius: 50%; margin-top: 3px; flex: 0 0 auto; }
.timeline-line { width: 2px; flex: 1; background: #EDEFF2; }

/* ── Form fields ── */
.form-label { display: flex; flex-direction: column; gap: 6px; }
.form-label-text { font-size: 12.5px; font-weight: 600; color: #5A616B; }
.form-input {
  height: 44px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-form);
  padding: 0 12px; font-size: 13.5px; outline: none; color: var(--text-primary);
  transition: border-color .15s;
}
.form-input:focus { border-color: var(--brand-orange); }
.form-textarea {
  min-height: 72px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-form);
  padding: 11px 12px; font-size: 13.5px; resize: vertical; outline: none;
  transition: border-color .15s;
}
.form-textarea:focus { border-color: var(--brand-orange); }
.form-select {
  height: 44px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-form);
  padding: 0 12px; font-size: 13.5px; color: var(--text-secondary);
}
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.col-span-2  { grid-column: 1 / -1; }

/* ── Pagination ── */
.pagination { display: flex; gap: 6px; }
.page-btn {
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-secondary); cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.page-btn.active { border-color: var(--brand-orange); background: var(--brand-orange); color: #fff; font-weight: 600; }

/* ── Application form ── */
.apply-shell { min-height: 100vh; background: #F4F5F7; }
.apply-split { display: grid; grid-template-columns: minmax(0, 420px) 1fr; min-height: 100vh; }
.apply-hero {
  position: relative;
  background: url("https://kiiramotorsstorage.blob.core.windows.net/assets/Plant/first.webp") center/cover no-repeat;
  color: #fff; display: flex; flex-direction: column; overflow: hidden;
}
.apply-form-wrap { padding: 64px 44px 48px; overflow-y: auto; max-height: 100vh; }

/* Form card */
.form-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 24px; box-shadow: 0 1px 3px rgba(16,24,40,.05);
}

/* Success overlay */
.success-overlay { max-width: 560px; margin: 0 auto; padding: 120px 20px 60px; text-align: center; }
.success-icon {
  width: 84px; height: 84px; border-radius: 50%; background: #DCFCE7;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 22px;
}

/* ── Modal (gate pass) ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(15,19,27,.6); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
  background: var(--surface); border-radius: 20px;
  max-width: 400px; width: 100%; max-height: 92vh; overflow-y: auto;
  box-shadow: 0 24px 70px rgba(0,0,0,.4);
}
.modal-hd {
  background: linear-gradient(135deg, #1A1F2B, #10131B);
  padding: 20px 22px;
  display: flex; align-items: center; justify-content: space-between;
  border-radius: 20px 20px 0 0;
}
.modal-close {
  width: 30px; height: 30px; border-radius: 8px; border: none;
  background: rgba(255,255,255,.1); color: #fff; cursor: pointer; font-size: 16px;
}

/* ── Chart bars ── */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding-top: 18px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar-fill { width: 100%; max-width: 34px; border-radius: 7px 7px 4px 4px; transition: height .5s; }
.bar-label { font-size: 11px; color: var(--text-placeholder); font-weight: 600; }

/* ── Backdrop (mobile) ── */
.vms-backdrop {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(15,19,27,.4); opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.vms-backdrop.open { opacity: 1; pointer-events: auto; }

/* ── Dashboard 2-col grid ── */
.dash-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 15px;
  align-items: stretch;
}
.dash-grid > .card { height: 100%; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .vms-sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 60; transform: translateX(-110%); }
  .vms-sidebar.open { transform: translateX(0); }
  .vms-hamb { display: inline-flex !important; }
  .hide-sm  { display: none !important; }
  .vms-content { padding: 18px 16px 60px; }
  .detail-grid  { grid-template-columns: 1fr; }
  .dash-grid    { grid-template-columns: 1fr; }
  .apply-split  { grid-template-columns: 1fr; }
  .apply-hero   { display: none; }
  .vms-search-wrap { display: none; }
}
@media (min-width: 901px) {
  .vms-hamb  { display: none !important; }
}

/* ── Page header ── */
.page-hd { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-hd h1 { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 23px; margin: 0; letter-spacing: -.01em; }
.page-hd p  { margin: 5px 0 0; color: var(--text-muted); font-size: 13.5px; }

/* ── Toast ── */
.vms-toast-wrap { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.vms-toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px;
  background: #1A1D21; color: #fff; border-radius: 12px;
  font-size: 13.5px; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,.25);
  pointer-events: auto; animation: vmsFade .3s ease both;
  min-width: 260px; max-width: 420px;
}
.vms-toast.success { background: #14532D; }
.vms-toast.error   { background: #7F1D1D; }

/* ── Loading skeleton ── */
.skeleton { background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Active-now badge ── */
.active-badge {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 13px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 11px;
  font-size: 12.5px; font-weight: 600; color: #15803D;
}
