* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, sans-serif; background: #f4f6f8; color: #17202a; }
a { color: #1164b4; text-decoration: none; }
.topbar { background: #17202a; color: #fff; padding: 14px 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { font-weight: 700; font-size: 20px; }
.topbar nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.topbar nav a { color: #fff; }
.user-info { color: #d6e6f5; font-size: 14px; }
.container { max-width: 1180px; margin: 0 auto; padding: 24px; }
h1, h2 { margin-top: 0; }
.muted { color: #667085; }
.login-card, .form-card { background: #fff; border-radius: 14px; padding: 24px; box-shadow: 0 10px 24px rgba(0,0,0,.06); }
.login-card { max-width: 440px; margin: 50px auto; }
form label { display: block; margin-top: 14px; margin-bottom: 6px; font-weight: 700; }
input, textarea, select { width: 100%; padding: 11px 12px; border: 1px solid #d0d5dd; border-radius: 10px; background: #fff; font: inherit; }
textarea { min-height: 110px; resize: vertical; }
button, .button { display: inline-block; margin-top: 16px; padding: 11px 16px; border: 0; border-radius: 10px; background: #1164b4; color: #fff; font-weight: 700; cursor: pointer; }
.button.secondary { background: #e9eef5; color: #17202a; }
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 10px; background: #e9eef5; }
.alert.success { background: #e6f6eb; }
.alert.danger { background: #ffe7e7; }
.alert.warning { background: #fff4d6; }
.alert.info { background: #e8f2ff; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.filters { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; background: #fff; padding: 14px; border-radius: 14px; margin-bottom: 18px; }
.filters select { max-width: 240px; }
.filters button, .filters .button { margin-top: 0; }
.table-wrap { overflow-x: auto; background: #fff; border-radius: 14px; box-shadow: 0 10px 24px rgba(0,0,0,.04); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px; border-bottom: 1px solid #edf0f3; text-align: left; vertical-align: top; }
th { background: #fafbfc; font-size: 13px; color: #475467; }
.actions { white-space: nowrap; }
.actions a { margin-right: 8px; }
.empty { text-align: center; color: #667085; padding: 24px; }
.badge { display: inline-block; padding: 5px 9px; border-radius: 999px; font-size: 13px; font-weight: 700; background: #e9eef5; }
.status-nowe { background: #edf2ff; color: #2447a8; }
.status-przyjete { background: #e6f6eb; color: #137333; }
.status-w_trakcie { background: #fff4d6; color: #8a5b00; }
.status-wykonane { background: #dff7e7; color: #0f6b32; }
.status-problem { background: #ffe7e7; color: #b42318; }
.status-anulowane { background: #eeeeee; color: #555; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.order-card, .empty-card { display: block; background: #fff; color: inherit; border-radius: 14px; padding: 18px; box-shadow: 0 10px 24px rgba(0,0,0,.05); }
.card-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.order-card h2 { font-size: 20px; margin: 12px 0 8px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: 18px; }
.detail-main, .detail-side { background: #fff; border-radius: 14px; padding: 22px; box-shadow: 0 10px 24px rgba(0,0,0,.04); }
.info-box { background: #f8fafc; border-radius: 12px; padding: 14px; margin-bottom: 18px; }
.info-box p { margin: 8px 0; }
.description { white-space: pre-wrap; }
.inline-form { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.inline-form select { max-width: 260px; }
.inline-form button { margin-top: 0; }
.comment { padding: 12px 0; border-bottom: 1px solid #edf0f3; }
.comment span { display: block; color: #667085; font-size: 13px; margin-top: 3px; }
.comment p { margin-bottom: 0; white-space: pre-wrap; }
.photos { display: grid; gap: 12px; }
.photo-box img { width: 100%; border-radius: 12px; display: block; border: 1px solid #edf0f3; }
.photo-box small { display: block; color: #667085; margin-top: 5px; }
.two-col { display: grid; grid-template-columns: 380px 1fr; gap: 18px; }
.inline-delete-form { display: inline; }
.inline-delete-form button { margin: 0; padding: 0; border: 0; background: none; font: inherit; cursor: pointer; }
.link-danger { color: #b42318; font-weight: 700; }
.danger-button { display: inline-block; margin-top: 12px; padding: 11px 16px; border: 0; border-radius: 10px; background: #b42318; color: #fff; font-weight: 700; cursor: pointer; }
.delete-order-detail-form { display: inline-block; margin-left: 8px; }
.login-page { min-height: calc(100vh - 96px); display: flex; align-items: center; justify-content: center; }
.branded-login { text-align: center; }
.login-logo-wrap { display: flex; justify-content: center; margin-bottom: 18px; }
.login-logo { max-width: 240px; width: 100%; height: auto; display: block; }
.branded-login h1 { font-size: 30px; margin-bottom: 8px; }
.branded-login form { text-align: left; margin-top: 20px; }
@media (max-width: 850px) {
    .topbar, .page-head { flex-direction: column; align-items: flex-start; }
    .detail-grid, .two-col { grid-template-columns: 1fr; }
    .container { padding: 16px; }
}


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

.search-filters input[type="text"] {
    min-width: 280px;
    flex: 1;
}

.search-filters input[type="date"] {
    max-width: 170px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card {
    background: #fff;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 10px 24px rgba(0,0,0,.04);
}

.stat-card strong {
    display: block;
    font-size: 34px;
    line-height: 1;
    margin-bottom: 8px;
}

.stat-card span {
    color: #667085;
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.history-item {
    border-left: 4px solid #d0d5dd;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 10px;
    margin-bottom: 10px;
}

.history-item span {
    display: block;
    color: #667085;
    font-size: 13px;
    margin-top: 3px;
}

.history-item p {
    margin: 6px 0 0;
    white-space: pre-wrap;
}

.attachment-list {
    display: grid;
    gap: 10px;
}

.attachment-item {
    padding: 10px 0;
    border-bottom: 1px solid #edf0f3;
}

.attachment-item small {
    display: block;
    color: #667085;
    margin-top: 4px;
}

.photo-box {
    border-bottom: 1px solid #edf0f3;
    padding-bottom: 12px;
}

.settings-form {
    margin-bottom: 18px;
}

.settings-form h2 {
    margin-top: 22px;
    padding-top: 12px;
    border-top: 1px solid #edf0f3;
}

.settings-form h2:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    margin-top: 14px;
}

.checkbox-row input[type="checkbox"] {
    width: auto;
}

.field-help {
    margin-top: 5px;
    color: #667085;
    font-size: 13px;
}

.today-section {
    margin-bottom: 18px;
}

.inner-table {
    box-shadow: none;
    border: 1px solid #edf0f3;
}


/* v6 - lista i sortowanie zleceń */
.sort-info {
    background: #fff;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 12px;
    color: #667085;
    box-shadow: 0 8px 20px rgba(0,0,0,.035);
}

.list-table th a {
    color: #344054;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 800;
}

.list-table tr:hover td {
    background: #f8fafc;
}

.row-title {
    font-weight: 800;
    color: #1164b4;
}

.row-subtext {
    color: #667085;
    font-size: 13px;
    margin-top: 4px;
    line-height: 1.35;
}

.nowrap {
    white-space: nowrap;
}

.priority-pill {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    background: #e9eef5;
}

.priority-pilny {
    background: #ffe7e7;
    color: #b42318;
}

.priority-normalny {
    background: #edf2ff;
    color: #2447a8;
}

.priority-niski {
    background: #e6f6eb;
    color: #137333;
}

.badge.success {
    background: #dff7e7;
    color: #0f6b32;
}

.badge.danger {
    background: #ffe7e7;
    color: #b42318;
}

@media (max-width: 760px) {
    .list-table th,
    .list-table td {
        padding: 10px 8px;
        font-size: 13px;
    }

    .row-subtext {
        display: none;
    }
}
