/* Argus CRM design system */

:root {
	--sidebar-bg: #0b1220;
	--sidebar-hover: #16203a;
	--sidebar-text: #94a3b8;
	--sidebar-active: #6366f1;
	--bg: #eef1f6;
	--card: #ffffff;
	--border: #e2e8f0;
	--text: #0f172a;
	--muted: #64748b;
	--accent: #6366f1;
	--accent-dark: #4338ca;
	--green: #16a34a;
	--green-bg: #dcfce7;
	--amber: #b45309;
	--amber-bg: #fef3c7;
	--red: #b91c1c;
	--red-bg: #fee2e2;
	--blue: #1d4ed8;
	--blue-bg: #dbeafe;
	--radius: 12px;
	--shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

html, body { height: 100%; }

body {
	font-family: var(--font);
	background: var(--bg);
	color: var(--text);
	font-size: 14.5px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

/* ---------- Layout ---------- */

.sidebar {
	position: fixed;
	inset: 0 auto 0 0;
	width: 232px;
	background: var(--sidebar-bg);
	display: flex;
	flex-direction: column;
	z-index: 10;
}

.brand {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 20px 20px 18px;
	border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.brand img { width: 30px; height: 30px; }

.brand .name {
	color: #fff;
	font-size: 17px;
	font-weight: 700;
	letter-spacing: 0.2px;
}

.brand .tag {
	display: block;
	font-size: 11px;
	font-weight: 500;
	color: var(--sidebar-text);
	letter-spacing: 0.4px;
	text-transform: uppercase;
}

.nav { padding: 14px 12px; flex: 1; }

.nav .section {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.8px;
	color: #475569;
	padding: 12px 10px 6px;
}

.nav a {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 10px;
	border-radius: 8px;
	color: var(--sidebar-text);
	text-decoration: none;
	font-weight: 500;
	margin-bottom: 2px;
	transition: background 0.12s, color 0.12s;
}

.nav a svg { width: 17px; height: 17px; flex-shrink: 0; }

.nav a:hover { background: var(--sidebar-hover); color: #e2e8f0; }

.nav a.active {
	background: var(--sidebar-active);
	color: #fff;
	box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.sidebar .foot {
	padding: 14px 18px;
	border-top: 1px solid rgba(148, 163, 184, 0.12);
	display: flex;
	align-items: center;
	gap: 10px;
}

.avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: linear-gradient(135deg, #818cf8, #4338ca);
	color: #fff;
	font-weight: 700;
	font-size: 12.5px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.foot .who { color: #e2e8f0; font-weight: 600; font-size: 13px; }
.foot .role { color: var(--sidebar-text); font-size: 11.5px; }

.main { margin-left: 232px; padding: 26px 32px 48px; min-height: 100vh; }

.topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 22px;
}

.topbar h1 { font-size: 21px; font-weight: 700; letter-spacing: -0.2px; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

.search {
	width: 260px;
	padding: 8px 12px 8px 34px;
	border: 1px solid var(--border);
	border-radius: 9px;
	background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.8-3.8'/%3E%3C/svg%3E") no-repeat 11px center;
	font-size: 13.5px;
	color: var(--text);
	outline: none;
}

.search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15); }

/* ---------- Cards & KPIs ---------- */

.kpis {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 16px;
	margin-bottom: 22px;
}

.kpi {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 16px 18px;
	box-shadow: var(--shadow);
}

.kpi .label {
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	color: var(--muted);
}

.kpi .value { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: -0.5px; }
.kpi .delta { font-size: 12px; margin-top: 2px; color: var(--muted); }
.kpi .delta.up { color: var(--green); font-weight: 600; }

.card {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	overflow: hidden;
}

.card .card-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 15px 20px;
	border-bottom: 1px solid var(--border);
}

.card .card-head h2 { font-size: 15px; font-weight: 700; }
.card .card-head .hint { font-size: 12.5px; color: var(--muted); }

/* ---------- Table ---------- */

.table { width: 100%; border-collapse: collapse; }

.table th {
	text-align: left;
	font-size: 11.5px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	color: var(--muted);
	padding: 11px 20px;
	border-bottom: 1px solid var(--border);
	background: #f8fafc;
}

.table td { padding: 12px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background 0.1s; }
.table tbody tr[data-id] { cursor: pointer; }
.table tbody tr:hover { background: #f6f8ff; }

.cell-name { font-weight: 650; }
.cell-sub { font-size: 12px; color: var(--muted); }
.cell-mono { font-family: var(--mono); font-size: 12.5px; }
.cell-right { text-align: right; }

/* ---------- Pills ---------- */

.pill {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 11.5px;
	font-weight: 650;
	white-space: nowrap;
}

.pill.active { background: var(--green-bg); color: var(--green); }
.pill.onboarding { background: var(--blue-bg); color: var(--blue); }
.pill.at-risk { background: var(--red-bg); color: var(--red); }
.pill.renewal-due { background: var(--amber-bg); color: var(--amber); }

/* Case statuses */
.pill.open { background: var(--blue-bg); color: var(--blue); }
.pill.pending { background: var(--amber-bg); color: var(--amber); }
.pill.resolved { background: var(--green-bg); color: var(--green); }
.pill.closed, .pill.low { background: #e2e8f0; color: #475569; }

/* Case priorities */
.pill.urgent { background: var(--red-bg); color: var(--red); }
.pill.high { background: var(--amber-bg); color: var(--amber); }
.pill.normal { background: var(--blue-bg); color: var(--blue); }

/* ---------- Buttons ---------- */

.btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 8px 14px;
	border-radius: 9px;
	border: 1px solid transparent;
	font-family: var(--font);
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
	transition: background 0.12s, border-color 0.12s;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: #cbd5e1; background: #f8fafc; }

/* ---------- Customer profile ---------- */

.profile-head {
	display: flex;
	align-items: center;
	gap: 18px;
	padding: 22px 24px;
	background: linear-gradient(120deg, #312e81, #4338ca 55%, #6366f1);
	border-radius: var(--radius);
	color: #fff;
	box-shadow: var(--shadow);
	margin-bottom: 20px;
}

.profile-head .big-avatar {
	width: 62px;
	height: 62px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.16);
	border: 2px solid rgba(255, 255, 255, 0.45);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 22px;
	font-weight: 700;
	flex-shrink: 0;
}

.profile-head h2 { font-size: 20px; letter-spacing: -0.2px; }
.profile-head .role { opacity: 0.85; font-size: 13.5px; margin-top: 1px; }
.profile-head .meta { margin-left: auto; text-align: right; font-size: 13px; }
.profile-head .meta div { opacity: 0.9; }
.profile-head .meta b { font-size: 17px; }

.grid-2 {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
	align-items: start;
}

.dl { padding: 8px 0; }

.dl .row {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	padding: 10px 20px;
	border-bottom: 1px solid var(--border);
}

.dl .row:last-child { border-bottom: none; }
.dl dt { color: var(--muted); font-size: 13px; padding-top: 1px; flex-shrink: 0; }
.dl dd { font-weight: 600; text-align: right; }
.dl dd.mono { font-family: var(--mono); font-size: 13px; font-weight: 500; }

.timeline { padding: 6px 0; }

.timeline .event {
	position: relative;
	padding: 12px 20px 12px 40px;
	border-bottom: 1px solid var(--border);
}

.timeline .event:last-child { border-bottom: none; }

.timeline .event::before {
	content: "";
	position: absolute;
	left: 19px;
	top: 18px;
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--accent);
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.timeline .event .date { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.timeline .event .text { margin-top: 2px; font-size: 13.5px; }

/* ---------- Documents ---------- */

.upload-grid {
	display: grid;
	grid-template-columns: 5fr 7fr;
	gap: 20px;
	align-items: start;
}

.dropzone {
	border: 2px dashed #c7cde0;
	border-radius: var(--radius);
	padding: 38px 24px;
	text-align: center;
	background: #fafbff;
	transition: border-color 0.15s, background 0.15s;
	cursor: pointer;
}

.dropzone:hover, .dropzone.dragover {
	border-color: var(--accent);
	background: #f1f2ff;
}

.dropzone .icon { font-size: 30px; margin-bottom: 8px; color: var(--accent); }
.dropzone .title { font-weight: 650; font-size: 14.5px; }
.dropzone .hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }

.field select {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid var(--border);
	border-radius: 9px;
	font-family: var(--font);
	font-size: 13.5px;
	background: #fff;
	color: var(--text);
	outline: none;
}

.field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15); }

.progress {
	height: 7px;
	background: var(--border);
	border-radius: 99px;
	overflow: hidden;
	margin-top: 12px;
	display: none;
}

.progress .bar {
	height: 100%;
	width: 0%;
	background: linear-gradient(90deg, var(--accent), #818cf8);
	border-radius: 99px;
	transition: width 0.15s ease-out;
}

.upload-status { font-size: 12.5px; color: var(--muted); margin-top: 8px; min-height: 18px; }

.doc-list { list-style: none; }

.doc-list li {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 20px;
	border-bottom: 1px solid var(--border);
}

.doc-list li:last-child { border-bottom: none; }

.doc-icon {
	width: 34px;
	height: 34px;
	border-radius: 8px;
	background: var(--blue-bg);
	color: var(--blue);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 15px;
	flex-shrink: 0;
}

.doc-list .name { font-weight: 600; }
.doc-list .meta { font-size: 12px; color: var(--muted); }
.doc-list .size { margin-left: auto; font-size: 12.5px; color: var(--muted); font-family: var(--mono); }

.doc-list li.fresh { background: #f0fdf4; animation: fadein 0.4s; }

@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Reports ---------- */

.chart { padding: 18px 20px 20px; }

.bar-row {
	display: grid;
	grid-template-columns: 150px 1fr 90px;
	align-items: center;
	gap: 12px;
	margin-bottom: 13px;
}

.bar-row:last-child { margin-bottom: 0; }
.bar-row .blabel { font-size: 13px; font-weight: 600; color: var(--text); text-align: right; }

.bar-track { background: #eef1f8; border-radius: 7px; height: 22px; overflow: hidden; }

.bar-fill {
	height: 100%;
	border-radius: 7px;
	background: linear-gradient(90deg, var(--accent-dark), var(--accent));
	min-width: 3px;
	transition: width 0.5s ease-out;
}

.bar-fill.green { background: linear-gradient(90deg, #15803d, #22c55e); }
.bar-fill.amber { background: linear-gradient(90deg, #b45309, #f59e0b); }
.bar-fill.red { background: linear-gradient(90deg, #b91c1c, #ef4444); }

.bar-row .bvalue { font-size: 12.5px; font-weight: 700; font-family: var(--mono); }

/* ---------- Toast ---------- */

.toast {
	position: fixed;
	bottom: 24px;
	right: 24px;
	background: #0f172a;
	color: #fff;
	padding: 13px 18px;
	border-radius: 10px;
	box-shadow: 0 10px 30px rgba(15, 23, 42, 0.35);
	font-size: 13.5px;
	font-weight: 600;
	display: none;
	align-items: center;
	gap: 9px;
	z-index: 50;
}

.toast.show { display: flex; animation: slideup 0.25s ease-out; }
.toast .dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; }

@keyframes slideup { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Utility ---------- */

.back-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--muted);
	text-decoration: none;
	font-size: 13px;
	font-weight: 600;
	margin-bottom: 14px;
}

.back-link:hover { color: var(--accent); }

.loading { padding: 40px 20px; text-align: center; color: var(--muted); }
.error-box { padding: 28px 20px; text-align: center; color: var(--red); font-weight: 600; }

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
	.kpis { grid-template-columns: repeat(2, 1fr); }
	.grid-2, .upload-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
	.sidebar { width: 64px; }
	.sidebar .name, .sidebar .tag, .nav .section, .nav a span, .sidebar .foot .who, .sidebar .foot .role { display: none; }
	.nav a { justify-content: center; }
	.main { margin-left: 64px; padding: 18px; }
	.search { display: none; }
}
