/* ==========================================================
   YesMyTax - Admin Panel theme
   Dark navy sidebar, compact layout built around data tables
   ========================================================== */
:root {
	--ap-navy: #0b1b2b;
	--ap-navy-2: #12283d;
	--ap-navy-line: #1e3851;
	--ap-accent: #22c55e;
	--ap-accent-dark: #16a34a;
	--ap-blue: #2563eb;
	--ap-ink: #0f172a;
	--ap-muted: #64748b;
	--ap-line: #e2e8f0;
	--ap-bg: #eef2f6;
	--ap-radius: 10px;
	--ap-sidebar: 248px;
}

body.admin-panel { font-family: 'Inter', system-ui, sans-serif; background: var(--ap-bg); color: var(--ap-ink); font-size: 14px; }
.ap-muted { color: var(--ap-muted); }

/* ---------- Sidebar ---------- */
.ap-sidebar {
	position: fixed; inset: 0 auto 0 0; width: var(--ap-sidebar); z-index: 1040;
	background: linear-gradient(180deg, var(--ap-navy) 0%, #0d2236 100%); color: #cbd5e1;
	display: flex; flex-direction: column; padding: 18px 14px; transition: transform .25s;
}
.ap-brand { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 22px; border-bottom: 1px solid var(--ap-navy-line); margin-bottom: 14px; }
.ap-brand-logo { background: #fff; border-radius: 8px; padding: 6px 10px; display: inline-flex; }
.ap-brand-logo img { height: 30px; width: auto; }
.ap-brand-tag { font-size: 10px; font-weight: 700; letter-spacing: .14em; color: var(--ap-accent); border: 1px solid rgba(34, 197, 94, .4); padding: 3px 7px; border-radius: 4px; }
.ap-nav-label { font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #5f7790; padding: 14px 10px 6px; }
.ap-nav a {
	display: flex; align-items: center; gap: 12px; color: #b6c4d3; text-decoration: none; font-weight: 500;
	padding: 10px 12px; border-radius: 8px; margin-bottom: 2px; position: relative; transition: .15s;
}
.ap-nav a i { width: 18px; text-align: center; color: #6f88a1; }
.ap-nav a:hover { background: var(--ap-navy-2); color: #fff; }
.ap-nav a.active { background: rgba(34, 197, 94, .12); color: #fff; }
.ap-nav a.active i { color: var(--ap-accent); }
.ap-nav a.active::before { content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--ap-accent); }

.ap-sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 2px; border-top: 1px solid var(--ap-navy-line); }
.ap-sidebar-user { flex: 1; min-width: 0; line-height: 1.25; }
.ap-sidebar-user strong { display: block; color: #fff; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-sidebar-user span { font-size: 11.5px; color: #6f88a1; }
.ap-logout { color: #6f88a1; padding: 6px 8px; border-radius: 6px; }
.ap-logout:hover { color: #f87171; background: var(--ap-navy-2); }

/* ---------- Avatars ---------- */
.avatar { border-radius: 50%; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.avatar-initial { background: #dbeafe; color: #1d4ed8; font-weight: 700; }
.ap-sidebar .avatar-initial { background: var(--ap-accent); color: var(--ap-navy); }
.avatar-sm { width: 34px; height: 34px; font-size: 13px; }
.avatar-lg { width: 64px; height: 64px; font-size: 24px; }

/* ---------- Shell ---------- */
.ap-shell { margin-left: var(--ap-sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.ap-topbar {
	display: flex; align-items: center; gap: 14px; background: #fff; border-bottom: 1px solid var(--ap-line);
	padding: 14px 28px; position: sticky; top: 0; z-index: 1020;
}
.ap-crumbs { font-size: 12px; color: var(--ap-muted); }
.ap-crumbs i { font-size: 10px; margin: 0 4px; }
.ap-title { font-size: 20px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.ap-date { color: var(--ap-muted); font-size: 13px; }
.ap-burger { border: 1px solid var(--ap-line); background: #fff; border-radius: 8px; width: 40px; height: 40px; }
.ap-content { padding: 24px 28px; flex: 1; }
.ap-footer { padding: 14px 28px; color: var(--ap-muted); font-size: 12px; }

/* ---------- Buttons ---------- */
.ap-btn-primary { background: var(--ap-navy); color: #fff; border: 1px solid var(--ap-navy); font-weight: 600; border-radius: 8px; }
.ap-btn-primary:hover, .ap-btn-primary:focus { background: var(--ap-accent-dark); border-color: var(--ap-accent-dark); color: #fff; }
.ap-btn-ghost { background: #fff; color: var(--ap-ink); border: 1px solid var(--ap-line); font-weight: 500; border-radius: 8px; }
.ap-btn-ghost:hover { background: #f8fafc; border-color: #cbd5e1; color: var(--ap-ink); }
.ap-btn-danger { background: #fff; color: #dc2626; border: 1px solid #fecaca; border-radius: 8px; }
.ap-btn-danger:hover { background: #fef2f2; color: #b91c1c; }

/* ---------- KPIs ---------- */
.ap-kpi { background: #fff; border: 1px solid var(--ap-line); border-radius: var(--ap-radius); padding: 18px; display: flex; align-items: center; gap: 14px; }
.ap-kpi-icon { width: 46px; height: 46px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.k-blue { background: #dbeafe; color: #1d4ed8; }
.k-green { background: #dcfce7; color: #15803d; }
.k-amber { background: #fef3c7; color: #b45309; }
.k-violet { background: #ede9fe; color: #6d28d9; }
.ap-kpi-value { font-size: 24px; font-weight: 700; line-height: 1.1; }
.ap-kpi-label { color: var(--ap-muted); font-size: 12.5px; }

/* ---------- Panels & tables ---------- */
.ap-panel { background: #fff; border: 1px solid var(--ap-line); border-radius: var(--ap-radius); overflow: hidden; }
.ap-panel-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--ap-line); }
.ap-panel-head h2 { font-size: 15px; font-weight: 700; margin: 0; }
.ap-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ap-filters .form-control { width: auto; min-width: 140px; }
.ap-w-90 { min-width: 90px !important; max-width: 100px; }

.ap-table { margin: 0; }
.ap-table > thead th {
	background: #f8fafc; color: var(--ap-muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
	border-bottom: 1px solid var(--ap-line) !important; padding: 11px 14px; white-space: nowrap;
}
.ap-table > tbody td { padding: 11px 14px; vertical-align: middle; border-color: #f1f5f9; }
.ap-table > tbody tr:hover > td { background: #f8fafc; }
.ap-client { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.ap-client strong { display: block; color: var(--ap-ink); }
.ap-client small { color: var(--ap-muted); }
.ap-client:hover strong { color: var(--ap-blue); }
.ap-code { background: #f1f5f9; color: #334155; padding: 3px 7px; border-radius: 5px; font-size: 12px; }
.ap-num { display: inline-block; min-width: 30px; padding: 2px 8px; border-radius: 6px; background: #f1f5f9; color: #94a3b8; font-weight: 600; }
.ap-num.on { background: #dcfce7; color: #15803d; }
.ap-num.on-violet { background: #ede9fe; color: #6d28d9; }
.ap-year { background: var(--ap-navy); color: #fff; font-weight: 600; font-size: 12px; padding: 3px 9px; border-radius: 5px; }

/* DataTables controls */
.dataTables_wrapper { padding: 12px 14px; }
.dataTables_wrapper .dataTables_length select, .dataTables_wrapper .dataTables_filter input { border-radius: 8px; }
.dataTables_wrapper .dataTables_info { color: var(--ap-muted); font-size: 12.5px; }
.page-item.active .page-link { background: var(--ap-navy); border-color: var(--ap-navy); }
.page-link { color: var(--ap-navy); }

/* document type chips */
.chip { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 5px; }
.chip-w2 { background: #dcfce7; color: #166534; }
.chip-1099 { background: #dbeafe; color: #1e40af; }
.chip-1098 { background: #ede9fe; color: #5b21b6; }
.chip-1095 { background: #e0f2fe; color: #075985; }
.chip-estate { background: #fee2e2; color: #991b1b; }
.chip-foreign { background: #ccfbf1; color: #115e59; }
.chip-savings { background: #fef3c7; color: #92400e; }
.chip-other { background: #f1f5f9; color: #475569; }

/* Activity feed */
.ap-feed { list-style: none; margin: 0; padding: 6px 0; }
.ap-feed li { display: flex; gap: 12px; padding: 10px 18px; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.ap-feed li:last-child { border-bottom: 0; }
.ap-feed li > i { margin-top: 3px; font-size: 16px; }
.ap-feed a { color: var(--ap-ink); text-decoration: none; }
.ap-feed a:hover { color: var(--ap-blue); }
.ap-feed-time { color: var(--ap-muted); font-size: 11.5px; margin-top: 2px; }

/* Client profile page */
.ap-back { display: inline-flex; align-items: center; gap: 6px; color: var(--ap-muted); text-decoration: none; margin-bottom: 14px; font-weight: 500; }
.ap-back:hover { color: var(--ap-ink); }
.ap-profile { display: flex; align-items: center; gap: 18px; padding: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.ap-profile-main { flex: 1; min-width: 240px; }
.ap-profile-main h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.ap-profile-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--ap-muted); }
.ap-profile-meta i { margin-right: 4px; }
.ap-profile-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ap-status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 5px; }
.ap-status.ok { background: #dcfce7; color: #15803d; }
.ap-status.warn { background: #fef3c7; color: #b45309; }

.ap-tabs { border-bottom: 1px solid var(--ap-line); margin-bottom: 16px; gap: 6px; }
.ap-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--ap-muted); font-weight: 600; padding: 10px 14px; background: none; border-radius: 0; }
.ap-tabs .nav-link.active { color: var(--ap-ink); border-bottom-color: var(--ap-accent); }
.ap-tabs .nav-link i { margin-right: 6px; }
.ap-pill { background: #e2e8f0; color: #334155; border-radius: 999px; font-size: 11px; padding: 1px 8px; margin-left: 4px; }

.ap-empty { text-align: center; padding: 40px 16px; color: var(--ap-muted); }
.ap-empty > i { font-size: 36px; color: #cbd5e1; margin-bottom: 10px; }

.ap-modal .modal-content { border: 0; border-radius: 12px; }
.ap-modal .modal-header { border-bottom: 1px solid var(--ap-line); }
.ap-modal .modal-footer { border-top: 1px solid var(--ap-line); background: #f8fafc; border-radius: 0 0 12px 12px; }

.admin-panel .alert { border-radius: 8px; border-left: 4px solid; }
.admin-panel .form-control:focus, .admin-panel .form-select:focus { border-color: #94a3b8; box-shadow: 0 0 0 3px rgba(15, 23, 42, .08); }

/* ---------- Saadvi-style menu & workflow ---------- */
.ap-sidebar { overflow-y: auto; }
.ap-nav a { gap: 12px; }
.ap-badge {
	min-width: 26px; text-align: center; font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
	background: var(--ap-accent); color: var(--ap-navy);
}
.ap-badge.zero { background: var(--ap-navy-2); color: #6f88a1; }
.ap-nav-label { padding-top: 12px; }

.ap-welcome { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.ap-welcome h2 { font-size: 20px; font-weight: 700; margin: 0 0 2px; }

.ap-stat {
	display: flex; align-items: center; gap: 16px; text-decoration: none; color: var(--ap-ink); position: relative;
	background: #fff; border: 1px solid var(--ap-line); border-radius: var(--ap-radius); padding: 20px;
	border-left: 4px solid var(--c); transition: .15s;
}
.ap-stat:hover { box-shadow: 0 6px 20px rgba(15, 23, 42, .08); transform: translateY(-1px); color: var(--ap-ink); }
.ap-stat-icon { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; background: var(--bg); color: var(--c); flex-shrink: 0; }
.ap-stat-label { font-weight: 600; font-size: 13.5px; }
.ap-stat-value { font-size: 30px; font-weight: 700; line-height: 1.15; }
.ap-stat-hint { font-size: 12px; color: var(--ap-muted); }
.ap-stat-go { position: absolute; right: 18px; top: 18px; color: #cbd5e1; transition: .15s; }
.ap-stat:hover .ap-stat-go { color: var(--c); transform: translateX(3px); }
.ap-stat.k-green  { --c: #16a34a; --bg: #dcfce7; }
.ap-stat.k-blue   { --c: #2563eb; --bg: #dbeafe; }
.ap-stat.k-sky    { --c: #0284c7; --bg: #e0f2fe; }
.ap-stat.k-violet { --c: #7c3aed; --bg: #ede9fe; }
.ap-stat.k-amber  { --c: #d97706; --bg: #fef3c7; }
.ap-stat.k-red    { --c: #dc2626; --bg: #fee2e2; }
.k-sky { background: #e0f2fe; color: #0369a1; }
.k-red { background: #fee2e2; color: #b91c1c; }
/* the k-* colour classes are for icons; on a stat card they only set the accent colour */
.ap-stat.k-green, .ap-stat.k-blue, .ap-stat.k-sky, .ap-stat.k-violet, .ap-stat.k-amber, .ap-stat.k-red { background: #fff; color: var(--ap-ink); }

/* client status pills */
.st { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; vertical-align: middle; }
.st-none   { background: #f1f5f9; color: #64748b; }
.st-blue   { background: #dbeafe; color: #1d4ed8; }
.st-violet { background: #ede9fe; color: #6d28d9; }
.st-amber  { background: #fef3c7; color: #b45309; }
.st-red    { background: #fee2e2; color: #b91c1c; }
.st-green  { background: #dcfce7; color: #15803d; }

/* client page */
.ap-section-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.ap-readonly { background: #f8fafc; border: 1px solid var(--ap-line); border-radius: 8px; padding: 9px 12px; min-height: 40px; word-break: break-word; }
.ap-status-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.ap-status-option { display: flex; align-items: center; gap: 8px; border: 1px solid var(--ap-line); border-radius: 8px; padding: 10px 12px; cursor: pointer; font-weight: 500; }
.ap-status-option input { accent-color: var(--ap-navy); }
.ap-status-option:has(input:checked) { border-color: var(--ap-navy); box-shadow: 0 0 0 3px rgba(15, 23, 42, .08); }
.ap-status-option.st-blue span::before, .ap-status-option.st-violet span::before, .ap-status-option.st-amber span::before, .ap-status-option.st-red span::before {
	content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: middle;
}
.ap-status-option { background: #fff; color: var(--ap-ink); }
.ap-status-option.st-blue span::before { background: #2563eb; }
.ap-status-option.st-violet span::before { background: #7c3aed; }
.ap-status-option.st-amber span::before { background: #d97706; }
.ap-status-option.st-red span::before { background: #dc2626; }
.ap-subtabs { border-bottom: 1px solid var(--ap-line); gap: 4px; }
.ap-subtabs .nav-link { color: var(--ap-muted); font-weight: 600; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 12px; }
.ap-subtabs .nav-link.active { color: var(--ap-ink); border-bottom-color: var(--ap-accent); }
.ap-messages { list-style: none; margin: 0; padding: 0; }
.ap-messages li { padding: 14px 18px; border-bottom: 1px solid #f1f5f9; }
.ap-messages li:last-child { border-bottom: 0; }
.ap-messages p { color: #334155; margin-top: 4px; }

/* ---------- Delete / bulk selection ---------- */
.ap-check { width: 36px; padding-right: 0 !important; }
.ap-check .form-check-input { cursor: pointer; margin: 0; }
.ap-table > tbody tr.ap-selected > td { background: #fef2f2; }
.ap-bulkbar {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	background: #fef2f2; border-bottom: 1px solid #fecaca; color: #991b1b; padding: 10px 18px; font-size: 13.5px;
}
.ap-bulkbar[hidden] { display: none; }
.ap-confirm-icon {
	width: 56px; height: 56px; border-radius: 50%; background: #fee2e2; color: #dc2626; font-size: 22px;
	display: flex; align-items: center; justify-content: center; margin: 0 auto 14px;
}

/* ---------- Admin sign-in page ---------- */
body.ap-login-page {
	min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
	background: radial-gradient(circle at 15% 10%, #12304a 0%, transparent 45%), linear-gradient(180deg, var(--ap-navy) 0%, #071421 100%);
}
.ap-login { width: 100%; max-width: 400px; }
.ap-login-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 22px; }
.ap-login-card { background: #fff; border-radius: 12px; padding: 30px; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.ap-login-card h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.ap-login-card a { color: var(--ap-blue); text-decoration: none; }
.ap-login-foot { text-align: center; margin-top: 18px; color: #5f7790; font-size: 13px; }
.ap-login-foot a { color: #b6c4d3; text-decoration: none; }
.ap-login-foot a:hover { color: #fff; }
.ap-login-foot span { margin: 0 8px; }

/* ---------- Mobile ---------- */
.ap-backdrop { display: none; }
@media (max-width: 991.98px) {
	.ap-sidebar { transform: translateX(-100%); }
	.ap-shell { margin-left: 0; }
	body.ap-open .ap-sidebar { transform: none; }
	body.ap-open .ap-backdrop { display: block; position: fixed; inset: 0; background: rgba(2, 6, 23, .5); z-index: 1035; }
	.ap-topbar, .ap-content { padding-left: 16px; padding-right: 16px; }
}
