:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-2: #f9fbff;
  --text: #10233f;
  --muted: #667085;
  --line: #d8e1ee;
  --primary: #1e4a8c;
  --primary-deep: #102d59;
  --gold: #d2a94b;
  --success: #1f8a5b;
  --warning: #d9811c;
  --danger: #c73f4c;
  --purple: #6a5acd;
  --shadow: 0 14px 40px rgba(14, 32, 67, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, "Segoe UI", Arial, sans-serif; background: linear-gradient(180deg, #eef4ff 0%, #f8fafc 100%); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.app-shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, var(--primary-deep), #173c6e); color: #fff; padding: 24px 18px; display: flex; flex-direction: column; justify-content: space-between; }
.brand-block { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.brand-logo { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(135deg, var(--gold), #f8dd96); color: #10233f; font-weight: 700; }
.brand-block h1 { margin: 0; font-size: 1rem; }
.brand-block p { margin: 2px 0 0; color: #bfd3f3; font-size: 0.8rem; }
.nav-menu { display: grid; gap: 8px; }
.nav-link { padding: 12px 14px; border-radius: 12px; color: #dbe9ff; transition: 0.2s ease; }
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,0.12); color: #fff; }
.nav-link.subtle { opacity: 0.85; }
.sidebar-footer { border-top: 1px solid rgba(255,255,255,0.12); padding-top: 18px; }
.profile-mini { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.profile-mini span { display: block; color: #bfd3f3; font-size: 0.78rem; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: #fff; color: #173c6e; display: grid; place-items: center; font-weight: 700; }

.content-area { display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 24px; background: rgba(255,255,255,0.82); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 4; border-bottom: 1px solid var(--line); }
.topbar-left, .topbar-actions { display: flex; align-items: center; gap: 12px; }
.eyebrow { margin: 0 0 4px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--gold); font-size: 0.72rem; font-weight: 700; }
.topbar-left h2 { margin: 0; font-size: 1.3rem; }
.global-search input, .status-search input, input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; background: #fff; color: var(--text); }
.global-search { width: min(320px, 42vw); }
.icon-button, .menu-toggle { border: 0; background: #fff; border-radius: 12px; box-shadow: var(--shadow); cursor: pointer; }
.icon-button { padding: 10px 12px; position: relative; }
.dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.profile-pill { width: 40px; height: 40px; display: grid; place-items: center; background: var(--primary); color: #fff; border-radius: 12px; font-weight: 700; }

.main-content { padding: 20px 24px 32px; }
.card, .panel { background: var(--panel); border: 1px solid rgba(18, 52, 94, 0.08); border-radius: var(--radius); box-shadow: var(--shadow); }
.welcome-banner { padding: 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.welcome-banner h3 { margin: 0; font-size: 1.25rem; }
.demo-pill { padding: 8px 12px; border-radius: 999px; background: #f9f1dc; color: #8a6912; font-size: 0.8rem; font-weight: 700; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { padding: 18px; border-radius: 18px; background: linear-gradient(180deg, #fff 0%, #f7faff 100%); border: 1px solid var(--line); }
.stat-card .label { display: block; color: var(--muted); font-size: 0.84rem; margin-bottom: 10px; }
.stat-card .value { font-size: 1.9rem; font-weight: 700; }
.stat-card .trend { margin-top: 6px; color: var(--success); font-size: 0.78rem; }

.content-grid.two-col { display: grid; grid-template-columns: 1.25fr 0.75fr; gap: 18px; }
.panel { padding: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h3 { margin: 0; }
.text-link { color: var(--primary); font-weight: 700; }
.table-wrap { overflow: auto; }
.table-wrap table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid #edf2f8; vertical-align: top; }
thead th { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; position: sticky; top: 0; background: #fff; z-index: 1; }
tbody tr:hover { background: #f8fbff; }
.badge { display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 700; }
.status-blue { background: #e8f0ff; color: #264f9a; }
.status-orange { background: #fff2df; color: #b86a00; }
.status-purple { background: #f0ebff; color: #5b44b1; }
.status-green { background: #e9f8ef; color: #1d7b50; }
.status-yellow { background: #fff5cf; color: #9b7200; }
.status-red { background: #ffe5e8; color: #a62034; }
.status-darkgreen { background: #e0f4ea; color: #0c6a3b; }
.status-grey { background: #eef0f3; color: #5d6577; }

.btn { border: none; border-radius: 12px; padding: 10px 14px; cursor: pointer; font-weight: 700; }
.btn-primary { background: linear-gradient(135deg, #1f4d88, #2e66ac); color: #fff; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--line); }
.btn-danger { background: #fce9ec; color: var(--danger); }
.btn-small { padding: 8px 10px; font-size: 0.78rem; }

.stack-list { display: grid; gap: 10px; }
.stack-item { padding: 12px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); }
.stack-item small { color: var(--muted); display: block; margin-top: 6px; }

.filters-grid, .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.full-span { grid-column: 1 / -1; }
label span { display: block; margin-bottom: 8px; font-weight: 700; font-size: 0.9rem; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.form-errors { color: var(--danger); min-height: 22px; margin-top: 8px; }
.review-summary { display: grid; gap: 12px; }
.review-row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid #edf2f8; }

.modal-overlay { position: fixed; inset: 0; background: rgba(12, 26, 50, 0.42); display: grid; place-items: center; padding: 20px; z-index: 20; }
.modal-overlay.hidden { display: none; }
.modal-card { background: #fff; border-radius: 20px; box-shadow: 0 24px 60px rgba(0,0,0,0.18); overflow: hidden; }
.modal-large { width: min(960px, 100%); }
.modal-small { width: min(620px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid #edf2f8; }
.modal-body { padding: 20px; max-height: 78vh; overflow: auto; }
.modal-close { background: transparent; box-shadow: none; }

.toast-container { position: fixed; top: 18px; right: 18px; display: grid; gap: 10px; z-index: 30; }
.toast { background: #102d59; color: #fff; border-radius: 12px; padding: 12px 14px; min-width: 220px; box-shadow: var(--shadow); }

.empty-state-panel { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line); background: #f8fbff; border-radius: 16px; }
.status-result { margin-top: 18px; }

.customer-view { background: linear-gradient(180deg, #edf3ff, #fff); }
.customer-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.customer-card { width: min(920px, 100%); background: #fff; border-radius: 24px; box-shadow: var(--shadow); padding: 24px; }
.customer-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.status-search { display: flex; gap: 12px; }
.status-search input { flex:1; }
.status-card { background: #f8fbff; border: 1px solid #dce8f7; border-radius: 16px; padding: 18px; }
.timeline { display: grid; gap: 8px; }
.timeline-item { display: flex; align-items: flex-start; gap: 10px; }
.timeline-dot { width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--primary); }
.timeline-item.current .timeline-dot { background: var(--gold); }
.timeline-item.light .timeline-dot { background: #b8c7dd; }

.pagination { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.page-btn { padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -100%; top: 0; bottom: 0; width: 280px; z-index: 12; transition: 0.25s ease; }
  .sidebar.open { left: 0; }
  .content-grid.two-col, .filters-grid, .form-grid { grid-template-columns: 1fr; }
  .status-search, .welcome-banner, .topbar, .topbar-actions { flex-direction: column; align-items: stretch; }
  .global-search { width: 100%; }
  .customer-header { flex-direction: column; align-items: flex-start; }
}
