/*!
 * FinGrove UI — design system
 * Author: Ahsan Alam (https://artintechsolution.com/)
 */
:root {
    --fg-brand: #0e7c66;
    --fg-brand-600: #0b6553;
    --fg-brand-50: #e7f5f1;
    --fg-ink: #0f1f1c;
    --fg-sidebar: #0b2e28;
    --fg-sidebar-2: #12423a;
    --fg-accent: #f2a541;
    --fg-text: #1e2b29;
    --fg-muted: #66756f;
    --fg-line: #e3e9e6;
    --fg-bg: #f4f7f6;
    --fg-card: #ffffff;
    --fg-ok: #16a34a;
    --fg-ok-50: #e8f7ee;
    --fg-warn: #d97706;
    --fg-warn-50: #fdf3e2;
    --fg-bad: #dc2626;
    --fg-bad-50: #fdecec;
    --fg-info: #2563eb;
    --fg-info-50: #e9f0fe;
    --fg-violet: #7c3aed;
    --fg-violet-50: #f1ebfe;
    --fg-radius: 12px;
    --fg-shadow: 0 1px 2px rgba(15, 31, 28, .05), 0 4px 16px rgba(15, 31, 28, .05);
    --fg-sidebar-w: 256px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; background: var(--fg-bg); color: var(--fg-text);
    font: 14px/1.55 "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--fg-brand); text-decoration: none; }
a:hover { color: var(--fg-brand-600); }
h1, h2, h3, h4 { margin: 0; color: var(--fg-ink); font-weight: 650; letter-spacing: -.01em; }
p { margin: 0 0 .75rem; }
code { background: var(--fg-bg); border: 1px solid var(--fg-line); border-radius: 6px; padding: 1px 6px; font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--fg-line); margin: 16px 0; }

/* ---------- App shell ---------- */
.fg-shell { display: flex; min-height: 100vh; }
.fg-sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--fg-sidebar-w); z-index: 40;
    background: linear-gradient(180deg, var(--fg-sidebar) 0%, #0a2722 100%); color: #cfe3dd;
    display: flex; flex-direction: column; transition: transform .25s ease;
}
.fg-brandbar { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.fg-logo {
    width: 38px; height: 38px; border-radius: 10px; flex: none; display: grid; place-items: center;
    background: linear-gradient(135deg, #18a487, #0e7c66); color: #fff; font-weight: 800; font-size: 14px; letter-spacing: .02em;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}
.fg-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; background: #fff; }
.fg-brandbar strong { display: block; color: #fff; font-size: 15px; line-height: 1.2; }
.fg-brandbar small { color: #8fb4aa; font-size: 11.5px; }
.fg-nav { flex: 1; overflow-y: auto; padding: 6px 10px 18px; scrollbar-width: thin; scrollbar-color: #24564c transparent; }
.fg-nav-label { padding: 14px 10px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: #6f9a8f; }
.fg-nav a {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 1px 0; border-radius: 8px;
    color: #cfe3dd; font-size: 13.5px; font-weight: 500;
}
.fg-nav a i { font-size: 16px; width: 18px; text-align: center; color: #86b5a9; }
.fg-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.fg-nav a.active { background: rgba(24, 164, 135, .2); color: #fff; box-shadow: inset 3px 0 0 #2fd1ad; }
.fg-nav a.active i { color: #2fd1ad; }
.fg-nav .fg-count { margin-left: auto; background: var(--fg-accent); color: #3b2604; border-radius: 99px; font-size: 10.5px; font-weight: 700; padding: 0 7px; }
.fg-sidebar-foot { padding: 12px 18px; border-top: 1px solid rgba(255,255,255,.07); font-size: 11.5px; color: #6f9a8f; }

.fg-main { flex: 1; margin-left: var(--fg-sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.fg-topbar {
    position: sticky; top: 0; z-index: 30; height: 62px; display: flex; align-items: center; gap: 14px; padding: 0 26px;
    background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--fg-line);
}
.fg-topbar .fg-crumb { flex: 1; min-width: 0; font-weight: 600; color: var(--fg-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fg-topbar .fg-crumb small { color: var(--fg-muted); font-weight: 500; }
.fg-menu-btn { display: none; border: 0; background: none; font-size: 22px; color: var(--fg-ink); cursor: pointer; padding: 4px; }
.fg-iconbtn { position: relative; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: var(--fg-text); background: var(--fg-bg); border: 1px solid var(--fg-line); }
.fg-iconbtn:hover { color: var(--fg-brand); border-color: #cfe0da; }
.fg-dot { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--fg-bad); box-shadow: 0 0 0 2px #fff; }
.fg-user { display: flex; align-items: center; gap: 10px; }
.fg-avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--fg-brand-50); color: var(--fg-brand); font-weight: 700; font-size: 13px; overflow: hidden; }
.fg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.fg-avatar.lg { width: 72px; height: 72px; font-size: 24px; }
.fg-user .fg-who { line-height: 1.2; }
.fg-user .fg-who strong { display: block; font-size: 13px; }
.fg-user .fg-who small { color: var(--fg-muted); font-size: 11.5px; }
.fg-content { padding: 24px 26px 40px; max-width: 1480px; width: 100%; }
.fg-backdrop { display: none; }

/* ---------- Page header ---------- */
.fg-pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.fg-pagehead h1 { font-size: 22px; }
.fg-pagehead p { margin: 4px 0 0; color: var(--fg-muted); }
.fg-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Cards & grids ---------- */
.fg-card { background: var(--fg-card); border: 1px solid var(--fg-line); border-radius: var(--fg-radius); box-shadow: var(--fg-shadow); margin-bottom: 20px; min-width: 0; }
.fg-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--fg-line); }
.fg-card-head h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.fg-card-head h3 i { color: var(--fg-brand); }
.fg-card-body { padding: 18px; }
.fg-card-foot { padding: 12px 18px; border-top: 1px solid var(--fg-line); background: #fafcfb; border-radius: 0 0 var(--fg-radius) var(--fg-radius); }
.fg-grid { display: grid; gap: 20px; }
.fg-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fg-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fg-grid-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.fg-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.fg-stat { background: var(--fg-card); border: 1px solid var(--fg-line); border-radius: var(--fg-radius); box-shadow: var(--fg-shadow); padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.fg-stat-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; flex: none; }
.fg-stat-value { font-size: 21px; font-weight: 700; color: var(--fg-ink); line-height: 1.15; letter-spacing: -.01em; }
.fg-stat-label { color: var(--fg-muted); font-size: 12.5px; }
.fg-stat-hint { font-size: 11.5px; margin-top: 2px; }
.tone-brand { background: var(--fg-brand-50); color: var(--fg-brand); }
.tone-ok { background: var(--fg-ok-50); color: var(--fg-ok); }
.tone-warn { background: var(--fg-warn-50); color: var(--fg-warn); }
.tone-bad { background: var(--fg-bad-50); color: var(--fg-bad); }
.tone-info { background: var(--fg-info-50); color: var(--fg-info); }
.tone-violet { background: var(--fg-violet-50); color: var(--fg-violet); }

/* ---------- Tables ---------- */
.fg-table-wrap { overflow-x: auto; }
table.fg-table { width: 100%; border-collapse: collapse; }
.fg-table th { text-align: left; font-size: 11.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-muted); background: #f8faf9; padding: 10px 14px; border-bottom: 1px solid var(--fg-line); white-space: nowrap; }
.fg-table td { padding: 11px 14px; border-bottom: 1px solid #eef2f0; vertical-align: middle; }
.fg-table tbody tr:hover { background: #fbfdfc; }
.fg-table tfoot td { font-weight: 700; background: #f8faf9; border-top: 1px solid var(--fg-line); }
.fg-table .num, .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fg-table .muted, .muted { color: var(--fg-muted); }
.fg-table td small { display: block; color: var(--fg-muted); font-size: 12px; }
.fg-empty { text-align: center; padding: 36px 16px; color: var(--fg-muted); }
.fg-empty i { display: block; font-size: 28px; color: #b8cbc5; margin-bottom: 6px; }

/* ---------- Definition list ---------- */
.fg-dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; margin: 0; }
.fg-dl div { min-width: 0; }
.fg-dl dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-muted); font-weight: 600; }
.fg-dl dd { margin: 2px 0 0; font-weight: 550; color: var(--fg-ink); overflow-wrap: anywhere; }
.fg-kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--fg-line); }
.fg-kv:last-child { border-bottom: 0; }
.fg-kv span:first-child { color: var(--fg-muted); }
.fg-kv span:last-child { font-weight: 600; text-align: right; }

/* ---------- Badges ---------- */
.fg-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 650; white-space: nowrap; }
.fg-badge.ok { background: var(--fg-ok-50); color: #15803d; }
.fg-badge.warn { background: var(--fg-warn-50); color: #b45309; }
.fg-badge.bad { background: var(--fg-bad-50); color: #b91c1c; }
.fg-badge.info { background: var(--fg-info-50); color: #1d4ed8; }
.fg-badge.violet { background: var(--fg-violet-50); color: #6d28d9; }
.fg-badge.muted { background: #eef2f0; color: #52605b; }
.fg-badge.brand { background: var(--fg-brand-50); color: var(--fg-brand-600); }

/* ---------- Buttons ---------- */
.fg-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 15px; border-radius: 9px;
    border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 13.5px; line-height: 1.3; cursor: pointer; white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s; text-decoration: none;
}
.fg-btn i { font-size: 15px; }
.fg-btn-primary { background: var(--fg-brand); color: #fff; }
.fg-btn-primary:hover { background: var(--fg-brand-600); color: #fff; }
.fg-btn-light { background: #fff; color: var(--fg-text); border-color: var(--fg-line); }
.fg-btn-light:hover { border-color: #bcd3cb; color: var(--fg-brand); }
.fg-btn-ok { background: var(--fg-ok); color: #fff; }
.fg-btn-ok:hover { background: #15803d; color: #fff; }
.fg-btn-warn { background: var(--fg-warn); color: #fff; }
.fg-btn-danger { background: #fff; color: var(--fg-bad); border-color: #f3c4c4; }
.fg-btn-danger:hover { background: var(--fg-bad-50); color: #b91c1c; }
.fg-btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.fg-btn-block { width: 100%; }
.fg-btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Forms ---------- */
.fg-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 18px; }
.fg-field { margin-bottom: 15px; min-width: 0; }
.fg-field.span-2 { grid-column: span 2; }
.fg-field.span-all { grid-column: 1 / -1; }
.fg-label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; color: var(--fg-ink); }
.fg-label .req { color: var(--fg-bad); }
.fg-input, .fg-select, .fg-textarea {
    width: 100%; padding: 9px 12px; font: inherit; color: var(--fg-text); background: #fff;
    border: 1px solid #d5dfdb; border-radius: 9px; transition: border-color .15s, box-shadow .15s;
}
.fg-textarea { min-height: 88px; resize: vertical; }
.fg-input:focus, .fg-select:focus, .fg-textarea:focus { outline: none; border-color: var(--fg-brand); box-shadow: 0 0 0 3px rgba(14, 124, 102, .14); }
.fg-input.is-invalid, .fg-select.is-invalid, .fg-textarea.is-invalid { border-color: var(--fg-bad); }
.fg-input:disabled, .fg-select:disabled, .fg-textarea:disabled { background: #f3f6f5; color: var(--fg-muted); border-color: #e3e9e6; cursor: not-allowed; }
.fg-hint { font-size: 12px; color: var(--fg-muted); margin-top: 4px; }
.fg-error { font-size: 12px; color: var(--fg-bad); margin-top: 4px; }
.fg-check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.fg-check input { width: 16px; height: 16px; accent-color: var(--fg-brand); }
.fg-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.fg-filters .fg-field { margin: 0; min-width: 150px; flex: 1; }
.fg-filters .fg-field.grow { flex: 2.5; min-width: 220px; }
.fg-inline-form { display: inline; }
details.fg-details { border: 1px dashed #c9d9d3; border-radius: 10px; padding: 0 14px; background: #fbfdfc; }
details.fg-details[open] { padding-bottom: 14px; }
details.fg-details summary { cursor: pointer; padding: 11px 0; font-weight: 600; color: var(--fg-brand); list-style: none; }
details.fg-details summary::-webkit-details-marker { display: none; }

/* ---------- Alerts ---------- */
.fg-alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; border: 1px solid; font-size: 13.5px; }
.fg-alert i { font-size: 17px; line-height: 1.2; }
.fg-alert ul { margin: 0; padding-left: 18px; }
.fg-alert.ok { background: var(--fg-ok-50); border-color: #bfe6cd; color: #166534; }
.fg-alert.bad { background: var(--fg-bad-50); border-color: #f5c2c2; color: #991b1b; }
.fg-alert.warn { background: var(--fg-warn-50); border-color: #f3d7a8; color: #92400e; }
.fg-alert.info { background: var(--fg-info-50); border-color: #c6d6fb; color: #1e40af; }

/* ---------- Misc ---------- */
.fg-progress { height: 8px; background: #e6eeeb; border-radius: 99px; overflow: hidden; }
.fg-progress > span { display: block; height: 100%; background: linear-gradient(90deg, #18a487, #0e7c66); border-radius: 99px; }
.fg-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--fg-line); margin-bottom: 18px; overflow-x: auto; }
.fg-tabs a { padding: 10px 14px; color: var(--fg-muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.fg-tabs a.active { color: var(--fg-brand); border-bottom-color: var(--fg-brand); }
.fg-list { list-style: none; margin: 0; padding: 0; }
.fg-list li { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid #eef2f0; }
.fg-list li:last-child { border-bottom: 0; }
.fg-list.fg-card-body { padding: 4px 18px; }
.fg-chart { position: relative; height: 280px; }
.fg-thread { display: flex; flex-direction: column; gap: 12px; }
.fg-msg { max-width: 82%; padding: 10px 14px; border-radius: 12px; background: var(--fg-bg); border: 1px solid var(--fg-line); }
.fg-msg.mine { align-self: flex-end; background: var(--fg-brand-50); border-color: #c7e6dd; }
.fg-msg small { display: block; color: var(--fg-muted); font-size: 11.5px; margin-bottom: 3px; }
.fg-pagination { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; padding: 12px 18px; }
.fg-pagination a, .fg-pagination span { min-width: 34px; height: 34px; padding: 0 9px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid var(--fg-line); background: #fff; color: var(--fg-text); font-weight: 600; font-size: 13px; }
.fg-pagination .active { background: var(--fg-brand); border-color: var(--fg-brand); color: #fff; }
.fg-pagination .disabled { color: #b2c0bb; }
.fg-demo { background: #fff8eb; border: 1px solid #f6dcaa; border-radius: 10px; padding: 12px 14px; font-size: 12.5px; line-height: 1.7; }
.fg-demo-acc { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; padding: 8px 10px; background: #fff; border: 1px solid #f0d49c; border-radius: 8px; font: inherit; color: var(--fg-ink); text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.fg-demo-acc:hover, .fg-demo-acc:focus-visible { border-color: var(--fg-brand); box-shadow: 0 0 0 3px rgba(14, 124, 102, .14); outline: none; }
.fg-demo-acc-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.fg-demo-acc-who small { color: var(--fg-muted); overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11.5px; }
.fg-demo-acc-use { flex: none; font-weight: 600; color: var(--fg-brand); white-space: nowrap; }
.fg-demo-acc.is-used { border-color: var(--fg-brand); background: var(--fg-brand-50); }
.text-ok { color: var(--fg-ok); } .text-bad { color: var(--fg-bad); } .text-warn { color: var(--fg-warn); }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; } .mt-2 { margin-top: 12px; } .mb-2 { margin-bottom: 12px; }
.w-100 { width: 100%; } .nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.flex { display: flex; gap: 8px; align-items: center; } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; }

/* ---------- Auth ---------- */
.fg-auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.fg-auth-art {
    background: radial-gradient(1200px 600px at 10% 10%, #18a487 0%, transparent 60%), linear-gradient(160deg, #0b2e28 0%, #0e7c66 100%);
    color: #e6f4ef; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
}
.fg-auth-art h2 { color: #fff; font-size: 30px; line-height: 1.2; max-width: 460px; }
.fg-auth-art ul { padding: 0; list-style: none; margin: 24px 0 0; }
.fg-auth-art li { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; color: #cbe7de; }
.fg-auth-art li i { color: #7fe3c9; }
.fg-auth-form { display: grid; place-items: center; padding: 40px 24px; background: #fff; }
.fg-auth-box { width: 100%; max-width: 380px; }
.fg-auth-box h1 { font-size: 24px; margin-bottom: 4px; }

/* ---------- Print ---------- */
.fg-print-only { display: none; }
@media print {
    .fg-sidebar, .fg-topbar, .fg-actions, .fg-filters, .fg-no-print, .fg-pagination { display: none !important; }
    .fg-main { margin: 0; }
    .fg-content { padding: 0; max-width: none; }
    .fg-card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
    .fg-print-only { display: block; }
    body { background: #fff; font-size: 12px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .fg-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .fg-grid-side { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .fg-sidebar { transform: translateX(-100%); }
    body.nav-open .fg-sidebar { transform: none; }
    body.nav-open .fg-backdrop { display: block; position: fixed; inset: 0; background: rgba(11, 46, 40, .45); z-index: 35; }
    .fg-main { margin-left: 0; }
    .fg-menu-btn { display: block; }
    .fg-grid-2, .fg-grid-3 { grid-template-columns: 1fr; }
    .fg-auth { grid-template-columns: 1fr; }
    .fg-auth-art { display: none; }
}
@media (max-width: 600px) {
    .fg-content { padding: 16px; }
    .fg-topbar { padding: 0 14px; }
    .fg-user .fg-who { display: none; }
    .fg-dl { grid-template-columns: 1fr; }
    .fg-field.span-2 { grid-column: auto; }
    .fg-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
    .fg-stat { padding: 12px; gap: 10px; }
    .fg-stat-icon { width: 38px; height: 38px; font-size: 17px; }
    .fg-stat-value { font-size: 17px; }
}
