/* =======================================
   PORTAL - Modern Corporate Design
   ======================================= */

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f5f7fa;
    color: #1a1f36;
    height: 100%;
}

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

/* ---- Header ---- */
.portal-header {
    height: 60px;
    background: #ffffff;
    border-bottom: 1px solid #e8eaf0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.brand-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1f36;
    display: block;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 11px;
    color: #6b7280;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header-firma {
    display: flex;
    align-items: center;
}

.firma-info-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}

.firma-name {
    font-size: 15px;
    font-weight: 700;
    color: #1a1f36;
    line-height: 1.2;
}

.firma-details {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.firma-detail-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #6b7280;
    text-decoration: none;
    transition: color 0.15s;
    white-space: nowrap;
}

.firma-detail-item:hover {
    color: #2563eb;
}

.firma-detail-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

/* ---- Body ---- */
.portal-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* ---- Sidebar ---- */
.portal-sidebar {
    width: 220px;
    background: #ffffff;
    border-right: 1px solid #e8eaf0;
    padding: 20px 12px;
    flex-shrink: 0;
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    text-decoration: none;
    color: #4b5563;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
    background: #f0f4ff;
    color: #2563eb;
}

.nav-item.active {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 600;
}

.nav-item svg {
    flex-shrink: 0;
    opacity: 0.8;
}

/* ---- Main Content ---- */
.portal-main {
    flex: 1;
    padding: 28px 32px;
    overflow-y: auto;
    min-width: 0;
}

/* ---- Page Header ---- */
.page-header {
    margin-bottom: 28px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: #1a1f36;
    margin: 0 0 4px 0;
}

.page-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

/* ---- Stat Cards ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: #fff;
    border: 1px solid #e8eaf0;
    border-radius: 12px;
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.blue   { background: #eff6ff; }
.stat-icon.green  { background: #f0fdf4; }
.stat-icon.orange { background: #fff7ed; }
.stat-icon.purple { background: #faf5ff; }

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: #1a1f36;
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: #6b7280;
    margin-top: 2px;
}

/* ---- Cards / Panels ---- */
.card {
    background: #fff;
    border: 1px solid #e8eaf0;
    border-radius: 12px;
    padding: 22px 24px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f0f2f7;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1f36;
    margin: 0;
}

.card-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    background: #f0f4ff;
    color: #2563eb;
}

/* ---- Table ---- */
.portal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.portal-table thead th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #6b7280;
    padding: 8px 14px;
    border-bottom: 2px solid #e8eaf0;
    background: #fafafa;
}

.portal-table tbody tr {
    border-bottom: 1px solid #f0f2f7;
    transition: background 0.1s;
}

.portal-table tbody tr:hover {
    background: #f8faff;
}

.portal-table tbody td {
    padding: 12px 14px;
    color: #374151;
    vertical-align: top;
}

/* ---- Day Card (Denní přehled) ---- */
.den-card {
    background: #fff;
    border: 1px solid #e8eaf0;
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
}

.den-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: linear-gradient(to right, #f8faff, #fff);
    border-bottom: 1px solid #e8eaf0;
    cursor: pointer;
    gap: 16px;
}

.den-date {
    font-size: 15px;
    font-weight: 700;
    color: #1a1f36;
    min-width: 120px;
}

.den-stavba {
    font-size: 14px;
    color: #2563eb;
    font-weight: 600;
}

.den-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
}

.den-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.den-badge.hours   { background: #f0fdf4; color: #16a34a; }
.den-badge.workers { background: #f0f4ff; color: #2563eb; }

.den-body {
    padding: 12px 20px;
}

/* ---- Employee Row ---- */
.emp-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid #f5f7fa;
}

.emp-row:last-child { border-bottom: none; }

.emp-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: white;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.emp-info { flex: 1; min-width: 0; }

.emp-name {
    font-weight: 600;
    font-size: 14px;
    color: #1a1f36;
}

.emp-position {
    font-size: 12px;
    color: #6b7280;
}

.emp-time {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.emp-stats {
    text-align: right;
    flex-shrink: 0;
}

.emp-hours {
    font-size: 16px;
    font-weight: 700;
    color: #16a34a;
}

.emp-hours-label {
    font-size: 11px;
    color: #9ca3af;
}

.emp-prace {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed #e8eaf0;
}

.prace-item {
    font-size: 12px;
    color: #4b5563;
    padding: 2px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.prace-item::before {
    content: '•';
    color: #2563eb;
}

/* ---- Filters ---- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.filter-select, .filter-input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    color: #374151;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s;
}

.filter-select:focus, .filter-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* ---- Badges / Pills ---- */
.badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
}

.badge-success { background: #dcfce7; color: #16a34a; }
.badge-info    { background: #dbeafe; color: #1d4ed8; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-neutral { background: #f3f4f6; color: #6b7280; }

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    color: #6b7280;
    margin: 0 0 6px;
}

.empty-state p {
    font-size: 14px;
    margin: 0;
}

/* ---- Error / Unauthorized ---- */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f7fa;
}

.error-card {
    background: #fff;
    border: 1px solid #e8eaf0;
    border-radius: 16px;
    padding: 48px 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.error-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.error-card h1 {
    font-size: 22px;
    font-weight: 700;
    color: #1a1f36;
    margin: 0 0 10px;
}

.error-card p {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
    line-height: 1.6;
}

/* ---- Loading ---- */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: #9ca3af;
    gap: 12px;
    font-size: 14px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e8eaf0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- Month separator ---- */
.month-header {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #6b7280;
    padding: 10px 0 8px;
    margin-top: 12px;
    border-top: 2px solid #e8eaf0;
}

.month-header:first-child {
    margin-top: 0;
    border-top: none;
}

/* ---- Přítomnost na stavbě ---- */
.pritomnost-grid {
    display: flex;
    flex-direction: column;
}

.pritomnost-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f5f7fa;
}

.pritomnost-row:last-child {
    border-bottom: none;
}

.pritomnost-stavba {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #2563eb;
    margin-top: 2px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .portal-sidebar {
        display: none;
    }

    .portal-main {
        padding: 16px;
    }

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