* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f6f8;
    color: #1f2937;
}

a {
    color: inherit;
    text-decoration: none;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eef2f7;
}

.login-box {
    width: 380px;
    background: #ffffff;
    padding: 32px;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.login-box h1 {
    margin: 0 0 8px;
}

.login-box p {
    margin: 0 0 24px;
    color: #6b7280;
}

label {
    display: block;
    margin: 14px 0 6px;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
}

button {
    width: 100%;
    margin-top: 20px;
    padding: 12px 16px;
    border: 0;
    border-radius: 8px;
    background: #0f766e;
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

button:hover {
    background: #115e59;
}

.alert {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.alert.error {
    background: #fee2e2;
    color: #991b1b;
}

.topbar {
    height: 60px;
    background: #0f172a;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.topbar a {
    color: #d1fae5;
}

.layout {
    display: flex;
    min-height: calc(100vh - 60px);
}

.sidebar {
    width: 230px;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    padding: 20px;
}

.sidebar a {
    display: block;
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 6px;
    color: #374151;
}

.sidebar a:hover,
.sidebar a.active {
    background: #ccfbf1;
    color: #0f766e;
    font-weight: 700;
}

.content {
    flex: 1;
    padding: 28px;
}

h1 {
    margin-top: 0;
}

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

.card {
    background: #ffffff;
    padding: 22px;
    border-radius: 14px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.04);
}

.card span {
    display: block;
    color: #6b7280;
    margin-bottom: 8px;
}

.card strong {
    font-size: 30px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
}

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

th {
    background: #f9fafb;
    font-weight: 700;
}

tr:last-child td {
    border-bottom: 0;
}

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

.page-header h1 {
    margin-bottom: 4px;
}

.page-header p {
    margin: 0;
    color: #6b7280;
}

.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 16px;
    border-radius: 8px;
    font-weight: 700;
    text-decoration: none;
}

.btn-primary {
    background: #0f766e;
    color: #ffffff;
}

.btn-primary:hover {
    background: #115e59;
}

.btn-secondary {
    background: #e5e7eb;
    color: #111827;
}

.btn-secondary:hover {
    background: #d1d5db;
}

.form-section {
    background: #ffffff;
    padding: 22px;
    border-radius: 14px;
    margin-bottom: 22px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.04);
}

.form-section h2 {
    margin-top: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.btn-small {
    width: auto;
    margin: 0;
    padding: 9px 14px;
    font-size: 14px;
}

.items-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.items-table {
    min-width: 1500px;
}

.items-table th,
.items-table td {
    vertical-align: top;
    font-size: 13px;
}

.items-table textarea {
    min-height: 54px;
    resize: vertical;
}

.items-table input,
.items-table textarea {
    padding: 8px;
    font-size: 13px;
}

.items-table th:nth-child(1),
.items-table td:nth-child(1) {
    width: 280px;
}

.items-table th:nth-child(13),
.items-table td:nth-child(13) {
    width: 180px;
}

.equipment-total,
.labor-total,
.line-total,
.executed-total,
.remaining-quantity,
.remaining-total {
    font-weight: 700;
    white-space: nowrap;
    padding-top: 17px;
}

.remove-row {
    width: 34px;
    height: 34px;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    background: #fee2e2;
    color: #991b1b;
    font-size: 22px;
    line-height: 1;
}

.remove-row:hover {
    background: #fecaca;
}

.totals-box {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-top: 20px;
}

.totals-box div {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    padding: 16px;
    border-radius: 10px;
}

.totals-box span {
    display: block;
    color: #6b7280;
    margin-bottom: 6px;
}

.totals-box strong {
    font-size: 18px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 40px;
}

.btn-submit {
    width: auto;
    min-width: 220px;
}

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

.status {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.status-draft {
    background: #e5e7eb;
    color: #374151;
}

.status-emisa {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-acceptata {
    background: #dcfce7;
    color: #166534;
}

.status-in_executie {
    background: #fef3c7;
    color: #92400e;
}

.status-finalizata {
    background: #ccfbf1;
    color: #0f766e;
}

.status-anulata {
    background: #fee2e2;
    color: #991b1b;
}

.table-action {
    display: inline-block;
    margin-right: 8px;
    font-weight: 700;
    color: #0f766e;
}

@media (max-width: 1200px) {
    .cards,
    .form-grid,
    .totals-box {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 760px) {
    .layout {
        display: block;
    }

    .sidebar {
        width: 100%;
        display: flex;
        gap: 8px;
        overflow-x: auto;
    }

    .sidebar a {
        white-space: nowrap;
    }

    .form-grid,
    .totals-box {
        grid-template-columns: 1fr;
    }

    .page-header {
        display: block;
    }

    .page-header .btn-primary,
    .page-header .btn-secondary {
        margin-top: 14px;
    }
}

.alert.success {
    background: #dcfce7;
    color: #166534;
}

.filters-box {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    background: #ffffff;
    padding: 18px;
    border-radius: 14px;
    margin-bottom: 22px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.04);
}

.filter-field {
    width: 360px;
    max-width: 100%;
}

.filter-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-filter {
    width: auto;
    margin: 0;
    padding: 11px 16px;
}

.btn-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 16px;
    border-radius: 8px;
    background: #e5e7eb;
    color: #111827;
    font-weight: 700;
    text-decoration: none;
}

.btn-clear:hover {
    background: #d1d5db;
}

.actions-cell {
    white-space: nowrap;
}

.delete-form {
    display: inline;
}

.table-action-delete {
    display: inline-block;
    width: auto;
    margin: 0 0 0 8px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #b91c1c;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}

.table-action-delete:hover {
    color: #7f1d1d;
    background: transparent;
}

@media (max-width: 760px) {
    .filters-box {
        display: block;
    }

    .filter-field {
        width: 100%;
    }

    .filter-actions {
        margin-top: 12px;
    }
}

.autosave-status {
    margin: 0 0 18px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 700;
    font-size: 14px;
}

.autosave-saving {
    background: #fef3c7;
    color: #92400e;
}

.autosave-saved {
    background: #dcfce7;
    color: #166534;
}

.autosave-error {
    background: #fee2e2;
    color: #991b1b;
}

.checkbox-cell {
    text-align: center;
    vertical-align: middle;
    width: 80px;
}

.checkbox-cell input[type="checkbox"],
.worklog-employee-checkbox {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: #0f172a;
}

.worklog-units-buttons {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.worklog-unit-btn {
    display: inline-block !important;
    width: auto !important;
    min-width: 44px;
    max-width: 44px;
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #0f172a;
    border-radius: 6px;
    font-weight: 700;
    font-size: 13px;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: 0.15s ease;
    margin: 0 !important;
}

.worklog-unit-btn:hover {
    border-color: #0f172a;
    background: #f8fafc;
}

.worklog-unit-btn.active {
    background: #0f766e;
    border-color: #0f766e;
    color: #ffffff;
}

.page-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.report-work-line {
    margin-bottom: 6px;
    line-height: 1.4;
}

@media print {
    .topbar,
    .sidebar,
    .page-actions,
    .form-section:first-of-type {
        display: none !important;
    }

    .layout {
        display: block !important;
    }

    .content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    .form-section {
        box-shadow: none !important;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}
/* Import Excel ofertă */
.offer-header-actions {
    align-items: flex-end;
}

.page-actions-vertical {
    flex-direction: column;
    gap: 8px;
}

.offer-import-form {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin: 0;
}

.offer-import-form input[type="file"] {
    display: none;
}

.offer-import-label {
    cursor: pointer;
    width: 100%;
    min-width: 220px;
    text-align: center;
}

.offer-import-status {
    max-width: 260px;
    min-height: 18px;
    font-size: 12px;
    line-height: 1.35;
    font-weight: 700;
    color: #64748b;
    text-align: right;
}

.offer-import-loading {
    color: #92400e;
}

.offer-import-success {
    color: #166534;
}

.offer-import-error {
    color: #991b1b;
}

/* Import Excel ofertă - compatibil Windows/Mac */
.offer-import-submit {
    width: 100%;
    text-align: center;
    cursor: pointer;
}
