:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --accent: #06b6d4;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --success: #10b981;
    --warning: #f59e0b;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --white: #ffffff;
    --text: #0f172a;
    --text-secondary: #475569;
    --muted: #64748b;
    --border: #e2e8f0;
    --layout-width: 90%;
    --radius: 0.75rem;
    --radius-lg: 1rem;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.1);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Cairo', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ===== App Shell ===== */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-content {
    flex: 1;
    width: var(--layout-width);
    max-width: var(--layout-width);
    margin: 0 auto;
    padding: 1.75rem 0 2.5rem;
}

.page-header-bar {
    margin-bottom: 1.75rem;
}

/* ===== Navbar ===== */
.navbar {
    --navbar-inner-height: 4.5rem;
    --navbar-height: calc(3px + var(--navbar-inner-height));
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(226, 232, 240, 0.85);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
    transition: box-shadow 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}

.navbar.is-scrolled {
    background: rgba(255, 255, 255, 0.96);
    border-bottom-color: rgba(203, 213, 225, 0.9);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 8px 32px rgba(15, 23, 42, 0.08);
}

.navbar-accent {
    height: 3px;
    background: linear-gradient(90deg, #4338ca 0%, #6366f1 35%, #06b6d4 70%, #4338ca 100%);
    background-size: 200% 100%;
    animation: navbar-accent-shift 8s ease infinite;
}

@keyframes navbar-accent-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.navbar-inner {
    width: var(--layout-width);
    max-width: var(--layout-width);
    margin: 0 auto;
    padding: 0;
    min-height: var(--navbar-inner-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.navbar-start,
.navbar-end {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.navbar-start {
    flex: 1;
    min-width: 0;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
    color: var(--text);
    flex-shrink: 0;
    padding: 0.35rem 0;
    transition: opacity 0.2s ease;
}

.navbar-brand:hover {
    text-decoration: none;
    color: var(--text);
    opacity: 0.92;
}

.navbar-brand-icon {
    width: 2.75rem;
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #6366f1 0%, #4338ca 55%, #3730a3 100%);
    color: #fff;
    border-radius: 0.85rem;
    box-shadow:
        0 8px 20px rgba(79, 70, 229, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.15) inset;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.navbar-brand:hover .navbar-brand-icon {
    transform: translateY(-1px);
    box-shadow:
        0 12px 28px rgba(79, 70, 229, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.navbar-brand-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.navbar-brand-copy {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    min-width: 0;
}

.navbar-brand-text {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--text);
    white-space: nowrap;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.navbar-brand-tagline {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.3rem;
    margin-inline-start: 0.5rem;
    background: rgba(241, 245, 249, 0.75);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 999px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.navbar-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.95rem;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 999px;
    white-space: nowrap;
    position: relative;
    transition: color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
}

.navbar-link-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
    opacity: 0.72;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.navbar-link-icon svg {
    width: 100%;
    height: 100%;
}

.navbar-link:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.navbar-link:hover .navbar-link-icon {
    opacity: 1;
}

.navbar-link.is-active {
    color: #fff;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #4338ca 100%);
    box-shadow:
        0 6px 18px rgba(79, 70, 229, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.12) inset;
}

.navbar-link.is-active .navbar-link-icon {
    opacity: 1;
}

.navbar-user-btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.35rem 0.85rem 0.35rem 0.35rem;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 999px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    cursor: pointer;
    font-family: inherit;
    transition: box-shadow 0.22s ease, border-color 0.22s ease, transform 0.22s ease;
}

.navbar-user-btn:hover,
.dropdown.is-open > .navbar-user-btn {
    border-color: #c7d2fe;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.12);
}

.navbar-user-avatar {
    width: 2.15rem;
    height: 2.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #818cf8, #4f46e5);
    color: #fff;
    border-radius: 50%;
    font-size: 0.82rem;
    font-weight: 800;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.navbar-user-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    line-height: 1.15;
    text-align: right;
}

.navbar-user-name {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text);
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.navbar-user-role {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--muted);
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.navbar-user-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    transition: transform 0.22s ease, color 0.22s ease;
}

.navbar-user-chevron svg {
    width: 1rem;
    height: 1rem;
}

.dropdown.is-open > .navbar-user-btn .navbar-user-chevron {
    transform: rotate(180deg);
    color: var(--primary);
}

.navbar-dropdown {
    left: 0;
    right: auto;
    min-width: 14.5rem;
    padding: 0.45rem;
    border-radius: calc(var(--radius) + 0.15rem);
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow:
        0 20px 50px rgba(15, 23, 42, 0.14),
        0 0 0 1px rgba(255, 255, 255, 0.6) inset;
    animation: navbar-dropdown-in 0.2s ease;
}

@keyframes navbar-dropdown-in {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.navbar-dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.65rem;
}

.navbar-dropdown-avatar {
    width: 2.35rem;
    height: 2.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #818cf8, #4f46e5);
    color: #fff;
    border-radius: 50%;
    font-size: 0.88rem;
    font-weight: 800;
    flex-shrink: 0;
}

.navbar-dropdown-header strong {
    display: block;
    font-size: 0.88rem;
    font-weight: 800;
}

.navbar-dropdown-header small {
    display: block;
    font-size: 0.72rem;
    color: var(--muted);
    font-weight: 600;
    margin-top: 0.1rem;
}

.navbar-dropdown-divider {
    height: 1px;
    margin: 0.25rem 0.35rem 0.35rem;
    background: var(--border);
}

.navbar-dropdown-item {
    display: flex !important;
    align-items: center;
    gap: 0.6rem;
}

.navbar-dropdown-item svg {
    width: 1.05rem;
    height: 1.05rem;
    flex-shrink: 0;
    opacity: 0.7;
}

.navbar-dropdown-item--danger {
    color: var(--danger);
}

.navbar-dropdown-item--danger:hover {
    background: #fef2f2;
    color: var(--danger-dark);
}

.navbar-toggle {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 2.65rem;
    height: 2.65rem;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 0.75rem;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.22s ease, box-shadow 0.22s ease;
}

.navbar-toggle-bar {
    display: block;
    width: 1.15rem;
    height: 2px;
    background: var(--text);
    border-radius: 999px;
    transition: transform 0.25s ease, opacity 0.25s ease, width 0.25s ease;
}

.navbar-toggle.is-active .navbar-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.navbar-toggle.is-active .navbar-toggle-bar:nth-child(2) {
    opacity: 0;
    width: 0;
}

.navbar-toggle.is-active .navbar-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.navbar-mobile-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--navbar-height);
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 90;
}

.navbar-mobile-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

/* ===== Page ===== */
.container {
    width: 100%;
    max-width: 100%;
    margin: 0;
}

.page-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text);
}

.page-subtitle {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 500;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ===== Dashboard ===== */
.dashboard-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.75rem 2rem;
    margin-bottom: 1.75rem;
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.2), transparent 50%),
        linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #4338ca 100%);
    color: #fff;
    box-shadow: 0 16px 40px rgba(67, 56, 202, 0.25);
}

.dashboard-hero h2 {
    margin: 0 0 0.35rem;
    font-size: 1.35rem;
    font-weight: 800;
}

.dashboard-hero p {
    margin: 0;
    font-size: 0.92rem;
    color: rgba(255, 255, 255, 0.78);
    max-width: 32rem;
}

.dashboard-hero-badge {
    text-align: center;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius);
    backdrop-filter: blur(8px);
    min-width: 7rem;
}

.dashboard-hero-badge span {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
}

.dashboard-hero-badge small {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.65);
}

/* ===== Stats ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.35rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-card-icon {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.85rem;
    flex-shrink: 0;
}

.stat-card-icon svg { width: 1.4rem; height: 1.4rem; }

.stat-card--indigo .stat-card-icon { background: #eef2ff; color: #4f46e5; }
.stat-card--cyan .stat-card-icon { background: #ecfeff; color: #0891b2; }
.stat-card--violet .stat-card-icon { background: #f5f3ff; color: #7c3aed; }
.stat-card--emerald .stat-card-icon { background: #ecfdf5; color: #059669; }

.stat-card-body { display: flex; flex-direction: column; }

.stat-label {
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 600;
}

.stat-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}

/* ===== Cards ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.card-elevated { box-shadow: var(--shadow); }

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
}

.card-subtitle {
    margin: 0.2rem 0 0;
    font-size: 0.82rem;
    color: var(--muted);
}

.card-body { padding: 1.5rem; }
.card-body-flush { padding: 0; }
.card-body-flush .table-modern th:first-child,
.card-body-flush .table-modern td:first-child { padding-right: 1.5rem; }
.card-body-flush .table-modern th:last-child,
.card-body-flush .table-modern td:last-child { padding-left: 1.5rem; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.6rem 1.15rem;
    border-radius: 0.65rem;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.4;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-secondary);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg);
    border-color: #cbd5e1;
    text-decoration: none;
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover { background: var(--danger-dark); color: #fff; }

.btn-link {
    background: transparent;
    color: var(--muted);
    border: none;
    padding: 0;
}

.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.82rem; }
.btn-lg { padding: 0.75rem 1.35rem; font-size: 0.92rem; }

/* ===== Forms ===== */
.form-group { margin-bottom: 1.15rem; }

.form-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.form-control,
.form-select,
textarea.form-control {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1.5px solid var(--border);
    border-radius: 0.65rem;
    font-family: inherit;
    font-size: 0.92rem;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
    outline: none;
    border-color: #818cf8;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.form-actions-end { justify-content: flex-end; }

/* ===== Alerts ===== */
.alert {
    padding: 0.9rem 1.1rem;
    border-radius: 0.65rem;
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
    font-weight: 600;
}

.alert-success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.text-muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

/* ===== Tables ===== */
.table-wrapper { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th,
.table td {
    padding: 0.85rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: right;
}

.table th {
    color: var(--muted);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #f8fafc;
}

.table-modern tbody tr {
    transition: background 0.15s;
}

.table-modern tbody tr:hover {
    background: #f8fafc;
}

.table-title {
    font-weight: 600;
    color: var(--text);
}

.table-actions a {
    margin-left: 0.75rem;
    font-weight: 600;
    font-size: 0.85rem;
}

.ref-pill {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    font-size: 0.78rem;
    font-weight: 700;
    font-family: ui-monospace, monospace;
    color: #4338ca;
    background: #eef2ff;
    border-radius: 0.4rem;
    text-decoration: none;
}

.ref-pill:hover {
    background: #e0e7ff;
    color: #3730a3;
    text-decoration: none;
}

/* ===== Status Badges ===== */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 999px;
    white-space: nowrap;
}

.status-badge--active { background: #ecfdf5; color: #047857; }
.status-badge--draft { background: #fef3c7; color: #b45309; }
.status-badge--archived { background: #f1f5f9; color: #475569; }

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-state-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border-radius: 50%;
    color: var(--muted);
}

.empty-state-icon svg { width: 1.75rem; height: 1.75rem; }
.empty-state p { color: var(--muted); margin: 0 0 1.25rem; }

/* ===== Dropdown ===== */
.dropdown { position: relative; }

.dropdown-toggle {
    background: transparent;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 0.92rem;
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.5rem;
}

.dropdown-menu {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 0.5rem);
    min-width: 10rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    overflow: hidden;
    padding: 0.35rem;
}

.dropdown.is-open .dropdown-menu { display: block; }

.dropdown-item {
    display: block;
    width: 100%;
    padding: 0.6rem 0.85rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 0.45rem;
    border: none;
    background: transparent;
    text-align: right;
    font-family: inherit;
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--bg);
    text-decoration: none;
    color: var(--text);
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    padding: 1.5rem;
    overflow-y: auto;
}

.modal.is-open { display: block; }

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
}

.modal-dialog {
    position: relative;
    max-width: 32rem;
    margin: 2rem auto;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 1.75rem;
}

.modal-dialog:has(.modal-content) {
    padding: 0;
    overflow: hidden;
}

/* ===== Misc ===== */
.dl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.dl-grid dt { color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.dl-grid dd { margin: 0.15rem 0 0; font-weight: 700; }

.pagination {
    display: flex;
    gap: 0.35rem;
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
    flex-wrap: wrap;
}

.page-item { list-style: none; }

.page-link {
    display: inline-block;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.45rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.88rem;
    background: var(--surface);
}

.page-item.active .page-link {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.page-item.disabled .page-link { opacity: 0.5; cursor: not-allowed; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.guest-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.guest-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow);
}

.guest-logo {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary);
}

@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    .navbar-brand-tagline {
        display: none;
    }

    .navbar-menu {
        margin-inline-start: 0;
    }

    .navbar-link {
        padding-inline: 0.75rem;
    }

    .navbar-link-text {
        display: none;
    }

    .navbar-link-icon {
        width: 1.2rem;
        height: 1.2rem;
    }
}

@media (max-width: 960px) {
    .navbar {
        --navbar-inner-height: 4.15rem;
    }

    .navbar-inner {
        padding: 0 1rem;
        flex-wrap: wrap;
        align-items: center;
    }

    .navbar-brand-text {
        font-size: 0.85rem;
        max-width: 10rem;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .navbar-menu {
        display: none;
        order: 3;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        margin: 0;
        padding: 0.65rem;
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        background: rgba(255, 255, 255, 0.98);
        box-shadow: var(--shadow-lg);
        gap: 0.25rem;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transform: translateY(-8px);
        transition: max-height 0.35s ease, opacity 0.25s ease, transform 0.25s ease, padding 0.25s ease;
    }

    .navbar-menu.is-open {
        display: flex;
        max-height: 28rem;
        opacity: 1;
        transform: translateY(0);
        margin-top: 0.35rem;
        margin-bottom: 0.65rem;
    }

    .navbar-link {
        padding: 0.8rem 0.95rem;
        border-radius: 0.65rem;
    }

    .navbar-link-text {
        display: inline;
    }

    .navbar-toggle {
        display: flex;
    }

    .navbar-user-meta {
        display: none;
    }

    .navbar-user-btn {
        padding: 0.3rem;
    }

    .navbar-mobile-backdrop {
        display: block;
    }

    .app-content {
        width: var(--layout-width);
        padding: 1.25rem 0 2rem;
    }

    .navbar-inner {
        width: var(--layout-width);
    }

    .dashboard-hero {
        flex-direction: column;
        align-items: flex-start;
        padding: 1.35rem;
    }
}

@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr; }
}

/* ===== Login Page ===== */
.login-body {
    background: #f8fafc;
}

.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.login-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3rem 2.5rem;
    color: #fff;
    background:
        radial-gradient(circle at 20% 20%, rgba(129, 140, 248, 0.2), transparent 35%),
        radial-gradient(circle at 80% 80%, rgba(99, 102, 241, 0.15), transparent 40%),
        linear-gradient(145deg, #1e1b4b 0%, #312e81 45%, #4338ca 100%);
    overflow: hidden;
}

.login-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
}

.login-brand-content {
    position: relative;
    z-index: 1;
    max-width: 420px;
}

.login-brand-logo {
    width: 4.5rem;
    height: 4.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(8px);
}

.login-brand-logo svg {
    width: 2.2rem;
    height: 2.2rem;
}

.login-brand-title {
    margin: 0 0 0.75rem;
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.4;
}

.login-brand-subtitle {
    margin: 0 0 2rem;
    color: rgba(255, 255, 255, 0.82);
    font-size: 1rem;
    line-height: 1.8;
}

.login-features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.85rem;
}

.login-features li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.92);
}

.login-feature-icon {
    width: 1.5rem;
    height: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(34, 211, 238, 0.2);
    color: #67e8f9;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.login-brand-footer {
    position: relative;
    z-index: 1;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.55);
}

.login-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
}

.login-form-wrapper {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 1.25rem;
    padding: 2.25rem 2rem;
    box-shadow:
        0 4px 6px -1px rgba(15, 23, 42, 0.06),
        0 20px 40px -12px rgba(15, 23, 42, 0.12);
}

.login-form-header {
    margin-bottom: 1.75rem;
}

.login-form-title {
    margin: 0 0 0.35rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
}

.login-form-desc {
    margin: 0;
    color: #64748b;
    font-size: 0.92rem;
}

.login-alert {
    padding: 0.85rem 1rem;
    border-radius: 0.65rem;
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
}

.login-alert p {
    margin: 0;
}

.login-alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.login-form {
    display: grid;
    gap: 1.25rem;
}

.login-field {
    display: grid;
    gap: 0.45rem;
}

.login-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: #334155;
}

.login-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.login-input-icon {
    position: absolute;
    right: 0.9rem;
    display: flex;
    color: #94a3b8;
    pointer-events: none;
}

.login-input-icon svg {
    width: 1.15rem;
    height: 1.15rem;
}

.login-input {
    width: 100%;
    padding: 0.8rem 2.75rem 0.8rem 2.75rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 0.75rem;
    font-family: inherit;
    font-size: 0.95rem;
    color: #0f172a;
    background: #f8fafc;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.login-input::placeholder {
    color: #94a3b8;
}

.login-input:focus {
    outline: none;
    border-color: #818cf8;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.login-password-toggle {
    position: absolute;
    left: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 0.4rem;
    transition: color 0.2s, background 0.2s;
}

.login-password-toggle:hover {
    color: #0ea5e9;
    background: rgba(14, 165, 233, 0.08);
}

.login-password-toggle svg {
    width: 1.15rem;
    height: 1.15rem;
}

.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.login-remember {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    color: #475569;
    cursor: pointer;
}

.login-remember input {
    width: 1rem;
    height: 1rem;
    accent-color: #0ea5e9;
}

.login-forgot {
    font-size: 0.88rem;
    font-weight: 600;
    color: #0ea5e9;
    text-decoration: none;
}

.login-forgot:hover {
    color: #0284c7;
    text-decoration: underline;
}

.login-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.9rem 1.25rem;
    border: none;
    border-radius: 0.75rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #4338ca 100%);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
    transition: transform 0.2s, box-shadow 0.2s;
}

.login-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(14, 165, 233, 0.4);
}

.login-submit:active {
    transform: translateY(0);
}

.login-submit svg {
    width: 1.15rem;
    height: 1.15rem;
    transform: scaleX(-1);
}

.login-register {
    margin: 1.5rem 0 0;
    text-align: center;
    font-size: 0.9rem;
    color: #64748b;
}

.login-register a {
    font-weight: 700;
    color: #0284c7;
}

.login-field .text-danger {
    font-size: 0.82rem;
}

@media (max-width: 960px) {
    .login-page {
        grid-template-columns: 1fr;
    }

    .login-brand {
        min-height: auto;
        padding: 2rem 1.5rem;
    }

    .login-brand-subtitle,
    .login-features {
        display: none;
    }

    .login-brand-footer {
        display: none;
    }

    .login-main {
        padding: 1.5rem 1rem 2.5rem;
        margin-top: -1rem;
    }

    .login-form-wrapper {
        padding: 1.75rem 1.25rem;
    }
}

/* ===== Settings Pages ===== */
.page-subtitle {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 500;
}

.settings-back-link {
    display: inline-block;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
}

.settings-back-link:hover {
    color: var(--primary);
    text-decoration: none;
}

.settings-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 1.75rem 2rem;
    margin-bottom: 1.75rem;
    border-radius: 1rem;
    background:
        radial-gradient(circle at 100% 0%, rgba(99, 102, 241, 0.15), transparent 45%),
        linear-gradient(135deg, #312e81 0%, #4338ca 50%, #4f46e5 100%);
    color: #fff;
    box-shadow: 0 12px 32px rgba(67, 56, 202, 0.25);
}

.settings-hero-content {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.settings-hero-icon {
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.85rem;
    backdrop-filter: blur(6px);
}

.settings-hero-icon svg {
    width: 1.75rem;
    height: 1.75rem;
}

.settings-hero-title {
    margin: 0 0 0.25rem;
    font-size: 1.35rem;
    font-weight: 800;
}

.settings-hero-desc {
    margin: 0;
    font-size: 0.92rem;
    color: rgba(255, 255, 255, 0.82);
}

.settings-hero-stats {
    display: flex;
    gap: 1.5rem;
}

.settings-hero-stat {
    text-align: center;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    min-width: 5rem;
}

.settings-hero-stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.2;
}

.settings-hero-stat-label {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.75);
}

.settings-modules {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.settings-module {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 1rem;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    position: relative;
    overflow: hidden;
}

.settings-module::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    border-radius: 0 1rem 1rem 0;
}

.settings-module--users::before { background: #0ea5e9; }
.settings-module--roles::before { background: #8b5cf6; }
.settings-module--org::before { background: #10b981; }
.settings-module--doctypes::before { background: #f59e0b; }
.settings-module--txntypes::before { background: #ec4899; }
.settings-module--folders::before { background: #14b8a6; }
.settings-module--languages::before { background: #6366f1; }

.settings-module:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.1);
    border-color: #c7d2fe;
    text-decoration: none;
    color: inherit;
}

.settings-module-icon {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    flex-shrink: 0;
}

.settings-module--users .settings-module-icon {
    background: #e0f2fe;
    color: #0284c7;
}

.settings-module--roles .settings-module-icon {
    background: #ede9fe;
    color: #7c3aed;
}

.settings-module--org .settings-module-icon {
    background: #d1fae5;
    color: #059669;
}

.settings-module--doctypes .settings-module-icon {
    background: #fef3c7;
    color: #d97706;
}

.settings-module--txntypes .settings-module-icon {
    background: #fce7f3;
    color: #db2777;
}

.settings-module--folders .settings-module-icon {
    background: #ccfbf1;
    color: #0d9488;
}

.settings-module--languages .settings-module-icon {
    background: #eef2ff;
    color: #4f46e5;
}

.settings-module-icon svg {
    width: 1.5rem;
    height: 1.5rem;
}

.settings-module-body {
    flex: 1;
    min-width: 0;
}

.settings-module-title {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
    font-weight: 700;
}

.settings-module-desc {
    margin: 0 0 0.75rem;
    font-size: 0.88rem;
    color: var(--muted);
    line-height: 1.6;
}

.settings-module-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.settings-module-arrow {
    display: flex;
    align-items: center;
    color: var(--muted);
    flex-shrink: 0;
    margin-top: 0.25rem;
    transition: transform 0.2s, color 0.2s;
}

.settings-module-arrow svg {
    width: 1.25rem;
    height: 1.25rem;
}

.settings-module:hover .settings-module-arrow {
    color: var(--primary);
    transform: translateX(-4px);
}

.settings-badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 999px;
    background: #eef2ff;
    color: var(--primary);
}

.settings-badge--muted {
    background: #f3f4f6;
    color: var(--muted);
}

.settings-badge--danger {
    background: #fef2f2;
    color: var(--danger);
}

.settings-badge--primary {
    background: #eef2ff;
    color: #4338ca;
}

.org-tree-unit-label {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    background: linear-gradient(135deg, #eef2ff, #ede9fe);
    color: #4338ca;
    border-radius: 0.35rem;
}

.org-tree-edit-panel {
    position: relative;
}

.org-tree-edit-panel summary {
    list-style: none;
    cursor: pointer;
}

.org-tree-edit-panel summary::-webkit-details-marker {
    display: none;
}

.org-tree-add summary {
    list-style: none;
    cursor: pointer;
}

.org-tree-add summary::-webkit-details-marker {
    display: none;
}

.org-tree-add-node {
    margin-top: 0.35rem;
}

.org-tree-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    background: #f5f3ff;
    border: 1px dashed #c7d2fe;
    border-radius: 0.5rem;
    transition: background 0.2s, border-color 0.2s;
}

.org-tree-add-btn:hover {
    background: #eef2ff;
    border-color: var(--primary);
}

.org-tree-add-btn svg {
    width: 0.9rem;
    height: 0.9rem;
}

.org-inline-form {
    margin-top: 0.75rem;
}

.org-edit-form,
.org-tree-add .org-inline-form {
    position: absolute;
    left: 0;
    top: calc(100% + 0.5rem);
    z-index: 10;
    min-width: 300px;
    padding: 1rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

.org-tree-add .org-inline-form {
    position: relative;
    top: auto;
    left: auto;
    margin-top: 0.5rem;
}

.card > .card-body > .org-inline-form--root {
    display: block;
}

.card > .card-body > .org-inline-form--root .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.org-tree-children--empty {
    padding-top: 0.25rem;
}

.org-path {
    display: inline-block;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #4338ca;
    background: #f5f3ff;
    padding: 0.25rem 0.6rem;
    border-radius: 0.4rem;
}

.org-path--compact {
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.org-path--inline {
    background: transparent;
    padding: 0;
    color: var(--muted);
    font-size: inherit;
}

.org-unit-picker-hint {
    margin: 0.35rem 0 0;
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.5;
}

.org-unit-select option {
    font-family: inherit;
}

.user-edit-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.org-scope-preview {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    background: #f5f3ff;
    border-radius: 0.6rem;
    border: 1px solid #e0e7ff;
}

.org-scope-preview-label {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

.org-scope-info {
    margin-top: 1.25rem;
    padding: 1rem 1.15rem;
    background: #f9fafb;
    border-radius: 0.65rem;
    border: 1px solid var(--border);
    font-size: 0.88rem;
    line-height: 1.6;
}

.org-scope-info ul {
    margin: 0.5rem 0 0;
    padding-right: 1.25rem;
}

.org-scope-info li {
    margin-bottom: 0.35rem;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.82rem;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.user-avatar {
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #eef2ff;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.user-avatar--sm {
    width: 1.85rem;
    height: 1.85rem;
    font-size: 0.78rem;
}

.user-avatar--admin { background: #ede9fe; color: #7c3aed; }
.user-avatar--manager { background: #fef3c7; color: #d97706; }
.user-avatar--user { background: #e0f2fe; color: #0284c7; }
.user-avatar--more { background: #f3f4f6; color: var(--muted); font-size: 0.72rem; }

.user-tag {
    display: inline-block;
    margin-right: 0.35rem;
    padding: 0.1rem 0.4rem;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 0.25rem;
    background: #ecfdf5;
    color: #059669;
}

.role-pill {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 999px;
}

.role-pill--admin { background: #ede9fe; color: #6d28d9; }
.role-pill--manager { background: #fef3c7; color: #b45309; }
.role-pill--user { background: #e0f2fe; color: #0369a1; }

.settings-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--muted);
}

.settings-empty-icon {
    width: 3.5rem;
    height: 3.5rem;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 50%;
    color: var(--muted);
}

.settings-empty-icon svg {
    width: 1.75rem;
    height: 1.75rem;
}

.settings-empty p {
    margin: 0 0 1rem;
}

/* Roles Grid */
.roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.25rem;
}

.role-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.role-card::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
}

.role-card--admin::before { background: linear-gradient(90deg, #7c3aed, #a78bfa); }
.role-card--manager::before { background: linear-gradient(90deg, #d97706, #fbbf24); }
.role-card--user::before { background: linear-gradient(90deg, #0284c7, #38bdf8); }

.role-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.role-card-icon {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
}

.role-card--admin .role-card-icon { background: #ede9fe; color: #7c3aed; }
.role-card--manager .role-card-icon { background: #fef3c7; color: #d97706; }
.role-card--user .role-card-icon { background: #e0f2fe; color: #0284c7; }

.role-card-icon svg {
    width: 1.5rem;
    height: 1.5rem;
}

.role-card-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.role-card-count {
    font-size: 0.85rem;
    color: var(--muted);
}

.role-card-permissions-title,
.role-card-users-title {
    margin: 0 0 0.65rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.role-permissions-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.45rem;
}

.role-permissions-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
}

.role-permissions-list svg {
    width: 1rem;
    height: 1rem;
    color: #10b981;
    flex-shrink: 0;
}

.role-card-users {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.role-users-avatars {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

/* Organization Tree */
.org-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.org-stat {
    flex: 1;
    min-width: 140px;
    padding: 1.25rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.org-stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}

.org-stat-label {
    font-size: 0.85rem;
    color: var(--muted);
}

.org-tree-card-wrapper .card-body {
    padding: 1.5rem;
}

.org-tree {
    list-style: none;
    margin: 0;
    padding: 0;
}

.org-tree-children {
    list-style: none;
    margin: 0;
    padding-right: 2rem;
    border-right: 2px solid #e0e7ff;
    margin-right: 1.25rem;
}

.org-tree-children.is-hidden {
    display: none;
}

.org-tree-node {
    margin-bottom: 0.65rem;
}

.org-tree-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.org-tree-toggle {
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 0.35rem;
    background: var(--white);
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 0.85rem;
    color: var(--muted);
    transition: background 0.2s, color 0.2s;
}

.org-tree-toggle:hover {
    background: #eef2ff;
    color: var(--primary);
}

.org-tree-toggle svg {
    width: 0.85rem;
    height: 0.85rem;
    transition: transform 0.2s;
}

.org-tree-node.is-collapsed .org-tree-toggle svg {
    transform: rotate(90deg);
}

.org-tree-spacer {
    width: 1.75rem;
    flex-shrink: 0;
}

.org-tree-card {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1rem 1.15rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.org-tree-card:hover {
    border-color: #c7d2fe;
    box-shadow: 0 4px 12px rgba(67, 56, 202, 0.1);
}

.org-tree-card--inactive {
    opacity: 0.65;
    background: #f9fafb;
}

.org-tree-card-icon {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eef2ff;
    color: var(--primary);
    border-radius: 0.6rem;
    flex-shrink: 0;
}

.org-tree-card-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.org-tree-card-body {
    flex: 1;
    min-width: 0;
}

.org-tree-card-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.org-tree-card-name {
    font-size: 0.98rem;
}

.org-tree-code {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    background: #f3f4f6;
    color: var(--muted);
    border-radius: 0.3rem;
    font-family: monospace;
}

.org-tree-card-desc {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.5;
}

.org-tree-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.org-tree-edit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.4rem;
    color: var(--muted);
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}

.org-tree-edit:hover {
    background: #eef2ff;
    color: var(--primary);
    text-decoration: none;
}

.org-tree-edit svg {
    width: 1.1rem;
    height: 1.1rem;
}

@media (max-width: 768px) {
    .settings-hero {
        padding: 1.25rem;
    }

    .settings-hero-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .settings-hero-stats {
        width: 100%;
        justify-content: space-between;
    }

    .org-tree-children {
        padding-right: 1rem;
        margin-right: 0.75rem;
    }
}

.settings-section-title {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--muted);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

.ref-types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.ref-type-card {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1.25rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    box-shadow: var(--shadow);
}

.ref-type-card--inactive {
    opacity: 0.65;
    background: #f9fafb;
}

.ref-type-card-icon {
    width: 2.75rem;
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.65rem;
}

.ref-type-card-icon--doc {
    background: #fef3c7;
    color: #d97706;
}

.ref-type-card-icon--txn {
    background: #fce7f3;
    color: #db2777;
}

.ref-type-card-icon svg {
    width: 1.35rem;
    height: 1.35rem;
}

.ref-type-card-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ref-type-card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.ref-type-card-desc {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.5;
}

.ref-type-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.ref-type-edit {
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}

.ref-type-edit-toggle {
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    list-style: none;
}

.ref-type-edit-toggle::-webkit-details-marker {
    display: none;
}

.ref-type-edit-form {
    margin-top: 0.75rem;
}

.folder-tree-card {
    border-right-width: 3px;
    border-right-style: solid;
    border-right-color: #c7d2fe;
}

.folder-tree-edit {
    position: relative;
}

.folder-tree-edit summary {
    list-style: none;
    cursor: pointer;
}

.folder-tree-edit summary::-webkit-details-marker {
    display: none;
}

.folder-edit-form {
    position: absolute;
    left: 0;
    top: calc(100% + 0.5rem);
    z-index: 10;
    min-width: 280px;
    padding: 1rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

.languages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.language-card {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1.25rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.language-card::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
}

.language-card--inactive {
    opacity: 0.65;
}

.language-card-flag {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef2ff, #ede9fe);
    color: #4f46e5;
    border-radius: 0.65rem;
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

.language-card-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.language-card-name {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.language-card-sub {
    margin: 0;
    font-size: 0.88rem;
    color: var(--muted);
}

.language-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.language-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 999px;
}

.language-badge--default {
    background: #ecfdf5;
    color: #059669;
}

.language-card-edit {
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}

.ref-type-delete-form {
    margin-top: 0.5rem;
}

/* Permissions Form */
.permissions-form-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.permissions-form-hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    max-width: 36rem;
}

.permissions-form-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.permissions-groups {
    display: grid;
    gap: 1rem;
}

.permissions-group {
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    overflow: hidden;
}

.permissions-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

.permissions-group-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
}

.permissions-group-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.5rem;
    padding: 1rem;
}

.permission-checkbox {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.permission-checkbox:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.permission-checkbox:has(input:checked) {
    border-color: #8b5cf6;
    background: #f5f3ff;
}

.permission-checkbox input {
    margin: 0;
}

.permission-checkbox-label {
    font-size: 0.88rem;
    font-weight: 600;
}

.permission-checkbox-key {
    font-size: 0.72rem;
    color: var(--muted);
    direction: ltr;
    text-align: right;
}

.role-card-meta {
    flex: 1;
}

.role-card-desc {
    margin: 0 0 1rem;
    font-size: 0.88rem;
    color: var(--muted);
    line-height: 1.5;
}

.role-system-badge {
    display: inline-block;
    margin-top: 0.25rem;
    padding: 0.1rem 0.45rem;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 999px;
    background: #ede9fe;
    color: #7c3aed;
}

.role-permissions-more {
    color: var(--muted);
    font-size: 0.85rem;
}

.role-card-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.role-card--custom::before,
.role-card:not(.role-card--admin):not(.role-card--manager):not(.role-card--user)::before {
    background: linear-gradient(90deg, #64748b, #94a3b8);
}

.role-card:not(.role-card--admin):not(.role-card--manager):not(.role-card--user) .role-card-icon {
    background: #f1f5f9;
    color: #475569;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: #fafafa;
}

.form-grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.alert-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    padding: 0.85rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.25rem;
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    padding: 0.85rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.25rem;
}

/* ===== Transaction workflow ===== */
.txn-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    background: color-mix(in srgb, var(--txn-status-color, #64748b) 15%, white);
    color: var(--txn-status-color, #64748b);
    border: 1px solid color-mix(in srgb, var(--txn-status-color, #64748b) 30%, white);
}

.txn-workflow-steps {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
}

.txn-workflow-step {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.5rem;
    border-radius: 0.65rem;
    background: #f8fafc;
    border: 1px solid var(--border);
}

.txn-workflow-step--current {
    background: #eef2ff;
    border-color: #c7d2fe;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.txn-workflow-step--done {
    opacity: 0.75;
}

.txn-workflow-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
}

.txn-workflow-arrow {
    color: var(--muted);
    font-weight: 700;
    font-size: 1.1rem;
}

.ref-type-card-icon--status {
    display: flex;
    align-items: center;
    justify-content: center;
}

.txn-status-order {
    font-size: 1.1rem;
    font-weight: 800;
}

.settings-module--txn-statuses .settings-module-icon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.settings-module--archive .settings-module-icon {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
}

.form-grid--checks {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-hint {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: var(--muted);
}

.txn-advance-form {
    margin-top: 1rem;
}

.table-empty {
    text-align: center;
    color: var(--muted);
    padding: 2rem !important;
}

.settings-badge--success {
    background: #dcfce7;
    color: #166534;
}

.settings-module--ref-numbers::before { background: #0d9488; }

.settings-module--ref-numbers .settings-module-icon {
    background: #ccfbf1;
    color: #0f766e;
}

.ref-settings-info {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    background: #ecfeff;
    border: 1px solid #a5f3fc;
    border-radius: 0.75rem;
    color: #155e75;
}

.ref-settings-info svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.ref-settings-info p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.ref-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.ref-settings-toggles {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ref-settings-toggle {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.ref-settings-toggle:hover {
    border-color: #99f6e4;
    background: #f0fdfa;
}

.ref-settings-toggle--block {
    margin-bottom: 1rem;
}

.ref-settings-toggle input {
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.ref-settings-toggle-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.ref-settings-toggle-body strong {
    font-size: 0.92rem;
    color: var(--text);
}

.ref-settings-toggle-body small {
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.4;
}

.ref-settings-preview {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    margin: 1rem 0;
    background: #f8fafc;
    border: 1px dashed var(--border);
    border-radius: 0.65rem;
}

.ref-settings-preview-label {
    font-size: 0.85rem;
    color: var(--muted);
}

.ref-settings-preview code {
    font-size: 1rem;
    font-weight: 600;
    color: #0f766e;
}

.ref-settings-note {
    padding: 0.85rem 1rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 0.65rem;
    font-size: 0.85rem;
    color: #92400e;
    line-height: 1.5;
}

.ref-settings-note--readonly {
    background: #f8fafc;
    border-color: var(--border);
    color: var(--muted);
}

.ref-settings-actions {
    display: flex;
    justify-content: flex-start;
    padding-top: 0.5rem;
}

/* ===== Transaction page layout ===== */
.txn-page { padding-bottom: 2rem; }

.txn-page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.txn-page-meta {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.txn-ref {
    font-size: 0.85rem;
    padding: 0.2rem 0.55rem;
    background: #f1f5f9;
    border-radius: 0.4rem;
}

.txn-layout {
    display: grid;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.txn-sidebar {
    position: sticky;
    top: 1rem;
}

.txn-sidebar-inner {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.txn-sidebar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1.15rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #fafbff 0%, var(--surface) 100%);
}

.txn-sidebar-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

.txn-sidebar-subtitle {
    margin: 0.2rem 0 0;
    font-size: 0.8rem;
    color: var(--muted);
}

.txn-dropzone {
    margin: 1rem;
    border: 2px dashed #c7d2fe;
    border-radius: 0.85rem;
    background: #f8faff;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.txn-dropzone.is-dragover {
    border-color: #6366f1;
    background: #eef2ff;
    transform: scale(1.01);
}

.txn-dropzone-input {
    display: none;
}

.txn-dropzone-content {
    padding: 1.25rem 1rem;
    text-align: center;
}

.txn-dropzone-icon {
    width: 3rem;
    height: 3rem;
    margin: 0 auto 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #eef2ff;
    color: #4f46e5;
}

.txn-dropzone-icon svg { width: 1.5rem; height: 1.5rem; }

.txn-dropzone-title {
    margin: 0 0 0.25rem;
    font-weight: 700;
    font-size: 0.92rem;
}

.txn-dropzone-hint {
    margin: 0 0 0.85rem;
    font-size: 0.78rem;
    color: var(--muted);
}

.txn-dropzone-queue {
    padding: 1rem;
}

.txn-dropzone-queue.is-hidden,
.is-hidden { display: none !important; }

.txn-dropzone-files {
    list-style: none;
    margin: 0 0 0.85rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.txn-dropzone-file {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.5rem;
    align-items: center;
    padding: 0.55rem 0.65rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.55rem;
    font-size: 0.82rem;
}

.txn-dropzone-file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.txn-dropzone-file-size { color: var(--muted); font-size: 0.75rem; }

.txn-dropzone-file-remove {
    border: none;
    background: transparent;
    color: #ef4444;
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
}

.btn-block { width: 100%; }

.txn-attachments-list {
    max-height: calc(100vh - 22rem);
    overflow-y: auto;
    padding: 0 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.txn-attachment-card {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: #fafafa;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.txn-attachment-card:hover {
    border-color: #c7d2fe;
    box-shadow: var(--shadow-sm);
}

.txn-attachment-thumb {
    display: block;
    width: 72px;
    height: 72px;
    border-radius: 0.55rem;
    overflow: hidden;
    border: 1px solid var(--border);
}

.txn-attachment-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.txn-attachment-icon-wrap {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.55rem;
    background: var(--surface);
    border: 1px solid var(--border);
}

.txn-file-icon {
    display: inline-flex;
    width: 2rem;
    height: 2rem;
}

.txn-file-icon svg { width: 100%; height: 100%; }

.txn-file-icon--pdf { color: #dc2626; }
.txn-file-icon--word { color: #2563eb; }
.txn-file-icon--excel { color: #16a34a; }
.txn-file-icon--image { color: #9333ea; }
.txn-file-icon--file { color: #64748b; }

.txn-attachment-name {
    margin: 0 0 0.25rem;
    font-size: 0.88rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.txn-attachment-meta {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 0.45rem;
}

.txn-attachment-badge {
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: #eef2ff;
    color: #4338ca;
    font-weight: 600;
}

.txn-attachment-actions {
    display: flex;
    gap: 0.35rem;
}

.txn-attachment-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.45rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
}

.txn-attachment-action:hover {
    background: #eef2ff;
    color: #4338ca;
    text-decoration: none;
}

.txn-attachment-action--danger:hover {
    background: #fef2f2;
    color: #dc2626;
}

.txn-attachments-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--muted);
}

.txn-attachments-empty .txn-file-icon {
    width: 2.5rem;
    height: 2.5rem;
    margin-bottom: 0.65rem;
    opacity: 0.5;
}

.txn-hero {
    background: linear-gradient(135deg, #ffffff 0%, #f8faff 100%);
    border-color: #e0e7ff;
}

.txn-hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    padding: 1.25rem 1.5rem;
}

.txn-hero-label {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 0.2rem;
}

.txn-hero-item strong {
    font-size: 0.95rem;
}

.txn-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.txn-detail-block h4 {
    margin: 0 0 0.35rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.txn-detail-block p {
    margin: 0 0 1rem;
    line-height: 1.6;
}

.txn-meta-grid { margin-top: 0.5rem; }

.txn-advance-box {
    padding: 1rem;
    background: #f8faff;
    border: 1px solid #e0e7ff;
    border-radius: 0.75rem;
}

.txn-advance-next {
    margin: 0 0 0.35rem;
    font-size: 0.8rem;
    color: var(--muted);
}

.txn-state-message {
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
}

.txn-state-message--success {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.txn-state-message--warning {
    background: #fffbeb;
    border-color: #fde68a;
}

.txn-state-message p {
    margin: 0.35rem 0 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.txn-delete-form { margin-top: 1rem; }

.modal-dialog-lg { max-width: 42rem; }

.modal-content { padding: 0; overflow: hidden; }

.modal-header,
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-footer {
    border-bottom: none;
    border-top: 1px solid var(--border);
    justify-content: flex-end;
}

.modal-body { padding: 1.25rem 1.5rem; }

.modal-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
}

@media (max-width: 1024px) {
    .txn-layout {
        grid-template-columns: 1fr;
    }

    .txn-sidebar {
        position: static;
        order: -1;
    }

    .txn-attachments-list {
        max-height: none;
    }
}
