:root {
    /* Light Theme Variables */
    --primary: #6366f1;
    --primary-alt: #a855f7;
    --bg-main: #f3f4f6;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --accent-success: #22c55e;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --accent-info: #3b82f6;
    --sidebar-width: 270px;
    --sidebar-collapsed-width: 74px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    /* Dark Theme Variables */
    --bg-main: #111111;
    --bg-sidebar: #1a1a1a;
    --bg-card: #1f1f1f;
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --border: #333333;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background: var(--bg-main);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    transition: var(--transition);
    overflow-x: hidden;
}

    .login-page {
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 1.5rem;
        background:
            radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 30%),
            radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.12), transparent 28%),
            linear-gradient(135deg, #f8fbff 0%, #eef4ff 100%);
    }

    .login-shell {
        width: min(980px, 100%);
        display: grid;
        grid-template-columns: 1.2fr 0.8fr;
        gap: 1.25rem;
        align-items: stretch;
    }

    .login-hero,
    .login-card {
        border-radius: 24px;
        background: rgba(255, 255, 255, 0.88);
        backdrop-filter: blur(8px);
        border: 1px solid rgba(215, 220, 230, 0.9);
        box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
    }

    .login-hero {
        padding: 2.2rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .login-logo {
        width: 64px;
        height: 64px;
        object-fit: contain;
        margin-bottom: 1rem;
    }

    .login-hero h1 {
        margin: 0 0 0.75rem;
        font-size: clamp(2rem, 4vw, 3.4rem);
        line-height: 1.02;
        color: #0f172a;
        letter-spacing: -0.04em;
    }

    .login-hero p {
        margin: 0;
        max-width: 54ch;
        color: #475569;
        font-size: 1rem;
        line-height: 1.7;
    }

    .login-card {
        padding: 2rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .login-card h2 {
        margin: 0;
        font-size: 1.7rem;
        color: #0f172a;
    }

    .login-card > p {
        margin: 0.35rem 0 1.2rem;
        color: #64748b;
    }

    .login-form {
        display: grid;
        gap: 0.95rem;
    }

    .login-form label {
        display: grid;
        gap: 0.4rem;
    }

    .login-form span {
        font-size: 0.82rem;
        font-weight: 700;
        color: #334155;
    }

    .login-form input {
        width: 100%;
        border: 1px solid #d7dce6;
        border-radius: 14px;
        padding: 0.82rem 0.95rem;
        font-size: 0.95rem;
        color: #0f172a;
        background: #fff;
        box-sizing: border-box;
    }

    .login-form input:focus {
        outline: none;
        border-color: #3b82f6;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
    }

    .login-submit {
        margin-top: 0.35rem;
        border: none;
        border-radius: 14px;
        padding: 0.85rem 1rem;
        background: linear-gradient(135deg, #2563eb, #1d4ed8);
        color: #fff;
        font-size: 0.95rem;
        font-weight: 800;
        cursor: pointer;
    }

    .login-error {
        margin-bottom: 0.9rem;
        padding: 0.7rem 0.85rem;
        border-radius: 12px;
        background: rgba(239, 68, 68, 0.1);
        color: #b91c1c;
        font-weight: 600;
    }

    .header-user-chip {
        padding: 0.45rem 0.8rem;
        border-radius: 999px;
        background: rgba(37, 99, 235, 0.08);
        color: #1d4ed8;
        font-size: 0.78rem;
        font-weight: 700;
    }

    .header-logout-btn {
        padding: 0.5rem 0.85rem;
        border-radius: 999px;
        border: 1px solid #d7dce6;
        color: #334155;
        text-decoration: none;
        font-size: 0.8rem;
        font-weight: 700;
        background: #fff;
    }

    .header-logout-btn {
        padding: 0.5rem 0.85rem;
        border-radius: 999px;
        border: 1px solid #d7dce6;
        color: #334155;
        text-decoration: none;
        font-size: 0.8rem;
        font-weight: 700;
        background: #fff;
    }

    .header-logout-btn:hover {
        border-color: #93c5fd;
        color: #1d4ed8;
    }

    /* Profile Avatar */
    .profile-avatar-wrap {
        position: relative;
    }

    .profile-avatar-btn {
        width: 38px;
        height: 38px;
        border-radius: 50%;
        background: linear-gradient(135deg, #6366f1, #a855f7);
        color: #fff;
        font-size: 1rem;
        font-weight: 700;
        border: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
        transition: transform 0.15s, box-shadow 0.15s;
        flex-shrink: 0;
    }

    .profile-avatar-btn:hover {
        transform: scale(1.07);
        box-shadow: 0 4px 14px rgba(99, 102, 241, 0.45);
    }

    .profile-dropdown {
        position: absolute;
        top: calc(100% + 10px);
        right: 0;
        min-width: 200px;
        width: max-content;
        max-width: 320px;
        background: #fff;
        border-radius: 14px;
        box-shadow: 0 8px 32px rgba(15, 23, 42, 0.14), 0 1.5px 6px rgba(15,23,42,0.07);
        border: 1px solid #e5e7eb;
        padding: 1rem 1.1rem 0.75rem;
        z-index: 9999;
        animation: profileDropIn 0.15s ease;
    }

    @keyframes profileDropIn {
        from { opacity: 0; transform: translateY(-6px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    .profile-dropdown-email {
        font-size: 0.82rem;
        font-weight: 700;
        color: #1d4ed8;
        white-space: nowrap;
        line-height: 1.3;
    }

    .profile-dropdown-role {
        font-size: 0.78rem;
        color: #6b7280;
        margin-top: 0.2rem;
        font-weight: 500;
    }

    .profile-dropdown-divider {
        height: 1px;
        background: #e5e7eb;
        margin: 0.65rem 0;
    }

    .profile-dropdown-logout {
        display: block;
        font-size: 0.82rem;
        font-weight: 700;
        color: #ef4444;
        text-decoration: none;
        padding: 0.3rem 0;
        transition: color 0.15s;
    }

    .profile-dropdown-logout:hover {
        color: #b91c1c;
    }

    .profile-dropdown-item {
        display: block;
        width: 100%;
        font-size: 0.82rem;
        font-weight: 700;
        color: #2563eb;
        background: none;
        border: none;
        padding: 0.3rem 0;
        margin-bottom: 0.3rem;
        cursor: pointer;
        transition: color 0.15s;
        text-align: left;
    }

    .profile-dropdown-item:hover {
        color: #1d4ed8;
    }

    [data-theme="dark"] .profile-dropdown {
        background: #1f1f1f;
        border-color: #333;
        box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    }

    [data-theme="dark"] .profile-dropdown-divider {
        background: #333;
    }

    [data-theme="dark"] .profile-dropdown-item {
        color: #3b82f6;
    }

    [data-theme="dark"] .profile-dropdown-item:hover {
        color: #60a5fa;
    }

    .user-mgmt-page {
        display: grid;
        gap: 0.95rem;
    }

    .user-mgmt-page-head {
        border: 1px solid #d7dce6;
        border-radius: 16px;
        background: linear-gradient(135deg, #f8fbff 0%, #eef4ff 100%);
        box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
        padding: 0.95rem 1.05rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.8rem;
    }

    .user-mgmt-kicker {
        margin: 0;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        font-size: 0.68rem;
        font-weight: 800;
        color: #2563eb;
    }

    .user-mgmt-title {
        margin: 0.15rem 0 0.2rem;
        font-size: 1.12rem;
        color: #0f172a;
        letter-spacing: -0.01em;
    }

    .user-mgmt-subtitle {
        margin: 0;
        font-size: 0.8rem;
        color: #64748b;
    }

    .user-mgmt-meta {
        border: 1px solid #dbe3ef;
        border-radius: 12px;
        background: #fff;
        padding: 0.48rem 0.7rem;
        display: grid;
        gap: 0.05rem;
        min-width: 92px;
        text-align: right;
    }

    .user-mgmt-meta-label {
        font-size: 0.68rem;
        color: #64748b;
        font-weight: 700;
    }

    .user-mgmt-meta-value {
        font-size: 1rem;
        color: #0f172a;
        font-weight: 800;
    }

    .user-mgmt-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .user-mgmt-card {
        min-height: 220px;
        overflow: hidden;
    }

    .user-mgmt-card .table-header {
        background: linear-gradient(135deg, #f8fbff 0%, #eef4ff 100%);
        border-bottom: 1px solid #dbe3ef;
        padding: 0.78rem 0.9rem;
    }

    .user-mgmt-card .table-header h3 {
        margin: 0;
        font-size: 1rem;
        color: #0f172a;
    }

    .user-mgmt-body {
        padding: 0.9rem;
    }

    .user-mgmt-form {
        display: grid;
        gap: 0.72rem;
    }

    .user-mgmt-form label,
    .user-mgmt-inline {
        display: grid;
        gap: 0.35rem;
    }

    .user-mgmt-form span {
        font-size: 0.76rem;
        font-weight: 700;
        color: #334155;
    }

    .user-mgmt-form input,
    .user-mgmt-form select,
    .user-mgmt-inline input,
    .user-mgmt-inline select {
        width: 100%;
        border: 1px solid #d7dce6;
        border-radius: 10px;
        padding: 0.48rem 0.62rem;
        font-size: 0.82rem;
        color: #0f172a;
        box-sizing: border-box;
        background: #fff;
        transition: border-color 0.15s ease, box-shadow 0.15s ease;
    }

    .user-mgmt-form input:focus,
    .user-mgmt-form select:focus,
    .user-mgmt-inline input:focus,
    .user-mgmt-inline select:focus {
        outline: none;
        border-color: #60a5fa;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
    }

    .user-mgmt-table .user-mgmt-inline {
        display: flex;
        align-items: center;
        gap: 0.42rem;
        min-width: 0;
    }

    .user-mgmt-table tbody td {
        vertical-align: middle;
    }

    .user-mgmt-table tbody td:nth-child(2) .user-mgmt-inline input {
        min-width: 200px;
    }

    .user-mgmt-btn {
        border: 1px solid #c9d4e3;
        border-radius: 10px;
        background: #ffffff;
        color: #334155;
        font-size: 0.74rem;
        font-weight: 700;
        padding: 0.42rem 0.72rem;
        cursor: pointer;
        white-space: nowrap;
        transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
    }

    .user-mgmt-btn:hover {
        border-color: #93c5fd;
        box-shadow: 0 6px 14px rgba(37, 99, 235, 0.14);
        transform: translateY(-1px);
    }

    .user-mgmt-btn-primary {
        border-color: #2563eb;
        background: linear-gradient(135deg, #2563eb, #1d4ed8);
        color: #fff;
    }

    .user-mgmt-btn-danger {
        border-color: #dc2626;
        background: linear-gradient(135deg, #ef4444, #dc2626);
        color: #fff;
    }

    .user-mgmt-alert {
        border-radius: 10px;
        padding: 0.6rem 0.72rem;
        font-size: 0.78rem;
        margin-bottom: 0.75rem;
        font-weight: 600;
        border: 1px solid transparent;
    }

    .user-mgmt-alert-success {
        background: rgba(34, 197, 94, 0.12);
        color: #166534;
        border-color: rgba(34, 197, 94, 0.25);
    }

    .user-mgmt-alert-error {
        background: rgba(239, 68, 68, 0.12);
        color: #991b1b;
        border-color: rgba(239, 68, 68, 0.22);
    }

    .user-mgmt-self {
        display: inline-flex;
        align-items: center;
        border: 1px solid #bfdbfe;
        border-radius: 999px;
        background: rgba(59, 130, 246, 0.1);
        color: #1d4ed8;
        padding: 0.23rem 0.58rem;
        font-size: 0.72rem;
        font-weight: 700;
    }

    .recurring-page-wrap {
        display: grid;
        gap: 1rem;
    }

    .recurring-page-card {
        overflow: visible;
    }

    .recurring-preview-card {
        overflow: visible;
        border-color: #d7e3f7;
        background: linear-gradient(180deg, #fbfdff 0%, #f6f9ff 100%);
    }

    .recurring-preview-header {
        padding-bottom: 0.7rem;
    }

    .recurring-preview-kicker {
        margin: 0;
        font-size: 0.68rem;
        font-weight: 800;
        color: #2563eb;
        text-transform: uppercase;
        letter-spacing: 0.08em;
    }

    .recurring-preview-title {
        margin: 0.16rem 0 0.18rem;
        font-size: 1rem;
        color: #0f172a;
        letter-spacing: -0.01em;
    }

    .recurring-preview-subtitle {
        margin: 0;
        font-size: 0.8rem;
        color: #64748b;
        max-width: 72ch;
    }

    .under-review-list {
        padding: 0.55rem;
        display: grid;
        gap: 0.45rem;
    }

    .under-review-card {
        border-color: #dbe3ef;
        overflow: hidden;
        box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    }

    .under-review-card-top {
        gap: 0.9rem;
        cursor: pointer;
    }

    .under-review-main {
        min-width: 0;
    }

    .under-review-title-line {
        row-gap: 0.35rem;
        column-gap: 0.35rem;
    }

    .under-review-title-line h4 {
        font-size: 0.98rem;
    }

    .under-review-title-line span {
        background: rgba(15, 23, 42, 0.06);
        border-radius: 999px;
        padding: 0.12rem 0.5rem;
    }

    .under-review-toggle {
        width: 30px;
        height: 30px;
        border-radius: 999px;
    }

    .under-review-card-body {
        padding: 0.75rem 0.8rem 0.85rem;
        background: #ffffff;
    }

    .under-review-cycle-stack {
        display: grid;
        gap: 0.55rem;
    }

    .under-review-cycle-item {
        border: 1px solid #e6edf7;
        border-radius: 12px;
        background: #f9fbff;
        padding: 0.56rem 5.4rem 0.72rem 0.78rem;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
        position: relative;
    }

    .under-review-cycle-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        margin-bottom: 0;
    }

    .under-review-cycle-head-right {
        justify-content: flex-end;
    }

    .under-review-header-actions {
        display: inline-flex;
        align-items: center;
        gap: 0.38rem;
    }

    .under-review-add-btn,
    .under-review-edit-btn,
    .under-review-form-btn {
        border: 1px solid #bfdbfe;
        background: #eff6ff;
        color: #1d4ed8;
        border-radius: 999px;
        font-size: 0.72rem;
        font-weight: 700;
        padding: 0.2rem 0.62rem;
        cursor: pointer;
        line-height: 1.3;
    }

    .under-review-add-btn {
        width: 30px;
        height: 30px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 1rem;
        font-weight: 800;
    }

    .under-review-toolbar-add-btn {
        width: 34px;
        height: 32px;
        padding: 0;
        border-radius: 999px;
        font-size: 1.04rem;
        font-weight: 800;
    }

    .under-review-add-btn:hover,
    .under-review-edit-btn:hover,
    .under-review-form-btn:hover {
        background: #dbeafe;
        border-color: #93c5fd;
    }

    .under-review-cycle-controls {
        display: inline-flex;
        align-items: center;
        gap: 0.36rem;
    }

    .under-review-cycle-tools-row {
        position: absolute;
        top: 0.56rem;
        right: 0.68rem;
        display: inline-flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 0.22rem;
        margin-bottom: 0;
    }

    .under-review-edit-icon {
        width: 28px;
        height: 24px;
        padding: 0;
        border-radius: 8px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0.88rem;
        line-height: 1;
    }

    .under-review-add-form,
    .under-review-edit-form {
        border: 1px solid #dbe3ef;
        border-radius: 10px;
        background: #f8fafc;
        padding: 0.58rem 0.62rem;
        margin-bottom: 0.55rem;
    }

    .under-review-form-grid {
        display: grid;
        grid-template-columns: 1fr 1fr 110px;
        gap: 0.45rem;
    }

    .under-review-form-grid label {
        display: grid;
        gap: 0.18rem;
    }

    .under-review-form-grid label span {
        font-size: 0.68rem;
        font-weight: 700;
        color: #64748b;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .under-review-input {
        width: 100%;
        border: 1px solid #cbd5e1;
        border-radius: 8px;
        padding: 0.34rem 0.46rem;
        font-size: 0.78rem;
        background: #fff;
        color: #0f172a;
    }

    .under-review-input:focus {
        outline: none;
        border-color: #60a5fa;
        box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.14);
    }

    .under-review-form-actions {
        display: flex;
        justify-content: flex-end;
        gap: 0.34rem;
        margin-top: 0.45rem;
    }

    .under-review-form-btn-primary {
        background: #2563eb;
        border-color: #2563eb;
        color: #fff;
    }

    .under-review-form-btn-primary:hover {
        background: #1d4ed8;
        border-color: #1d4ed8;
    }

    .under-review-form-cancel {
        background: #fff;
        border-color: #cbd5e1;
        color: #475569;
    }

    .under-review-form-cancel:hover {
        background: #f8fafc;
        border-color: #94a3b8;
    }

    .under-review-cycle-meta {
        display: inline-flex;
        align-items: center;
        border-radius: 999px;
        border: 1px solid #dbe3ef;
        background: #f8fafc;
        color: #64748b;
        font-size: 0.72rem;
        font-weight: 700;
        padding: 0.12rem 0.5rem;
        white-space: nowrap;
    }

    .under-review-cycle-meta-id {
        border-color: #dbe3ef;
        background: #eef2f7;
        color: #334155;
        letter-spacing: 0.01em;
    }

    .under-review-cycle-body {
        display: grid;
        gap: 0.28rem;
        font-size: 0.8rem;
        color: #334155;
        line-height: 1.5;
    }

    .under-review-cycle-line {
        display: grid;
        grid-template-columns: 82px 1fr;
        gap: 0.42rem;
        align-items: start;
    }

    .under-review-cycle-label {
        font-size: 0.74rem;
        font-weight: 700;
        color: #64748b;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        padding-top: 0.04rem;
    }

    .under-review-cycle-value {
        color: #0f172a;
        font-weight: 600;
        word-break: break-word;
    }

    .under-review-cycle-badge {
        display: inline-flex;
        align-items: center;
        border-radius: 999px;
        border: 1px solid #93c5fd;
        background: linear-gradient(180deg, rgba(37, 99, 235, 0.16), rgba(37, 99, 235, 0.1));
        color: #1e40af;
        font-weight: 700;
        letter-spacing: 0.01em;
        padding: 0.16rem 0.58rem;
        font-size: 0.72rem;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 0 0 1px rgba(59, 130, 246, 0.08);
    }

    .under-review-id-text {
        display: inline-flex;
        align-items: center;
        padding: 0.14rem 0.52rem;
        border-radius: 999px;
        border: 1px solid #dbe3ef;
        background: #f8fafc;
        color: #475569;
        font-size: 0.74rem;
        font-weight: 700;
        white-space: nowrap;
    }

    .recurring-header {
        padding: 0.58rem 0.75rem;
    }

    .recurring-header-search {
        width: min(460px, 100%);
        display: inline-flex;
        align-items: center;
        gap: 0.42rem;
        border: 1px solid #d7dce6;
        border-radius: 10px;
        background: #fff;
        padding: 0.38rem 0.58rem;
    }

    .recurring-header-search input {
        flex: 1 1 auto;
        min-width: 0;
        border: none;
        outline: none;
        background: transparent;
        color: #0f172a;
        font-size: 0.82rem;
        font-weight: 600;
    }

    .recurring-cards-list {
        padding: 0.55rem;
        display: grid;
        gap: 0.45rem;
    }

    .recurring-card {
        border: 1px solid #dbe3ef;
        border-radius: 10px;
        overflow: visible;
        background: #fff;
    }

    .recurring-card-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.65rem;
        padding: 0.58rem 0.68rem;
        background: linear-gradient(135deg, #f8fbff 0%, #eef4ff 100%);
    }

    .recurring-main h4 {
        margin: 0;
        font-size: 0.92rem;
        color: #0f172a;
    }

    .recurring-title-line {
        display: flex;
        gap: 0.35rem;
        flex-wrap: wrap;
        align-items: center;
    }

    .recurring-title-line span {
        font-size: 0.72rem;
        font-weight: 600;
        color: #475569;
        background: rgba(15, 23, 42, 0.06);
        border-radius: 8px;
        padding: 0.1rem 0.45rem;
    }

    .recurring-toggle {
        border: 1px solid #93c5fd;
        background: #2563eb;
        color: #fff;
        border-radius: 999px;
        width: 28px;
        height: 28px;
        padding: 0;
        cursor: pointer;
        font-size: 0.78rem;
        font-weight: 700;
        flex: 0 0 auto;
    }

    .recurring-card-body {
        padding: 0.6rem;
        border-top: 1px solid #e5e7eb;
    }

    .recurring-toolbar {
        display: flex;
        gap: 0.42rem;
        flex-wrap: wrap;
        margin-bottom: 0.5rem;
    }

    .recurring-toolbar .rp-columns-wrap {
        order: 98;
    }

    .recurring-toolbar .page-size-pill {
        order: 99;
        margin-left: auto;
    }

    .under-review-table-toolbar .search-pill {
        min-width: min(340px, 100%);
    }

    .under-review-columns-wrap {
        position: relative;
    }

    .under-review-columns-btn {
        width: 32px;
        min-width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .under-review-columns-menu {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        width: min(360px, 88vw);
        max-height: 52vh;
        overflow: auto;
        box-sizing: border-box;
        background: #ffffff;
        border: 1px solid #d7dce6;
        border-radius: 12px;
        box-shadow: 0 16px 32px rgba(15, 23, 42, 0.14);
        padding: 0.62rem;
        z-index: 10;
    }

    .under-review-table .under-review-edit-row-btn {
        width: 28px;
        height: 24px;
        padding: 0;
        border-radius: 8px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0.86rem;
        line-height: 1;
    }

    .rp-columns-wrap {
        position: relative;
    }

    .rp-columns-menu-overlay {
        overflow: auto;
    }

    .rp-columns-wrap .toolbar-btn {
        width: 32px;
        min-width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .rp-columns-menu {
        position: fixed;
        width: 340px;
        max-height: 60vh;
        overflow: auto;
        box-sizing: border-box;
        background: #ffffff;
        border: 1px solid #d7dce6;
        border-radius: 12px;
        box-shadow: 0 10px 26px rgba(15, 23, 42, 0.16);
        padding: 0.45rem 0.45rem 0.7rem;
        z-index: 999;
    }

    .table-column-menu {
        position: fixed;
        width: 340px;
        max-height: 60vh;
        overflow: auto;
        box-sizing: border-box;
        background: #ffffff;
        border: 1px solid #d7dce6;
        border-radius: 12px;
        box-shadow: 0 10px 26px rgba(15, 23, 42, 0.16);
        padding: 0.45rem 0.45rem 0.7rem;
        z-index: 10000;
    }

    .table-column-menu.open-up,
    .rp-columns-menu.open-up {
        top: auto;
        bottom: calc(100% + 6px);
    }

    .table-column-menu-title,
    .rp-columns-title {
        font-size: 0.74rem;
        color: #475569;
        font-weight: 700;
        margin-bottom: 0.3rem;
        padding: 0.15rem 0.25rem;
    }

    .table-column-option,
    .rp-col-option {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.65rem;
        font-size: 0.74rem;
        border-radius: 8px;
        padding: 0.28rem 0.35rem;
    }

    .table-column-option:hover,
    .rp-col-option:hover {
        background: #f4f7fb;
    }

    .table-column-option span,
    .rp-col-option span {
        font-weight: 600;
        color: #334155;
    }

    .table-column-toggle {
        appearance: none;
        -webkit-appearance: none;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        border: 1.5px solid #94a3b8;
        background: #fff;
        display: inline-grid;
        place-items: center;
        cursor: pointer;
        flex: 0 0 auto;
    }

    .table-column-toggle::after {
        content: '';
        width: 8px;
        height: 8px;
        border-radius: 50%;
        transform: scale(0);
        background: #2563eb;
        transition: transform 0.12s ease;
    }

    .table-column-toggle:checked {
        border-color: #2563eb;
    }

    .table-column-toggle:checked::after {
        transform: scale(1);
    }

    .table-column-menu {
        position: fixed;
        width: 340px;
        max-height: 60vh;
        overflow: auto;
        box-sizing: border-box;
        background: #ffffff;
        border: 1px solid #d7dce6;
        border-radius: 12px;
        box-shadow: 0 10px 26px rgba(15, 23, 42, 0.16);
        padding: 0.45rem 0.45rem 0.7rem;
        z-index: 10000;
    }

    .table-column-menu.open-up,
    .rp-columns-menu.open-up {
        top: auto;
        bottom: calc(100% + 6px);
    }

    .table-column-menu-title,
    .rp-columns-title {
        font-size: 0.74rem;
        color: #475569;
        font-weight: 700;
        margin-bottom: 0.3rem;
        padding: 0.15rem 0.25rem;
    }

    .table-column-option,
    .rp-col-option {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.65rem;
        font-size: 0.74rem;
        border-radius: 8px;
        padding: 0.28rem 0.35rem;
    }

    .table-column-option:hover,
    .rp-col-option:hover {
        background: #f4f7fb;
    }

    .table-column-option span,
    .rp-col-option span {
        font-weight: 600;
        color: #334155;
    }

    .table-column-toggle {
        appearance: none;
        -webkit-appearance: none;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        border: 1.5px solid #94a3b8;
        background: #fff;
        display: inline-grid;
        place-items: center;
        cursor: pointer;
        flex: 0 0 auto;
    }

    .table-column-toggle::after {
        content: '';
        width: 8px;
        height: 8px;
        border-radius: 50%;
        transform: scale(0);
        background: #2563eb;
        transition: transform 0.12s ease;
    }

    .table-column-toggle:checked {
        border-color: #2563eb;
    }

    .table-column-toggle:checked::after {
        transform: scale(1);
    }

    .rp-columns-menu.open-up {
        top: auto;
        bottom: calc(100% + 6px);
    }

    .rp-columns-title {
        font-size: 0.74rem;
        color: #475569;
        font-weight: 700;
        margin-bottom: 0.3rem;
        padding: 0.15rem 0.25rem;
    }

    .rp-col-option {
        display: grid;
        grid-template-columns: minmax(110px, 1fr) auto auto;
        align-items: center;
        gap: 0.45rem;
        font-size: 0.74rem;
        border-radius: 8px;
        padding: 0.28rem 0.3rem;
    }

    .rp-col-option:last-child {
        margin-bottom: 0.15rem;
    }

    .rp-col-option:hover {
        background: #f4f7fb;
    }

    .rp-col-option span {
        font-weight: 600;
        color: #334155;
    }

    .rp-col-option label {
        display: inline-flex;
        align-items: center;
        gap: 0.24rem;
        color: #475569;
        font-weight: 600;
        white-space: nowrap;
    }

    .rp-col-option input[type="radio"] {
        margin: 0;
        accent-color: #2563eb;
    }

    .recurring-footer {
        margin-top: 0.55rem;
        padding-left: 0;
        padding-right: 0;
        border-top: none;
    }

    .rp-page {
        font-size: 0.8rem;
        font-weight: 600;
        color: #475569;
    }

    .recurring-empty {
        text-align: center;
        padding: 0.85rem;
        border-radius: 12px;
        background: #f8fafc;
        border: 1px dashed #d7dce6;
        color: #64748b;
        font-weight: 600;
    }

    @media (max-width: 960px) {
        .recurring-card-top {
            align-items: flex-start;
        }
    }

    @media (max-width: 980px) {
        .user-mgmt-page-head {
            grid-template-columns: 1fr;
            display: grid;
            text-align: left;
        }

        .user-mgmt-meta {
            justify-self: start;
            text-align: left;
        }

        .user-mgmt-grid {
            grid-template-columns: 1fr;
        }
    }

    [data-theme="dark"] .user-mgmt-page-head,
    [data-theme="dark"] .user-mgmt-card .table-header {
        background: linear-gradient(135deg, #202733 0%, #232d3d 100%);
        border-color: #394355;
    }

    [data-theme="dark"] .user-mgmt-kicker {
        color: #93c5fd;
    }

    [data-theme="dark"] .user-mgmt-title,
    [data-theme="dark"] .user-mgmt-meta-value,
    [data-theme="dark"] .user-mgmt-card .table-header h3 {
        color: #e2e8f0;
    }

    [data-theme="dark"] .user-mgmt-subtitle,
    [data-theme="dark"] .user-mgmt-meta-label,
    [data-theme="dark"] .user-mgmt-form span {
        color: #cbd5e1;
    }

    [data-theme="dark"] .user-mgmt-meta {
        background: #202733;
        border-color: #394355;
    }

    [data-theme="dark"] .user-mgmt-self {
        color: #93c5fd;
        border-color: #3b82f6;
        background: rgba(59, 130, 246, 0.2);
    }

    [data-theme="dark"] .recurring-card {
        background: #1f2530;
        border-color: #394355;
    }

    [data-theme="dark"] .recurring-card-top {
        background: linear-gradient(135deg, #202733 0%, #232d3d 100%);
    }

    [data-theme="dark"] .recurring-preview-card {
        background: linear-gradient(180deg, #1d2430 0%, #202733 100%);
        border-color: #394355;
    }

    [data-theme="dark"] .recurring-preview-kicker {
        color: #93c5fd;
    }

    [data-theme="dark"] .recurring-preview-title,
    [data-theme="dark"] .under-review-customer-name {
        color: #e2e8f0;
    }

    [data-theme="dark"] .recurring-preview-subtitle,
    [data-theme="dark"] .under-review-card-body,
    [data-theme="dark"] .under-review-cycle-body,
    [data-theme="dark"] .under-review-cycle-meta,
    [data-theme="dark"] .under-review-id-text {
        color: #cbd5e1;
    }

    [data-theme="dark"] .under-review-card {
        border-color: #394355;
        box-shadow: 0 12px 24px rgba(2, 6, 23, 0.28);
    }

    [data-theme="dark"] .under-review-card-body {
        background: #1f2530;
    }

    [data-theme="dark"] .under-review-cycle-item {
        background: #202733;
        border-color: #394355;
        box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.08);
    }

    [data-theme="dark"] .under-review-title-line span,
    [data-theme="dark"] .under-review-id-text {
        background: rgba(148, 163, 184, 0.18);
        border-color: #394355;
        color: #cbd5e1;
    }

    [data-theme="dark"] .under-review-cycle-meta {
        background: #202733;
        border-color: #394355;
        color: #cbd5e1;
    }

    [data-theme="dark"] .under-review-cycle-meta-id {
        background: #253043;
        border-color: #394355;
        color: #cbd5e1;
    }

    [data-theme="dark"] .under-review-add-btn,
    [data-theme="dark"] .under-review-edit-btn,
    [data-theme="dark"] .under-review-form-btn {
        background: #202733;
        border-color: #394355;
        color: #cbd5e1;
    }

    [data-theme="dark"] .under-review-add-btn:hover,
    [data-theme="dark"] .under-review-edit-btn:hover,
    [data-theme="dark"] .under-review-form-btn:hover {
        background: #263040;
        border-color: #4b5c75;
    }

    [data-theme="dark"] .under-review-add-form,
    [data-theme="dark"] .under-review-edit-form {
        background: #202733;
        border-color: #394355;
    }

    [data-theme="dark"] .under-review-form-grid label span {
        color: #93a6bf;
    }

    [data-theme="dark"] .under-review-input {
        background: #1f2530;
        border-color: #394355;
        color: #e2e8f0;
    }

    [data-theme="dark"] .under-review-input:focus {
        border-color: #4b5c75;
        box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    }

    [data-theme="dark"] .under-review-form-cancel {
        background: #202733;
        border-color: #394355;
        color: #cbd5e1;
    }

    [data-theme="dark"] .under-review-form-cancel:hover {
        background: #263040;
        border-color: #4b5c75;
    }

    [data-theme="dark"] .under-review-toggle,
    [data-theme="dark"] .under-review-cycle-badge {
        background: linear-gradient(180deg, rgba(37, 99, 235, 0.22), rgba(37, 99, 235, 0.12));
        border-color: #4b5c75;
        color: #dbeafe;
    }

    [data-theme="dark"] .under-review-cycle-badge {
        box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.22), 0 0 0 1px rgba(96, 165, 250, 0.14);
    }

    [data-theme="dark"] .under-review-toggle:hover {
        background: #263040;
        border-color: #4b5c75;
    }

    [data-theme="dark"] .under-review-cycle-label {
        color: #93a6bf;
    }

    [data-theme="dark"] .under-review-cycle-value {
        color: #e2e8f0;
    }

    [data-theme="dark"] .under-review-columns-menu {
        background: #1f2530;
        border-color: #394355;
        box-shadow: 0 16px 32px rgba(0, 0, 0, 0.34);
    }

    @media (max-width: 900px) {
        .under-review-list {
            padding: 0.42rem;
        }

        .under-review-customer-name {
            font-size: 0.88rem;
        }

        .under-review-title-line {
            flex-direction: column;
            align-items: flex-start;
        }

        .under-review-cycle-head {
            align-items: flex-start;
            flex-direction: column;
        }

        .under-review-form-grid {
            grid-template-columns: 1fr;
        }

        .under-review-form-actions {
            justify-content: flex-start;
            flex-wrap: wrap;
        }

        .under-review-cycle-line {
            grid-template-columns: 1fr;
            gap: 0.14rem;
        }

        .under-review-cycle-item {
            padding-right: 0.78rem;
        }

        .under-review-cycle-tools-row {
            position: static;
            margin-bottom: 0.18rem;
            display: inline-flex;
            flex-direction: row;
            align-items: center;
            gap: 0.3rem;
        }

        .under-review-cycle-label {
            font-size: 0.69rem;
        }
    }

    [data-theme="dark"] .recurring-main h4,
    [data-theme="dark"] .rp-page {
        color: #e2e8f0;
    }

    [data-theme="dark"] .recurring-title-line span {
        background: rgba(148, 163, 184, 0.18);
        color: #cbd5e1;
    }

    [data-theme="dark"] .recurring-header-search {
        background: #202733;
        border-color: #394355;
    }

    [data-theme="dark"] .recurring-header-search input {
        color: #e2e8f0;
    }

    [data-theme="dark"] .rp-columns-menu {
        background: #202733;
        border-color: #394355;
        box-shadow: 0 12px 26px rgba(2, 6, 23, 0.5);
    }

    [data-theme="dark"] .rp-columns-title,
    [data-theme="dark"] .rp-col-option span,
    [data-theme="dark"] .rp-col-option label {
        color: #cbd5e1;
    }

    [data-theme="dark"] .rp-col-option:hover {
        background: #263040;
    }

    [data-theme="dark"] .recurring-card-body {
        border-top-color: #2b3340;
    }

    [data-theme="dark"] .recurring-empty {
        background: #202733;
        border-color: #394355;
        color: #cbd5e1;
    }

    [data-theme="dark"] .user-mgmt-form input,
    [data-theme="dark"] .user-mgmt-form select,
    [data-theme="dark"] .user-mgmt-inline input,
    [data-theme="dark"] .user-mgmt-inline select,
    [data-theme="dark"] .user-mgmt-btn {
        background: #202733;
        border-color: #394355;
        color: #e2e8f0;
    }

    [data-theme="dark"] .user-mgmt-btn-primary {
        background: #3b82f6;
        border-color: #3b82f6;
        color: #fff;
    }

    [data-theme="dark"] .user-mgmt-btn-danger {
        background: #ef4444;
        border-color: #ef4444;
        color: #fff;
    }

    /* Modal/Popup Styles */
    .modal-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        animation: fadeIn 0.2s ease;
    }

    .modal-overlay.active {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }

    @keyframes slideIn {
        from {
            transform: scale(0.95);
            opacity: 0;
        }
        to {
            transform: scale(1);
            opacity: 1;
        }
    }

    .modal-content {
        background: #ffffff;
        border-radius: 12px;
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
        max-width: 500px;
        width: 90%;
        animation: slideIn 0.2s ease;
        position: relative;
    }

    .modal-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1rem;
        border-bottom: 1px solid #e5e7eb;
    }

    .modal-title {
        font-size: 1.1rem;
        font-weight: 700;
        color: #1f2937;
        margin: 0;
    }

    .modal-close-btn {
        background: none;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        color: #6b7280;
        padding: 0;
        width: 30px;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 6px;
        transition: background 0.2s ease;
    }

    .modal-close-btn:hover {
        background: #f3f4f6;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .modal-form label {
        display: flex;
        flex-direction: column;
        margin-bottom: 1rem;
    }

    .modal-form label span {
        font-size: 0.875rem;
        font-weight: 600;
        color: #374151;
        margin-bottom: 0.4rem;
    }

    .modal-form input,
    .modal-form select,
    .modal-form textarea {
        width: 100%;
        box-sizing: border-box;
        padding: 0.5rem 0.75rem;
        border: 1px solid #d1d5db;
        border-radius: 8px;
        font-size: 0.875rem;
        font-family: inherit;
        transition: border-color 0.2s ease, box-shadow 0.2s ease;
    }

    .modal-form input:focus,
    .modal-form select:focus,
    .modal-form textarea:focus {
        outline: none;
        border-color: #2563eb;
        box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    }

    .modal-footer {
        display: flex;
        gap: 0.75rem;
        justify-content: flex-end;
        padding: 1rem;
        border-top: 1px solid #e5e7eb;
    }

    .modal-btn {
        border: 1px solid #d1d5db;
        border-radius: 8px;
        background: #ffffff;
        color: #374151;
        font-size: 0.875rem;
        font-weight: 600;
        padding: 0.5rem 1rem;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .modal-btn:hover {
        border-color: #9ca3af;
        background: #f9fafb;
    }

    .modal-btn-primary {
        background: #2563eb;
        border-color: #2563eb;
        color: #ffffff;
    }

    .modal-btn-primary:hover {
        background: #1d4ed8;
        border-color: #1d4ed8;
    }

    .modal-btn-cancel {
        background: #f3f4f6;
        border-color: #e5e7eb;
        color: #374151;
    }

    .modal-btn-cancel:hover {
        background: #e5e7eb;
    }

    .modal-btn-danger {
        background: #ef4444;
        border-color: #ef4444;
        color: #fff;
    }

    .modal-btn-danger:hover {
        background: #dc2626;
        border-color: #dc2626;
    }

    /* My Records Edit Modal */
    .mr-edit-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.85rem 1rem;
    }
    .mr-edit-label {
        display: flex;
        flex-direction: column;
        gap: 0.3rem;
        font-size: 0.8rem;
        font-weight: 600;
        color: #374151;
        position: relative;
    }
    .mr-edit-input {
        padding: 0.4rem 0.65rem;
        border: 1px solid #d1d5db;
        border-radius: 8px;
        font-size: 0.8rem;
        font-family: inherit;
        background: #fff;
        transition: border-color 0.2s;
    }
    .mr-edit-input:focus {
        outline: none;
        border-color: #6366f1;
        box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
    }
    .mr-missing-star { color: #f59e0b; font-size: 0.72rem; }
    .mr-edit-btn {
        background: none;
        border: 1px solid #f59e0b;
        border-radius: 6px;
        padding: 0.18rem 0.42rem;
        cursor: pointer;
        font-size: 0.78rem;
        color: #d97706;
        transition: background 0.15s;
    }
    .mr-edit-btn:hover { background: #fef3c7; }
    [data-theme="dark"] .mr-edit-label { color: #d1d5db; }
    [data-theme="dark"] .mr-edit-input { background: #1e2533; border-color: #394355; color: #e5e7eb; }
    [data-theme="dark"] .mr-edit-btn { border-color: #d97706; color: #fbbf24; }
    [data-theme="dark"] .mr-edit-btn:hover { background: rgba(251,191,36,0.1); }

    /* Recurring profile ID clickable link in tables */
    .rp-id-link {
        color: #2563eb;
        text-decoration: none;
        font-weight: 500;
        border-bottom: 1px dashed #93c5fd;
        transition: color 0.15s, border-color 0.15s;
    }
    .rp-id-link:hover { color: #1d4ed8; border-bottom-color: #1d4ed8; }
    [data-theme="dark"] .rp-id-link { color: #60a5fa; border-bottom-color: #3b82f6; }
    [data-theme="dark"] .rp-id-link:hover { color: #93c5fd; border-bottom-color: #93c5fd; }

    /* Create User Button (Plus Symbol) */
    .create-user-btn-wrap {
        position: absolute;
        top: 0;
        right: 0;
    }

    .create-user-btn {
        background: #2563eb;
        border: none;
        border-radius: 999px;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        font-size: 1.5rem;
        color: white;
        transition: all 0.2s ease;
        position: relative;
        overflow: visible;
    }

    .create-user-btn:hover {
        transform: scale(1.1);
        box-shadow: 0 6px 14px rgba(37, 99, 235, 0.3);
    }

    .create-user-btn-tooltip {
        position: absolute;
        top: calc(100% + 8px);
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0, 0, 0, 0.8);
        color: white;
        padding: 0.5rem 0.75rem;
        border-radius: 6px;
        font-size: 0.75rem;
        font-weight: 600;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        z-index: 10;
    }

    .create-user-btn:hover .create-user-btn-tooltip {
        opacity: 1;
    }

    /* Dark theme modal styles */
    [data-theme="dark"] .modal-content {
        background: #202733;
        color: #e2e8f0;
    }

    [data-theme="dark"] .modal-header {
        border-bottom-color: #394355;
    }

    [data-theme="dark"] .modal-title {
        color: #e2e8f0;
    }

    [data-theme="dark"] .modal-close-btn {
        color: #9ca3af;
    }

    [data-theme="dark"] .modal-close-btn:hover {
        background: #2d3748;
    }

    [data-theme="dark"] .modal-form label span {
        color: #d1d5db;
    }

    [data-theme="dark"] .modal-form input,
    [data-theme="dark"] .modal-form select,
    [data-theme="dark"] .modal-form textarea {
        background: #1a1f2e;
        border-color: #394355;
        color: #e2e8f0;
    }

    [data-theme="dark"] .modal-form input:focus,
    [data-theme="dark"] .modal-form select:focus,
    [data-theme="dark"] .modal-form textarea:focus {
        border-color: #3b82f6;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    }

    [data-theme="dark"] .modal-footer {
        border-top-color: #394355;
    }

    [data-theme="dark"] .modal-btn {
        background: #2d3748;
        border-color: #394355;
        color: #e2e8f0;
    }

    [data-theme="dark"] .modal-btn:hover {
        background: #3a434f;
        border-color: #4b5563;
    }

    [data-theme="dark"] .modal-btn-primary {
        background: #3b82f6;
        border-color: #3b82f6;
        color: #ffffff;
    }

    [data-theme="dark"] .modal-btn-primary:hover {
        background: #2563eb;
    }

    [data-theme="dark"] .modal-btn-cancel {
        background: #2d3748;
        border-color: #394355;
        color: #e2e8f0;
    }

    [data-theme="dark"] .modal-btn-cancel:hover {
        background: #3a434f;
    }

    [data-theme="dark"] .modal-btn-danger {
        background: #dc2626;
        border-color: #dc2626;
    }

    [data-theme="dark"] .modal-btn-danger:hover {
        background: #b91c1c;
        border-color: #b91c1c;
    }

    @media (max-width: 900px) {
        .login-shell {
            grid-template-columns: 1fr;
        }
    }


/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-collapsed-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 2rem 0.8rem;
    position: fixed;
    height: 100vh;
    transition: var(--transition);
    z-index: 100;
    overflow: hidden;
}

.sidebar:hover {
    width: var(--sidebar-width);
    padding: 2rem 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 2rem;
    min-height: 36px;
}

.logo-text {
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-6px);
    max-width: 0;
    overflow: hidden;
    transition: var(--transition);
}

.sidebar:hover .logo-text {
    opacity: 1;
    transform: translateX(0);
    max-width: 160px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--primary-alt));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.nav-menu {
    list-style: none;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.nav-item {
    margin-bottom: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 44px;
    height: 44px;
    margin: 0 auto;
    padding: 0;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 14px;
    font-weight: 500;
    transition: var(--transition);
    justify-content: center;
}

.nav-link i {
    font-style: normal;
    width: 20px;
    min-width: 20px;
    text-align: center;
}

.nav-text {
    opacity: 0;
    transform: translateX(-6px);
    max-width: 0;
    overflow: hidden;
    white-space: normal;
    line-height: 1.2;
    transition: var(--transition);
}

.sidebar:hover .nav-link {
    width: 100%;
    height: auto;
    min-height: 44px;
    margin: 0;
    padding: 0.65rem 0.9rem;
    justify-content: flex-start;
}

.sidebar:hover .nav-text {
    opacity: 1;
    transform: translateX(0);
    max-width: 220px;
}

.nav-link:hover, .nav-link.active {
    background: var(--primary);
    color: white;
}

.sidebar-footer {
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.support-card {
    background: linear-gradient(135deg, #f0f4ff, #e0e7ff);
    padding: 1.25rem;
    border-radius: 16px;
    text-align: center;
}

[data-theme="dark"] .support-card {
    background: #2a2a2a;
}

.support-card p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.btn-support {
    width: 100%;
    padding: 0.6rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

/* Main Content Styling */
.main-wrapper {
    margin-left: var(--sidebar-collapsed-width);
    flex-grow: 1;
    min-width: 0;
    max-width: calc(100vw - var(--sidebar-collapsed-width));
    overflow-x: hidden;
    padding: 1rem;
    transition: var(--transition);
}

.sidebar:hover + .main-wrapper {
    margin-left: var(--sidebar-width);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.header-title h1 {
    font-size: 1.875rem;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* ── Notification Bell ── */
.notif-wrap {
    position: relative;
}

.notif-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    color: var(--text-secondary, #64748b);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.notif-btn:hover {
    background: var(--bg-hover, #f1f5f9);
    color: var(--primary, #6366f1);
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    pointer-events: none;
}

.notif-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 310px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 1000;
    overflow: hidden;
}

.notif-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border, #e2e8f0);
    background: var(--bg-secondary, #f8fafc);
}

.notif-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
}

.notif-list {
    max-height: 320px;
    overflow-y: auto;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    border-bottom: 1px solid var(--border, #f1f5f9);
    transition: background 0.15s;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background: var(--bg-hover, #f8fafc);
}

.notif-icon {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.notif-msg {
    font-size: 0.82rem;
    color: var(--text-primary, #1e293b);
    line-height: 1.4;
}

.notif-empty {
    padding: 1rem;
    font-size: 0.82rem;
    color: var(--text-secondary, #64748b);
    text-align: center;
}

[data-theme="dark"] .notif-dropdown {
    background: #1e2733;
    border-color: #2d3a4a;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

[data-theme="dark"] .notif-header {
    background: #17202a;
    border-color: #2d3a4a;
}

[data-theme="dark"] .notif-item {
    border-color: #2d3a4a;
}

[data-theme="dark"] .notif-item:hover {
    background: #243040;
}

[data-theme="dark"] .notif-btn {
    color: #94a3b8;
}

[data-theme="dark"] .notif-btn:hover {
    background: #243040;
    color: #818cf8;
}

/* Theme Toggle */
.theme-switch {
    position: relative;
    width: 60px;
    height: 30px;
    background: var(--border);
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
}

.theme-switch .toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

[data-theme="dark"] .theme-switch .toggle-thumb {
    left: 33px;
    background: #333;
}

/* Analytics Grid */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* 6-card variant — used for the top KPI row on the dashboard */
.analytics-grid-6 {
    grid-template-columns: repeat(6, 1fr) !important;
    gap: 1rem !important;
}
.analytics-grid-6 .stat-card {
    padding: 0.8rem;
}
.analytics-grid-6 .stat-card .stat-value {
    font-size: 1.1rem;
}
.analytics-grid-6 .stat-card .stat-title {
    font-size: 0.78rem;
}
.analytics-grid-6 .stat-card .stat-icon {
    width: 30px;
    height: 30px;
    font-size: 0.85rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.stat-title {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-icon {
    width: 36px;
    height: 36px;
    background: #f0f4ff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

[data-theme="dark"] .stat-icon { background: #2a2a2a !important; color: inherit !important; }

/* Icon colour utility classes (light + dark variants) */
.icon-red   { background: #fee2e2; color: #dc2626; }
.icon-green { background: #dcfce7; color: #16a34a; }
.icon-blue  { background: #e0f2fe; color: #0284c7; }
.icon-amber { background: #fef3c7; color: #d97706; }
.icon-pink  { background: #fce7f3; color: #db2777; }
.icon-purple{ background: #ede9fe; color: #7c3aed; }
.icon-teal  { background: #ccfbf1; color: #0d9488; }
[data-theme="dark"] .icon-red   { background: rgba(220,38,38,0.18)  !important; color: #f87171 !important; }
[data-theme="dark"] .icon-green { background: rgba(22,163,74,0.18)  !important; color: #4ade80 !important; }
[data-theme="dark"] .icon-blue  { background: rgba(2,132,199,0.18)  !important; color: #38bdf8 !important; }
[data-theme="dark"] .icon-amber { background: rgba(217,119,6,0.18)  !important; color: #fbbf24 !important; }
[data-theme="dark"] .icon-pink  { background: rgba(219,39,119,0.18) !important; color: #f472b6 !important; }
[data-theme="dark"] .icon-purple{ background: rgba(124,58,237,0.18) !important; color: #a78bfa !important; }
[data-theme="dark"] .icon-teal  { background: rgba(13,148,136,0.18) !important; color: #2dd4bf !important; }

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-trend {
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.trend-up { color: var(--accent-success); }
.trend-down { color: var(--accent-danger); }

/* Charts Area */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* ---- Profit / Loss split card ---- */
.pnl-card {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

.pnl-chart-side {
    padding: 1.25rem 1.5rem 1.5rem;
    border-right: 1px solid var(--border);
}

.pnl-metrics-side {
    padding: 1.25rem 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pnl-metrics-label {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.pnl-metric-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
    flex: 1;
}

.pnl-mini-card {
    background: var(--bg-main);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 12px;
    padding: 0.8rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

[data-theme="dark"] .pnl-mini-card {
    background: rgba(255, 255, 255, 0.03);
}

.pnl-mini-card-wide {
    /* same styles, alias for clarity */
}

.pnl-mini-title {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-muted);
    line-height: 1.2;
}

.pnl-mini-value {
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--text-main);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.pnl-mini-trend {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.3;
    min-height: 1rem;
}

@media (max-width: 1100px) {
    .pnl-card {
        grid-template-columns: 1fr;
    }
    .pnl-chart-side {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .pnl-metric-row {
        grid-template-columns: 1fr 1fr;
    }
}

.account-manager-summary-wrap {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.account-manager-summary-head h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-main);
}

.account-manager-summary-head p {
    margin: 0.2rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.account-manager-cards-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.8rem;
}

.manager-summary-card {
    border: 1px solid #d8deea;
    background: linear-gradient(180deg, #ffffff, #f8fbff);
    border-radius: 14px;
    padding: 0.85rem 0.85rem 0.9rem;
    text-align: left;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.manager-summary-card:hover {
    transform: translateY(-2px);
    border-color: #93c5fd;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.12);
}

.manager-summary-title {
    font-size: 0.84rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.manager-summary-metric {
    font-size: 1rem;
    font-weight: 800;
    color: #1d4ed8;
}

.manager-summary-submetric {
    margin-top: 0.15rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: #334155;
}

.manager-summary-detail {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
}

.manager-summary-empty {
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    padding: 1rem;
    font-size: 0.85rem;
    color: #64748b;
    background: #f8fafc;
}

.chart-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.chart-title {
    font-size: 1rem;
    font-size: 0.9rem;
    font-weight: 700;
}

/* Visualization Styles */
.chart-container {
    height: 240px;
    position: relative;
}

/* Table Area */
.table-card {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: visible;
}

.modern-table-card {
    border-radius: 14px;
    border-color: #d9dee7;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

[data-theme="dark"] .modern-table-card {
    border-color: #2f3642;
    box-shadow: none;
}

[data-theme="dark"] .manager-summary-card {
    border-color: #3a4455;
    background: linear-gradient(180deg, #202733, #1b2431);
}

[data-theme="dark"] .manager-summary-card:hover {
    border-color: #4b5c75;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
}

[data-theme="dark"] .manager-summary-title {
    color: #e2e8f0;
}

[data-theme="dark"] .manager-summary-metric {
    color: #93c5fd;
}

[data-theme="dark"] .manager-summary-submetric {
    color: #cbd5e1;
}

[data-theme="dark"] .manager-summary-detail {
    color: #94a3b8;
}

[data-theme="dark"] .manager-summary-empty {
    border-color: #3a4455;
    background: #1e2733;
    color: #cbd5e1;
}

.admin-assigned-card {
    margin-bottom: 1.5rem;
}

.table-header {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.consolidated-toolbar-wrap {
    justify-content: flex-start;
}

.consolidated-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.toolbar-left {
    flex: 1;
}

.toolbar-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: #ffffff;
    border: 1px solid #d7dce6;
    border-radius: 999px;
    padding: 0.18rem 0.45rem;
    min-height: 28px;
}

.cv-toggle-btn {
    cursor: pointer;
    height: 28px;
    width: auto;
    min-width: auto;
    padding: 0 0.65rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-main);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.cv-toggle-btn.cv-active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.cv-toggle-btn:hover:not(.cv-active) {
    background: #f0f4ff;
    border-color: #93c5fd;
}

/* ── Combined-mode: hide inner (per-record) columns from outer rows ──── */
table.cv-combined-mode .js-col-subscription,
table.cv-combined-mode .js-col-description,
table.cv-combined-mode .js-col-order_name,
table.cv-combined-mode .js-col-quantity,
table.cv-combined-mode .js-col-po_number,
table.cv-combined-mode .js-col-amount,
table.cv-combined-mode .js-col-sales_price,
table.cv-combined-mode .js-col-sku_id,
table.cv-combined-mode .js-col-number_of_days,
table.cv-combined-mode .js-col-per_user_per_day,
table.cv-combined-mode .js-col-per_user_per_month,
table.cv-combined-mode .js-col-currency_conv_rate { display: none !important; }

.cv-combined-row td {
    background: rgba(37, 99, 235, 0.04);
}

/* ── Column-settings two-section headers ───────────────────────────── */
.col-section-header {
    font-size: 0.69rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.3rem 0.4rem 0.1rem;
    margin-top: 0.15rem;
}
.col-section-outer { color: #2563eb; }
.col-section-inner { color: #7c3aed; }
.col-section-separator {
    border-top: 1px solid var(--border, #e2e8f0);
    margin: 0.35rem 0.2rem;
}

.cv-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #2563eb;
    color: #fff;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.1rem 0.42rem;
    min-width: 20px;
}

[data-theme="dark"] .cv-toggle-btn.cv-active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

[data-theme="dark"] .cv-toggle-btn:hover:not(.cv-active) {
    background: rgba(37, 99, 235, 0.12);
    border-color: #3b82f6;
}

[data-theme="dark"] .cv-combined-row td {
    background: rgba(37, 99, 235, 0.08);
}

[data-theme="dark"] .cv-count-badge {
    background: #2563eb;
}

.toolbar-btn {
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-main);
    width: 28px;
    min-width: 28px;
    height: 28px;
    padding: 0;
    gap: 0;
    justify-content: center;
    overflow: hidden;
    transition: var(--transition);
}

.toolbar-btn:hover {
    background: #f3f6fb;
    width: 28px;
    min-width: 28px;
    padding: 0;
    justify-content: center;
}

.filter-pill {
    width: 128px;
    min-width: 128px;
    max-width: 128px;
    flex: 0 0 128px;
}

.filter-pill select {
    width: 100%;
    min-width: 0;
    text-overflow: ellipsis;
}

/* ── Multi-Select Dropdown ── */
.ms-wrap {
    position: relative;
    display: inline-flex;
    flex: 1 1 auto;
    min-width: 0;
}
.ms-trigger {
    background: transparent;
    border: none;
    padding: 0;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    white-space: nowrap;
    text-align: left;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ms-trigger.ms-has-selection {
    color: #6366f1;
    font-weight: 600;
}
.ms-trigger:focus { outline: none; }
.ms-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: -30px;
    min-width: 210px;
    max-width: 270px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.14);
    z-index: 600;
    padding: 0.5rem;
}
.ms-actions {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 0.4rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border, #e2e8f0);
}
.ms-action-btn {
    flex: 1;
    padding: 0.22rem 0.4rem;
    font-size: 0.69rem;
    font-weight: 600;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.ms-action-btn:hover {
    background: rgba(99, 102, 241, 0.08);
    color: #6366f1;
    border-color: rgba(99, 102, 241, 0.3);
}
.ms-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.ms-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.28rem 0.4rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.79rem;
    color: var(--text-main);
    transition: background 0.1s;
    user-select: none;
}
.ms-item:hover { background: rgba(99, 102, 241, 0.07); }
.ms-item input[type="checkbox"] {
    margin: 0;
    accent-color: #6366f1;
    cursor: pointer;
    flex-shrink: 0;
    width: 13px;
    height: 13px;
}
[data-theme="dark"] .ms-panel {
    background: #1f2530;
    border-color: #394355;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
[data-theme="dark"] .ms-actions { border-bottom-color: #394355; }
[data-theme="dark"] .ms-action-btn { border-color: #394355; color: #94a3b8; }
[data-theme="dark"] .ms-action-btn:hover { background: rgba(99,102,241,0.15); color: #818cf8; }
[data-theme="dark"] .ms-item { color: #cbd5e1; }
[data-theme="dark"] .ms-item:hover { background: rgba(99, 102, 241, 0.12); }

.export-wrap {
    position: relative;
}

.toolbar-export-btn {
    cursor: pointer;
    height: 28px;
    width: auto;
    min-width: auto;
    padding: 0 0.55rem;
    font-size: 0.72rem;
    font-weight: 600;
    gap: 0.25rem;
    color: #16a34a;
    border-color: #bbf7d0;
    background: #f0fdf4;
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}

.toolbar-export-btn:hover {
    background: #dcfce7;
    border-color: #86efac;
    color: #15803d;
    box-shadow: 0 1px 4px rgba(22, 163, 74, 0.12);
}

.toolbar-export-btn.export-open {
    background: #dcfce7;
    border-color: #4ade80;
    color: #15803d;
}

.toolbar-export-btn .export-btn-icon {
    font-size: 0.78rem;
    line-height: 1;
}

.export-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 160px;
    background: #fff;
    border: 1px solid #d7dce6;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.14);
    padding: 0.4rem;
    z-index: 400;
}

.export-menu-header {
    font-size: 0.68rem;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.45rem 0.35rem;
}

.export-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    border: none;
    background: transparent;
    color: #374151;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 8px;
    padding: 0.45rem 0.5rem;
    cursor: pointer;
    transition: background 0.12s;
    white-space: nowrap;
}

.export-option:hover {
    background: #f0fdf4;
    color: #15803d;
}

.export-option .export-opt-icon {
    font-size: 0.92rem;
    line-height: 1;
    flex: 0 0 auto;
}

.export-option .export-opt-ext {
    font-size: 0.68rem;
    font-weight: 700;
    color: #9ca3af;
    margin-left: auto;
}

.export-option:hover .export-opt-ext {
    color: #4ade80;
}

[data-theme="dark"] .toolbar-export-btn {
    background: rgba(22, 163, 74, 0.1);
    border-color: rgba(74, 222, 128, 0.25);
    color: #4ade80;
}

[data-theme="dark"] .toolbar-export-btn:hover,
[data-theme="dark"] .toolbar-export-btn.export-open {
    background: rgba(22, 163, 74, 0.18);
    border-color: #4ade80;
    color: #86efac;
}

[data-theme="dark"] .export-menu {
    background: #1f2530;
    border-color: #394355;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .export-menu-header {
    color: #6b7280;
}

[data-theme="dark"] .export-option {
    color: #cbd5e1;
}

[data-theme="dark"] .export-option:hover {
    background: rgba(22, 163, 74, 0.1);
    color: #4ade80;
}

[data-theme="dark"] .export-option .export-opt-ext {
    color: #4b5563;
}

.page-size-pill {
    gap: 0.35rem;
}

.page-size-pill > span:not(.toolbar-icon) {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.toolbar-icon {
    font-size: 0.72rem;
    line-height: 1;
    opacity: 0.85;
}

.search-pill {
    min-width: 170px;
}

.toolbar-pill input,
.toolbar-pill select {
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-main);
    font-size: 0.72rem;
    font-weight: 500;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.toolbar-pill select {
    padding-right: 0.35rem;
    cursor: pointer;
}

.toolbar-pill input[type="text"] {
    min-width: 110px;
}

.date-pill input[type="date"] {
    min-width: 90px;
    font-size: 0.72rem;
}

.date-sep {
    font-size: 0.72rem;
    color: #6b7280;
    font-weight: 600;
}

[data-theme="dark"] .toolbar-pill {
    background: #202733;
    border-color: #394355;
}

[data-theme="dark"] .toolbar-pill select,
[data-theme="dark"] .toolbar-pill input {
    color: #e2e8f0;
    background: transparent;
}

[data-theme="dark"] .toolbar-pill select option {
    background: #1e2636;
    color: #e2e8f0;
}

[data-theme="dark"] .filter-pill select option,
[data-theme="dark"] .page-size-pill select option {
    background: #1e2636;
    color: #e2e8f0;
}

[data-theme="dark"] .export-menu {
    background: #202733;
    border-color: #394355;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .export-option {
    color: #d1d5db;
}

[data-theme="dark"] .export-option:hover {
    background: #2a3342;
}

[data-theme="dark"] .toolbar-btn:hover {
    background: #2a3342;
}

[data-theme="dark"] .date-sep {
    color: #a3adbf;
}

table {
    width: 100%;
    border-collapse: collapse;
}

.table-scroll-wrap {
    overflow-x: auto;
    overflow-y: visible;
    width: 100%;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.table-footer-pager {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.62rem 0.9rem;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}

.results-text {
    font-size: 0.78rem;
    font-weight: 500;
    color: #374151;
}

.logs-sep {
    margin: 0 0.35rem;
    color: #cbd5f5;
    font-weight: 700;
}

.pager-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.pager-controls-numeric {
    gap: 0.45rem;
}

.pagination-buttons {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.pager-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid #d7dce6;
    background: #fff;
    color: #374151;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.pager-btn.pager-number.active {
    background: #3f8fe8;
    border-color: #3f8fe8;
    color: #fff;
}

.pager-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 34px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #6b7280;
}

.pager-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#pageIndicator {
    font-size: 0.85rem;
    color: #4b5563;
    font-weight: 600;
    min-width: 90px;
    text-align: center;
}

[data-theme="dark"] .table-footer-pager {
    background: #1f2530;
    border-top-color: #2b3340;
}

[data-theme="dark"] .results-text,
[data-theme="dark"] #pageIndicator,
[data-theme="dark"] .pager-btn {
    color: #d1d5db;
}

[data-theme="dark"] .pager-btn {
    background: #202733;
    border-color: #394355;
}

.modern-table {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.modern-table thead th {
    background: #f2f5fa;
    color: #4f5f78;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    padding: 0.78rem 0.8rem;
    border-bottom: 1px solid #d9dee7;
    position: sticky;
    top: 0;
    z-index: 2;
    white-space: nowrap;
    line-height: 1.2;
}

.modern-table thead th.sortable {
    cursor: pointer;
    user-select: none;
}

.modern-table thead th .sort-indicator {
    display: inline-block;
    min-width: 10px;
    margin-left: 5px;
    color: #4ca3dc;
    opacity: 0.9;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    vertical-align: middle;
}

.modern-table tbody td {
    padding: 0.78rem 0.8rem;
    font-size: 11px;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-weight: 500;
    color: #374151;
    border-top: 1px solid #e8edf4;
    vertical-align: middle;
    white-space: nowrap;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.25;
}

/* Dynamic column limits based on semantic header classes */
.modern-table thead th.js-col-customer_id { min-width: 90px; }
.modern-table thead th.js-col-customer_name { min-width: 160px; }
.modern-table thead th.js-col-domain_primary { min-width: 140px; }
.modern-table thead th.js-col-secondary_domain { min-width: 130px; }
.modern-table thead th.js-col-product { min-width: 110px; }
.modern-table thead th.js-col-cycle { min-width: 80px; }
.modern-table thead th.js-col-latest_end_date { min-width: 95px; }
.modern-table thead th.js-col-currency { min-width: 50px; }
.modern-table thead th.js-col-gst_treatment { min-width: 80px; }
.modern-table thead th.js-col-sales_price { min-width: 110px; }
.modern-table thead th.js-col-purchase_price { min-width: 80px; }
.modern-table thead th.js-col-renewal_date { min-width: 90px; }
.modern-table thead th.js-col-creation_date { min-width: 90px; }
.modern-table thead th.js-col-reason { min-width: 70px; }
.modern-table thead th.js-col-description { min-width: 100px; }
.modern-table thead th.js-col-sku_id { min-width: 70px; }

.sales-price-cell {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.sales-price-value {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

td.js-col-sales_price {
    white-space: nowrap;
}

.sales-price-edit-btn {
    flex: 0 0 auto;
    border: 1px solid #cfd8e6;
    background: #ffffff;
    color: #475569;
    border-radius: 999px;
    width: 1.7rem;
    height: 1.7rem;
    padding: 0;
    font-size: 0.8rem;
    line-height: 1;
    cursor: pointer;
}

.sales-price-edit-btn:hover {
    background: #eef4ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.recurring-name-cell {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.recurring-name-value {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

td.js-col-recurring_invoice_name,
th.js-col-recurring_invoice_name {
    width: 190px;
    max-width: 190px;
    white-space: nowrap;
    overflow: hidden;
}

.recurring-name-edit-btn {
    flex: 0 0 auto;
    border: 1px solid #cfd8e6;
    background: #ffffff;
    color: #475569;
    border-radius: 999px;
    width: 1.7rem;
    height: 1.7rem;
    padding: 0;
    font-size: 0.8rem;
    line-height: 1;
    cursor: pointer;
}

.recurring-name-edit-btn:hover {
    background: #fef3c7;
    border-color: #fbbf24;
    color: #92400e;
}

[data-theme="dark"] .recurring-name-edit-btn {
    background: #202733;
    border-color: #394355;
    color: #cbd5e1;
}

[data-theme="dark"] .recurring-name-edit-btn:hover {
    background: #3b2f12;
    border-color: #fbbf24;
    color: #fde68a;
}

[data-theme="dark"] .sales-price-edit-btn {
    background: #202733;
    border-color: #394355;
    color: #cbd5e1;
}

[data-theme="dark"] .sales-price-edit-btn:hover {
    background: #1e3a5f;
    border-color: #93c5fd;
    color: #bfdbfe;
}

.sales-price-edit-btn:disabled {
    opacity: 0.55;
    cursor: wait;
}

.review-action-btn {
    border: 1px solid #cfd8e6;
    background: #ffffff;
    color: #334155;
    border-radius: 999px;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    font-size: 0.8rem;
    line-height: 1;
    cursor: pointer;
}

.review-action-btn:hover {
    border-color: #93c5fd;
    background: #eef4ff;
    color: #1d4ed8;
}

.review-action-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.42);
}

.under-review-modal {
    z-index: 2500;
}

.under-review-modal-dialog {
    width: min(780px, 96vw);
    border-radius: 18px;
    border-color: #cfd8e6;
    box-shadow: 0 28px 56px rgba(2, 6, 23, 0.24);
    overflow: hidden;
}

.under-review-modal-head {
    margin: -1rem -1rem 0.9rem;
    padding: 1rem 1rem 0.85rem;
    background: linear-gradient(135deg, #f8fbff 0%, #eef4ff 100%);
    border-bottom: 1px solid #dbe3ef;
}

.under-review-modal-kicker {
    margin: 0 0 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.68rem;
    font-weight: 800;
    color: #2563eb;
}

.under-review-modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem 0.7rem;
}

.under-review-modal-field {
    display: grid;
    gap: 0.25rem;
}

.under-review-modal-field span {
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.under-review-modal-field-wide {
    grid-column: 1 / -1;
}

.under-review-textarea {
    min-height: 66px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.35;
}

.review-action-modal[hidden] {
    display: none !important;
}

.review-action-dialog {
    position: relative;
    width: min(520px, 96vw);
    background: #ffffff;
    border: 1px solid #d7dce6;
    border-radius: 14px;
    box-shadow: 0 22px 42px rgba(2, 6, 23, 0.22);
    padding: 1rem 1rem 0.9rem;
}

.review-action-close {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 1.2rem;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 999px;
    cursor: pointer;
}

.review-action-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.review-action-title {
    margin: 0 1.9rem 0.25rem 0;
    font-size: 1.02rem;
    color: #0f172a;
    font-weight: 700;
}

.review-action-subtitle {
    margin: 0 0 0.8rem;
    font-size: 0.83rem;
    color: #64748b;
}

.review-action-form {
    display: grid;
    gap: 0.65rem;
}

.review-field {
    display: grid;
    gap: 0.3rem;
}

.review-field[hidden] {
    display: none !important;
}

.review-field.locked input {
    opacity: 0.9;
    background: #f1f5f9;
    color: #64748b;
    border-color: #d1d9e6;
    cursor: not-allowed;
    pointer-events: none;
}

.review-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #334155;
}

.review-field input {
    border: 1px solid #d7dce6;
    border-radius: 10px;
    padding: 0.55rem 0.65rem;
    font-size: 0.85rem;
    color: #0f172a;
}

.review-field input:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

.review-action-status {
    min-height: 1.05rem;
    font-size: 0.79rem;
    font-weight: 600;
    color: #334155;
}

.review-action-status.error {
    color: #dc2626;
}

.review-action-status.success {
    color: #16a34a;
}

.review-action-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
    margin-top: 0.25rem;
}

.review-action-btn-secondary,
.review-action-btn-primary {
    border-radius: 10px;
    padding: 0.5rem 0.78rem;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
}

.review-action-btn-secondary {
    background: #f8fafc;
    border-color: #d7dce6;
    color: #334155;
}

.review-action-btn-primary {
    background: #2563eb;
    color: #ffffff;
}

.review-action-btn-primary:disabled {
    opacity: 0.65;
    cursor: wait;
}

@media (max-width: 1400px) {
    .modern-table thead th,
    .modern-table tbody td {
        font-size: 11px;
        padding: 0.72rem 0.65rem;
    }
}

@media (max-width: 1100px) {
    .modern-table thead th,
    .modern-table tbody td {
        font-size: 10px;
        padding: 0.62rem 0.55rem;
    }
}

.modern-table tbody tr:nth-child(even) td {
    background: #fcfdff;
}

.modern-table tbody tr:hover td {
    background: #f6f9ff;
}

.review-table tbody tr td {
    background: rgba(239, 68, 68, 0.03);
}

.review-table tbody tr:nth-child(even) td {
    background: rgba(239, 68, 68, 0.05);
}

.review-table tbody tr:hover td {
    background: rgba(239, 68, 68, 0.09);
}

.missing-value {
    color: #dc2626;
    font-weight: 700;
}

/* Inline customer-name searchable dropdown (My Records page) */
.cn-dropdown-wrap {
    position: relative;
    min-width: 160px;
}
.cn-search-input {
    width: 100%;
    padding: 0.25rem 0.5rem;
    font-size: 0.78rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-main);
    box-sizing: border-box;
    outline: none;
}
.cn-search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
}
.cn-options-list {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    list-style: none;
    margin: 0;
    padding: 0.25rem 0;
    z-index: 1000;
    display: none;
}
.cn-option {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cn-option:hover {
    background: var(--primary);
    color: #fff;
}
.cn-name-text {
    vertical-align: middle;
}
.cn-edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 0 0 0.35rem;
    font-size: 0.8rem;
    opacity: 0.45;
    vertical-align: middle;
    line-height: 1;
}
.cn-edit-btn:hover {
    opacity: 1;
}
[data-theme="dark"] .cn-search-input {
    background: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}
[data-theme="dark"] .cn-options-list {
    background: #1e293b;
    border-color: #334155;
}
[data-theme="dark"] .cn-option {
    color: #f1f5f9;
}
[data-theme="dark"] .cn-option:hover {
    background: var(--primary);
}

/* Accept bar */
.accept-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    font-size: 0.83rem;
    color: var(--text-muted);
}

.accept-btn {
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.45rem 1.1rem;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

.accept-btn:hover:not(:disabled) {
    background: #4f46e5;
}

.accept-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.col-select {
    width: 3% !important;
    min-width: 3% !important;
    max-width: 3% !important;
    text-align: center;
    padding: 0.2rem 0.1rem !important;
    font-weight: 600;
    font-size: 0.65rem;
    color: #4b5563;
    overflow: hidden;
}

.modern-table thead th.col-select,
.modern-table tbody td.col-select {
    width: 3% !important;
    min-width: 3% !important;
    max-width: 3% !important;
}

.col-select-label {
    display: block;
    white-space: nowrap;
    letter-spacing: 0.01em;
    line-height: 1.1;
    margin-bottom: 0.15rem;
}

.col-select input[type="checkbox"] {
    cursor: pointer;
    width: 14px;
    height: 14px;
    accent-color: #6366f1;
    margin: 0;
}

[data-theme="dark"] .col-select {
    color: #9db1c9;
}

[data-theme="dark"] .modern-table thead th {
    background: #232a36;
    color: #b8c2d2;
    border-bottom-color: #394355;
}

[data-theme="dark"] .modern-table tbody td {
    color: #d1d5db;
    border-top-color: #2b3340;
}

[data-theme="dark"] .modern-table thead th .sort-indicator {
    color: #6fc2ff;
}

[data-theme="dark"] .modern-table tbody tr:nth-child(even) td {
    background: #1f2530;
}

[data-theme="dark"] .modern-table tbody tr:hover td {
    background: #253043;
}

[data-theme="dark"] .sales-price-edit-btn {
    background: #202733;
    border-color: #394355;
    color: #d1d5db;
}

[data-theme="dark"] .sales-price-edit-btn:hover {
    background: #273244;
    border-color: #4b5a73;
    color: #ffffff;
}

[data-theme="dark"] .review-action-btn {
    background: #202733;
    border-color: #394355;
    color: #d1d5db;
}

[data-theme="dark"] .review-action-btn:hover {
    background: #273244;
    border-color: #4b5a73;
    color: #ffffff;
}

[data-theme="dark"] .review-action-dialog {
    background: #1f2530;
    border-color: #394355;
    box-shadow: 0 22px 42px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .under-review-modal-dialog {
    border-color: #3a4455;
    box-shadow: 0 28px 56px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .under-review-modal-head {
    background: linear-gradient(135deg, #202733 0%, #1b2431 100%);
    border-bottom-color: #394355;
}

[data-theme="dark"] .under-review-modal-kicker {
    color: #93c5fd;
}

[data-theme="dark"] .under-review-modal-field span {
    color: #9fb0c7;
}

[data-theme="dark"] .review-action-close {
    color: #94a3b8;
}

[data-theme="dark"] .review-action-close:hover {
    background: #2a3342;
    color: #ffffff;
}

[data-theme="dark"] .review-action-title {
    color: #e5e7eb;
}

[data-theme="dark"] .review-action-subtitle {
    color: #a3adbf;
}

[data-theme="dark"] .review-field label {
    color: #d1d5db;
}

[data-theme="dark"] .review-field input {
    background: #202733;
    border-color: #394355;
    color: #e5e7eb;
}

[data-theme="dark"] .review-field.locked input {
    background: #2a3342;
    color: #94a3b8;
    border-color: #465267;
}

[data-theme="dark"] .review-field input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.28);
}

[data-theme="dark"] .review-action-status {
    color: #cbd5e1;
}

[data-theme="dark"] .review-action-status.error {
    color: #fca5a5;
}

[data-theme="dark"] .review-action-status.success {
    color: #86efac;
}

[data-theme="dark"] .review-action-btn-secondary {
    background: #202733;
    border-color: #394355;
    color: #d1d5db;
}

[data-theme="dark"] .review-action-btn-primary {
    background: #3b82f6;
    color: #ffffff;
}

[data-theme="dark"] .review-table tbody tr td {
    background: rgba(239, 68, 68, 0.08);
}

[data-theme="dark"] .review-table tbody tr:nth-child(even) td {
    background: rgba(239, 68, 68, 0.11);
}

[data-theme="dark"] .review-table tbody tr:hover td {
    background: rgba(239, 68, 68, 0.18);
}

[data-theme="dark"] .missing-value {
    color: #fca5a5;
}

th {
    padding: 0.4rem 0.25rem;
    background: transparent;
    text-align: left;
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 800;
}

td {
    padding: 0.4rem 0.25rem;
    border-top: 1px solid var(--border);
    font-size: 0.7rem;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

tr:hover {
    background: rgba(0,0,0,0.02);
}

[data-theme="dark"] tr:hover {
    background: rgba(255,255,255,0.02);
}

.badge {
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-MATCHED { background: rgba(34, 197, 94, 0.1); color: var(--accent-success); }
.badge-SALES_ONLY { background: rgba(245, 158, 11, 0.1); color: var(--accent-warning); }
.badge-PURCHASE_ONLY { background: rgba(59, 130, 246, 0.1); color: var(--accent-info); }
.badge-PRICE_MISMATCH, .badge-LOSS_ALERT { background: rgba(239, 68, 68, 0.1); color: var(--accent-danger); }

/* Control Panel (Hidden but accessible via Sidebar) */
.data-panel {
    display: block; /* Visible on page load */
    padding: 1.5rem;
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.upload-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.upload-box {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
}

.upload-box:hover {
    border-color: var(--primary);
}

.upload-box h4 {
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

input[type="file"] {
    width: 100%;
    margin-bottom: 1rem;
}

.btn-action {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-action:hover {
    background: var(--primary-alt);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.analytics-grid, .charts-grid, .table-card {
    animation: fadeIn 0.5s ease forwards;
}

@media (max-width: 900px) {
    .sidebar,
    .sidebar:hover {
        width: var(--sidebar-width);
        padding: 1.25rem 1rem;
    }

    .logo-text,
    .sidebar:hover .logo-text,
    .nav-text,
    .sidebar:hover .nav-text {
        opacity: 1;
        transform: translateX(0);
        max-width: 220px;
    }

    .nav-link,
    .sidebar:hover .nav-link {
        width: 100%;
        height: auto;
        min-height: 44px;
        margin: 0;
        padding: 0.65rem 0.9rem;
        justify-content: flex-start;
    }

    .main-wrapper,
    .sidebar:hover + .main-wrapper {
        margin-left: var(--sidebar-width);
    }
}

.modern-table thead th.sortable {
    cursor: pointer;
    user-select: none;
    position: sticky;
}

.modern-table thead th .sort-indicator {
    margin-left: 0.3rem;
    font-size: 11px;
    color: #4ca3dc;
    opacity: 0.9;
    font-weight: 800;
    line-height: 1;
}

@media (max-width: 900px) {
    .consolidated-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .account-manager-cards-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .toolbar-right {
        justify-content: flex-start;
    }

    .search-pill {
        min-width: 100%;
    }

    .toolbar-pill {
        width: 100%;
        border-radius: 14px;
    }

    .toolbar-pill input[type="text"],
    .toolbar-pill select,
    .date-pill input[type="date"] {
        width: 100%;
        min-width: 0;
    }

    .table-footer-pager {
        flex-direction: column;
        align-items: flex-start;
    }

    .under-review-modal-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .account-manager-cards-grid {
        grid-template-columns: 1fr;
    }
}

/* ================================================
   ACTIVITY LOGS PAGE
   ================================================ */

.logs-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-bottom: 2rem;
}

.logs-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.55rem;
    justify-content: space-between;
}

.logs-toolbar-left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.55rem;
    flex: 1;
}

.logs-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.logs-filter-pill {
    min-width: 160px;
}

.logs-filter-pill select {
    width: 100%;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-main);
    font-size: 0.78rem;
    font-weight: 500;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    cursor: pointer;
}

.logs-stats-bar {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0 0.1rem;
}

.logs-table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    box-shadow: var(--shadow);
}

.logs-table {
    width: 100%;
    min-width: 1100px;
    border-collapse: collapse;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.logs-table thead th {
    background: var(--bg-main);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}

.logs-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.logs-table tbody tr:last-child {
    border-bottom: none;
}

.logs-table tbody tr:hover {
    background: var(--bg-main);
}

.logs-table tbody td {
    padding: 0.65rem 0.9rem;
    font-size: 12px;
    color: var(--text-main);
    vertical-align: middle;
}

.logs-cell-num {
    color: var(--text-muted);
    font-size: 11px;
    width: 42px;
    text-align: center;
}

.logs-cell-ts {
    white-space: nowrap;
    font-size: 11px;
    color: var(--text-muted);
    min-width: 160px;
}

.logs-cell-user {
    font-weight: 600;
    font-size: 12px;
    min-width: 150px;
    word-break: break-word;
}

.logs-cell-page {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.logs-cell-record {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.logs-cell-field {
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}

.logs-cell-val {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}

.logs-cell-old {
    color: var(--accent-danger);
}

.logs-cell-new {
    color: var(--accent-success);
}

.logs-cell-details {
    max-width: 220px;
    font-size: 11px;
}

.logs-empty-cell {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Action badges */
.log-action-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-blue    { background: #dbeafe; color: #1d4ed8; }
.badge-purple  { background: #ede9fe; color: #7c3aed; }
.badge-green   { background: #dcfce7; color: #15803d; }
.badge-red     { background: #fee2e2; color: #b91c1c; }
.badge-orange  { background: #ffedd5; color: #c2410c; }
.badge-teal    { background: #ccfbf1; color: #0f766e; }
.badge-indigo  { background: #e0e7ff; color: #4338ca; }
.badge-gray    { background: #f3f4f6; color: #374151; }

[data-theme="dark"] .badge-blue    { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge-purple  { background: #3b2a5c; color: #c4b5fd; }
[data-theme="dark"] .badge-green   { background: #14532d; color: #86efac; }
[data-theme="dark"] .badge-red     { background: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .badge-orange  { background: #7c2d12; color: #fdba74; }
[data-theme="dark"] .badge-teal    { background: #134e4a; color: #5eead4; }
[data-theme="dark"] .badge-indigo  { background: #312e81; color: #a5b4fc; }
[data-theme="dark"] .badge-gray    { background: #374151; color: #d1d5db; }

/* Role badge */
.log-role-badge {
    display: inline-block;
    padding: 0.18rem 0.48rem;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    background: #f3f4f6;
    color: #374151;
    text-transform: capitalize;
    white-space: nowrap;
}

[data-theme="dark"] .log-role-badge {
    background: #2a3342;
    color: #cbd5e1;
}

/* Detail tags */
.log-detail-tag {
    display: inline-block;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.1rem 0.38rem;
    font-size: 10px;
    margin: 1px 2px;
    color: var(--text-muted);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

/* Logs pagination */
.logs-pager {
    margin-top: 0.35rem;
}

.logs-pager-row {
    width: 100%;
    border-radius: 10px;
}

.logs-pager .pager-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 0.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.logs-pager .pager-btn:hover:not([disabled]) {
    background: #6366f1;
    color: #fff;
    border-color: #6366f1;
}

.logs-pager .pager-btn.pager-active {
    background: #6366f1;
    color: #fff;
    border-color: #6366f1;
}

.logs-pager .pager-btn[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
}

.logs-pager .pager-ellipsis {
    padding: 0 0.25rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}


/* ---- Details "view" button in table cell ---- */
.log-view-details-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-align: left;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    align-items: center;
}

.log-view-details-btn:hover .log-detail-tag {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.log-detail-more {
    display: inline-block;
    font-size: 10px;
    color: var(--primary);
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    cursor: pointer;
    white-space: nowrap;
}

/* ---- Log Details Modal ---- */
.log-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.log-modal-overlay[hidden] {
    display: none;
}

.log-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    width: min(620px, 100%);
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.log-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--border);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    flex-shrink: 0;
}

.log-modal-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.log-modal-close:hover {
    background: var(--bg-main);
    color: var(--text-main);
}

.log-modal-body {
    overflow-y: auto;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.log-modal-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.log-modal-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border);
}

.log-modal-grid {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.log-modal-row {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 0.5rem;
    align-items: start;
    font-size: 13px;
}

.log-modal-key {
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.log-modal-val {
    color: var(--text-main);
    word-break: break-word;
}

.log-modal-old {
    color: var(--accent-danger);
    font-weight: 600;
}

.log-modal-new {
    color: var(--accent-success);
    font-weight: 600;
}

.log-modal-raw {
    font-size: 12px;
    color: var(--text-muted);
    word-break: break-all;
}

.log-modal-nested {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    background: var(--bg-main);
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    font-size: 12px;
}

.log-modal-nested-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 0.4rem;
    color: var(--text-muted);
}

.log-modal-nested-row span:last-child {
    color: var(--text-main);
    word-break: break-word;
}

/* ===================== TASK MANAGEMENT PAGE ===================== */

.task-page {
    display: grid;
    gap: 1.25rem;
}

.task-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.2rem 1.3rem;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(59, 130, 246, 0.05));
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: var(--shadow);
}

.task-hero-eyebrow {
    margin: 0 0 0.35rem;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--primary);
}

.task-hero h2 {
    margin: 0;
    font-size: clamp(1.35rem, 2vw, 1.8rem);
}

.task-hero-copy {
    margin: 0.45rem 0 0;
    max-width: 72ch;
    color: var(--text-muted);
    line-height: 1.6;
}

.task-refresh-btn {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    white-space: nowrap;
    font-size: 0.95rem;
    cursor: pointer;
    position: relative;
    z-index: 2;
}

.task-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.task-stat-card {
    min-height: 154px;
}

.task-board-wrap {
    width: 100%;
}

.task-board-wrap {
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.task-board-grid {
    display: grid;
    grid-template-columns: repeat(6, 300px);
    gap: 1rem;
    align-items: start;
    min-width: max-content;
}

.task-stage-column {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.84));
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 1rem;
    min-height: 520px;
    width: 300px;
    display: grid;
    gap: 0.9rem;
    align-content: start;
}

[data-theme="dark"] .task-stage-column {
    background: linear-gradient(180deg, rgba(31, 41, 55, 0.96), rgba(17, 24, 39, 0.92));
}

.task-stage-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
}

.task-stage-header > div {
    min-width: 0;
    flex: 1;
}

.task-stage-eyebrow {
    margin: 0 0 0.2rem;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.task-stage-header h3 {
    margin: 0;
    font-size: 0.98rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-stage-count {
    flex-shrink: 0;
    min-width: 32px;
    height: 32px;
    padding: 0 0.55rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
    font-weight: 800;
    font-size: 0.85rem;
}

.task-stage-list {
    display: grid;
    gap: 0.85rem;
    min-width: 0;
}

/* ── Compact task card ────────────────────────────────────────── */
.task-card-compact {
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: var(--bg-card);
    padding: 0.75rem 0.9rem;
    display: grid;
    gap: 0.35rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.12s, border-color 0.15s;
    min-width: 0;
    overflow: hidden;
    word-break: break-word;
    outline: none;
}

.task-card-compact:hover {
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.12);
    transform: translateY(-1px);
    border-color: rgba(99, 102, 241, 0.3);
}

.task-card-compact:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.tcc-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.tcc-cycle-badge {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    text-transform: uppercase;
    white-space: nowrap;
}
.tcc-cycle-monthly    { background: rgba(59,130,246,0.12);  color: #2563eb; }
.tcc-cycle-quarterly  { background: rgba(20,184,166,0.12);  color: #0d9488; }
.tcc-cycle-halfyearly { background: rgba(245,158,11,0.12);  color: #d97706; }
.tcc-cycle-annual     { background: rgba(139,92,246,0.12);  color: #7c3aed; }
.tcc-cycle-other      { background: rgba(148,163,184,0.12); color: var(--text-muted); }

.tcc-note-dot {
    font-size: 0.75rem;
    margin-left: auto;
    opacity: 0.7;
}

.tcc-name {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text-main);
    overflow-wrap: break-word;
}

.tcc-domain {
    margin: 0;
    font-size: 0.77rem;
    color: var(--text-muted);
    overflow-wrap: break-word;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tcc-end-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.2rem;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.tcc-end-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
}

.tcc-end-date {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-main);
}

.tcc-overdue {
    color: #dc2626 !important;
}

/* ── Drag & Drop ──────────────────────────────────────────────── */
.task-card-draggable {
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: element;
}
.task-card-draggable * {
    user-select: none;
    -webkit-user-select: none;
}
.task-card-draggable:active {
    cursor: grabbing;
}
/* ghost image is a cloned node appended to body — no .dragging class needed */

/* drag handle ⠿ shown top-right of card */
.tcc-drag-handle {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.85rem;
    opacity: 0.45;
    line-height: 1;
    flex-shrink: 0;
    cursor: grab;
    pointer-events: none; /* handled by article-level draggable */
}
.task-card-draggable:hover .tcc-drag-handle {
    opacity: 0.75;
}

/* drop zone states */
.task-stage-list.dnd-valid {
    border-radius: 14px;
    outline: 2px dashed rgba(99, 102, 241, 0.45);
    outline-offset: -3px;
    background: rgba(99, 102, 241, 0.04);
    transition: background 0.15s, outline-color 0.15s;
}
.task-stage-list.dnd-invalid {
    opacity: 0.45;
    pointer-events: none;
}
.task-stage-list.dnd-hovering {
    outline: 2px solid #6366f1;
    outline-offset: -3px;
    background: rgba(99, 102, 241, 0.10);
}
[data-theme="dark"] .task-stage-list.dnd-valid    { background: rgba(99, 102, 241, 0.08); }
[data-theme="dark"] .task-stage-list.dnd-hovering { background: rgba(99, 102, 241, 0.15); }
/* ──────────────────────────────────────────────────────────────── */

[data-theme="dark"] .tcc-cycle-monthly    { color: #60a5fa; }
[data-theme="dark"] .tcc-cycle-quarterly  { color: #2dd4bf; }
[data-theme="dark"] .tcc-cycle-halfyearly { color: #fbbf24; }
[data-theme="dark"] .tcc-cycle-annual     { color: #a78bfa; }

/* ── Task card detail modal (ClickUp-style) ──────────────────── */
.tcd-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    backdrop-filter: blur(3px);
}

.tcd-overlay[hidden] {
    display: none;
}

.tcd-panel {
    width: min(720px, 100%);
    max-height: min(88vh, 780px);
    background: var(--bg-card);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28), 0 4px 16px rgba(15, 23, 42, 0.12);
    border: 1px solid var(--border);
    animation: tcdPopIn 0.18s cubic-bezier(0.34, 1.3, 0.64, 1);
    overflow: hidden;
}

@keyframes tcdPopIn {
    from { transform: scale(0.93); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.tcd-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 1rem;
}

.tcd-close-btn {
    border: none;
    background: rgba(148, 163, 184, 0.14);
    color: var(--text-muted);
    border-radius: 50%;
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.tcd-close-btn:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}
.tcd-goto-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    background: rgba(148, 163, 184, 0.14);
    color: var(--text-muted);
    font-size: 1.05rem;
    text-decoration: none;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
    border: 1px solid transparent;
}
.tcd-goto-btn:hover {
    background: rgba(99, 102, 241, 0.12);
    color: #6366f1;
    border-color: rgba(99, 102, 241, 0.3);
}

.tcd-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
    gap: 1.25rem;
    align-content: start;
}

.tcd-title-block {
    grid-column: 1 / -1;
}

.tcd-title {
    margin: 0 0 0.2rem;
    font-size: 1.2rem;
    font-weight: 900;
    line-height: 1.35;
    color: var(--text-main);
    word-break: break-word;
}

.tcd-domain {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    word-break: break-word;
}

.tcd-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tcd-section-label {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0;
}

.tcd-meta {
    display: grid;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    grid-column: 1 / -1;
}

.tcd-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.65rem 1rem;
    font-size: 0.86rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}
.tcd-meta-row:last-child { border-bottom: none; }
.tcd-meta-row:nth-child(odd) { background: rgba(148, 163, 184, 0.04); }

.tcd-meta-label {
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

.tcd-meta-value {
    color: var(--text-main);
    font-weight: 700;
    text-align: right;
    word-break: break-word;
}

.tcd-overdue {
    color: #dc2626 !important;
}

.tcd-notes-block {
    grid-column: 1 / -1;
    padding: 1rem;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.12);
}

.tcd-notes-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.tcd-notes-text {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text-main);
    white-space: pre-wrap;
    word-break: break-word;
}

.tcd-notes-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.15s;
}
.tcd-notes-input:focus {
    outline: none;
    border-color: var(--accent-blue, #6366f1);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.tcd-notes-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.55rem;
}

.tcd-save-note-btn {
    padding: 0.35rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    background: var(--accent-blue, #6366f1);
    color: #fff;
    cursor: pointer;
    transition: opacity 0.15s;
}
.tcd-save-note-btn:hover:not(:disabled) { opacity: 0.85; }
.tcd-save-note-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.tcd-save-note-status {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.tcd-save-note-status.tcd-save-ok  { color: #22c55e; }
.tcd-save-note-status.tcd-save-err { color: #ef4444; }

#tcdNotes {
    grid-column: 1 / -1;
}

.tcd-hint {
    grid-column: 1 / -1;
}

.tcd-footer {
    padding: 1.1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    flex-shrink: 0;
    background: rgba(148, 163, 184, 0.04);
}

@media (max-width: 600px) {
    .tcd-overlay { padding: 0; align-items: flex-end; }
    .tcd-panel { width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0; }
    .tcd-body { grid-template-columns: 1fr; }
    .tcd-footer { flex-direction: column; }
    .tcd-footer .task-action-btn,
    .tcd-footer .task-edit-btn { width: 100%; text-align: center; border-radius: 12px; }
}

.task-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    min-width: 0;
}

.task-card-title {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.4;
    overflow-wrap: break-word;
    word-break: break-word;
}

.task-card-subtitle {
    margin: 0.2rem 0 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    overflow-wrap: break-word;
    word-break: break-word;
}

.task-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.55rem;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
    font-size: 0.7rem;
    font-weight: 800;
    white-space: nowrap;
    flex-shrink: 0;
}

.task-chip-muted {
    background: rgba(148, 163, 184, 0.14);
    color: var(--text-muted);
}

.task-card-meta {
    display: grid;
    gap: 0.45rem;
}

.task-meta-row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.86rem;
    color: var(--text-muted);
}

.task-meta-row strong {
    color: var(--text-main);
    font-weight: 700;
    text-align: right;
}

.task-card-notes {
    padding: 0.75rem;
    border-radius: 16px;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.12);
}

.task-card-notes span {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.task-card-notes p {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-main);
    white-space: pre-wrap;
    word-break: break-word;
}

.task-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.task-edit-btn,
.task-action-btn {
    border: none;
    border-radius: 999px;
    padding: 0.62rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    transition: var(--transition);
}

.task-edit-btn {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-main);
}

.task-action-btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-alt));
    color: #fff;
}

.task-action-btn-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--accent-danger);
}

.task-action-btn-success {
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #fff;
}

.task-action-btn-neutral {
    background: rgba(148, 163, 184, 0.18);
    color: var(--text-main);
}

/* ---- Stage hint box ---- */
.task-card-hint {
    padding: 0.65rem 0.85rem;
    border-radius: 12px;
    font-size: 0.82rem;
    line-height: 1.6;
}
.task-card-hint p { margin: 0; }
.task-card-hint-stage4 {
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: var(--text-muted);
}
.task-card-hint-stage5 {
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: var(--text-muted);
}
[data-theme="dark"] .task-card-hint-stage4 { color: var(--text-muted); }
[data-theme="dark"] .task-card-hint-stage5 { color: var(--text-muted); }

/* ---- Done badge ---- */
.task-done-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 800;
    border: 1px solid rgba(99, 102, 241, 0.18);
}
.task-done-badge.task-done-badge-relation-ended {
    background: #fee2e2;
    color: #b91c1c;
    border-color: rgba(185, 28, 28, 0.18);
}
[data-theme="dark"] .task-done-badge { color: #4ade80; background: rgba(34, 197, 94, 0.1); }
[data-theme="dark"] .task-done-badge.task-done-badge-relation-ended { color: #fca5a5; background: rgba(127, 29, 29, 0.24); }

.task-edit-btn:hover,
.task-action-btn:hover {
    transform: translateY(-1px);
}

.task-empty-state {
    padding: 1rem;
    border-radius: 16px;
    border: 1px dashed rgba(148, 163, 184, 0.45);
    color: var(--text-muted);
    background: rgba(148, 163, 184, 0.06);
    line-height: 1.6;
}

.task-edit-modal .modal-content {
    width: min(780px, calc(100vw - 2rem));
}

.task-edit-form textarea {
    resize: vertical;
    min-height: 140px;
}

/* ===================== TASK VIEW TOGGLE ===================== */

.task-hero-controls {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
}

.view-toggle-group {
    display: flex;
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
}

.view-toggle-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.83rem;
    font-weight: 700;
    padding: 0.38rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.view-toggle-btn.view-toggle-active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: 0 1px 6px rgba(99, 102, 241, 0.14);
}

.view-toggle-btn:hover:not(.view-toggle-active) {
    color: var(--text-main);
}

/* ===================== TASK CALENDAR VIEW ===================== */

.task-calendar-section {
    display: grid;
    gap: 1.25rem;
}

/* ---- Summary stats grid ---- */
.cal-summary-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
    margin-bottom: 0.1rem;
}

.cal-stat-box {
    background: var(--bg-card);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 18px;
    padding: 1rem 1rem 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.55rem;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    box-shadow: var(--shadow);
}

.cal-stat-box:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
}

.cal-stat-box.cal-stat-active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.cal-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.cal-stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    line-height: 1.2;
}

.cal-stat-count {
    font-size: 1.5rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.03em;
}

/* ---- Filter banner ---- */
.cal-filter-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.15);
    font-size: 0.83rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.cal-filter-banner strong {
    color: var(--primary);
}

.cal-filter-clear {
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 0.83rem;
    cursor: pointer;
    padding: 0.1rem 0.35rem;
    border-radius: 6px;
    transition: var(--transition);
    margin-left: auto;
}

.cal-filter-clear:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

@media (max-width: 900px) {
    .cal-summary-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .cal-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ---- Outer card ---- */
.cal-v2-wrap {
    background: var(--bg-card);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 24px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* ---- Month header ---- */
.cal-v2-month-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.cal-v2-month-label {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.cal-nav-btn {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-main);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.cal-nav-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--primary);
}

/* ---- Horizontal date strip ---- */
.cal-strip-shell {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    overflow: hidden;
}

.cal-strip-track {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    flex: 1;
    padding: 0.65rem 0.5rem;
    gap: 2px;
    scrollbar-width: none;
}

.cal-strip-track::-webkit-scrollbar { display: none; }

.cal-strip-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.45rem 0.6rem;
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.15s;
    min-width: 48px;
    flex-shrink: 0;
    user-select: none;
}

.cal-strip-pill:hover:not(.cal-strip-selected) {
    background: rgba(99, 102, 241, 0.07);
}

.cal-strip-pill.cal-strip-selected {
    background: var(--primary);
    border-radius: 14px;
}

.cal-strip-dow {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    line-height: 1;
}

.cal-strip-pill.cal-strip-selected .cal-strip-dow {
    color: rgba(255, 255, 255, 0.65);
}

.cal-strip-day-wrap {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.cal-strip-today:not(.cal-strip-selected) .cal-strip-day-wrap {
    border: 1.5px solid rgba(99, 102, 241, 0.45);
    background: rgba(99, 102, 241, 0.08);
}

.cal-strip-day {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
}

.cal-strip-today:not(.cal-strip-selected) .cal-strip-day {
    color: var(--primary);
    font-weight: 900;
}

.cal-strip-pill.cal-strip-selected .cal-strip-day {
    color: #fff;
}

.cal-strip-dots {
    display: flex;
    gap: 2px;
    min-height: 6px;
    align-items: center;
    justify-content: center;
}

/* ---- Shared dot colours ---- */
.cal-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cal-dot-overdue  { background: #ef4444; }
.cal-dot-active   { background: #f59e0b; }
.cal-dot-upcoming { background: #8b5cf6; }
.cal-dot-done     { background: #22c55e; }

/* ---- Task timeline ---- */
.cal-timeline-wrap {
    padding: 1.2rem 1.4rem 1.6rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.cal-tl-empty {
    padding: 2rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.cal-tl-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.55rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--border);
}

.cal-tl-date-label {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text-main);
}

.cal-tl-count {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.cal-tl-today-pill {
    font-size: 0.69rem;
    font-weight: 800;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    letter-spacing: 0.04em;
}

.cal-tl-rows {
    display: flex;
    flex-direction: column;
}

.cal-tl-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 0.5rem;
    border-radius: 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.09);
    transition: background 0.12s;
}

.cal-tl-row:last-child { border-bottom: none; }
.cal-tl-row:hover { background: rgba(99, 102, 241, 0.04); }

.cal-tl-status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cal-tl-body {
    flex: 1;
    min-width: 0;
}

.cal-tl-name {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-tl-domain {
    margin-top: 0.1rem;
    font-size: 0.775rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-tl-meta {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.cal-tl-stage {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-muted);
    white-space: nowrap;
}

.cal-tl-enddate {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
}

.cal-tl-assignee {
    font-size: 0.76rem;
    color: var(--text-muted);
    white-space: nowrap;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Cycle badge (shared) */
.cal-cycle-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    white-space: nowrap;
}

/* Status badges */
.cal-status-overdue  { background: rgba(239, 68,  68,  0.1); color: #ef4444; }
.cal-status-active   { background: rgba(245, 158, 11,  0.1); color: #d97706; }
.cal-status-upcoming { background: rgba(139, 92,  246, 0.1); color: #7c3aed; }
.cal-status-done     { background: rgba(34,  197, 94,  0.1); color: #16a34a; }

.cal-tl-status {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
    white-space: nowrap;
}

/* ---- Legend ---- */
.cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1.1rem;
    padding: 0.65rem 1.4rem;
    border-top: 1px solid var(--border);
    justify-content: flex-end;
}

.cal-legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.74rem;
    color: var(--text-muted);
    font-weight: 600;
}

@media (max-width: 900px) {
    .cal-tl-meta { display: none; }
    .cal-timeline-wrap { padding: 1rem 1rem 1.25rem; }
}

@media (max-width: 600px) {
    .cal-strip-pill { min-width: 40px; padding: 0.4rem 0.4rem; }
    .cal-strip-dow { font-size: 0.6rem; }
    .cal-strip-day { font-size: 0.82rem; }
    .view-toggle-btn { font-size: 0.78rem; padding: 0.32rem 0.7rem; }
}

@media (max-width: 1600px) {
    /* board scrolls horizontally — no column wrapping */
}

@media (max-width: 1320px) {
    /* board scrolls horizontally — no column wrapping */
}

@media (max-width: 900px) {
    .task-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .task-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .task-board-grid,
    .task-summary-grid {
        grid-template-columns: 1fr;
    }
}

/* ===================== RECURRING PROFILES PAGE ===================== */

.rp-page {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Toolbar */
.rp-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.65rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.7rem 1rem;
}

.rp-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.rp-toolbar-right {
    display: flex;
    align-items: center;
}

.rp-count-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Profile list */
.rp-profile-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

/* Profile card */
.rp-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.rp-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.1);
}

.rp-card--open {
    border-color: #3b82f6;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.13);
}

/* Card header */
.rp-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    user-select: none;
    background: linear-gradient(135deg, #f8faff 0%, #f2f5fc 100%);
    border-bottom: 1px solid transparent;
    transition: background 0.15s ease;
}

.rp-card--open .rp-card-header {
    border-bottom-color: var(--border);
    background: linear-gradient(135deg, #eef4ff 0%, #e8f0fe 100%);
}

.rp-card-title-group {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.rp-profile-badge {
    flex-shrink: 0;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #dbeafe, #ede9fe);
    border: 1px solid #bfdbfe;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.rp-card-info {
    min-width: 0;
}

.rp-card-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.3rem;
}

.rp-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.rp-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    white-space: nowrap;
}

.rp-meta-chip-icon {
    font-size: 0.72rem;
}

.rp-meta-more {
    font-weight: 700;
    color: #2563eb;
    opacity: 0.8;
}

/* Expand button */
.rp-expand-btn {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: 1px solid #d1d9e6;
    background: #ffffff;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    transition: background 0.15s, border-color 0.15s, transform 0.2s;
}

.rp-expand-btn:hover {
    background: #eef4ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.rp-card--open .rp-expand-btn {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1d4ed8;
}

/* Card body */
.rp-card-body {
    padding: 0;
}

.rp-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

/* Records table inside card */
.rp-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.rp-table thead th {
    background: #f8fafc;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
    text-align: left;
}

.rp-table tbody td {
    padding: 0.55rem 0.9rem;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-main);
    font-size: 0.8rem;
    white-space: nowrap;
    font-weight: 500;
}

.rp-table tbody tr:last-child td {
    border-bottom: none;
}

.rp-table tbody tr:hover td {
    background: #f8faff;
}

/* Empty / loading states */
.rp-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: 14px;
    color: var(--text-muted);
}

.rp-empty-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.75rem;
}

.rp-empty p {
    margin: 0.25rem 0;
    font-weight: 600;
    font-size: 0.9rem;
}

.rp-empty-hint {
    font-size: 0.82rem !important;
    font-weight: 400 !important;
    opacity: 0.75;
}

.rp-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Dark mode */
[data-theme="dark"] .rp-card-header {
    background: linear-gradient(135deg, #202733 0%, #232d3d 100%);
}

[data-theme="dark"] .rp-card--open .rp-card-header {
    background: linear-gradient(135deg, #1e2d4a 0%, #1b2840 100%);
}

[data-theme="dark"] .rp-profile-badge {
    background: linear-gradient(135deg, #1e3a5f, #2d2460);
    border-color: #334e7a;
}

[data-theme="dark"] .rp-meta-chip {
    background: #202733;
    border-color: #394355;
    color: #94a3b8;
}

[data-theme="dark"] .rp-expand-btn {
    background: #202733;
    border-color: #394355;
    color: #94a3b8;
}

[data-theme="dark"] .rp-expand-btn:hover,
[data-theme="dark"] .rp-card--open .rp-expand-btn {
    background: #1e3a5f;
    border-color: #3b82f6;
    color: #93c5fd;
}

[data-theme="dark"] .rp-table thead th {
    background: #1b2431;
    color: #94a3b8;
    border-color: #2f3a4e;
}

[data-theme="dark"] .rp-table tbody td {
    border-color: #232d3d;
}

[data-theme="dark"] .rp-table tbody tr:hover td {
    background: rgba(255,255,255,0.03);
}

[data-theme="dark"] .rp-empty {
    background: #1b2230;
    border-color: #394355;
}


/* -- Column Drag-to-Reorder -------------------------------------------- */
.col-drag-handle {
    cursor: grab;
    color: #94a3b8;
    font-size: 1rem;
    flex: 0 0 auto;
    user-select: none;
    padding: 0 2px;
    line-height: 1;
}
.col-drag-handle:active { cursor: grabbing; }
.col-label-text { flex: 1; }

.table-column-option.col-dragging { opacity: 0.35; }
.table-column-option.col-drag-over {
    background: rgba(99, 102, 241, 0.08);
    outline: 2px dashed #6366f1;
    outline-offset: -2px;
    border-radius: 8px;
}

[data-theme="dark"] .col-drag-handle { color: #64748b; }
[data-theme="dark"] .table-column-option.col-drag-over {
    background: rgba(99, 102, 241, 0.16);
    outline-color: #818cf8;
}
