* {
    font-family: "Rajdhani", sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html {
    scroll-behavior: smooth;
}

:root {
    --crm-bg: #edf1f6;
    --crm-bg-alt: #e2e7f0;
    --crm-card-bg: #fefefe;
    --crm-primary: #0d6efd;
    --crm-primary-hover: #0b5ed7;
    --crm-primary-soft: #e7f1ff;
    --crm-text-main: #111827;
    --crm-text-muted: #6b7280;
    --crm-border: #d1d5db;
    --crm-border-strong: #9ca3af;
    --crm-sidebar-bg: #232E5E;
}

body {
    background:
        radial-gradient(circle at top left, #ffffff 0, #edf1f6 55%),
        radial-gradient(circle at bottom right, #dde3ee 0, #e5e9f2 60%);
    color: var(--crm-text-main);
    min-height: 100vh;
}

a {
    text-decoration: none;
}

a:hover {
    text-decoration: none;
}

/* GŁÓWNA KARTA (metal design) */
.main-shell {
    padding-top: 5rem;
    padding-bottom: 2.5rem;
}

.crm-card {
    background:
        linear-gradient(135deg, #ffffff 0, #f9fafb 40%, #f3f4f6 100%);
    border-radius: 1.25rem;
    border: 1px solid rgba(209, 213, 219, 0.9);
    box-shadow:
        0 18px 40px rgba(15, 23, 42, 0.12),
        0 0 0 1px rgba(255, 255, 255, 0.8);
    padding: 1.8rem 1.8rem 1.4rem;
}

@media (max-width: 768px) {
    .main-shell { padding-top: 4.5rem; }
    .crm-card { padding: 1.3rem 1.1rem 1.1rem; }
}

.crm-page-title {
    font-size: 1.45rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* ALERTY */
.alert {
    border-radius: 0.9rem;
    border: 1px solid var(--crm-border);
}

.alert-success {
    background: linear-gradient(135deg, #ecfdf3, #e0f2fe);
}

.alert-danger {
    background: #fef2f2;
}

.alert-info {
    background: #eff6ff;
}

/* PRZYCISKI */
.btn-primary {
    background-image: linear-gradient(to bottom, #0d6efd, #0b5ed7);
    border-color: #0b5ed7;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.4);
}

.btn-primary:hover {
    background-image: linear-gradient(to bottom, #0b5ed7, #0a58ca);
    border-color: #0a58ca;
    box-shadow: 0 12px 26px rgba(37, 99, 235, 0.45);
}

.btn-outline-secondary {
    border-radius: 999px;
    border-color: var(--crm-border);
    color: var(--crm-text-main);
    background-color: #ffffff;
}

.btn-outline-secondary:hover {
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    color: var(--crm-primary);
    border-color: var(--crm-border-strong);
}

.btn-sm {
    font-size: 0.8rem;
    padding-block: 0.25rem;
    padding-inline: 0.7rem;
    border-radius: 999px;
}

/* TABELA – metal look */
.table {
    color: var(--crm-text-main);
    font-size: 0.86rem;
}

.table thead {
    background: linear-gradient(180deg, #f9fafb 0%, #edf2f7 100%);
}

.table thead th {
    border-bottom-color: var(--crm-border);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--crm-text-muted);
}

.table tbody tr {
    background-color: rgba(255, 255, 255, 0.98);
}

.table tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

.table tbody tr:hover {
    background: #e7f1ff;
}

.table td, .table th {
    border-color: #e5e7eb;
}

/* FORM FIELDS */
.form-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--crm-text-muted);
    margin-bottom: 0.25rem;
}

.form-control,
.form-select {
    border-radius: 0.6rem;
    border: 1px solid var(--crm-border);
    font-size: 0.88rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--crm-primary);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.18);
}

.form-control::placeholder {
    color: #9ca3af;
}

.form-text {
    font-size: 0.76rem;
    color: var(--crm-text-muted);
}

/* TABS */
.nav-tabs {
    border-bottom-color: var(--crm-border);
}

.nav-tabs .nav-link {
    border: none;
    border-radius: 999px;
    padding: 0.45rem 0.95rem;
    font-size: 0.82rem;
    color: var(--crm-text-muted);
    background-color: transparent;
    margin-right: 0.25rem;
}

.nav-tabs .nav-link:hover {
    background-color: #f3f4f6;
    color: var(--crm-text-main);
}

.nav-tabs .nav-link.active {
    background-color: var(--crm-primary-soft);
    color: var(--crm-primary);
}

/* PILLS (statusy) */
.nav-pills .nav-link {
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    font-size: 0.78rem;
    color: var(--crm-text-muted);
    background-color: #eef1f6;
    border: 1px solid transparent;
}

.nav-pills .nav-link.active {
    background-color: var(--crm-primary-soft);
    color: var(--crm-primary);
    border-color: rgba(37, 99, 235, 0.4);
}

/* BADGE */
.badge {
    border-radius: 999px;
}

/* LOGIN – jasny panel */
.auth-bg {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: var(--crm-sidebar-bg);
}

.auth-card {
    max-width: 420px;
    width: 100%;
    background:
        linear-gradient(135deg, #ffffff 0%, #f5f5f5 40%, #e5e7eb 100%);
    border-radius: 1.1rem;
    border: 1px solid var(--crm-border);
    box-shadow:
        0 18px 40px rgba(15, 23, 42, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.9);
    padding: 1.9rem 1.7rem 1.4rem;
}

.auth-title {
    font-size: 1.55rem;
    font-weight: 600;
    color: var(--crm-primary);
}

.auth-subtitle {
    font-size: 0.88rem;
    color: var(--crm-text-muted);
}

nav[aria-label="Pagination Navigation"] svg {
    width: 12px;
    height: 12px;
}

/* Opcjonalnie: zmniejsza też przyciski (padding) */
nav[aria-label="Pagination Navigation"] .inline-flex.items-center {
    padding: 0.15rem 0.35rem;
}

/*   LAYOUT Z SIDEBAR'EM */

.crm-app {
    min-height: 100vh;
    display: flex;
}
/* Lewy panel */
.crm-sidebar {
    width: 230px;
    background: linear-gradient(
        180deg,
        #263368 0%,
        #232e5e 50%,
        #20294f 100%
    );
    border-right: 1px solid rgba(15, 23, 42, 0.6);
    box-shadow: 4px 0 16px rgba(15, 23, 42, 0.35);
    padding: 0.75rem 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease;
    color: #e5ecff;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow: hidden;
    z-index: 1000;
}

/* Główny content obok */
.crm-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: 230px;
    width: calc(100% - 230px);
}

.crm-main-inner {
    padding: 1.5rem;
}

.crm-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.crm-logo-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.crm-logo-icon img{
    width: 32px;
    height: 32px;
}

.crm-logo-text {
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #f9fbff;
    white-space: nowrap;
}

.crm-logo-text img{
    width: auto;
    height: 32px;
}

/* przycisk zwijania */
.crm-sidebar-toggle {
    border: none;
    background: transparent;
    padding: 0.15rem 0.35rem;
    border-radius: 999px;
    cursor: pointer;
    color: rgba(248, 250, 252, 0.75);
}

.crm-sidebar.crm-sidebar-collapsed .crm-sidebar-toggle i {
    transform: rotate(180deg);
}

/* Lista nawigacji w sidebarze */
.crm-nav {
    list-style: none;
    padding: 0 4px 0 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.crm-nav-item {
    margin-bottom: 0.25rem;
}

.crm-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.65rem;
    border-radius: 0.75rem;
    color: rgba(226, 232, 255, 0.78);
    font-size: 0.9rem;
}

.crm-nav-link:hover {
    background-color: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.crm-nav-link.active {
    background-color: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    font-weight: 600;
}

.crm-nav-icon {
    font-size: 1.2rem;
    width: 24px;
    display: inline-flex;
    justify-content: center;
    color: inherit;
}

.crm-nav-label {
    white-space: nowrap;
}

/* stopka sidebaru (logout + email) */
.crm-sidebar-footer {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(15, 23, 42, 0.7);
    font-size: 0.8rem;
    color: rgba(226, 232, 255, 0.7);
}

.crm-user-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: rgba(241, 245, 255, 0.88);
}

/* Logout button – ikona + tekst obok siebie */
.crm-logout-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    color: var(--crm-sidebar-bg);
}

/* Ikona logout */
.crm-logout-icon {
    font-size: 1rem;
    color: var(--crm-sidebar-bg);
}

/* Chowamy tekst przy zwiniętym sidebarze */
.crm-sidebar.crm-sidebar-collapsed .crm-user-label,
.crm-sidebar.crm-sidebar-collapsed .crm-logout-label {
    display: none;
}

/* zwinięty sidebar – albo klasa na samym sidebarze, albo na <html> */
.crm-sidebar.crm-sidebar-collapsed,
html.sidebar-collapsed .crm-sidebar {
    width: 72px;
}

.crm-sidebar.crm-sidebar-collapsed .crm-logo-text,
html.sidebar-collapsed .crm-logo-text {
    display: none;
}

.crm-sidebar.crm-sidebar-collapsed .crm-nav-label,
html.sidebar-collapsed .crm-nav-label {
    display: none;
}

.crm-sidebar.crm-sidebar-collapsed .crm-sidebar-footer button,
html.sidebar-collapsed .crm-sidebar-footer button {
    padding-inline: 0.4rem;
}

/* marginesy main */
.crm-sidebar.crm-sidebar-collapsed + .crm-main,
html.sidebar-collapsed .crm-main {
    margin-left: 72px;
    width: calc(100% - 72px);
}

/* Strzałka w przycisku zwijania – animacja */
.crm-sidebar-toggle i {
    display: inline-block;
    transition: transform 0.2s ease;
}

.crm-sidebar.crm-sidebar-collapsed .crm-sidebar-toggle i {
    transform: rotate(180deg);
    margin-left: -5px;
}

/* karta główna – używana w layout’cie wewnątrz crm-main */
.crm-main .crm-card {
    margin: 0;
}

/* Smukły scroll tylko w nav jeśli dużo elementów */
.crm-nav::-webkit-scrollbar {
    width: 6px;
}
.crm-nav::-webkit-scrollbar-thumb {
    background: #c7ccd5;
    border-radius: 10px;
}
.crm-nav::-webkit-scrollbar-track {
    background: transparent;
}

.crm-sidebar.crm-sidebar-collapsed .crm-nav {
    overflow-y: auto;
}

.crm-main {
    margin-left: 230px;
    width: calc(100% - 230px);
}

.crm-sidebar.crm-sidebar-collapsed + .crm-main {
    margin-left: 72px;
    width: calc(100% - 72px);
}
