/* ============================================================
 * panel-polish.css — Notion-style studio overlay
 *
 * Loaded AFTER panel-v2.css. Additive only — no data-style
 * attribute, no theme picker. Notion aesthetic applied on top
 * of existing Office Style + 5-palette system.
 *
 * Scope:
 *   - Typography (Inter only, no Manrope)
 *   - Body / page canvas (warm off-white)
 *   - Sidebar (warm white, hairline border, hover bg)
 *   - Top header / topbar (flat, border-bottom only)
 *   - Cards (white-on-warm-bg, hairline border, generous padding)
 *   - Buttons (Notion-style — solid charcoal CTA, ghost secondary)
 *   - Tables (clean rows, hairline divider, subtle row hover)
 *   - Forms (subtle borders, smooth focus rings)
 *   - Page fade-in + micro-interactions
 *
 * All effects respect prefers-reduced-motion.
 * ============================================================ */

/* ── Notion Design Tokens ─────────────────────────────────── */
:root {
    /* Light mode (Notion's signature warm white) */
    --notion-bg-canvas: #f7f6f3;
    --notion-bg-surface: #ffffff;
    --notion-bg-hover: rgba(55, 53, 47, 0.06);
    --notion-bg-active: rgba(55, 53, 47, 0.08);
    --notion-text-primary: #37352f;
    --notion-text-secondary: #787774;
    --notion-text-tertiary: #9b9a97;
    --notion-border: rgba(55, 53, 47, 0.09);
    --notion-border-strong: rgba(55, 53, 47, 0.16);
    --notion-accent-bg: rgba(35, 131, 226, 0.07);
    --notion-shadow-sm: 0 1px 2px rgba(15, 15, 15, 0.07);
    --notion-shadow:
        rgba(15, 15, 15, 0.04) 0px 0px 0px 1px,
        rgba(15, 15, 15, 0.03) 0px 3px 6px,
        rgba(15, 15, 15, 0.06) 0px 9px 24px;
    --notion-radius: 6px;
    --notion-radius-lg: 10px;
}

html[data-theme="dark"] {
    /* Notion dark mode (their actual app uses #191919 canvas, #2f2f2f surface) */
    --notion-bg-canvas: #191919;
    --notion-bg-surface: #2f2f2f;
    --notion-bg-hover: rgba(255, 255, 255, 0.055);
    --notion-bg-active: rgba(255, 255, 255, 0.08);
    --notion-text-primary: #e7e5e2;
    --notion-text-secondary: rgba(255, 255, 255, 0.6);
    --notion-text-tertiary: rgba(255, 255, 255, 0.4);
    --notion-border: rgba(255, 255, 255, 0.094);
    --notion-border-strong: rgba(255, 255, 255, 0.16);
    --notion-accent-bg: rgba(35, 131, 226, 0.18);
    --notion-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --notion-shadow:
        rgba(0, 0, 0, 0.4) 0px 0px 0px 1px,
        rgba(0, 0, 0, 0.3) 0px 3px 6px,
        rgba(0, 0, 0, 0.5) 0px 9px 24px;
}

/* ── Typography (Inter only) ──────────────────────────────── */
html:not([data-font-family]) body,
html[data-font-family="default"] body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif !important;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.003em;
    color: var(--notion-text-primary);
}

html:not([data-font-family]) h1,
html:not([data-font-family]) h2,
html:not([data-font-family]) h3,
html:not([data-font-family]) h4,
html:not([data-font-family]) h5,
html:not([data-font-family]) h6,
html[data-font-family="default"] h1,
html[data-font-family="default"] h2,
html[data-font-family="default"] h3,
html[data-font-family="default"] h4,
html[data-font-family="default"] h5,
html[data-font-family="default"] h6 {
    font-family: 'Inter', system-ui, sans-serif !important;
    font-weight: 700;
    letter-spacing: -0.022em;
    color: var(--notion-text-primary);
}

html:not([data-font-family]) .page-title,
html:not([data-font-family]) .breadcrumb-current,
html[data-font-family="default"] .page-title,
html[data-font-family="default"] .breadcrumb-current {
    font-family: 'Inter', system-ui, sans-serif !important;
    font-weight: 600;
    letter-spacing: -0.018em;
}

/* ── Body / page canvas (warm off-white) ──────────────────── */
html[data-theme="light"] body {
    background: var(--notion-bg-canvas) !important;
    color: var(--notion-text-primary) !important;
}
html[data-theme="dark"] body {
    background: var(--notion-bg-canvas) !important;
    color: var(--notion-text-primary) !important;
}
/* Kill the ambient gradient blobs in dark mode (Notion is flatter) */
html[data-theme="dark"] body::before {
    opacity: 0.4;
}

/* ── 1. Sidebar wrapper + card (warm white, hairline border) ── */
/* `.col-md-3.pt-3` is the outer flex column that wraps the sidebar
   card. panel-v2.css sets it to dark navy — flatten to the page canvas. */
.col-md-3.pt-3 {
    background: var(--notion-bg-canvas) !important;
    background-image: none !important;
    border-right: 1px solid var(--notion-border) !important;
}
.left-sidebar-card {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    border-radius: var(--notion-radius-lg) !important;
    box-shadow: var(--notion-shadow-sm) !important;
}

.sidebar-link {
    color: var(--notion-text-secondary) !important;
    border-radius: var(--notion-radius) !important;
    padding: 0.35rem 0.6rem !important;
    font-weight: 500;
    transition:
        background-color 120ms ease,
        color 120ms ease !important;
}

.sidebar-link:hover {
    background: var(--notion-bg-hover) !important;
    color: var(--notion-text-primary) !important;
    transform: none !important;  /* Notion has no transform tricks */
}

.sidebar-link.active {
    background: var(--notion-bg-active) !important;
    color: var(--notion-text-primary) !important;
    font-weight: 600 !important;
    box-shadow: none !important;
}

.sidebar-link.active i,
.sidebar-link.active .icon-label > i:first-child {
    color: var(--notion-text-primary) !important;
}

/* ── 2. Top header / topbar (flat, border-bottom only) ───── */
.top-menu-card {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    border-radius: var(--notion-radius-lg) !important;
    box-shadow: var(--notion-shadow-sm) !important;
}
html[data-theme="light"] .top-menu-card,
html[data-theme="dark"] .top-menu-card {
    background: var(--notion-bg-surface) !important;
    border-color: var(--notion-border) !important;
    background-image: none !important;
}

.top-menu-card .card-body {
    padding: 0.5rem 0.85rem !important;
}

/* Breadcrumb */
.panel-breadcrumb {
    background: transparent;
    font-size: 0.85rem;
}
.panel-breadcrumb .breadcrumb-item a {
    color: var(--notion-text-secondary) !important;
    transition: color 150ms ease;
}
.panel-breadcrumb .breadcrumb-item a:hover {
    color: var(--notion-text-primary) !important;
    text-decoration: none;
}
.panel-breadcrumb .breadcrumb-item.active {
    color: var(--notion-text-primary) !important;
    font-weight: 500;
}
.panel-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    color: var(--notion-text-tertiary) !important;
}

/* ── 3. Cards (pure white on warm bg, hairline border) ──── */
html[data-theme="light"] .card,
html[data-theme="dark"] .card {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    border-radius: var(--notion-radius-lg) !important;
    box-shadow: var(--notion-shadow-sm) !important;
    color: var(--notion-text-primary) !important;
    transition:
        box-shadow 200ms ease,
        border-color 200ms ease !important;
}

html[data-theme="light"] .card:hover,
html[data-theme="dark"] .card:hover {
    box-shadow:
        rgba(15, 15, 15, 0.04) 0px 0px 0px 1px,
        rgba(15, 15, 15, 0.04) 0px 3px 6px !important;
    transform: none !important;
}

.card-body {
    padding: 1.25rem 1.35rem !important;
    color: var(--notion-text-primary);
}

.card-header {
    background: transparent !important;
    border-bottom: 1px solid var(--notion-border) !important;
    padding: 0.85rem 1.35rem !important;
    color: var(--notion-text-primary) !important;
    font-weight: 600;
}

.card-title,
.card-header h5,
.card-header h6 {
    color: var(--notion-text-primary) !important;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Form shell (form-card style) */
.form-shell,
.form-card,
.panel-card {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    border-radius: var(--notion-radius-lg) !important;
    box-shadow: var(--notion-shadow-sm) !important;
}

.panel-card-copy {
    color: var(--notion-text-secondary);
}

/* ── 4. Buttons (Notion CTA — solid charcoal, ghost secondary) ── */
.btn-primary {
    background: var(--notion-text-primary) !important;
    border: 1px solid var(--notion-text-primary) !important;
    color: var(--notion-bg-surface) !important;
    border-radius: var(--notion-radius) !important;
    font-weight: 500 !important;
    padding: 0.45rem 0.95rem !important;
    box-shadow: var(--notion-shadow-sm) !important;
    transition:
        background-color 140ms ease,
        border-color 140ms ease,
        box-shadow 180ms ease !important;
}

.btn-primary:hover:not(:disabled):not(.disabled) {
    background: #2f2c25 !important;
    border-color: #2f2c25 !important;
    color: #ffffff !important;
    transform: none !important;
    box-shadow:
        0 1px 2px rgba(15, 15, 15, 0.1),
        0 2px 6px rgba(15, 15, 15, 0.08) !important;
}

html[data-theme="dark"] .btn-primary {
    background: #ffffff !important;
    border-color: #ffffff !important;
    color: #191919 !important;
}
html[data-theme="dark"] .btn-primary:hover:not(:disabled):not(.disabled) {
    background: #e7e5e2 !important;
    border-color: #e7e5e2 !important;
}

.btn-primary:active:not(:disabled):not(.disabled) {
    transform: none !important;
    box-shadow: var(--notion-shadow-sm) !important;
}

/* Save button (form CTAs) */
.btn-save {
    background: var(--notion-text-primary) !important;
    border-color: var(--notion-text-primary) !important;
    color: var(--notion-bg-surface) !important;
    border-radius: var(--notion-radius) !important;
    font-weight: 500;
    box-shadow: var(--notion-shadow-sm) !important;
}
html[data-theme="dark"] .btn-save {
    background: #ffffff !important;
    border-color: #ffffff !important;
    color: #191919 !important;
}

/* Ghost / soft-add button — Notion secondary style */
.btn-soft-add,
.btn-filter-apply {
    background: transparent !important;
    color: var(--notion-text-primary) !important;
    border: 1px solid var(--notion-border-strong) !important;
    border-radius: var(--notion-radius) !important;
    font-weight: 500;
    transition: background-color 140ms ease, border-color 140ms ease !important;
}
.btn-soft-add:hover,
.btn-filter-apply:hover {
    background: var(--notion-bg-hover) !important;
    border-color: var(--notion-border-strong) !important;
    transform: none !important;
}

/* Outline buttons → Notion ghost */
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-light,
.btn-outline-dark {
    background: transparent !important;
    color: var(--notion-text-primary) !important;
    border: 1px solid var(--notion-border-strong) !important;
    border-radius: var(--notion-radius) !important;
    font-weight: 500;
}
.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-outline-light:hover,
.btn-outline-dark:hover {
    background: var(--notion-bg-hover) !important;
    border-color: var(--notion-border-strong) !important;
    color: var(--notion-text-primary) !important;
    transform: none !important;
}

/* Success / Danger / Warning — keep semantic colors but Notion shape */
.btn-success,
.btn-danger,
.btn-warning,
.btn-info {
    border-radius: var(--notion-radius) !important;
    font-weight: 500;
    box-shadow: var(--notion-shadow-sm) !important;
}
.btn-success:hover, .btn-danger:hover, .btn-warning:hover, .btn-info:hover {
    transform: none !important;
}

/* ── 5. Tables (clean rows, hairline divider, subtle hover) ── */
.table {
    color: var(--notion-text-primary);
    border-color: var(--notion-border) !important;
}

.table thead th,
.table-modern thead th,
html[data-theme="light"] .table thead th,
html[data-theme="dark"] .table thead th {
    background: var(--notion-bg-canvas) !important;
    color: var(--notion-text-secondary) !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 600 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-size: 0.78rem !important;
    border-bottom: 1px solid var(--notion-border-strong) !important;
    padding: 0.6rem 0.85rem !important;
}

.table tbody td,
.table-modern tbody td {
    background: var(--notion-bg-surface) !important;
    color: var(--notion-text-primary) !important;
    border-color: var(--notion-border) !important;
    padding: 0.55rem 0.85rem !important;
    font-size: 0.9rem;
}

.table-modern tbody tr:hover,
.table tbody tr:hover {
    background: var(--notion-bg-hover) !important;
    box-shadow: none !important;
}
.table-modern tbody tr:hover td,
.table tbody tr:hover td {
    background: var(--notion-bg-hover) !important;
}

/* Striped tables — Notion doesn't stripe, just uses dividers */
.table-striped tbody tr:nth-of-type(odd) td {
    background: var(--notion-bg-surface) !important;
}

/* ── Form controls (subtle Notion borders) ────────────────── */
.form-control,
.form-select,
textarea.form-control {
    background: var(--notion-bg-surface) !important;
    color: var(--notion-text-primary) !important;
    border: 1px solid var(--notion-border-strong) !important;
    border-radius: var(--notion-radius) !important;
    padding: 0.5rem 0.7rem !important;
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease,
        background-color 160ms ease;
}

.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
    background: var(--notion-bg-surface) !important;
    border-color: rgba(35, 131, 226, 0.55) !important;
    box-shadow: 0 0 0 3px rgba(35, 131, 226, 0.12) !important;
    outline: none !important;
}

.form-control::placeholder {
    color: var(--notion-text-tertiary);
    opacity: 0.85;
}

.form-label {
    color: var(--notion-text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}

/* ── Modals (Notion-style) ────────────────────────────────── */
.modal-content {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    border-radius: var(--notion-radius-lg) !important;
    box-shadow: var(--notion-shadow) !important;
    color: var(--notion-text-primary);
}
.modal-header {
    border-bottom: 1px solid var(--notion-border) !important;
    background: transparent !important;
}
.modal-footer {
    border-top: 1px solid var(--notion-border) !important;
    background: transparent !important;
}
.modal-title {
    color: var(--notion-text-primary) !important;
    font-weight: 600;
}

/* ── Dropdowns ─────────────────────────────────────────────── */
.dropdown-menu {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    border-radius: var(--notion-radius) !important;
    box-shadow: var(--notion-shadow) !important;
    padding: 0.3rem !important;
}
.dropdown-item {
    color: var(--notion-text-primary) !important;
    border-radius: 4px !important;
    padding: 0.4rem 0.6rem !important;
    font-size: 0.88rem;
}
.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--notion-bg-hover) !important;
    color: var(--notion-text-primary) !important;
}
.dropdown-divider {
    border-top: 1px solid var(--notion-border);
    margin: 0.3rem 0;
}

/* ── Badges (Notion uses soft, contained colors) ─────────── */
.badge {
    font-weight: 500 !important;
    border-radius: 4px !important;
    padding: 0.2em 0.45em !important;
    font-size: 0.72rem !important;
}

/* ── Alerts (clean, contained) ────────────────────────────── */
.alert {
    border-radius: var(--notion-radius) !important;
    border-width: 1px !important;
    padding: 0.7rem 0.95rem !important;
    font-size: 0.88rem;
}

/* ── List groups ──────────────────────────────────────────── */
.list-group-item {
    background: var(--notion-bg-surface) !important;
    border-color: var(--notion-border) !important;
    color: var(--notion-text-primary) !important;
}
.list-group-item:hover {
    background: var(--notion-bg-hover) !important;
}
.list-group-item.active {
    background: var(--notion-bg-active) !important;
    border-color: var(--notion-border-strong) !important;
    color: var(--notion-text-primary) !important;
    font-weight: 600;
}

/* ── Page fade-in (kept from previous polish) ─────────────── */
@keyframes td-polish-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
main,
.container.soft-enter,
.col-md-9.pt-3 {
    animation: td-polish-fade-in 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ============================================================
 * AUDIT FIXES (Round 2) — selectors discovered from panel-v2.css
 * Soft buttons, action icons, form validation, status chips,
 * avatars, popovers, offcanvas, spinners, filter chips, tag
 * pills, alert action buttons.
 * ============================================================ */

/* ── Soft buttons (secondary CTA family) ─────────────────── */
.btn-soft-secondary {
    background: transparent !important;
    color: var(--notion-text-primary) !important;
    border: 1px solid var(--notion-border-strong) !important;
    border-radius: var(--notion-radius) !important;
    font-weight: 500;
}
.btn-soft-secondary:hover {
    background: var(--notion-bg-hover) !important;
    color: var(--notion-text-primary) !important;
    border-color: var(--notion-border-strong) !important;
    transform: none !important;
}

/* ── Action icon buttons (table row actions, toolbar) ────── */
.btn-icon,
.row-action-btn {
    background: transparent !important;
    color: var(--notion-text-secondary) !important;
    border: 1px solid transparent !important;
    border-radius: var(--notion-radius) !important;
    transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}
.btn-icon:hover,
.row-action-btn:hover {
    background: var(--notion-bg-hover) !important;
    color: var(--notion-text-primary) !important;
    border-color: var(--notion-border) !important;
    transform: none !important;
}

/* ── Form validation states (Notion soft semantic) ──────── */
.form-control.is-valid,
.form-select.is-valid,
.was-validated .form-control:valid,
.was-validated .form-select:valid {
    border-color: #1e8449 !important;
    background-image: none !important;
    box-shadow: 0 0 0 3px rgba(30, 132, 73, 0.1) !important;
}
.form-control.is-invalid,
.form-select.is-invalid,
.was-validated .form-control:invalid,
.was-validated .form-select:invalid {
    border-color: #b54141 !important;
    background-image: none !important;
    box-shadow: 0 0 0 3px rgba(181, 65, 65, 0.1) !important;
}
.valid-feedback {
    color: #1e8449 !important;
    font-size: 0.78rem;
}
.invalid-feedback {
    color: #b54141 !important;
    font-size: 0.78rem;
}

/* ── Status chips (Notion soft contained pills) ──────────── */
.status-chip {
    background: var(--notion-bg-hover) !important;
    color: var(--notion-text-primary) !important;
    border-radius: 999px !important;
    padding: 0.18rem 0.55rem !important;
    font-size: 0.72rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
}
.status-chip-ok {
    background: rgba(30, 132, 73, 0.1) !important;
    color: #1e8449 !important;
}
.status-chip-warn {
    background: rgba(180, 95, 0, 0.1) !important;
    color: #b45f00 !important;
}
.status-chip-danger {
    background: rgba(181, 65, 65, 0.1) !important;
    color: #b54141 !important;
}
.status-chip-info {
    background: rgba(35, 131, 226, 0.1) !important;
    color: #2383e2 !important;
}

/* ── Avatars (Notion warm bg + hairline) ─────────────────── */
.avatar,
.user-avatar,
.sidebar-user-avatar {
    background: var(--notion-bg-hover) !important;
    border: 1px solid var(--notion-border) !important;
    color: var(--notion-text-primary) !important;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
}

/* ── Popovers ─────────────────────────────────────────────── */
.popover {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    border-radius: var(--notion-radius-lg) !important;
    box-shadow: var(--notion-shadow) !important;
    font-family: 'Inter', sans-serif;
}
.popover-header {
    background: transparent !important;
    border-bottom: 1px solid var(--notion-border) !important;
    color: var(--notion-text-primary) !important;
    font-weight: 600;
}
.popover-body {
    color: var(--notion-text-primary) !important;
}

/* ── Offcanvas (mobile drawer) ───────────────────────────── */
.offcanvas {
    background: var(--notion-bg-surface) !important;
    border-color: var(--notion-border) !important;
    color: var(--notion-text-primary) !important;
}
.offcanvas-header {
    border-bottom: 1px solid var(--notion-border) !important;
}
.offcanvas-title {
    color: var(--notion-text-primary) !important;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
}

/* ── Spinners ─────────────────────────────────────────────── */
.spinner-border,
.spinner-grow {
    color: var(--notion-text-primary) !important;
}
html[data-theme="dark"] .spinner-border,
html[data-theme="dark"] .spinner-grow {
    color: #ffffff !important;
}

/* ── Column visibility chip (table column toggle) ────────── */
.td-colvis-chip {
    background: var(--notion-bg-hover) !important;
    border: 1px solid var(--notion-border-strong) !important;
    color: var(--notion-text-secondary) !important;
    border-radius: var(--notion-radius) !important;
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
}
.td-colvis-chip:hover {
    background: var(--notion-bg-active) !important;
    color: var(--notion-text-primary) !important;
}

/* ── Dashboard chips (.dash-chip-*) ─────────────────────── */
.dash-chip-primary {
    background: rgba(35, 131, 226, 0.1) !important;
    color: #2383e2 !important;
    border-radius: 999px !important;
    font-weight: 500;
}
.dash-chip-warning {
    background: rgba(180, 95, 0, 0.1) !important;
    color: #b45f00 !important;
    border-radius: 999px !important;
    font-weight: 500;
}
.dash-chip-danger {
    background: rgba(181, 65, 65, 0.1) !important;
    color: #b54141 !important;
    border-radius: 999px !important;
    font-weight: 500;
}
.dash-chip-success {
    background: rgba(30, 132, 73, 0.1) !important;
    color: #1e8449 !important;
    border-radius: 999px !important;
    font-weight: 500;
}

/* ── Form check (checkbox / radio) ──────────────────────── */
.form-check-input {
    border-color: var(--notion-border-strong) !important;
    background-color: var(--notion-bg-surface) !important;
}
.form-check-input:checked {
    background-color: var(--notion-text-primary) !important;
    border-color: var(--notion-text-primary) !important;
}
html[data-theme="dark"] .form-check-input:checked {
    background-color: #ffffff !important;
    border-color: #ffffff !important;
}
.form-check-input:focus {
    border-color: rgba(35, 131, 226, 0.55) !important;
    box-shadow: 0 0 0 3px rgba(35, 131, 226, 0.12) !important;
}

/* Form switch (toggle) */
.form-switch .form-check-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3E%3Ccircle r='3' fill='%23787774'/%3E%3C/svg%3E") !important;
}
.form-switch .form-check-input:checked {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3E%3Ccircle r='3' fill='%23ffffff'/%3E%3C/svg%3E") !important;
}

/* ── Tag pills (resource type indicators) ──────────────── */
.tag-hardware,
.tag-payment,
.tag-license,
.tag-support,
.tag-customer,
.tag-employee {
    background: var(--notion-bg-hover) !important;
    color: var(--notion-text-primary) !important;
    border-radius: 999px !important;
    padding: 0.18rem 0.55rem !important;
    font-size: 0.7rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    border: 1px solid transparent !important;
}
/* Light semantic tints per type — kept restrained */
.tag-hardware { background: rgba(35, 131, 226, 0.08) !important; color: #2383e2 !important; }
.tag-payment  { background: rgba(30, 132, 73, 0.08) !important; color: #1e8449 !important; }
.tag-license  { background: rgba(180, 95, 0, 0.08) !important; color: #b45f00 !important; }
.tag-support  { background: rgba(35, 131, 226, 0.08) !important; color: #2383e2 !important; }

/* ── Alert action button (within alert components) ──────── */
.alert-action-btn {
    background: transparent !important;
    border: 1px solid var(--notion-border-strong) !important;
    color: var(--notion-text-primary) !important;
    border-radius: var(--notion-radius) !important;
    font-weight: 500;
}
.alert-action-btn:hover {
    background: var(--notion-bg-hover) !important;
    border-color: var(--notion-border-strong) !important;
}

/* ── Search box / filter bar wrappers ──────────────────── */
.search-box,
.search-bar,
.filter-row,
.toolbar-row {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    border-radius: var(--notion-radius-lg) !important;
    padding: 0.6rem 0.85rem;
}

/* ── Status dots / connection indicators ────────────────── */
.topbar-status-dot,
.h-status-dot-sm {
    box-shadow: 0 0 0 2px var(--notion-bg-surface) !important;
}

/* ── Accordion ─────────────────────────────────────────── */
.accordion-item {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    border-radius: var(--notion-radius) !important;
    color: var(--notion-text-primary) !important;
}
.accordion-button {
    background: var(--notion-bg-surface) !important;
    color: var(--notion-text-primary) !important;
    font-weight: 500;
    border-radius: var(--notion-radius) !important;
    box-shadow: none !important;
}
.accordion-button:not(.collapsed) {
    background: var(--notion-bg-hover) !important;
    color: var(--notion-text-primary) !important;
    box-shadow: inset 0 -1px 0 var(--notion-border) !important;
}
.accordion-button:focus {
    border-color: rgba(35, 131, 226, 0.55) !important;
    box-shadow: 0 0 0 3px rgba(35, 131, 226, 0.12) !important;
}
.accordion-body {
    background: var(--notion-bg-surface) !important;
    color: var(--notion-text-primary) !important;
}

/* ── Chart canvas wrappers ───────────────────────────────── */
.chart-wrapper,
.canvas-wrapper,
[class*="chart-card"] {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    border-radius: var(--notion-radius-lg) !important;
}

/* ── Toast container position helper (no visual) ─────────── */
.toast-container {
    z-index: 10000;
}

/* ── File input (input type="file") ──────────────────────── */
.form-control[type="file"] {
    padding: 0.4rem 0.7rem !important;
}
.form-control[type="file"]::file-selector-button {
    background: var(--notion-bg-hover) !important;
    color: var(--notion-text-primary) !important;
    border: 1px solid var(--notion-border-strong) !important;
    border-radius: var(--notion-radius) !important;
    margin-right: 0.7rem;
    padding: 0.3rem 0.65rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    transition: background-color 140ms ease;
}
.form-control[type="file"]::file-selector-button:hover {
    background: var(--notion-bg-active) !important;
}

/* ── Close button (modal × icon) ─────────────────────────── */
.btn-close {
    opacity: 0.6;
    filter: none;
}
.btn-close:hover {
    opacity: 1;
}
html[data-theme="dark"] .btn-close {
    filter: invert(1) brightness(0.9);
}

/* ── Card body utility ───────────────────────────────────── */
.card-body.bg-light,
.card-body.bg-white {
    background: var(--notion-bg-surface) !important;
}

/* ============================================================
 * DASHBOARD WIDGETS (Notion overrides)
 * Dashboard-specific selectors discovered via DOM inspection:
 * .hero-mini-stat, .metric-*, .section-card-*, .kpi-*
 * ============================================================ */

/* Hero mini stats row (Aktif / Beklemede / Yaklaşan / Toplam) */
.hero-mini-stats {
    background: transparent !important;
    gap: 0.75rem;
}
.hero-mini-stat {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    border-radius: var(--notion-radius-lg) !important;
    color: var(--notion-text-primary) !important;
    box-shadow: var(--notion-shadow-sm) !important;
    padding: 0.85rem 1rem !important;
}
.hero-mini-stat .label,
.hero-mini-stat .stat-label,
.hero-mini-stat [class*="label"] {
    color: var(--notion-text-secondary) !important;
    font-weight: 500;
}
.hero-mini-stat .value,
.hero-mini-stat .stat-value,
.hero-mini-stat [class*="value"] {
    color: var(--notion-text-primary) !important;
    font-weight: 700;
}

/* Metric cards (Hurda Donanım, Toplam Personel, etc.) */
.metric-card,
.metric-top {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    border-radius: var(--notion-radius-lg) !important;
    color: var(--notion-text-primary) !important;
}
.metric-title,
.metric-label {
    color: var(--notion-text-secondary) !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 500;
}
.metric-value,
.metric-number {
    color: var(--notion-text-primary) !important;
    font-weight: 700;
}
.metric-foot,
.metric-footer {
    color: var(--notion-text-tertiary) !important;
    border-top: 1px solid var(--notion-border) !important;
}

/* KPI tiles */
.kpi-label {
    color: var(--notion-text-secondary) !important;
    font-family: 'Inter', sans-serif !important;
}
.kpi-value {
    color: var(--notion-text-primary) !important;
    font-weight: 700;
}
.kpi-card,
.kpi-tile {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    border-radius: var(--notion-radius-lg) !important;
    box-shadow: var(--notion-shadow-sm) !important;
}

/* Section cards (sub-panels inside dashboard) */
.section-card,
[class*="section-card"] {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    border-radius: var(--notion-radius-lg) !important;
    box-shadow: var(--notion-shadow-sm) !important;
}
.section-card-title {
    color: var(--notion-text-primary) !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.section-card-meta {
    color: var(--notion-text-secondary) !important;
}

/* Dashboard drag bar (widget reorder handle) */
.dash-drag-bar {
    background: transparent !important;
    color: var(--notion-text-tertiary) !important;
}

/* Trust badge items (used on dashboard / about page) */
.trust-badge-item {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    border-radius: var(--notion-radius) !important;
    color: var(--notion-text-primary) !important;
}

/* Inner stat tiles like "p-2 rounded text-center" with rgba indigo bg */
.p-2.rounded.text-center,
.rounded.text-center {
    background: var(--notion-bg-hover) !important;
    color: var(--notion-text-primary) !important;
    border-radius: var(--notion-radius) !important;
}

/* Sidebar internal panels — brand text / menu groups */
.sidebar-brand-main {
    color: var(--notion-text-primary) !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 700;
}
.sidebar-brand-sub,
.sidebar-brand-name,
.sidebar-entry,
.sidebar-main {
    color: var(--notion-text-secondary) !important;
}
.sidebar-brand-text-link:hover {
    background: var(--notion-bg-hover) !important;
}

/* Dashboard area "Genel Durum Özeti" hero — usually a wrapper with class */
.dashboard-hero,
.panel-hero,
.dashboard-header {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    border-radius: var(--notion-radius-lg) !important;
    box-shadow: var(--notion-shadow-sm) !important;
    color: var(--notion-text-primary) !important;
}

/* Charts area — chart card */
[class*="chart"] .card,
[class*="chart-card"] {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
}

/* Generic bg-* utility overrides that are dashboard-specific */
.bg-light,
.bg-body-tertiary,
.bg-white {
    background: var(--notion-bg-surface) !important;
}

/* ============================================================
 * REMAINING COMPONENTS (Notion overrides)
 * Trial banner, mobile topbar, install prompt, AI chat widget,
 * skip link, tooltips, pagination, nav-tabs, toasts, spotlight.
 * ============================================================ */

/* ── Trial / warning banner ──────────────────────────────── */
.td-trial-banner {
    background: rgba(255, 196, 0, 0.08) !important;
    color: #92400e !important;
    border: 1px solid rgba(255, 196, 0, 0.25) !important;
    border-radius: var(--notion-radius) !important;
    font-family: 'Inter', sans-serif;
}
.td-trial-banner a {
    color: #92400e !important;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}
.td-trial-urgent {
    background: rgba(239, 68, 68, 0.08) !important;
    color: #991b1b !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}
.td-trial-urgent a { color: #991b1b !important; }
html[data-theme="dark"] .td-trial-banner {
    background: rgba(251, 191, 36, 0.1) !important;
    color: #fbbf24 !important;
    border-color: rgba(251, 191, 36, 0.3) !important;
}
html[data-theme="dark"] .td-trial-banner a { color: #fcd34d !important; }
html[data-theme="dark"] .td-trial-urgent {
    background: rgba(248, 113, 113, 0.12) !important;
    color: #fca5a5 !important;
    border-color: rgba(248, 113, 113, 0.35) !important;
}
html[data-theme="dark"] .td-trial-urgent a { color: #fecaca !important; }

/* ── Mobile topbar (sticky top on mobile) ────────────────── */
.td-mobile-topbar {
    background: var(--notion-bg-surface) !important;
    border-bottom: 1px solid var(--notion-border) !important;
    box-shadow: none !important;
}
html[data-theme="light"] .td-mobile-topbar,
html[data-theme="dark"] .td-mobile-topbar {
    background: var(--notion-bg-surface) !important;
    border-bottom-color: var(--notion-border) !important;
}
.td-mt-btn {
    color: var(--notion-text-primary) !important;
    background: transparent !important;
}
.td-mt-btn:hover,
.td-mt-btn:focus-visible {
    background: var(--notion-bg-hover) !important;
}
html[data-theme="light"] .td-mt-btn,
html[data-theme="dark"] .td-mt-btn {
    color: var(--notion-text-primary) !important;
}
html[data-theme="light"] .td-mt-btn:hover,
html[data-theme="dark"] .td-mt-btn:hover {
    background: var(--notion-bg-hover) !important;
}
.td-mt-brand-name {
    color: var(--notion-text-primary) !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 600;
}

/* ── PWA install prompt ──────────────────────────────────── */
.td-install-prompt {
    background: var(--notion-bg-surface) !important;
    color: var(--notion-text-primary) !important;
    border: 1px solid var(--notion-border) !important;
    border-radius: var(--notion-radius-lg) !important;
    box-shadow: var(--notion-shadow) !important;
    font-family: 'Inter', sans-serif !important;
}
.td-ip-icon {
    background: var(--notion-text-primary) !important;
    background-image: none !important;
    color: var(--notion-bg-surface) !important;
    border-radius: var(--notion-radius) !important;
}
html[data-theme="dark"] .td-ip-icon {
    background: #ffffff !important;
    color: #191919 !important;
}
.td-ip-title {
    font-family: 'Inter', sans-serif !important;
    color: var(--notion-text-primary) !important;
    font-weight: 600;
}
.td-ip-sub {
    color: var(--notion-text-secondary) !important;
}
.td-ip-btn {
    background: var(--notion-text-primary) !important;
    color: var(--notion-bg-surface) !important;
    border-radius: var(--notion-radius) !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 500;
}
.td-ip-btn:hover { transform: none !important; }
html[data-theme="dark"] .td-ip-btn {
    background: #ffffff !important;
    color: #191919 !important;
}
.td-ip-close {
    color: var(--notion-text-secondary) !important;
}
.td-ip-close:hover {
    background: var(--notion-bg-hover) !important;
    color: var(--notion-text-primary) !important;
}

/* ── Skip-to-content link (a11y) ─────────────────────────── */
.td-skip-link {
    background: var(--notion-text-primary) !important;
    color: var(--notion-bg-surface) !important;
    border-radius: 0 0 var(--notion-radius) var(--notion-radius) !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 600;
    box-shadow: var(--notion-shadow-sm) !important;
}
html[data-theme="dark"] .td-skip-link {
    background: #ffffff !important;
    color: #191919 !important;
}

/* Focus ring (consistent Notion blue accent) */
:focus-visible {
    outline: 2px solid rgba(35, 131, 226, 0.55) !important;
    outline-offset: 2px !important;
    border-radius: var(--notion-radius);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid rgba(35, 131, 226, 0.55) !important;
    outline-offset: 2px !important;
}

/* ── Tooltips ────────────────────────────────────────────── */
.tooltip-inner {
    background: var(--notion-text-primary) !important;
    color: var(--notion-bg-surface) !important;
    border-radius: var(--notion-radius) !important;
    font-size: 0.78rem;
    font-family: 'Inter', sans-serif;
    padding: 0.4rem 0.6rem;
}
.tooltip .tooltip-arrow::before {
    border-top-color: var(--notion-text-primary) !important;
    border-bottom-color: var(--notion-text-primary) !important;
    border-left-color: var(--notion-text-primary) !important;
    border-right-color: var(--notion-text-primary) !important;
}

/* ── Pagination ──────────────────────────────────────────── */
.page-link {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    color: var(--notion-text-primary) !important;
    border-radius: var(--notion-radius) !important;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
}
.page-link:hover {
    background: var(--notion-bg-hover) !important;
    color: var(--notion-text-primary) !important;
    border-color: var(--notion-border-strong) !important;
    z-index: 1;
}
.page-item.active .page-link {
    background: var(--notion-text-primary) !important;
    border-color: var(--notion-text-primary) !important;
    color: var(--notion-bg-surface) !important;
    font-weight: 500;
}
html[data-theme="dark"] .page-item.active .page-link {
    background: #ffffff !important;
    border-color: #ffffff !important;
    color: #191919 !important;
}
.page-item.disabled .page-link {
    background: var(--notion-bg-canvas) !important;
    color: var(--notion-text-tertiary) !important;
}
.pagination {
    gap: 0.2rem;
}

/* ── Nav tabs / pills ────────────────────────────────────── */
.nav-tabs {
    border-bottom: 1px solid var(--notion-border) !important;
}
.nav-tabs .nav-link {
    color: var(--notion-text-secondary) !important;
    border: none !important;
    border-bottom: 2px solid transparent !important;
    background: transparent !important;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    padding: 0.55rem 0.95rem;
    margin-bottom: -1px;
    transition: color 150ms ease, border-color 150ms ease;
}
.nav-tabs .nav-link:hover {
    color: var(--notion-text-primary) !important;
    border-bottom-color: var(--notion-border-strong) !important;
    background: transparent !important;
}
.nav-tabs .nav-link.active {
    color: var(--notion-text-primary) !important;
    background: transparent !important;
    border-bottom-color: var(--notion-text-primary) !important;
    font-weight: 600;
}
html[data-theme="dark"] .nav-tabs .nav-link.active {
    border-bottom-color: #ffffff !important;
}

.nav-pills .nav-link {
    color: var(--notion-text-secondary) !important;
    background: transparent !important;
    border-radius: var(--notion-radius) !important;
    font-weight: 500;
}
.nav-pills .nav-link:hover {
    background: var(--notion-bg-hover) !important;
    color: var(--notion-text-primary) !important;
}
.nav-pills .nav-link.active {
    background: var(--notion-bg-active) !important;
    color: var(--notion-text-primary) !important;
    font-weight: 600;
}

/* ── Toasts ──────────────────────────────────────────────── */
.toast {
    background: var(--notion-bg-surface) !important;
    color: var(--notion-text-primary) !important;
    border: 1px solid var(--notion-border) !important;
    border-radius: var(--notion-radius-lg) !important;
    box-shadow: var(--notion-shadow) !important;
    font-family: 'Inter', sans-serif;
}
.toast-header {
    background: transparent !important;
    border-bottom: 1px solid var(--notion-border) !important;
    color: var(--notion-text-primary) !important;
}

/* ── Spotlight search overlay ────────────────────────────── */
.spotlight-overlay,
#spotlight-overlay,
.td-spotlight-overlay {
    background: rgba(15, 15, 15, 0.45) !important;
    backdrop-filter: blur(8px) !important;
}
.spotlight-modal,
.td-spotlight-modal {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    border-radius: var(--notion-radius-lg) !important;
    box-shadow: var(--notion-shadow) !important;
}
.spotlight-input,
.td-spotlight-input {
    background: transparent !important;
    border: none !important;
    color: var(--notion-text-primary) !important;
    font-family: 'Inter', sans-serif;
}
.spotlight-hint {
    color: var(--notion-text-tertiary) !important;
}

/* ── Floating AI chat widget (actual IDs are camelCase) ──── */
#tdAiChatToggle,
#tdAiChatSend,
#td-ai-chat-toggle,
.td-ai-chat-toggle {
    background: var(--notion-text-primary) !important;
    background-image: none !important;
    color: var(--notion-bg-surface) !important;
    box-shadow: var(--notion-shadow) !important;
    border: none !important;
}
html[data-theme="dark"] #tdAiChatToggle,
html[data-theme="dark"] #tdAiChatSend,
html[data-theme="dark"] #td-ai-chat-toggle,
html[data-theme="dark"] .td-ai-chat-toggle {
    background: #ffffff !important;
    background-image: none !important;
    color: #191919 !important;
}
#tdAiChatToggle i,
#tdAiChatSend i {
    color: inherit !important;
}
.tdai-label-main {
    color: var(--notion-text-primary) !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 600;
}
.tdai-label-sub {
    color: var(--notion-text-secondary) !important;
}
html[data-theme="dark"] .tdai-label-main {
    color: var(--notion-text-primary) !important;
}
html[data-theme="dark"] .tdai-label-sub {
    color: var(--notion-text-secondary) !important;
}

.td-ai-chat-panel,
#td-ai-chat-panel {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    border-radius: var(--notion-radius-lg) !important;
    box-shadow: var(--notion-shadow) !important;
    font-family: 'Inter', sans-serif !important;
}
.td-ai-chat-header {
    background: var(--notion-bg-canvas) !important;
    background-image: none !important;
    border-bottom: 1px solid var(--notion-border) !important;
    color: var(--notion-text-primary) !important;
}
.td-ai-chat-msg-user {
    background: var(--notion-text-primary) !important;
    color: var(--notion-bg-surface) !important;
}
.td-ai-chat-msg-bot {
    background: var(--notion-bg-hover) !important;
    color: var(--notion-text-primary) !important;
}

/* ── Empty states ────────────────────────────────────────── */
.empty-state,
.td-empty-state {
    background: var(--notion-bg-canvas) !important;
    border: 1px dashed var(--notion-border-strong) !important;
    border-radius: var(--notion-radius-lg) !important;
    color: var(--notion-text-secondary) !important;
}
.empty-state .bi,
.td-empty-state .bi {
    color: var(--notion-text-tertiary) !important;
}
.empty-state h5,
.td-empty-state h5 {
    color: var(--notion-text-primary) !important;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
}

/* ── Progress bars ───────────────────────────────────────── */
.progress {
    background: var(--notion-bg-hover) !important;
    border-radius: var(--notion-radius) !important;
    height: 8px !important;
}
.progress-bar {
    background: var(--notion-text-primary) !important;
    background-image: none !important;
}
html[data-theme="dark"] .progress-bar {
    background: #ffffff !important;
}

/* ── Sidebar badges (notification dots) ─────────────────── */
.sidebar-badge {
    background: #ef4444 !important;
    color: #ffffff !important;
    border-radius: 999px !important;
    font-size: 0.62rem !important;
    font-weight: 600;
    padding: 0.1em 0.4em;
    border: 1.5px solid var(--notion-bg-surface);
}

/* ============================================================
 * LOGIN PAGE — Override login.css !important rules with Notion
 * login.css uses !important on .info-card and .login-card; we
 * win with higher specificity (html[data-theme="..."] .info-card)
 * plus !important to match its level.
 * ============================================================ */

html[data-theme="light"] .info-card,
html[data-theme="dark"] .info-card {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    border-radius: var(--notion-radius-lg) !important;
    color: var(--notion-text-primary) !important;
    box-shadow: var(--notion-shadow-sm) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

html[data-theme="light"] .info-card h5,
html[data-theme="light"] .info-card p,
html[data-theme="light"] .info-card li,
html[data-theme="light"] .info-card small,
html[data-theme="light"] .info-card .login-inline-note,
html[data-theme="dark"] .info-card h5,
html[data-theme="dark"] .info-card p,
html[data-theme="dark"] .info-card li,
html[data-theme="dark"] .info-card small,
html[data-theme="dark"] .info-card .login-inline-note {
    color: var(--notion-text-secondary) !important;
}

html[data-theme="light"] .info-card h5,
html[data-theme="dark"] .info-card h5 {
    color: var(--notion-text-primary) !important;
    font-weight: 700 !important;
    font-family: 'Inter', sans-serif !important;
    letter-spacing: -0.02em !important;
}

html[data-theme="light"] .info-card ul li::before,
html[data-theme="dark"] .info-card ul li::before {
    color: var(--notion-text-tertiary) !important;
}

/* Login card (right pane) — also override login.css !important */
html[data-theme="light"] .login-card,
html[data-theme="dark"] .login-card {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    border-radius: var(--notion-radius-lg) !important;
    color: var(--notion-text-primary) !important;
    box-shadow: var(--notion-shadow-sm) !important;
}

html[data-theme="light"] .login-card h3,
html[data-theme="dark"] .login-card h3 {
    color: var(--notion-text-primary) !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 700 !important;
    letter-spacing: -0.02em !important;
}

html[data-theme="light"] .login-card .muted-text,
html[data-theme="dark"] .login-card .muted-text,
html[data-theme="light"] .login-card .text-muted,
html[data-theme="dark"] .login-card .text-muted {
    color: var(--notion-text-secondary) !important;
}

html[data-theme="light"] .login-card p,
html[data-theme="dark"] .login-card p {
    color: var(--notion-text-secondary) !important;
}

/* Login primary button — override login.css gradient !important */
html[data-theme="light"] .login-card .btn-primary,
html[data-theme="dark"] .login-card .btn-primary {
    background: var(--notion-text-primary) !important;
    background-image: none !important;
    border: 1px solid var(--notion-text-primary) !important;
    color: var(--notion-bg-surface) !important;
    border-radius: var(--notion-radius) !important;
    box-shadow: var(--notion-shadow-sm) !important;
    font-weight: 500 !important;
    text-transform: none !important;
}
html[data-theme="dark"] .login-card .btn-primary {
    background: #ffffff !important;
    border-color: #ffffff !important;
    color: #191919 !important;
}
html[data-theme="light"] .login-card .btn-primary:hover,
html[data-theme="dark"] .login-card .btn-primary:hover {
    transform: none !important;
}
html[data-theme="light"] .login-card .btn-primary:hover {
    background: #2f2c25 !important;
    background-image: none !important;
    border-color: #2f2c25 !important;
}
html[data-theme="dark"] .login-card .btn-primary:hover {
    background: #e7e5e2 !important;
    background-image: none !important;
    border-color: #e7e5e2 !important;
}

/* TR/EN lang switch (Notion subtle) */
html[data-theme="light"] .lang-switch .btn-primary,
html[data-theme="dark"] .lang-switch .btn-primary,
html[data-theme="light"] .lang-switch .btn:hover,
html[data-theme="dark"] .lang-switch .btn:hover {
    background: var(--notion-text-primary) !important;
    background-image: none !important;
    border-color: var(--notion-text-primary) !important;
    color: var(--notion-bg-surface) !important;
    box-shadow: none !important;
}
html[data-theme="dark"] .lang-switch .btn-primary,
html[data-theme="dark"] .lang-switch .btn:hover {
    background: #ffffff !important;
    border-color: #ffffff !important;
    color: #191919 !important;
}

/* Login tool icons (theme toggle, links etc.) */
html[data-theme="light"] .login-tool-icon-btn,
html[data-theme="dark"] .login-tool-icon-btn {
    background: transparent !important;
    color: var(--notion-text-secondary) !important;
    border: 1px solid var(--notion-border-strong) !important;
    border-radius: var(--notion-radius) !important;
}
html[data-theme="light"] .login-tool-icon-btn:hover,
html[data-theme="dark"] .login-tool-icon-btn:hover {
    background: var(--notion-bg-hover) !important;
    color: var(--notion-text-primary) !important;
    border-color: var(--notion-border-strong) !important;
    transform: none !important;
}

/* Login grid wrapper — kill the dark gradient background */
html[data-theme="light"] .login-grid,
html[data-theme="dark"] .login-grid {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

/* Login background — flat warm canvas */
html[data-theme="light"] body,
html[data-theme="dark"] body {
    background: var(--notion-bg-canvas) !important;
}
html[data-theme="light"] #bg-layer,
html[data-theme="dark"] #bg-layer {
    background: var(--notion-bg-canvas) !important;
}
html[data-theme="light"] .bg-glow,
html[data-theme="dark"] .bg-glow,
html[data-theme="light"] #bg-particles,
html[data-theme="dark"] #bg-particles {
    display: none !important;
}

/* Intro screen (logo intro on ?intro=1) */
html[data-theme="light"] #intro-screen,
html[data-theme="dark"] #intro-screen {
    background: var(--notion-bg-canvas) !important;
}
html[data-theme="light"] #intro-screen .intro-subtitle-txt,
html[data-theme="dark"] #intro-screen .intro-subtitle-txt {
    color: var(--notion-text-secondary) !important;
}
html[data-theme="light"] #intro-screen .feat-icon,
html[data-theme="dark"] #intro-screen .feat-icon {
    background: var(--notion-bg-hover) !important;
    color: var(--notion-text-primary) !important;
    border: 1px solid var(--notion-border) !important;
}
html[data-theme="light"] #intro-enter-btn,
html[data-theme="dark"] #intro-enter-btn {
    background: var(--notion-text-primary) !important;
    color: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-text-primary) !important;
    box-shadow: var(--notion-shadow-sm) !important;
}
html[data-theme="dark"] #intro-enter-btn {
    background: #ffffff !important;
    border-color: #ffffff !important;
    color: #191919 !important;
}

/* Register CTA divider */
.td-register-cta-divider {
    color: var(--notion-text-tertiary) !important;
}
.td-register-cta-divider::before,
.td-register-cta-divider::after {
    background: var(--notion-border) !important;
}

/* Legal notice */
.td-legal-notice {
    border-top: 1px solid var(--notion-border) !important;
}
.td-legal-text {
    color: var(--notion-text-tertiary) !important;
}
.td-legal-icon {
    color: var(--notion-text-tertiary) !important;
}

/* Copyright */
.copyright {
    color: var(--notion-text-tertiary) !important;
    font-size: 0.72rem;
}

/* ============================================================
 * HIGH-SPECIFICITY NOTION OVERRIDES
 *
 * panel-v2.css scopes many components under
 *   `html[data-theme="dark"] .X` and `html[data-theme="light"] .X`
 * (specificity 0,2,1) with !important. Our base `.X` rules
 * (0,1,0) lose the cascade despite being loaded later, because
 * !important + higher specificity always wins.
 *
 * `html[data-theme] .X` matches BOTH themes (attribute always
 * present) at specificity 0,2,1 — equal to theirs — and since
 * panel-polish.css loads AFTER panel-v2.css, source order then
 * tips the scale to us.
 * ============================================================ */

/* Dropdowns */
html[data-theme] .dropdown-menu {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    color: var(--notion-text-primary) !important;
    border-radius: var(--notion-radius) !important;
    box-shadow: var(--notion-shadow) !important;
    padding: 0.3rem !important;
}
html[data-theme] .dropdown-item {
    color: var(--notion-text-primary) !important;
    background: transparent !important;
    border-radius: 4px !important;
}
html[data-theme] .dropdown-item:hover,
html[data-theme] .dropdown-item:focus {
    background: var(--notion-bg-hover) !important;
    color: var(--notion-text-primary) !important;
}
html[data-theme] .dropdown-item.text-danger,
html[data-theme] .dropdown-item .text-danger {
    color: #d96565 !important;
}
html[data-theme] .dropdown-divider {
    border-top: 1px solid var(--notion-border) !important;
}
html[data-theme] .dropdown-header {
    color: var(--notion-text-secondary) !important;
}

/* Modals */
html[data-theme] .modal-content {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    color: var(--notion-text-primary) !important;
    border-radius: var(--notion-radius-lg) !important;
    box-shadow: var(--notion-shadow) !important;
}
html[data-theme] .modal-header {
    background: transparent !important;
    border-bottom: 1px solid var(--notion-border) !important;
}
html[data-theme] .modal-footer {
    background: transparent !important;
    border-top: 1px solid var(--notion-border) !important;
}
html[data-theme] .modal-title {
    color: var(--notion-text-primary) !important;
}
html[data-theme] .modal-body {
    color: var(--notion-text-primary) !important;
}

/* List groups */
html[data-theme] .list-group-item {
    background: var(--notion-bg-surface) !important;
    border-color: var(--notion-border) !important;
    color: var(--notion-text-primary) !important;
}
html[data-theme] .list-group-item:hover {
    background: var(--notion-bg-hover) !important;
}
html[data-theme] .list-group-item.active {
    background: var(--notion-bg-active) !important;
    color: var(--notion-text-primary) !important;
    border-color: var(--notion-border-strong) !important;
}

/* Popover */
html[data-theme] .popover {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    color: var(--notion-text-primary) !important;
}
html[data-theme] .popover-header {
    background: transparent !important;
    border-bottom: 1px solid var(--notion-border) !important;
    color: var(--notion-text-primary) !important;
}
html[data-theme] .popover-body {
    color: var(--notion-text-primary) !important;
}

/* Offcanvas */
html[data-theme] .offcanvas {
    background: var(--notion-bg-surface) !important;
    color: var(--notion-text-primary) !important;
    border-color: var(--notion-border) !important;
}
html[data-theme] .offcanvas-header {
    border-bottom: 1px solid var(--notion-border) !important;
}
html[data-theme] .offcanvas-title {
    color: var(--notion-text-primary) !important;
}

/* Accordion */
html[data-theme] .accordion-item {
    background: var(--notion-bg-surface) !important;
    border-color: var(--notion-border) !important;
    color: var(--notion-text-primary) !important;
}
html[data-theme] .accordion-button {
    background: var(--notion-bg-surface) !important;
    color: var(--notion-text-primary) !important;
}
html[data-theme] .accordion-button:not(.collapsed) {
    background: var(--notion-bg-hover) !important;
    color: var(--notion-text-primary) !important;
    box-shadow: inset 0 -1px 0 var(--notion-border) !important;
}
html[data-theme] .accordion-body {
    background: var(--notion-bg-surface) !important;
    color: var(--notion-text-primary) !important;
}

/* Cards (panel-v2 scopes them per theme) */
html[data-theme] .card {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    color: var(--notion-text-primary) !important;
}
html[data-theme] .card-header {
    background: transparent !important;
    border-bottom: 1px solid var(--notion-border) !important;
    color: var(--notion-text-primary) !important;
}

/* Tables (panel-v2 scopes thead per theme) */
html[data-theme] .table thead th,
html[data-theme] .table-modern thead th {
    background: var(--notion-bg-canvas) !important;
    color: var(--notion-text-secondary) !important;
    border-bottom: 1px solid var(--notion-border-strong) !important;
    font-weight: 600 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}
html[data-theme] .table tbody td,
html[data-theme] .table-modern tbody td {
    background: var(--notion-bg-surface) !important;
    color: var(--notion-text-primary) !important;
    border-color: var(--notion-border) !important;
}
html[data-theme] .table tbody tr:hover td,
html[data-theme] .table-modern tbody tr:hover td {
    background: var(--notion-bg-hover) !important;
}

/* Form controls */
html[data-theme] .form-control,
html[data-theme] .form-select,
html[data-theme] textarea.form-control {
    background: var(--notion-bg-surface) !important;
    color: var(--notion-text-primary) !important;
    border: 1px solid var(--notion-border-strong) !important;
    border-radius: var(--notion-radius) !important;
}
html[data-theme] .form-control:focus,
html[data-theme] .form-select:focus {
    border-color: rgba(35, 131, 226, 0.55) !important;
    box-shadow: 0 0 0 3px rgba(35, 131, 226, 0.12) !important;
}

/* Top menu / topbar */
html[data-theme] .top-menu-card {
    background: var(--notion-bg-surface) !important;
    background-image: none !important;
    border: 1px solid var(--notion-border) !important;
}

/* Left sidebar card */
html[data-theme] .left-sidebar-card {
    background: var(--notion-bg-surface) !important;
    background-image: none !important;
    border: 1px solid var(--notion-border) !important;
}

/* Info card on login (auth pages) */
html[data-theme] .info-card {
    background: var(--notion-bg-surface) !important;
    background-image: none !important;
    border: 1px solid var(--notion-border) !important;
    color: var(--notion-text-primary) !important;
}

/* Login card (auth pages) */
html[data-theme] .login-card {
    background: var(--notion-bg-surface) !important;
    border: 1px solid var(--notion-border) !important;
    color: var(--notion-text-primary) !important;
}

/* Mobile topbar */
html[data-theme] .td-mobile-topbar {
    background: var(--notion-bg-surface) !important;
    border-bottom-color: var(--notion-border) !important;
}

/* Body — panel-v2 scopes body per theme with !important */
html[data-theme="light"] body {
    background: var(--notion-bg-canvas) !important;
    color: var(--notion-text-primary) !important;
}
html[data-theme="dark"] body {
    background: var(--notion-bg-canvas) !important;
    color: var(--notion-text-primary) !important;
}

/* Nav tabs active border */
html[data-theme] .nav-tabs .nav-link.active {
    border-bottom-color: var(--notion-text-primary) !important;
    background: transparent !important;
}
html[data-theme="dark"] .nav-tabs .nav-link.active {
    border-bottom-color: #ffffff !important;
}

/* Pagination active */
html[data-theme] .page-item.active .page-link {
    background: var(--notion-text-primary) !important;
    border-color: var(--notion-text-primary) !important;
    color: var(--notion-bg-surface) !important;
}
html[data-theme="dark"] .page-item.active .page-link {
    background: #ffffff !important;
    border-color: #ffffff !important;
    color: #191919 !important;
}

/* ============================================================
 * MOBILE TABLE FIX (≤767.98px)
 *
 * panel-v2.css already converts `.table-card-mobile` tables to
 * a card-stack on mobile (each <tr> becomes a card, <td> rows
 * paired with their data-label). This block re-skins that
 * transformation in Notion style and fixes overflow on long
 * text values (emails, AnyDesk IDs, addresses).
 *
 * Tables WITHOUT `.table-card-mobile` fall back to horizontal
 * scroll (.table-responsive) with compact padding + nowrap.
 * ============================================================ */

@media (max-width: 767.98px) {
    /* ── Card-stack rows (Notion-skinned) ─────────────────── */
    html[data-theme] .table-card-mobile tr {
        background: var(--notion-bg-surface) !important;
        border: 1px solid var(--notion-border) !important;
        border-radius: var(--notion-radius-lg) !important;
        margin-bottom: 0.6rem !important;
        box-shadow: var(--notion-shadow-sm) !important;
        overflow: hidden;
        padding: 0.25rem 0 !important;
    }
    html[data-theme] .table-card-mobile td {
        background: transparent !important;
        border: none !important;
        border-bottom: 1px solid var(--notion-border) !important;
        padding: 0.55rem 0.95rem !important;
        font-size: 0.85rem !important;
        color: var(--notion-text-primary) !important;
        line-height: 1.45;
        gap: 0.85rem !important;
    }
    html[data-theme] .table-card-mobile td:last-child {
        border-bottom: none !important;
    }
    html[data-theme] .table-card-mobile td::before {
        content: attr(data-label) !important;
        color: var(--notion-text-secondary) !important;
        font-weight: 500 !important;
        font-size: 0.72rem !important;
        text-transform: none !important;
        letter-spacing: 0 !important;
        white-space: nowrap;
        flex-shrink: 0;
        align-self: flex-start;
        padding-top: 0.1rem;
    }

    /* ── Long value wrap (emails, IDs, multi-line text) ───── */
    html[data-theme] .table-card-mobile td > *:not(::before) {
        text-align: right;
        max-width: 65%;
        overflow-wrap: anywhere;
        word-break: break-word;
        margin-left: auto;
    }
    /* Inner stacks (e.g. .employee-stack with name + sub-line) align right */
    html[data-theme] .table-card-mobile td .employee-stack,
    html[data-theme] .table-card-mobile td .employee-name-cell,
    html[data-theme] .table-card-mobile td .employee-security-stack,
    html[data-theme] .table-card-mobile td [class*="-stack"],
    html[data-theme] .table-card-mobile td [class*="-cell"] {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-end !important;
        gap: 0.15rem;
        text-align: right;
        max-width: 65%;
        margin-left: auto;
    }
    /* Force inline span lines to break to their own row */
    html[data-theme] .table-card-mobile td .employee-stack > *,
    html[data-theme] .table-card-mobile td .employee-name-cell > *,
    html[data-theme] .table-card-mobile td .employee-primary-line,
    html[data-theme] .table-card-mobile td .employee-muted-line,
    html[data-theme] .table-card-mobile td .employee-name-main,
    html[data-theme] .table-card-mobile td .employee-name-sub,
    html[data-theme] .table-card-mobile td [class*="primary-line"],
    html[data-theme] .table-card-mobile td [class*="muted-line"],
    html[data-theme] .table-card-mobile td [class*="name-main"],
    html[data-theme] .table-card-mobile td [class*="name-sub"] {
        display: block !important;
        width: 100%;
        text-align: right;
        margin-left: 0;
    }
    html[data-theme] .table-card-mobile td .employee-muted-line,
    html[data-theme] .table-card-mobile td .employee-name-sub,
    html[data-theme] .table-card-mobile td [class*="muted-line"],
    html[data-theme] .table-card-mobile td [class*="name-sub"] {
        color: var(--notion-text-secondary) !important;
        font-size: 0.78rem;
        font-weight: 400;
    }
    html[data-theme] .table-card-mobile td .employee-primary-line,
    html[data-theme] .table-card-mobile td .employee-name-main,
    html[data-theme] .table-card-mobile td [class*="primary-line"],
    html[data-theme] .table-card-mobile td [class*="name-main"] {
        font-weight: 600 !important;
    }
    /* Action cluster: row, gap, end-aligned */
    html[data-theme] .table-card-mobile td .action-cluster {
        display: flex !important;
        flex-direction: row !important;
        gap: 0.4rem;
        max-width: none;
        margin-left: 0;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    /* ── Badges align with end + wrap to multiple lines ──── */
    html[data-theme] .table-card-mobile td .badge {
        margin-left: 0.25rem;
        white-space: normal;
    }

    /* ── Action column: full-width row, buttons right-aligned ── */
    html[data-theme] .table-card-mobile td[data-label*="şlem"],
    html[data-theme] .table-card-mobile td[data-label*="Action"],
    html[data-theme] .table-card-mobile td[data-label*="Islemler"] {
        justify-content: flex-end !important;
        gap: 0.5rem;
        padding: 0.65rem 0.95rem !important;
        background: var(--notion-bg-hover) !important;
        border-top: 1px solid var(--notion-border) !important;
    }
    html[data-theme] .table-card-mobile td[data-label*="şlem"]::before,
    html[data-theme] .table-card-mobile td[data-label*="Action"]::before,
    html[data-theme] .table-card-mobile td[data-label*="Islemler"]::before {
        display: none !important;
    }
    /* Action buttons sized for touch targets (44x44 minimum) */
    html[data-theme] .table-card-mobile .action-cluster,
    html[data-theme] .table-card-mobile td .action-cluster {
        display: flex;
        gap: 0.45rem;
        align-items: center;
    }
    html[data-theme] .table-card-mobile .icon-btn,
    html[data-theme] .table-card-mobile .action-cluster .icon-btn,
    html[data-theme] .table-card-mobile .row-action-btn,
    html[data-theme] .table-card-mobile td button[type="submit"],
    html[data-theme] .table-card-mobile td .btn {
        min-width: 38px;
        min-height: 38px;
        padding: 0.35rem 0.5rem !important;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        border-radius: var(--notion-radius) !important;
        background: var(--notion-bg-surface) !important;
        background-image: none !important;
        border: 1px solid var(--notion-border) !important;
        color: var(--notion-text-secondary) !important;
        box-shadow: none !important;
    }
    html[data-theme] .table-card-mobile .icon-btn:hover,
    html[data-theme] .table-card-mobile .action-cluster .icon-btn:hover,
    html[data-theme] .table-card-mobile td button[type="submit"]:hover,
    html[data-theme] .table-card-mobile td .btn:hover {
        background: var(--notion-bg-hover) !important;
        color: var(--notion-text-primary) !important;
        transform: none !important;
    }
    html[data-theme] .table-card-mobile .icon-btn i,
    html[data-theme] .table-card-mobile td button[type="submit"] i,
    html[data-theme] .table-card-mobile td .btn i {
        color: inherit !important;
    }

    /* ── First cell (often ID pill) — left-aligned header look ── */
    html[data-theme] .table-card-mobile td:first-child {
        background: var(--notion-bg-canvas) !important;
        font-weight: 600;
    }
    html[data-theme] .table-card-mobile .employee-id-pill,
    html[data-theme] .table-card-mobile .id-pill,
    html[data-theme] .table-card-mobile [class*="id-pill"] {
        background: transparent !important;
        color: var(--notion-text-secondary) !important;
        font-size: 0.78rem;
        font-weight: 600;
        padding: 0 !important;
    }

    /* ── Tables WITHOUT .table-card-mobile → compact horizontal scroll ── */
    html[data-theme] .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: var(--notion-radius);
        margin-bottom: 0.5rem;
    }
    html[data-theme] .table:not(.table-card-mobile) {
        font-size: 0.78rem;
    }
    html[data-theme] .table:not(.table-card-mobile) thead th,
    html[data-theme] .table:not(.table-card-mobile) tbody td {
        padding: 0.45rem 0.6rem !important;
        white-space: nowrap;
    }
    /* Allow wrapping where explicitly hinted */
    html[data-theme] .table:not(.table-card-mobile) [data-wrap],
    html[data-theme] .table:not(.table-card-mobile) .text-wrap {
        white-space: normal !important;
    }

    /* ── Pagination on mobile — center + smaller ──────────── */
    html[data-theme] .pagination {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.15rem;
    }
    html[data-theme] .pagination .page-link {
        padding: 0.35rem 0.55rem !important;
        font-size: 0.78rem !important;
    }

    /* ── Toolbar / filter row → stack vertically ───────────── */
    html[data-theme] .panel-list-toolbar,
    html[data-theme] .corp-list-header,
    html[data-theme] .corp-list-actions {
        flex-wrap: wrap !important;
        gap: 0.6rem !important;
    }
    html[data-theme] .corp-list-actions {
        width: 100%;
    }

    /* ── Search input → full-width on mobile ──────────────── */
    html[data-theme] .employee-search-shell,
    html[data-theme] [class*="search-shell"] {
        width: 100% !important;
    }
}

/* ── Reduced motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    main, .container.soft-enter, .col-md-9.pt-3 { animation: none !important; }
    .btn-primary, .btn-save, .btn-soft-add, .btn-filter-apply,
    .btn-success, .btn-danger, .btn-warning, .btn-info,
    .btn-outline-primary, .btn-outline-secondary,
    .btn-outline-light, .btn-outline-dark,
    .card, .form-card, .panel-card, .form-shell,
    .form-control, .form-select, textarea.form-control,
    .sidebar-link, .table tbody tr, .dropdown-item,
    .panel-breadcrumb .breadcrumb-item a {
        transition-duration: 0.001ms !important;
    }
}
