/* =========================================================
   KHATA — Global Admin Stylesheet
   Loads on every admin page.
   ========================================================= */

/* ---------- Design tokens ---------- */

:root {
    --kh-primary: #3b82f6;
    --kh-primary-dark: #2563eb;
    --kh-cyan: #06b6d4;
    --kh-emerald: #10b981;
    --kh-emerald-dark: #059669;
    --kh-rose: #f43f5e;
    --kh-rose-dark: #e11d48;
    --kh-purple: #a855f7;
    --kh-purple-dark: #9333ea;

    --kh-bg: #f1f5f9;
    --kh-card: #ffffff;
    --kh-border: #e2e8f0;
    --kh-border-dark: #cbd5e1;

    --kh-text: #0f172a;
    --kh-text-muted: #64748b;
    --kh-text-soft: #94a3b8;

    --kh-radius: 12px;
    --kh-radius-sm: 8px;
    --kh-radius-pill: 999px;

    --kh-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --kh-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    --kh-shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.12);
}

/* ---------- Base ---------- */

body {
    background: var(--kh-bg) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif !important;
    color: var(--kh-text) !important;
}

#container {
    background: var(--kh-bg) !important;
}

/* =========================================================
   HEADER
   ========================================================= */

#header {
    background: linear-gradient(135deg, #1e3a8a 0%, #0891b2 100%) !important;
    color: #ffffff !important;
    padding: 14px 24px !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.15) !important;
    border-bottom: none !important;
    position: sticky;
    top: 0;
    z-index: 1000;
}

#branding h1,
#branding h1 a:link,
#branding h1 a:visited {
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 22px !important;
    letter-spacing: 0.3px;
    text-decoration: none !important;
}

#user-tools {
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 13px !important;
}

#user-tools a {
    color: #ffffff !important;
    font-weight: 600 !important;
    text-decoration: underline !important;
    text-decoration-color: rgba(255, 255, 255, 0.4);
}

#user-tools a:hover {
    text-decoration-color: #ffffff;
}

/* =========================================================
   BREADCRUMBS
   ========================================================= */

div.breadcrumbs {
    background: var(--kh-card) !important;
    border-bottom: 1px solid var(--kh-border) !important;
    padding: 12px 24px !important;
    font-size: 13px !important;
    color: var(--kh-text-muted) !important;
}

div.breadcrumbs a {
    color: var(--kh-primary) !important;
    text-decoration: none !important;
    font-weight: 500;
}

div.breadcrumbs a:hover {
    text-decoration: underline !important;
}

/* =========================================================
   MAIN CONTENT AREA
   ========================================================= */

#content {
    padding: 24px !important;
    max-width: 1400px;
    margin: 0 auto;
}

#content h1 {
    font-size: 24px !important;
    font-weight: 700 !important;
    color: var(--kh-text) !important;
    margin-bottom: 20px !important;
    padding: 0 !important;
}

/* =========================================================
   SIDEBAR
   ========================================================= */

#nav-sidebar {
    background: var(--kh-card) !important;
    border-right: 1px solid var(--kh-border) !important;
    padding: 16px 8px !important;
}

#nav-sidebar .current-app .section:link,
#nav-sidebar .current-app .section:visited {
    color: var(--kh-primary) !important;
    font-weight: 700 !important;
}

#nav-sidebar a:link,
#nav-sidebar a:visited {
    color: var(--kh-text) !important;
    border-radius: var(--kh-radius-sm) !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
    transition: background 0.15s ease !important;
    display: block !important;
}

#nav-sidebar a:hover {
    background: #eff6ff !important;
    color: var(--kh-primary-dark) !important;
}

#nav-sidebar .current-model {
    background: linear-gradient(135deg, #eff6ff 0%, #cffafe 100%) !important;
    color: var(--kh-primary-dark) !important;
    font-weight: 600;
}

#nav-sidebar caption {
    color: var(--kh-text-soft) !important;
    font-size: 11px !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 12px !important;
}

/* =========================================================
   CARDS / MODULES
   ========================================================= */

.module {
    background: var(--kh-card) !important;
    border-radius: var(--kh-radius) !important;
    box-shadow: var(--kh-shadow) !important;
    border: 1px solid var(--kh-border) !important;
    margin-bottom: 20px !important;
    overflow: hidden !important;
}

.module h2,
.module caption,
.inline-group h2 {
    background: linear-gradient(135deg, #1e3a8a 0%, #0891b2 100%) !important;
    color: #ffffff !important;
    padding: 12px 18px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    letter-spacing: 0.3px;
    margin: 0 !important;
    border: none !important;
}

/* =========================================================
   OBJECT TOOLS (top-right buttons)
   ========================================================= */

.object-tools {
    padding: 0 !important;
    margin: 0 0 16px 0 !important;
    float: right !important;
    clear: both !important;
}

.object-tools li {
    list-style: none !important;
    display: inline-block !important;
    margin-left: 8px !important;
}

.object-tools li a,
.object-tools li a:link,
.object-tools li a:visited {
    background: linear-gradient(135deg, var(--kh-primary) 0%, var(--kh-cyan) 100%) !important;
    color: #ffffff !important;
    border-radius: var(--kh-radius-sm) !important;
    padding: 10px 18px !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    text-decoration: none !important;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35) !important;
    transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease !important;
    display: inline-block !important;
    height: auto !important;
    line-height: 1.3 !important;
}

.object-tools li a:hover {
    background: linear-gradient(135deg, var(--kh-primary-dark) 0%, #0891b2 100%) !important;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.5) !important;
    transform: translateY(-1px);
}

.object-tools li a.addlink,
.object-tools li a[href*="/add/"] {
    background: linear-gradient(135deg, var(--kh-emerald) 0%, var(--kh-emerald-dark) 100%) !important;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35) !important;
}

.object-tools li a.addlink:hover,
.object-tools li a[href*="/add/"]:hover {
    background: linear-gradient(135deg, var(--kh-emerald-dark) 0%, #047857 100%) !important;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.5) !important;
}

/* =========================================================
   TABLES (CHANGE LISTS)
   ========================================================= */

#result_list {
    background: var(--kh-card) !important;
    border-radius: var(--kh-radius) !important;
    border: 1px solid var(--kh-border) !important;
    box-shadow: var(--kh-shadow-sm) !important;
    overflow: hidden !important;
    width: 100%;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

#result_list thead th {
    background: #f8fafc !important;
    color: var(--kh-text-muted) !important;
    font-size: 11px !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700 !important;
    padding: 12px 14px !important;
    border-bottom: 1px solid var(--kh-border) !important;
    white-space: nowrap;
}

#result_list thead th a {
    color: var(--kh-text-muted) !important;
    text-decoration: none !important;
}

#result_list thead th a:hover {
    color: var(--kh-primary) !important;
}

#result_list tbody tr {
    background: var(--kh-card) !important;
    transition: background 0.12s ease !important;
}

#result_list tbody tr:hover {
    background: #f8fafc !important;
}

#result_list tbody td,
#result_list tbody th {
    padding: 12px 14px !important;
    border-bottom: 1px solid #f1f5f9 !important;
    font-size: 13px !important;
    color: var(--kh-text) !important;
    vertical-align: middle !important;
}

#result_list tbody tr:last-child td {
    border-bottom: none !important;
}

#result_list tbody a {
    color: var(--kh-primary) !important;
    font-weight: 600;
    text-decoration: none !important;
}

#result_list tbody a:hover {
    text-decoration: underline !important;
}

/* Row action buttons inside table */
#result_list a.button {
    color: #ffffff !important;
    border: none !important;
    border-radius: var(--kh-radius-pill) !important;
    padding: 5px 14px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    text-decoration: none !important;
    display: inline-block !important;
    white-space: nowrap;
    transition: transform 0.15s ease, box-shadow 0.2s ease !important;
}

#result_list a.button:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

/* =========================================================
   FILTER SIDEBAR
   ========================================================= */

#changelist-filter {
    background: var(--kh-card) !important;
    border-radius: var(--kh-radius) !important;
    border: 1px solid var(--kh-border) !important;
    box-shadow: var(--kh-shadow-sm) !important;
    padding: 0 !important;
    overflow: hidden;
    margin-left: 20px;
}

#changelist-filter h2 {
    background: #f8fafc !important;
    color: var(--kh-text-muted) !important;
    padding: 12px 16px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--kh-border) !important;
    margin: 0 !important;
}

#changelist-filter h3 {
    padding: 12px 16px 4px !important;
    margin: 0 !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    color: var(--kh-text) !important;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

#changelist-filter ul {
    padding: 0 8px 8px !important;
    margin: 0 !important;
    list-style: none !important;
}

#changelist-filter li {
    border-radius: var(--kh-radius-sm) !important;
    margin-bottom: 2px !important;
}

#changelist-filter li a {
    display: block !important;
    padding: 6px 12px !important;
    border-radius: var(--kh-radius-sm) !important;
    color: var(--kh-text) !important;
    text-decoration: none !important;
    font-size: 13px !important;
}

#changelist-filter li.selected a {
    background: linear-gradient(135deg, #eff6ff 0%, #cffafe 100%) !important;
    color: var(--kh-primary-dark) !important;
    font-weight: 700 !important;
}

#changelist-filter li a:hover {
    background: #f1f5f9 !important;
}

/* =========================================================
   SEARCH BAR
   ========================================================= */

#changelist-search {
    background: var(--kh-card) !important;
    border-radius: var(--kh-radius) !important;
    padding: 12px 16px !important;
    margin-bottom: 16px !important;
    border: 1px solid var(--kh-border) !important;
    box-shadow: var(--kh-shadow-sm) !important;
}

#changelist-search label {
    display: none;
}

#changelist-search input[type="text"] {
    padding: 10px 14px !important;
    border: 1px solid var(--kh-border-dark) !important;
    border-radius: var(--kh-radius-sm) !important;
    font-size: 14px !important;
    min-width: 240px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

#changelist-search input[type="text"]:focus {
    outline: none !important;
    border-color: var(--kh-primary) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
}

#changelist-search input[type="submit"] {
    background: linear-gradient(135deg, var(--kh-primary) 0%, var(--kh-cyan) 100%) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    border-radius: var(--kh-radius-sm) !important;
    padding: 10px 18px !important;
    cursor: pointer;
}

/* =========================================================
   ACTIONS DROPDOWN (bulk actions)
   ========================================================= */

.actions {
    background: var(--kh-card) !important;
    border-radius: var(--kh-radius) !important;
    padding: 12px 16px !important;
    margin-bottom: 16px !important;
    border: 1px solid var(--kh-border) !important;
    box-shadow: var(--kh-shadow-sm) !important;
}

.actions select {
    padding: 8px 12px !important;
    border: 1px solid var(--kh-border-dark) !important;
    border-radius: var(--kh-radius-sm) !important;
    font-size: 14px !important;
}

.actions button {
    background: linear-gradient(135deg, var(--kh-primary) 0%, var(--kh-cyan) 100%) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    border-radius: var(--kh-radius-sm) !important;
    padding: 8px 16px !important;
    cursor: pointer;
    margin-left: 8px !important;
}

/* =========================================================
   FORMS
   ========================================================= */

.form-row {
    padding: 14px 18px !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

.form-row:last-child {
    border-bottom: none !important;
}

.form-row label {
    font-weight: 600 !important;
    color: var(--kh-text) !important;
    font-size: 13px !important;
    display: block;
    margin-bottom: 6px;
}

.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="number"],
.form-row input[type="password"],
.form-row input[type="url"],
.form-row input[type="date"],
.form-row input[type="datetime-local"],
.form-row textarea {
    padding: 10px 12px !important;
    border: 1px solid var(--kh-border-dark) !important;
    border-radius: var(--kh-radius-sm) !important;
    font-size: 14px !important;
    background: #ffffff !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
    max-width: 100%;
    box-sizing: border-box;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    outline: none !important;
    border-color: var(--kh-primary) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
}

.form-row .help {
    color: var(--kh-text-soft) !important;
    font-size: 12px !important;
    margin-top: 4px !important;
}

.form-row .readonly {
    padding: 10px 12px !important;
    background: #f8fafc !important;
    border: 1px solid var(--kh-border) !important;
    border-radius: var(--kh-radius-sm) !important;
    font-weight: 600;
    color: var(--kh-text) !important;
}

/* Fieldset inside form */
fieldset.module {
    background: var(--kh-card) !important;
    border-radius: var(--kh-radius) !important;
    box-shadow: var(--kh-shadow-sm) !important;
    border: 1px solid var(--kh-border) !important;
    margin-bottom: 20px !important;
    padding: 0 !important;
}

fieldset.module h2 {
    background: linear-gradient(135deg, #1e3a8a 0%, #0891b2 100%) !important;
    color: #ffffff !important;
    padding: 14px 20px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    margin: 0 !important;
    border-radius: var(--kh-radius) var(--kh-radius) 0 0 !important;
}

fieldset.module .description {
    background: #eff6ff !important;
    color: #1e3a8a !important;
    padding: 12px 20px !important;
    font-size: 13px !important;
    border-bottom: 1px solid var(--kh-border) !important;
}

/* =========================================================
   SUBMIT BUTTONS
   ========================================================= */

.submit-row {
    background: var(--kh-card) !important;
    border-radius: var(--kh-radius) !important;
    padding: 16px 20px !important;
    border: 1px solid var(--kh-border) !important;
    box-shadow: var(--kh-shadow-sm) !important;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 20px;
}

.submit-row input[type="submit"],
.submit-row button {
    background: linear-gradient(135deg, var(--kh-primary) 0%, var(--kh-cyan) 100%) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    border-radius: var(--kh-radius-sm) !important;
    padding: 11px 22px !important;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35) !important;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease !important;
}

.submit-row input[type="submit"]:hover,
.submit-row button:hover {
    background: linear-gradient(135deg, var(--kh-primary-dark) 0%, #0891b2 100%) !important;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.5) !important;
    transform: translateY(-1px);
}

.submit-row a.deletelink,
.submit-row .deletelink {
    background: linear-gradient(135deg, #ef4444 0%, var(--kh-rose) 100%) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: var(--kh-radius-sm) !important;
    padding: 11px 22px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35) !important;
}

.submit-row a.deletelink:hover,
.submit-row .deletelink:hover {
    background: linear-gradient(135deg, #dc2626 0%, var(--kh-rose-dark) 100%) !important;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.5) !important;
    transform: translateY(-1px);
}

/* =========================================================
   MESSAGES (success/error banners)
   ========================================================= */

.messagelist {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 0 20px 0 !important;
}

.messagelist li {
    border-radius: var(--kh-radius-sm) !important;
    padding: 14px 18px !important;
    margin-bottom: 8px !important;
    font-weight: 500;
    box-shadow: var(--kh-shadow-sm);
    border: none !important;
}

.messagelist li.success {
    background: #ecfdf5 !important;
    color: #065f46 !important;
    border-left: 4px solid var(--kh-emerald) !important;
}

.messagelist li.warning {
    background: #fef3c7 !important;
    color: #92400e !important;
    border-left: 4px solid #f59e0b !important;
}

.messagelist li.error {
    background: #fef2f2 !important;
    color: #991b1b !important;
    border-left: 4px solid #ef4444 !important;
}

.messagelist li.info {
    background: #eff6ff !important;
    color: #1e40af !important;
    border-left: 4px solid var(--kh-primary) !important;
}

/* =========================================================
   PAGINATION
   ========================================================= */

.paginator {
    background: var(--kh-card) !important;
    border-radius: var(--kh-radius) !important;
    padding: 14px 20px !important;
    margin-top: 20px !important;
    border: 1px solid var(--kh-border) !important;
    box-shadow: var(--kh-shadow-sm) !important;
    font-size: 13px !important;
    color: var(--kh-text-muted) !important;
}

.paginator a:link,
.paginator a:visited {
    background: linear-gradient(135deg, var(--kh-primary) 0%, var(--kh-cyan) 100%) !important;
    color: #ffffff !important;
    border-radius: var(--kh-radius-sm) !important;
    padding: 6px 14px !important;
    margin: 0 3px !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    display: inline-block;
}

.paginator .this-page {
    background: var(--kh-primary-dark) !important;
    color: #ffffff !important;
    border-radius: var(--kh-radius-sm) !important;
    padding: 6px 14px !important;
    margin: 0 3px !important;
    font-weight: 700 !important;
    display: inline-block;
}

/* =========================================================
   DASHBOARD (index page)
   ========================================================= */

.kh-dashboard {
    padding: 0;
}

.kh-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kh-stat-card {
    background: #ffffff;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    transition: box-shadow 0.15s ease;
}

.kh-stat-card:hover {
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.kh-stat-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kh-stat-icon svg {
    width: 22px;
    height: 22px;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.kh-icon-blue {
    background: #dbeafe;
    color: #1d4ed8;
}

.kh-icon-emerald {
    background: #d1fae5;
    color: #047857;
}

.kh-icon-purple {
    background: #ede9fe;
    color: #6d28d9;
}

.kh-icon-rose {
    background: #ffe4e6;
    color: #be123c;
}

.kh-stat-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.kh-stat-label {
    color: #6b7280;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

.kh-stat-value {
    color: #111827;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.kh-stat-sub {
    color: #9ca3af;
    font-size: 12px;
    font-weight: 400;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tables on the dashboard */
.kh-table-wrap {
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    margin-bottom: 20px;
}

.kh-quick-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.kh-quick-actions a {
    background: linear-gradient(135deg, var(--kh-primary) 0%, var(--kh-cyan) 100%);
    color: #ffffff !important;
    text-decoration: none !important;
    padding: 10px 18px;
    border-radius: var(--kh-radius-sm);
    font-weight: 600;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    display: inline-block;
}

.kh-quick-actions a:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.5);
}

.kh-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--kh-text);
    margin: 24px 0 12px;
    padding-left: 4px;
}

/* App list on dashboard */
.kh-app-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kh-app-card {
    background: var(--kh-card);
    border-radius: var(--kh-radius);
    padding: 18px;
    box-shadow: var(--kh-shadow-sm);
    border: 1px solid var(--kh-border);
}

.kh-app-card h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--kh-text);
}

.kh-app-card ul,
.kh-app-card ul li,
html body .kh-app-card ul,
html body .kh-app-card ul li {
    list-style: none !important;
    list-style-type: none !important;
    list-style-image: none !important;
    padding-left: 0 !important;
    margin-left: 0 !important;
}

.kh-app-card ul li::before,
html body .kh-app-card ul li::before {
    content: none !important;
    display: none !important;
}

.kh-app-card li {
    padding: 6px 0;
}

.kh-app-card a {
    color: var(--kh-primary) !important;
    font-weight: 500;
    text-decoration: none !important;
    font-size: 14px;
}

.kh-app-card a:hover {
    text-decoration: underline !important;
}

/* =========================================================
   LOGIN PAGE
   ========================================================= */

.login {
    background: linear-gradient(135deg, #1e3a8a 0%, #0891b2 100%) !important;
    min-height: 100vh;
}

.login #container {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 40px 0 !important;
}

.login #header {
    background: transparent !important;
    box-shadow: none !important;
}

.login #content {
    background: var(--kh-card) !important;
    border-radius: var(--kh-radius) !important;
    box-shadow: var(--kh-shadow-lg) !important;
    padding: 32px !important;
    max-width: 420px !important;
    margin: 0 auto !important;
}

.login .form-row {
    padding: 10px 0 !important;
    border: none !important;
}

.login .submit-row {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 10px 0 0 !important;
}

.login .submit-row input {
    width: 100% !important;
    padding: 12px !important;
    font-size: 14px !important;
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 768px) {

    #header {
        padding: 10px 16px !important;
    }

    #branding h1,
    #branding h1 a {
        font-size: 18px !important;
    }

    #content {
        padding: 14px !important;
    }

    #content h1 {
        font-size: 20px !important;
        margin-bottom: 14px !important;
    }

    div.breadcrumbs {
        padding: 10px 14px !important;
        font-size: 12px !important;
    }

    /* Object tools stack */
    .object-tools {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        margin-bottom: 14px !important;
        float: none !important;    
        width: 100% !important;
    }

    .object-tools li {
        display: block !important;
        margin: 0 !important;
    }

    .object-tools li a {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
        text-align: center;
        padding: 12px !important;
        font-size: 14px !important;
        min-height: 44px;
    }

    /* Filters collapse */
    #changelist-filter {
        margin-left: 0 !important;
        margin-bottom: 16px !important;
    }

    /* Tables become scrollable */
    .change-list .results {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    #result_list {
        min-width: 700px;
        font-size: 12px !important;
    }

    #result_list thead th,
    #result_list tbody td,
    #result_list tbody th {
        padding: 10px 10px !important;
        font-size: 12px !important;
    }

    /* Search */
        /* Search */
    #changelist-search {
        display: flex !important;
        flex-direction: column;
        align-items: flex-start;   /* buttons don't stretch */
        gap: 8px;
    }

    #changelist-search input[type="text"] {
        min-width: 0;
        width: 100% !important;
        box-sizing: border-box;
        padding: 10px 12px;
    }

    #changelist-search input[type="submit"] {
        width: auto !important;
        min-width: 70px !important;
        max-width: 120px !important;
        padding: 10px 16px !important;
        display: inline-block !important;
        align-self: flex-start;
        font-size: 14px !important;
    }

    #changelist-search > div,
    #changelist-search > span {
        width: 100%;
    }

    /* Form rows stack */
    .form-row label {
        font-size: 12px !important;
    }

    .form-row input,
    .form-row select,
    .form-row textarea {
        font-size: 16px !important;
    }

    /* Submit row stacks */
    .submit-row {
        flex-direction: column;
        align-items: stretch;
    }

    .submit-row input[type="submit"],
    .submit-row button,
    .submit-row a.deletelink {
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 12px !important;
        font-size: 14px !important;
        min-height: 44px;
        text-align: center;
        margin-bottom: 6px;
    }

    /* Stat cards smaller */
    .kh-stat-value {
        font-size: 22px;
    }

    .kh-stat-card {
        padding: 14px;
    }

    .kh-stat-icon {
        width: 38px;
        height: 38px;
    }

    .kh-stat-icon svg {
        width: 18px;
        height: 18px;
    }
}

/* =========================================================
   GLOBAL SELECT STYLING
   ========================================================= */

/* Base — applies to every <select> */
html body select,
html body form select,
html body .form-row select,
html body .related-widget-wrapper select,
html body .flex-container select,
html body select#id_account,
html body select[name="account"],
html body select[name="contact"],
html body select[name="currency"],
html body select[name="transaction_type"],
html body select[name="direction"],
html body select[name="commission_currency"],
html body select[name="category"] {
    padding: 10px 32px 10px 12px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-family: inherit !important;
    background-color: #ffffff !important;

    height: 42px !important;
    line-height: 20px !important;

    box-sizing: border-box !important;
    vertical-align: middle !important;
    max-width: 100% !important;

    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;

    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") !important;
    background-repeat: no-repeat !important;
    background-position: right 10px center !important;

    color: #0f172a !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

/* Focus state */
html body select:focus,
html body .form-row select:focus {
    outline: none !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
}

/* Bulk actions dropdown */
html body #changelist .actions select {
    height: 42px !important;
    line-height: 20px !important;
    min-width: 200px;
}

/* Filter sidebar dropdowns */
html body #changelist-filter select {
    width: 100%;
    margin: 4px 0;
    height: 42px !important;
    line-height: 20px !important;
}

/* Mobile — bigger for fingers */
@media (max-width: 768px) {
    html body select,
    html body .form-row select {
        font-size: 16px !important;
        height: 46px !important;
        line-height: 22px !important;
        min-height: 46px !important;
        padding: 10px 32px 10px 12px !important;
    }
}



/* =========================================================
   SELECT DEBUG / FINAL ALIGNMENT
   ========================================================= */

.form-row {
    overflow: visible !important;
}

.form-row .field-box {
    overflow: visible !important;
}

.form-row .field-box select {
    display: block !important;

    box-sizing: border-box !important;

    height: 38px !important;
    min-height: 38px !important;

    margin: 0 !important;

    padding: 6px 12px !important;

    font-family: inherit !important;
    font-size: 14px !important;
    font-weight: 400 !important;

    line-height: 24px !important;


    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;

    background: #ffffff !important;
    color: #0f172a !important;
}

.form-row .field-box select option {
    font-family: inherit !important;
    font-size: 14px !important;
    line-height: normal !important;
}


/* =========================================================
   DASHBOARD DATE RANGE FILTER
   ========================================================= */


.kh-dashboard-filter {
    width: 100%;
    box-sizing: border-box;

    display: flex;
    flex-direction: column;

    margin: 0 0 24px;
    padding: 18px;

    background: #ffffff;

    border: 1px solid #e2e8f0;
    border-radius: 14px;

    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 6px 18px rgba(15, 23, 42, 0.05);

    direction: rtl;
}


/* =========================================================
   HEADER
   ========================================================= */

.kh-filter-header {
    width: 100%;

    display: flex;
    align-items: center;

    gap: 12px;

    padding-bottom: 16px;
    margin-bottom: 16px;

    border-bottom: 1px solid #eef2f7;
}

.kh-filter-icon {
    width: 42px;
    height: 42px;

    flex: 0 0 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    color: #2563eb;

    background: #eff6ff;

    border: 1px solid #dbeafe;
    border-radius: 10px;
}

.kh-filter-icon svg {
    width: 20px;
    height: 20px;
}

.kh-filter-title {
    color: #0f172a;

    font-size: 15px;
    font-weight: 700;

    line-height: 1.4;
}

.kh-filter-subtitle {
    margin-top: 3px;

    color: #94a3b8;

    font-size: 11px;
    font-weight: 500;

    line-height: 1.4;
}


/* =========================================================
   OPTIONS
   ========================================================= */

.kh-filter-options {
    width: 100%;

    display: grid;

    grid-template-columns: repeat(4, 1fr);

    gap: 10px;

    box-sizing: border-box;
}


/* =========================================================
   OPTION
   ========================================================= */

.kh-filter-btn {
    width: 100%;
    min-height: 48px;

    box-sizing: border-box;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 12px 16px;

    border: 1px solid #e2e8f0;
    border-radius: 10px;

    background: #f8fafc;

    color: #475569 !important;

    font-size: 13px;
    font-weight: 600;

    line-height: 1.3;

    text-align: center;
    text-decoration: none !important;

    white-space: nowrap;

    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.18s ease;
}


/* =========================================================
   HOVER
   ========================================================= */

.kh-filter-btn:hover {
    background: #ffffff;

    border-color: #bfdbfe;

    color: #2563eb !important;

    box-shadow:
        0 2px 6px rgba(37, 99, 235, 0.08);

    transform: translateY(-1px);
}


/* =========================================================
   ACTIVE
   ========================================================= */

.kh-filter-btn.active {
    background:
        linear-gradient(
            135deg,
            #2563eb 0%,
            #0891b2 100%
        );

    border-color: transparent;

    color: #ffffff !important;

    box-shadow:
        0 4px 10px rgba(37, 99, 235, 0.20),
        0 8px 18px rgba(37, 99, 235, 0.10);
}

.kh-filter-btn.active:hover {
    color: #ffffff !important;

    transform: translateY(-1px);

    box-shadow:
        0 5px 14px rgba(37, 99, 235, 0.25);
}


/* Remove any old underline */

.kh-filter-btn.active::after {
    display: none !important;
    content: none !important;
}


/* =========================================================
   FOCUS
   ========================================================= */

.kh-filter-btn:focus {
    outline: none;
}

.kh-filter-btn:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.15);
    outline-offset: 2px;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 900px) {

    .kh-filter-options {
        grid-template-columns: repeat(2, 1fr);
    }

}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 520px) {

    .kh-dashboard-filter {
        padding: 14px;
    }

    .kh-filter-header {
        padding-bottom: 14px;
        margin-bottom: 14px;
    }

    .kh-filter-options {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .kh-filter-btn {
        min-height: 44px;
    }

}


/* =========================================================
   MOBILE TABLE HORIZONTAL SCROLL
   ========================================================= */

.kh-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    min-width: 0;
}

/* Keep the table wide enough to remain readable */
.kh-table-wrap table {
    width: 100%;
    min-width: 700px;
    border-collapse: collapse;
    margin: 0;
}

.kh-table-wrap::-webkit-scrollbar {
    height: 6px;
}
.kh-table-wrap::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* Mobile */
@media (max-width: 768px) {

    .kh-table-wrap {
        overflow-x: auto;
        overflow-y: hidden;
        width: 100%;
        max-width: 100%;
    }

    .kh-table-wrap table {
        min-width: 700px;
    }

}

/* =========================================================
   FINAL SCROLL FIX — must be last
   ========================================================= */

/* Table itself must not clip its parent's scroll */
.kh-table-wrap > #result_list {
    overflow: visible !important;
    width: max-content !important;
    min-width: 700px !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    border: none !important;
}

/* Wrapper must scroll */
.kh-table-wrap {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    max-width: 100% !important;
    width: 100% !important;
}

@media (max-width: 768px) {

    .change-list .results,
    #changelist-form .results {
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .change-list .results #result_list,
    #changelist-form .results #result_list {
        min-width: 900px !important;
        width: max-content !important;
        overflow: visible !important;
        table-layout: auto !important;
        white-space: nowrap;
    }
}

#result_list {
    overflow: visible !important;
}

/* .module must NOT clip the scroll container inside it */
.module {
    overflow: visible !important;
}

/* =========================================================
   DASHBOARD TABLE SCROLL — NUCLEAR OPTION
   ========================================================= */

html body .kh-dashboard .kh-table-wrap {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
}

html body .kh-dashboard .kh-table-wrap > table,
html body .kh-dashboard .kh-table-wrap > table#result_list {
    display: table !important;
    width: max-content !important;
    min-width: 700px !important;
    max-width: none !important;
    table-layout: auto !important;
    overflow: visible !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

html body .kh-dashboard .kh-table-wrap > table#result_list td,
html body .kh-dashboard .kh-table-wrap > table#result_list th {
    white-space: nowrap !important;
}



/* =========================================================
   SEARCH BAR — ABSOLUTE FINAL FIX
   ========================================================= */

@media (max-width: 768px) {

    /* Force the entire search block to stack vertically */
    html body #changelist-search,
    html body .change-list #changelist-search,
    html body #changelist-form #changelist-search {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        overflow: visible !important;
    }

    /* Every direct child stretches to full width */
    html body #changelist-search > * {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
        box-sizing: border-box !important;
        margin: 0 !important;
    }

    /* The text input — full width */
    html body #changelist-search input[type="text"],
    html body #changelist-search input[type="search"] {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: 46px !important;
        box-sizing: border-box !important;
        padding: 10px 12px !important;
        font-size: 16px !important;
        margin: 0 !important;
    }


    
    /* The search submit button — full width, ALWAYS */
    html body #changelist-search input[type="submit"],
    html body #changelist-search button[type="submit"],
    html body #changelist-search button {
        display: inline-block !important;
        width: auto !important;
        max-width: none !important;
        min-width: 100px !important;
        height: 42px !important;
        box-sizing: border-box !important;
        padding: 10px 22px !important;
        font-size: 14px !important;
        text-align: center !important;
        align-self: flex-end !important;
        margin: 0 !important;
        border-radius: 8px !important;
        background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%) !important;
        color: #ffffff !important;
        font-weight: 600 !important;
        border: none !important;
    }
}



/* =========================================================
   SEARCH BAR — FINAL FIX (matches Django 5.x markup)
   ========================================================= */

/* 1. Make the form itself a full-width flex container */
html body #changelist-search {
    display: flex !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    align-items: center !important;
}

/* 2. Make the WRAPPER DIV fill the form and lay out in a row */
html body #changelist-search > div {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

/* 3. Hide the label (magnifier icon) — the input has its own styling */
html body #changelist-search label {
    display: none !important;
}

/* 4. The text input grows to fill the remaining space */
html body #changelist-search input[type="text"] {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    height: 42px !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    color: #0f172a !important;
    margin: 0 !important;
}

/* 5. The search button — compact, stays on the right */
html body #changelist-search input[type="submit"] {
    flex: 0 0 auto !important;
    display: inline-block !important;
    width: auto !important;
    min-width: 100px !important;
    max-width: none !important;
    height: 42px !important;
    box-sizing: border-box !important;
    padding: 10px 22px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-align: center !important;
    border-radius: 8px !important;
    background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%) !important;
    color: #ffffff !important;
    border: none !important;
    cursor: pointer !important;
    margin: 0 !important;
    /* Push it to the right edge if there's spare space */
    margin-left: auto !important;
}


/* =========================================================
   MOBILE — stack vertically, button aligned right
   ========================================================= */

@media (max-width: 768px) {

    html body #changelist-search {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        gap: 8px !important;
    }

    html body #changelist-search > div {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    html body #changelist-search input[type="text"] {
        flex: 0 0 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: 46px !important;
        font-size: 16px !important;
        margin: 0 !important;
    }

    html body #changelist-search input[type="submit"] {
        flex: 0 0 auto !important;
        display: block !important;
        width: auto !important;
        min-width: 100px !important;
        max-width: none !important;
        height: 42px !important;
        box-sizing: border-box !important;
        padding: 10px 22px !important;
        font-size: 14px !important;
        /* Align to the RIGHT on mobile */
        align-self: flex-end !important;
        margin: 0 !important;
        margin-left: auto !important;
    }
}

/* =========================================================
   DATE HIERARCHY BREADCRUMB (nav.toplinks)
   ========================================================= */

html body #changelist nav.toplinks {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px 14px !important;
    background: #f9fafb !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    margin-bottom: 14px !important;
    box-sizing: border-box !important;
    font-size: 13px !important;
}

html body #changelist nav.toplinks a {
    display: inline-block !important;
    padding: 6px 12px !important;
    border-radius: 6px !important;
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    color: #2563eb !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    transition: background 0.15s ease, border-color 0.15s ease !important;
}

html body #changelist nav.toplinks a:hover {
    background: #eff6ff !important;
    border-color: #bfdbfe !important;
}

html body #changelist nav.toplinks a.date-back {
    color: #6b7280 !important;
}


/* =========================================================
   BULK-ACTIONS "GO" BUTTON  (button.button[type=submit])
   ========================================================= */

html body #changelist .actions button.button,
html body #changelist .actions button[type="submit"],
html body #changelist-form .actions button.button,
html body #changelist-form .actions button[type="submit"] {
    display: inline-block !important;
    width: auto !important;
    min-width: 90px !important;
    max-width: none !important;
    height: 42px !important;
    box-sizing: border-box !important;
    padding: 10px 22px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-align: center !important;
    border-radius: 8px !important;
    background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%) !important;
    color: #ffffff !important;
    border: none !important;
    cursor: pointer !important;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35) !important;
    transition: transform 0.15s ease, box-shadow 0.2s ease !important;
    margin: 0 !important;                 /* ← NO margin-left: auto on desktop */
    flex-shrink: 0 !important;            /* ← prevents shrinking */
}

html body #changelist .actions button.button:hover,
html body #changelist .actions button[type="submit"]:hover,
html body #changelist-form .actions button.button:hover,
html body #changelist-form .actions button[type="submit"]:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.5) !important;
}


/* =========================================================
   BULK-ACTIONS BAR — prevent overflow on desktop
   ========================================================= */

html body #changelist .actions,
html body #changelist-form .actions {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 10px 14px !important;
    background: #f9fafb !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    margin-bottom: 14px !important;
    overflow: hidden !important;          /* ← clips anything trying to escape */
}

html body #changelist .actions select,
html body #changelist-form .actions select {
    max-width: 100% !important;
    box-sizing: border-box !important;
    flex-shrink: 1 !important;            /* ← can shrink if needed */
    min-width: 0 !important;
}


/* =========================================================
   MOBILE — stack vertically, Go button right-aligned
   ========================================================= */

@media (max-width: 768px) {

    html body #changelist .actions,
    html body #changelist-form .actions {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        padding: 10px 12px !important;
    }

    html body #changelist .actions label,
    html body #changelist-form .actions label {
        font-size: 12px !important;
    }

    html body #changelist .actions select,
    html body #changelist-form .actions select {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: 44px !important;
        font-size: 15px !important;
    }

    html body #changelist .actions button.button,
    html body #changelist .actions button[type="submit"],
    html body #changelist-form .actions button.button,
    html body #changelist-form .actions button[type="submit"] {
        display: block !important;
        width: auto !important;
        min-width: 100px !important;
        max-width: none !important;
        height: 42px !important;
        /* ONLY on mobile: push it to the right */
        align-self: flex-end !important;
        margin-left: auto !important;
        margin-right: 0 !important;
    }
}


/* =========================================================
   APP LIST (dashboard — bottom section)
   ========================================================= */

.kh-app-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kh-app-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.kh-app-card h3 {
    margin: 0 0 12px 0;
    padding: 0 0 10px 0;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    border-bottom: 1px solid #f1f5f9;
}

/* Kill the bullets — CRITICAL */
.kh-app-card ul,
.kh-app-card ul li {
    list-style: none !important;
    list-style-type: none !important;
    list-style-image: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.kh-app-card ul li::before,
.kh-app-card ul li::marker {
    content: none !important;
    display: none !important;
}

.kh-app-card li {
    padding: 6px 0 !important;
    margin: 0 !important;
    border-bottom: 1px solid #f8fafc;
}

.kh-app-card li:last-child {
    border-bottom: none;
}

.kh-app-card a {
    color: var(--kh-primary) !important;
    font-weight: 500;
    text-decoration: none !important;
    font-size: 14px;
    transition: color 0.15s ease;
    display: inline-block;
    padding: 2px 0;
}

.kh-app-card a:hover {
    color: var(--kh-primary-dark) !important;
    text-decoration: underline !important;
}


/* =========================================================
   NET POSITION CARD (dashboard)
   ========================================================= */

.kh-icon-slate {
    background: #e2e8f0;
    color: #334155;
}

.kh-stat-card-net {
    align-items: flex-start !important;
}

.kh-stat-card-net .kh-stat-icon {
    margin-top: 4px;
}

.kh-net-body {
    gap: 4px !important;
}

/* Two sub-lines: Receivable + Payable */
.kh-net-lines {
    display: flex !important;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    font-size: 11.5px !important;
}

.kh-net-line {
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.3;
}

.kh-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    flex-shrink: 0;
}

.kh-dot-green { background: #10b981; }
.kh-dot-red   { background: #ef4444; }

.kh-net-tag {
    color: #6b7280;
    font-weight: 600;
    font-size: 10.5px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.kh-net-amounts {
    color: #111827;
    font-weight: 600;
    font-size: 11.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kh-net-amounts.muted {
    color: #9ca3af;
    font-weight: 500;
}

/* Mobile — allow wrapping */
@media (max-width: 768px) {
    .kh-net-lines {
        font-size: 12px !important;
    }
    .kh-net-amounts {
        font-size: 12px !important;
    }
}

.kh-icon-indigo {
    background: #e0e7ff;
    color: #4338ca;
}

/* =========================================================
   DASHBOARD — allow multi-line sub-text on specific cards
   (Personal Loans + Net Position — because they have
   multiple currencies that may not fit on one line)
   ========================================================= */

.kh-stat-card-loans .kh-stat-sub,
.kh-stat-card-net .kh-stat-sub,
.kh-stat-card-net .kh-net-lines {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    line-height: 1.4 !important;
}

/* Give the sub-text a bit of breathing room */
.kh-stat-card-loans .kh-stat-sub {
    margin-top: 4px;
}

/* The Net Position card's two sub-lines already stack;
   make sure each line can wrap to multiple rows if needed */
.kh-stat-card-net .kh-net-line {
    flex-wrap: wrap;
    row-gap: 2px;
}

.kh-stat-card-net .kh-net-amounts {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    line-height: 1.4 !important;
    word-break: break-word;
}



/* =========================================================
   CLICKABLE STAT CARDS — Net Position + Personal Loans
   ========================================================= */

.kh-stat-card-link {
    text-decoration: none !important;
    color: inherit !important;
    cursor: pointer;
    transition: box-shadow 0.15s ease, transform 0.15s ease,
                border-color 0.15s ease !important;
}

.kh-stat-card-link:hover {
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12) !important;
    transform: translateY(-2px);
    border-color: #cbd5e1 !important;
}

.kh-stat-card-link:active {
    transform: translateY(0);
}

.kh-stat-card-link:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.35);
    outline-offset: 2px;
}

/* Keep all inner text using the original color — no blue link color */
.kh-stat-card-link .kh-stat-label,
.kh-stat-card-link .kh-stat-value,
.kh-stat-card-link .kh-stat-sub,
.kh-stat-card-link .kh-net-tag,
.kh-stat-card-link .kh-net-amounts {
    text-decoration: none !important;
}



#nav-filter { display: none !important; }