/* ===== PePMoS – main.css ===== */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600&family=Space+Mono:wght@400;700&display=swap');

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

:root {
  --pg:  #1a4d2e;
  --pg2: #2d7a4f;
  --pg3: #4caf50;
  --pl:  #e8f5e9;
  --po:  #e65100;
  --po2: #ff6d00;
  --pol: #fff3e0;
  --pw:  #f9fbf8;
  --ps:  #f0f4f0;
  --pt:  #1a1a1a;
  --pt2: #4a4a4a;
  --pt3: #888;
  --border: #e0ebe0;
  --bdr:  10px;
  --bdr2: 6px;
  --nav-h: 58px;
  --side-w: 210px;
  --shadow: 0 1px 4px rgba(0,0,0,.07);
}

body { font-family: 'Sora', sans-serif; background: var(--pw); color: var(--pt); min-height: 100vh; font-size: 14px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── Nav ─────────────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--nav-h); background: var(--pg);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.nav-brand { display: flex; align-items: center; gap: 10px; }
.nav-logo { width: 32px; height: 32px; background: var(--po2); border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-logo svg { width: 18px; height: 18px; fill: white; }
.nav-title { color: white; font-size: 15px; font-weight: 600; letter-spacing: .4px; }
.nav-title span { color: var(--po2); }
.nav-sub { color: rgba(255,255,255,.55); font-size: 10px; letter-spacing: .5px; text-transform: uppercase; }
.nav-right { display: flex; align-items: center; gap: 10px; }
.nav-badge { background: rgba(255,255,255,.13); color: rgba(255,255,255,.85); padding: 4px 10px; border-radius: 12px; font-size: 11px; }
.nav-user { color: rgba(255,255,255,.75); font-size: 12px; }
.btn-nav { background: rgba(255,255,255,.12); color: white; border: 1px solid rgba(255,255,255,.2); padding: 6px 14px; border-radius: 20px; font-size: 12px; transition: background .2s; }
.btn-nav:hover { background: rgba(255,255,255,.22); }

/* ── Layout ──────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; padding-top: var(--nav-h); }

.sidebar {
  width: var(--side-w); flex-shrink: 0;
  background: white; border-right: 1px solid var(--border);
  position: fixed; top: var(--nav-h); bottom: 0; left: 0;
  overflow-y: auto; padding: 12px 0;
}
.sidebar-permit {
  padding: 12px 16px; border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.sidebar-permit .label { font-size: 10px; color: var(--pt3); }
.sidebar-permit .value { font-family: 'Space Mono', monospace; font-size: 11px; color: var(--pg); font-weight: 700; }
.sidebar-permit .expiry { font-size: 10px; color: var(--po); margin-top: 2px; }

.sidebar-section-label {
  padding: 10px 20px 4px; font-size: 10px; font-weight: 600;
  color: var(--pt3); letter-spacing: 1px; text-transform: uppercase;
}
.s-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; border-radius: var(--bdr2); cursor: pointer;
  font-size: 13px; color: var(--pt2); transition: all .15s;
  margin: 1px 8px;
}
.s-item:hover { background: var(--pl); color: var(--pg); }
.s-item.active { background: var(--pg); color: white; }
.s-item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: .75; }
.s-item.active svg { opacity: 1; }
.s-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pg3); margin-left: auto; flex-shrink: 0; }
.s-dot.orange { background: var(--po2); }

.main-content {
  flex: 1; margin-left: var(--side-w); padding: 24px;
  background: var(--ps); min-height: calc(100vh - var(--nav-h));
}

/* ── Page Header ─────────────────────────────────── */
.breadcrumb { font-size: 11px; color: var(--pt3); margin-bottom: 4px; }
.breadcrumb span { color: var(--pg); font-weight: 500; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.page-title { font-size: 20px; font-weight: 600; }
.page-sub { font-size: 12px; color: var(--pt3); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── Cards ───────────────────────────────────────── */
.card {
  background: white; border-radius: var(--bdr);
  border: 1px solid var(--border); padding: 20px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; font-size: 13px; font-weight: 600; }

/* ── Grids ───────────────────────────────────────── */
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.gap-16 { gap: 16px; }

/* ── KPI / Stat Cards ────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card {
  background: white; border-radius: var(--bdr); border: 1px solid var(--border);
  padding: 16px; box-shadow: var(--shadow);
}
.stat-card .label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--pt3); font-weight: 500; margin-bottom: 6px; }
.stat-card .value { font-size: 26px; font-weight: 600; color: var(--pg); font-family: 'Space Mono', monospace; line-height: 1; }
.stat-card .sub { font-size: 11px; color: var(--pt3); margin-top: 4px; }
.stat-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; padding: 2px 7px; border-radius: 10px; margin-top: 6px; font-weight: 500; }
.tag-up { background: #e8f5e9; color: #2e7d32; }
.tag-down { background: #fbe9e7; color: #bf360c; }
.tag-warn { background: var(--pol); color: var(--po); }

/* ── Badges ──────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 9px; border-radius: 12px; font-size: 11px; font-weight: 500; }
.b-green  { background: #e8f5e9; color: #1b5e20; }
.b-orange { background: #fff3e0; color: #e65100; }
.b-red    { background: #fce4ec; color: #880e4f; }
.b-blue   { background: #e3f2fd; color: #0d47a1; }
.b-gray   { background: #f5f5f5; color: #424242; }
.b-purple { background: #f3e5f5; color: #4a148c; }

/* ── Alerts ──────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: 8px; font-size: 12px; display: flex; align-items: flex-start; gap: 8px; margin-bottom: 14px; }
.alert svg { flex-shrink: 0; margin-top: 1px; }
.alert-warning { background: #fff8e1; border-left: 3px solid #ffc107; color: #5d4037; }
.alert-info    { background: #e3f2fd; border-left: 3px solid #2196f3; color: #0d47a1; }
.alert-success { background: #e8f5e9; border-left: 3px solid #4caf50; color: #1b5e20; }
.alert-error   { background: #fce4ec; border-left: 3px solid #e91e63; color: #880e4f; }

/* ── Table ───────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { background: var(--pl); color: var(--pg); font-weight: 600; padding: 10px 12px; text-align: left; font-size: 11px; letter-spacing: .3px; text-transform: uppercase; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid #f0f4f0; color: var(--pt2); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: #fafcfa; }
.tbl .mono { font-family: 'Space Mono', monospace; font-size: 11px; color: var(--pg); }

/* ── Buttons ─────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; border-radius: var(--bdr2); font-size: 13px; font-weight: 500; transition: all .2s; border: none; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 5px; }
.btn-block { width: 100%; }
.btn-primary   { background: var(--pg);  color: white; }
.btn-primary:hover { background: var(--pg2); }
.btn-secondary { background: var(--po);  color: white; }
.btn-secondary:hover { background: var(--po2); }
.btn-outline   { background: white; color: var(--pg); border: 1.5px solid var(--pg); }
.btn-outline:hover { background: var(--pl); }
.btn-danger    { background: #c62828; color: white; }
.btn-danger:hover { background: #b71c1c; }
.btn-ghost     { background: transparent; color: var(--pt2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--ps); }

/* ── Forms ───────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--pt2); margin-bottom: 5px; }
.form-input {
  width: 100%; padding: 10px 12px; border: 1.5px solid #dce8dc;
  border-radius: var(--bdr2); font-size: 13px; color: var(--pt);
  background: white; transition: border .2s, box-shadow .2s; outline: none;
}
.form-input:focus { border-color: var(--pg2); box-shadow: 0 0 0 3px rgba(45,122,79,.1); }
.form-input:read-only { background: #fafcfa; color: var(--pt3); }
select.form-input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input-hint { font-size: 10px; color: var(--pt3); margin-top: 4px; }
.input-icon { position: relative; }
.input-icon .form-input { padding-left: 36px; }
.input-icon .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; opacity: .4; }

/* ── Progress ────────────────────────────────────── */
.progress { background: #e0ebe0; border-radius: 10px; height: 8px; overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; border-radius: 10px; background: var(--pg2); transition: width .4s; }
.progress-fill.orange { background: var(--po2); }
.progress-fill.red    { background: #e53935; }

/* ── Chart bar (CSS-only) ────────────────────────── */
.chart-bar-row { display: flex; align-items: flex-end; gap: 8px; height: 100px; padding-top: 8px; }
.bar { flex: 1; border-radius: 4px 4px 0 0; min-width: 18px; }
.chart-labels { display: flex; gap: 8px; margin-top: 4px; }
.chart-lbl { flex: 1; font-size: 9px; text-align: center; color: var(--pt3); }

/* ── Timeline ────────────────────────────────────── */
.timeline { padding-left: 16px; border-left: 2px solid var(--pl); }
.tl-item { position: relative; padding: 0 0 14px 18px; }
.tl-dot { position: absolute; left: -22px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--pg); }
.tl-dot.orange { background: var(--po2); }
.tl-time { font-size: 10px; color: var(--pt3); margin-bottom: 2px; }
.tl-text { font-size: 12px; color: var(--pt2); }

/* ── Pill tabs ───────────────────────────────────── */
.pill-tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.pill-tab { padding: 5px 13px; border-radius: 20px; font-size: 12px; cursor: pointer; border: 1px solid var(--border); color: var(--pt2); background: white; font-family: inherit; transition: all .15s; }
.pill-tab.active { background: var(--pg); color: white; border-color: var(--pg); }

/* ── Avatar ──────────────────────────────────────── */
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--pg); display: flex; align-items: center; justify-content: center; color: white; font-size: 12px; font-weight: 600; flex-shrink: 0; }

/* ── Filter bar ──────────────────────────────────── */
.filter-bar { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; }
.filter-bar .form-input { padding: 8px 12px; }

/* ── Supply-chain flow ───────────────────────────── */
.flow-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f0f4f0; }
.flow-row:last-child { border-bottom: none; }
.flow-icon { width: 36px; height: 36px; border-radius: 8px; background: var(--pl); display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--pg); font-weight: 700; flex-shrink: 0; }

/* ── Auth pages ──────────────────────────────────── */
.auth-page { min-height: 100vh; background: linear-gradient(135deg, var(--pg) 0%, #0d2b18 55%, #1a1a2e 100%); display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-wrap { display: grid; grid-template-columns: 1fr 420px; gap: 48px; max-width: 920px; width: 100%; align-items: center; }
.auth-hero h1 { font-size: 32px; font-weight: 600; color: white; line-height: 1.3; margin-bottom: 12px; }
.auth-hero h1 span { color: var(--po2); }
.auth-hero p { color: rgba(255,255,255,.7); font-size: 14px; line-height: 1.7; margin-bottom: 20px; }
.auth-stat { font-family: 'Space Mono', monospace; font-size: 22px; color: var(--po2); font-weight: 700; }
.auth-stat-label { font-size: 10px; color: rgba(255,255,255,.5); }
.auth-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.auth-pill { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); color: rgba(255,255,255,.85); padding: 5px 12px; border-radius: 20px; font-size: 11px; }
.auth-stats-row { display: flex; gap: 20px; }
.auth-stats-divider { width: 1px; background: rgba(255,255,255,.15); }

.auth-card { background: white; border-radius: 14px; padding: 32px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.auth-card-logo { width: 52px; height: 52px; background: var(--pg); border-radius: 12px; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.auth-card-logo svg { width: 28px; height: 28px; fill: white; }
.auth-card h2 { font-size: 20px; font-weight: 600; color: var(--pg); margin-bottom: 4px; }
.auth-card .subtitle { font-size: 12px; color: var(--pt3); }
.auth-card-header { text-align: center; margin-bottom: 22px; }
.auth-link { color: var(--pg2); font-size: 12px; cursor: pointer; }
.auth-link:hover { text-decoration: underline; }
.auth-divider { height: 1px; background: #eee; margin: 14px 0; position: relative; }
.auth-divider span { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); background: white; padding: 0 8px; font-size: 11px; color: var(--pt3); }
.login-role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.auth-secure { display: flex; align-items: center; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid #f0f0f0; font-size: 10px; color: var(--pt3); }

/* Signup steps */
.step-indicator { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 20px; }
.step-circle { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; }
.step-circle.done { background: var(--po2); color: white; }
.step-circle.todo { background: rgba(255,255,255,.2); color: rgba(255,255,255,.5); }
.step-line { width: 32px; height: 2px; }
.step-line.done { background: var(--po2); }
.step-line.todo { background: rgba(255,255,255,.2); }
.facility-type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.ftype-card { border: 1.5px solid #dce8dc; border-radius: 8px; padding: 12px; cursor: pointer; text-align: center; transition: all .2s; }
.ftype-card:hover { border-color: var(--pg2); background: var(--pl); }
.ftype-card.selected { border-color: var(--pg); background: var(--pl); }
.ftype-icon { font-size: 22px; margin-bottom: 5px; }
.ftype-label { font-size: 12px; font-weight: 500; color: var(--pt2); }
.ftype-sub { font-size: 9px; color: var(--pt3); margin-top: 2px; }
.upload-area { border: 2px dashed #dce8dc; border-radius: 8px; padding: 20px; text-align: center; cursor: pointer; background: #fafcfa; transition: border .2s; }
.upload-area:hover { border-color: var(--pg2); }

/* ── Card-request widget ─────────────────────────── */
.smart-card-preview { background: var(--pg); border-radius: 10px; padding: 16px; color: white; display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.smart-card-preview .chip { width: 40px; height: 28px; background: rgba(255,255,255,.15); border-radius: 4px; }

/* ── Responsive helpers ──────────────────────────── */
@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Toast ───────────────────────────────────────── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 18px; border-radius: 8px; font-size: 13px; color: white; min-width: 240px; box-shadow: 0 4px 16px rgba(0,0,0,.2); animation: toastIn .3s ease; }
.toast.success { background: var(--pg); }
.toast.error   { background: #c62828; }
.toast.info    { background: #1565c0; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ── Spinner ─────────────────────────────────────── */
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.3); border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
