* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f6f9;
    color: #172033;
}

button {
    font: inherit;
}

.app {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 250px;
    background: #111827;
    color: white;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 30px;
}

.logo-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
    font-weight: bold;
}

.logo strong {
    display: block;
    font-size: 15px;
}

.logo span {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    opacity: .55;
}

nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-item {
    border: 0;
    background: transparent;
    color: #aeb7c7;
    text-align: left;
    padding: 13px 14px;
    border-radius: 9px;
    cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
    background: #1f2937;
    color: white;
}

.sidebar-bottom {
    margin-top: auto;
    padding: 20px 8px 5px;
    color: #8d97a8;
    font-size: 11px;
}

.sidebar-bottom small {
    display: block;
    margin-top: 4px;
    opacity: .65;
}

.main {
    flex: 1;
    min-width: 0;
}

.topbar {
    min-height: 90px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 22px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar h1 {
    margin: 0;
    font-size: 25px;
}

.topbar p {
    margin: 6px 0 0;
    color: #7a8496;
    font-size: 13px;
}

.admin-badge {
    padding: 9px 13px;
    background: #f1f5f9;
    border-radius: 20px;
    font-size: 12px;
}

.section {
    display: none;
    padding: 30px 32px;
}

.section.active {
    display: block;
}

.cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

.card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #eef2ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
}

.card.success .card-icon {
    background: #ecfdf5;
}

.card.danger .card-icon {
    background: #fef2f2;
}

.card span {
    display: block;
    color: #7a8496;
    font-size: 12px;
}

.card strong {
    display: block;
    margin-top: 5px;
    font-size: 27px;
}

.section-heading {
    margin: 28px 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-heading h2 {
    margin: 0;
    font-size: 18px;
}

.section-heading p {
    margin: 5px 0 0;
    color: #7a8496;
    font-size: 12px;
}

.expiry-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.expiry-card {
    padding: 20px;
    border-radius: 14px;
    background: white;
    border: 1px solid #e5e7eb;
}

.expiry-card span {
    display: block;
    font-size: 12px;
    color: #697386;
}

.expiry-card strong {
    display: block;
    margin-top: 10px;
    font-size: 28px;
}

.expiry-card.warning {
    border-left: 4px solid #f59e0b;
}

.expiry-card.urgent {
    border-left: 4px solid #ef4444;
}

.expiry-card.expired {
    border-left: 4px solid #7f1d1d;
}

.panel-box {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 22px;
}

.customer-list {
    display: flex;
    flex-direction: column;
}

.customer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 4px;
    border-bottom: 1px solid #eef0f3;
}

.customer-row:last-child {
    border-bottom: 0;
}

.customer-name {
    font-weight: 600;
    font-size: 14px;
}

.customer-meta {
    margin-top: 4px;
    font-size: 11px;
    color: #7a8496;
}

.status {
    font-size: 11px;
    padding: 5px 9px;
    border-radius: 20px;
}

.status.active {
    background: #ecfdf5;
    color: #047857;
}

.status.inactive {
    background: #fef2f2;
    color: #b91c1c;
}

.primary-button {
    border: 0;
    border-radius: 8px;
    padding: 10px 14px;
    background: #2563eb;
    color: white;
    cursor: pointer;
    font-size: 12px;
}

.primary-button:hover {
    background: #1d4ed8;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 14px 10px;
    border-bottom: 1px solid #eef0f3;
    font-size: 13px;
}

th {
    color: #7a8496;
    font-size: 11px;
    text-transform: uppercase;
}

.empty-state {
    text-align: center;
    padding: 55px 20px;
    color: #7a8496;
}

.empty-icon {
    font-size: 38px;
    margin-bottom: 10px;
}

.empty-state h3 {
    color: #172033;
    margin: 5px 0;
}

.empty-state p {
    font-size: 13px;
}

@media (max-width: 900px) {

    .sidebar {
        width: 210px;
    }

    .cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .expiry-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 650px) {

    .sidebar {
        width: 70px;
        padding: 12px 8px;
    }

    .logo div:not(.logo-icon),
    .nav-item {
        font-size: 0;
    }

    .nav-item {
        text-align: center;
    }

    .sidebar-bottom {
        display: none;
    }

    .topbar {
        padding: 18px;
    }

    .section {
        padding: 20px 16px;
    }

    .cards {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   TWOJANajLEPSZA 2.0 - EXTENDED UI
========================================================= */

.clickable {
    cursor: pointer;
}

.clickable:hover {
    background: #f8fafc;
}

.toolbar {
    margin-bottom: 16px;
}

.search-input,
.form-group input,
.form-group select,
.form-group textarea,
#import-panel,
#import-file {
    width: 100%;
    border: 1px solid #dbe1ea;
    border-radius: 9px;
    padding: 11px 13px;
    background: white;
    font: inherit;
    color: #172033;
}

.search-input {
    max-width: 420px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label,
.detail-label {
    display: block;
    margin-bottom: 6px;
    color: #697386;
    font-size: 12px;
}

.form-group textarea {
    min-height: 90px;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.search-input:focus {
    outline: none;
    border-color: #2563eb;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.small-button {
    border: 1px solid #dbe1ea;
    background: white;
    border-radius: 7px;
    padding: 7px 10px;
    cursor: pointer;
    font-size: 11px;
}

.small-button:hover {
    background: #f1f5f9;
}

.large-button {
    margin-top: 10px;
    padding: 12px 18px;
}

.empty-table {
    text-align: center;
    padding: 40px !important;
    color: #7a8496;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}

.modal.show {
    display: flex;
}

.modal-content {
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 25px 60px rgba(0,0,0,.2);
}

.modal-large {
    max-width: 850px;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-header h2 {
    margin: 0;
}

.modal-header p {
    margin: 5px 0 0;
    color: #7a8496;
    font-size: 12px;
}

.modal-close {
    border: 0;
    background: #f1f5f9;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    font-size: 22px;
    cursor: pointer;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 18px;
    background: #f8fafc;
    border-radius: 12px;
}

.detail-grid strong {
    display: block;
}

.detail-section {
    margin-top: 28px;
}

.detail-section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 12px;
}

.detail-section-heading h3 {
    margin: 0;
    font-size: 16px;
}

.detail-section-heading p {
    margin: 4px 0 0;
    color: #7a8496;
    font-size: 12px;
}

.person-card,
.service-card,
.panel-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
}

.person-card,
.service-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.person-card span:not(.status) {
    display: block;
    margin-top: 4px;
    color: #7a8496;
    font-size: 12px;
}

.service-meta,
.panel-meta {
    margin-top: 5px;
    color: #697386;
    font-size: 12px;
}

.detail-actions {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #eef0f3;
}

.empty-inline {
    padding: 20px;
    background: #f8fafc;
    border-radius: 10px;
    color: #7a8496;
    text-align: center;
}

.panel-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.panel-card-main {
    display: flex;
    align-items: center;
    gap: 14px;
}

.panel-card-main h3 {
    margin: 0;
    font-size: 15px;
}

.panel-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #eef2ff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px 0;
    font-size: 13px;
}

.import-box {
    max-width: 1000px;
}

.csv-format {
    background: #f8fafc;
    padding: 13px;
    border-radius: 9px;
    margin: 15px 0;
    font-size: 12px;
    color: #697386;
}

.import-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 25px;
}

.import-summary > div {
    border: 1px solid #e5e7eb;
    border-radius: 11px;
    padding: 16px;
    background: #fff;
}

.import-summary span {
    display: block;
    color: #697386;
    font-size: 11px;
}

.import-summary strong {
    display: block;
    margin-top: 6px;
    font-size: 24px;
}

.import-preview-box {
    margin-top: 20px;
}

.import-group {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
}

.import-group h4 {
    margin: 0;
    padding: 11px 14px;
    background: #f8fafc;
    font-size: 13px;
}

.import-row {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    gap: 10px;
    padding: 10px 14px;
    border-top: 1px solid #eef0f3;
    font-size: 11px;
}

.more-note {
    padding: 10px 14px;
    color: #7a8496;
    font-size: 11px;
}

.error-box {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    background: #fef2f2;
    color: #b91c1c;
}

.success-box {
    margin-top: 20px;
    padding: 18px;
    border-radius: 10px;
    background: #ecfdf5;
    color: #047857;
}

@media (max-width: 800px) {

    .form-grid,
    .detail-grid,
    .import-summary {
        grid-template-columns: 1fr;
    }

    .panel-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .panel-card-actions {
        flex-wrap: wrap;
    }

    .import-row {
        grid-template-columns: 1fr 1fr;
    }
}
