* {
    box-sizing: border-box;
}

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

a.btn,
button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    text-align: center;
    padding: 10px 14px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    background: #e4e7eb;
    color: #334e68;
    appearance: none;
}

a.btn-primary,
button.btn-primary {
    background: #0b69a3;
    color: white;
}

a.btn-primary:hover,
button.btn-primary:hover {
    background: #095a8c;
}

a.btn-secondary,
button.btn-secondary {
    background: #e4e7eb;
    color: #334e68;
}

a.btn-secondary:hover,
button.btn-secondary:hover {
    background: #cbd2d9;
}

a.btn-danger,
button.btn-danger {
    background: #d64545;
    color: white;
}

a.btn-danger:hover,
button.btn-danger:hover {
    background: #b83a3a;
}

.project-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.project-list .project-card {
    background: #ffffff;
    border: 1px solid #cfd8e3;
    border-radius: 14px;
    padding: 0;
    box-shadow: 0 6px 16px rgba(16, 42, 67, 0.10);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    overflow: hidden;
}

.project-list .project-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(16, 42, 67, 0.15);
}

.project-card-body {
    padding: 22px;
}

.project-card h2 {
    margin: 0 0 8px 0;
    font-size: 1.3rem;
}

.project-card h2 a {
    color: #111827;
    text-decoration: none;
}

.project-meta {
    color: #6b7280;
    margin: 0 0 14px 0;
}

.project-status {
    display: inline-block;
    background: #f1f5f9;
    color: #334155;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    margin-bottom: 18px;
}

.project-card-footer {
    margin-top: 20px;
}

.project-health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 14px;
}

.project-health-card {
    background: #ffffff;
    border: 1px solid #d9e2ec;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(16, 42, 67, 0.05);
}

.project-health-meta {
    color: #52606d;
    font-size: 14px;
    margin-top: 6px;
}

.project-health-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    gap: 8px;
    margin-top: 14px;
}

.project-health-stat {
    background: #f8fafc;
    border: 1px solid #eef2f6;
    border-radius: 8px;
    padding: 10px;
}

.project-health-stat span {
    display: block;
    color: #52606d;
    font-size: 12px;
    font-weight: 700;
}

.project-health-stat strong {
    display: block;
    color: #102a43;
    font-size: 20px;
    margin-top: 4px;
}

.project-risk-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
    color: #52606d;
    font-size: 14px;
    font-weight: 700;
}

.site-header {
    /* background: #ffffff;
    border-bottom: 1px solid #d9e2ec; */
    background: #1f2937; /* dark slate */
    color: white;
}



/* .main-nav a {
    text-decoration: none;
    color: #334e68;
    font-weight: 600;
}

.main-nav a:hover {
    color: #0b69a3;
} */

/* Desktop header */
.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.brand {
    font-size: 1.2rem;
    font-weight: 800;
    /* color: #222; */
    color: #ffffff;
    white-space: nowrap;
}

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

.main-nav a {
    /* color: #444; */
    color: #d1d5db;
    text-decoration: none;
    font-weight: 500;
}

.main-nav a.active {
    color: #ffffff;
    font-weight: 700;
}

.main-nav a:hover {
    /* color: #111; */
    color: #ffffff;
}

.logout-form {
    margin: 0;
}

.nav-logout {
    background: #dc3545;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.nav-logout:hover {
    background: #bb2d3b;
}

.nav-toggle,
.nav-toggle-label,
.nav-close {
    display: none;
}


.page-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px 40px;
}

.site-footer {
    border-top: 1px solid #d9e2ec;
    background: #ffffff;
    margin-top: 40px;
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px 20px;
    color: #7b8794;
    font-size: 14px;
}

.card {
    background: #ffffff;
    border: 1px solid #d9e2ec;
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(16, 42, 67, 0.05);
}

.section-title {
    margin: 24px 0 12px;
    color: #102a43;
}

.card .section-title:first-child {
    margin-top: 0;
}

.action-bar,
.page-footer-actions,
.pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.empty-state {
    color: #52606d;
}

.empty-state p {
    margin: 0 0 12px;
}

.empty-state p:last-child {
    margin-bottom: 0;
}

.page-title {
    margin-top: 0;
    margin-bottom: 4px;
    color: #102a43;
}

.page-subtitle {
    color: #52606d;
    margin: 0;
}

.meta {
    color: #7b8794;
    font-size: 14px;
}

.material-unit-hint {
    margin-top: 8px;
    color: #334e68;
    font-size: 14px;
    font-weight: 700;
}

.material-unit-hint-custom {
    color: #92400e;
}

/* .btn + .btn {
    margin-top: 10px;
} */

.action-block {
    margin-top: 20px;
}

.bulk-action-bar,
.sticky-actions {
    position: sticky;
    bottom: 12px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: #ffffff;
    padding: 12px;
    margin-top: 20px;
    border: 1px solid #d9e2ec;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(16, 42, 67, 0.14);
}

.bulk-selected-count {
    color: #334e68;
    font-size: 14px;
    font-weight: 700;
    margin-right: auto;
}

.bulk-action-bar button[type="submit"] {
    margin-top: 0;
}

/* .btn-danger {
    background: #d64545;
    color: white;
}

.btn-danger:hover {
    background: #b83a3a;
} */

.link-list {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.link-button {
    display: inline-block;
    text-decoration: none;
    background: #0b69a3;
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 600;
}

/* .link-button:hover {
    background: #095a8c;
} */

.simple-list {
    display: grid;
    gap: 12px;
}

.simple-item {
    background: #ffffff;
    border: 1px solid #d9e2ec;
    border-radius: 10px;
    padding: 14px 16px;
}

form p {
    margin-bottom: 14px;
}

input,
select,
textarea {
    width: 100%;
    max-width: 500px;
    padding: 10px;
    border: 1px solid #bcccdc;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

button[type="submit"] {
    margin-top: 8px;
}

/* Auth pages (login) */

.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
}

.auth-card {
    background: #ffffff;
    border: 1px solid #d9e2ec;
    border-radius: 10px;
    padding: 30px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 2px 6px rgba(16, 42, 67, 0.08);
}

.auth-title {
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
}

.auth-link-row {
    margin-top: 18px;
    text-align: center;
}

.auth-link-row a {
    color: #0b69a3;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.auth-link-row a:hover {
    text-decoration: underline;
}

.project-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.project-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0 20px;
}

.summary-card {
    background: #ffffff;
    border: 1px solid #d9e2ec;
    border-radius: 10px;
    padding: 14px;
    box-shadow: 0 1px 2px rgba(16, 42, 67, 0.05);
}

.summary-value {
    color: #102a43;
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
}

.summary-label {
    color: #52606d;
    font-size: 13px;
    font-weight: 700;
    margin-top: 8px;
}

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

.dashboard-company-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.dashboard-company-summary {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.dashboard-company-summary div {
    min-width: 120px;
    padding: 12px;
    border: 1px solid #eef2f6;
    border-radius: 8px;
    background: #f8fafc;
}

.dashboard-company-summary span {
    display: block;
    color: #102a43;
    font-size: 24px;
    font-weight: 800;
    line-height: 1;
}

.dashboard-company-summary strong {
    display: block;
    color: #52606d;
    font-size: 13px;
    margin-top: 6px;
}

.dashboard-stat-card {
    display: block;
    min-width: 0;
    padding: 14px;
    border: 1px solid #d9e2ec;
    border-radius: 10px;
    background: #ffffff;
    color: inherit;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(16, 42, 67, 0.05);
}

.dashboard-stat-card:hover {
    border-color: #0b69a3;
}

.dashboard-stat-warning {
    border-left: 4px solid #f59e0b;
}

.dashboard-stat-danger {
    border-left: 4px solid #dc2626;
}

.dashboard-stat-value {
    display: block;
    color: #102a43;
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
}

.dashboard-stat-label {
    display: block;
    color: #52606d;
    font-size: 13px;
    font-weight: 700;
    margin-top: 8px;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.3fr);
    gap: 16px;
    align-items: start;
}

.dashboard-action-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

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

.dashboard-project-row {
    display: grid;
    grid-template-columns: minmax(160px, 1.5fr) repeat(5, minmax(90px, 1fr));
    gap: 10px;
    align-items: center;
    padding: 12px;
    border: 1px solid #eef2f6;
    border-radius: 8px;
    color: #334e68;
    text-decoration: none;
}

.dashboard-project-row:hover {
    border-color: #0b69a3;
    background: #f8fafc;
}

.dashboard-project-row strong {
    color: #102a43;
}

.dashboard-risk-warning {
    color: #92400e;
    font-weight: 700;
}

.dashboard-risk-danger {
    color: #991b1b;
    font-weight: 700;
}

.profile-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr);
    gap: 16px;
    align-items: start;
}

.profile-layout > .card:only-child {
    grid-column: 1 / -1;
}

.profile-summary-grid,
.profile-detail-list,
.profile-project-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.profile-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-summary-item,
.profile-detail-list div,
.profile-project-list a {
    min-width: 0;
    padding: 10px;
    border: 1px solid #eef2f6;
    border-radius: 8px;
    background: #f8fafc;
}

.profile-summary-item span,
.profile-detail-list span {
    display: block;
    color: #52606d;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-summary-item strong,
.profile-detail-list strong {
    color: #102a43;
    overflow-wrap: anywhere;
}

.profile-project-list a {
    color: #102a43;
    font-weight: 700;
    text-decoration: none;
}

.profile-project-list a:hover {
    border-color: #0b69a3;
}

.user-summary-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.material-plan-list {
    display: grid;
    gap: 12px;
}

.material-plan-row {
    border: 1px solid #eef2f6;
    border-radius: 10px;
    border-left: 4px solid #d9e2ec;
    padding: 12px;
}

.material-plan-row-near-limit {
    border-color: #f59e0b;
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.material-plan-row-overused {
    border-color: #dc2626;
    border-left-color: #dc2626;
    background: #fef2f2;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.12);
}

.material-plan-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: space-between;
}

.material-plan-title {
    display: grid;
    gap: 3px;
}

.material-plan-comparison {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.comparison-metric {
    background: #f8fafc;
    border: 1px solid #eef2f6;
    border-radius: 8px;
    padding: 10px;
    min-width: 0;
}

.metric-label {
    display: block;
    color: #52606d;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
}

.metric-value {
    color: #102a43;
    font-size: 14px;
}

.material-plan-row-overused .metric-value {
    color: #7f1d1d;
}

.plan-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

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

.plan-status-near-limit {
    background: #fef3c7;
    color: #92400e;
}

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

.over-plan-warning {
    background: #fffbeb;
    border: 1px solid #f59e0b;
    border-radius: 10px;
    color: #78350f;
    margin-top: 16px;
    padding: 14px;
}

.over-plan-warning-top {
    background: #fef2f2;
    border-color: #dc2626;
    color: #7f1d1d;
    margin: 18px 0;
    padding: 18px;
}

.over-plan-warning-top h2 {
    font-size: 24px;
    margin: 0 0 8px;
}

.over-plan-warning-top .btn {
    margin-top: 8px;
}

.over-plan-warning h3 {
    margin: 0 0 8px;
}

.over-plan-warning p {
    margin: 0 0 12px;
}

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

.over-plan-item {
    background: #ffffff;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 10px;
}

.order-selected-summary {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    margin-top: 14px;
    padding: 8px 12px;
    border: 1px solid #d9e2ec;
    border-radius: 999px;
    background: #f8fafc;
    color: #334e68;
    font-size: 14px;
    font-weight: 700;
}

.material-plan-edit {
    margin-top: 10px;
}

.material-plan-edit summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #e4e7eb;
    color: #334e68;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

.material-plan-edit summary:hover {
    background: #cbd2d9;
}

.material-plan-edit form {
    margin-top: 12px;
}

.material-plan-edit .form-row,
.material-plan-add .form-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.material-plan-edit .form-row .form-group,
.material-plan-add .form-row .form-group {
    min-width: 0;
}

.material-plan-edit input,
.material-plan-edit select,
.material-plan-add input,
.material-plan-add select {
    height: 42px;
    width: 100%;
    max-width: none;
}

.material-plan-edit .form-actions .btn {
    height: 40px;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
    width: 96px;
}

.material-plan-add {
    margin-top: 16px;
}

.material-plan-add summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    padding: 10px 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #e4e7eb;
    color: #334e68;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    list-style: none;
    cursor: pointer;
}

.material-plan-add summary:hover {
    background: #cbd2d9;
}

.material-plan-add summary::-webkit-details-marker,
.material-plan-edit summary::-webkit-details-marker {
    display: none;
}

.project-edit-panel summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    padding: 10px 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #e4e7eb;
    color: #334e68;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    list-style: none;
    cursor: pointer;
}

.project-edit-panel summary:hover {
    background: #cbd2d9;
}

.project-edit-panel summary::-webkit-details-marker {
    display: none;
}

.project-edit-panel form {
    margin-top: 16px;
}

.request-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.request-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #ffffff;
    border: 1px solid #d9e2ec;
    border-radius: 10px;
    padding: 14px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(16, 42, 67, 0.05);
}

.request-card input[type="checkbox"] {
    transform: scale(1.4);
    margin-top: 4px;
}

.request-content {
    flex: 1;
}

.request-title {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 6px;
    color: #102a43;
}

.request-meta {
    font-size: 14px;
    color: #52606d;
    margin-bottom: 3px;
}

.request-card:has(input:checked) {
    border-color: #0b69a3;
    background: #eef8ff;
}

.card-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #ffffff;
    border: 1px solid #d9e2ec;
    border-radius: 10px;
    padding: 14px;
    cursor: pointer;
    /* box-shadow: 0 1px 2px rgba(16, 42, 67, 0.05); */
    transition: box-shadow 0.15s ease, transform 0.1s ease;
}

.card-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.card-item input[type="checkbox"] {
    transform: scale(1.4);
    margin-top: 4px;
    width: auto;
}

.card-content {
    flex: 1;
}

.card-title {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 6px;
    color: #102a43;
}

.card-meta {
    font-size: 14px;
    color: #52606d;
    margin-bottom: 3px;
}

.workflow-cue {
    color: #334e68;
    font-size: 13px;
    font-weight: 700;
    margin: 2px 0 8px;
}

.activity-timeline {
    display: grid;
    gap: 0;
}

.activity-item {
    display: grid;
    grid-template-columns: 14px 1fr;
    gap: 10px;
    padding: 0 0 14px;
    position: relative;
}

.activity-item:not(:last-child)::before {
    content: "";
    position: absolute;
    top: 14px;
    bottom: 0;
    left: 6px;
    border-left: 1px solid #d9e2ec;
}

.activity-dot {
    width: 13px;
    height: 13px;
    border-radius: 999px;
    background: #0b69a3;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 2px #dbeafe;
    margin-top: 2px;
    z-index: 1;
}

.activity-message {
    color: #102a43;
    font-size: 14px;
    font-weight: 700;
}

.activity-meta {
    color: #7b8794;
    font-size: 13px;
    margin-top: 3px;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #eef2f6;
}

.order-overview-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.order-overview-item {
    min-width: 0;
    padding: 12px;
    border: 1px solid #eef2f6;
    border-radius: 8px;
    background: #f8fafc;
}

.overview-label {
    display: block;
    color: #52606d;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 5px;
}

.overview-value {
    display: block;
    color: #102a43;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.overview-action {
    display: inline-block;
    color: #0b69a3;
    font-size: 13px;
    font-weight: 700;
    margin-top: 6px;
    text-decoration: none;
}

.overview-action:hover {
    text-decoration: underline;
}

.order-detail-form,
.order-notes,
.order-delivery-action {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #eef2f6;
}

.order-delivery-action form {
    margin: 0;
}

.card-item:has(input:checked) {
    border-color: #0b69a3;
    background: #eef8ff;
}

.main-nav {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: center;
}

.logout-form {
    margin-left: auto;
}

.card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    background: #e5e7eb;
    color: #374151;
}

.status-pending,
.status-created {
    background: #e5e7eb;
    color: #374151;
}

.status-approved {
    background: #dbeafe;
    color: #1e40af;
}

.status-ordered {
    background: #ede9fe;
    color: #5b21b6;
}

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

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

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

.form-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
}

.form-row {
    display: flex;
    gap: 10px;
}

.form-row .form-group {
    flex: 1;
}

input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #ddd;
    font-family: inherit;
    font-size: 1rem;
    box-sizing: border-box;
}

.errorlist {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    color: #991b1b;
    font-size: 13px;
    font-weight: 700;
}

.errorlist li {
    margin: 4px 0 0;
}

.errorlist.nonfield {
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px solid #fecaca;
    border-radius: 10px;
    background: #fef2f2;
}

.errorlist + input,
.errorlist + select,
.errorlist + textarea {
    border-color: #dc2626;
    background: #fffafa;
}

.form-group:has(.errorlist) input,
.form-group:has(.errorlist) select,
.form-group:has(.errorlist) textarea {
    border-color: #dc2626;
    background: #fffafa;
}

.inactive-users-toggle {
    margin-top: 20px;
}

.inactive-users-toggle summary {
    cursor: pointer;
    font-weight: 700;
    color: #374151;
    padding: 10px 0;
}

.inactive-users-list {
    margin-top: 12px;
}

.inactive-card {
    opacity: 0.72;
    background: #f8fafc;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

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

.filter-form {
    margin-bottom: 0;
}

.form-actions {
    display: flex;
    align-items: stretch;
    gap: 12px;
    flex-wrap: wrap;
}

.form-actions button[type="submit"] {
    margin-top: 0;
}

.filter-form .form-actions .btn {
    height: 40px;
    padding-top: 0;
    padding-bottom: 0;
}

.filter-form input,
.filter-form select {
    height: 42px;
}

.filter-form .form-actions button[type="submit"] {
    margin-top: 0;
}

.material-form-actions .btn {
    height: 40px;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.active-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #eef2f6;
}

.active-filters-label {
    color: #52606d;
    font-size: 14px;
    font-weight: 700;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #eef2f6;
    color: #334e68;
    font-size: 13px;
    font-weight: 600;
}

.filter-clear {
    color: #0b69a3;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.filter-clear:hover {
    text-decoration: underline;
}

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

.page-header .btn {
    flex: 0 0 auto;
}

.team-role-groups {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.assigned-team-groups {
    display: grid;
    gap: 12px;
}

.assigned-team-group h4 {
    margin: 0 0 6px;
    color: #334e68;
}

.assigned-team-group ul {
    margin: 0;
    padding-left: 20px;
}

.team-role-group summary {
    display: inline-block;
    width: auto;
    padding: 10px 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #e4e7eb;
    color: #334e68;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.team-role-group summary:hover {
    background: #cbd2d9;
}

.team-role-group summary::-webkit-details-marker {
    display: none;
}

.team-checkbox-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
    padding-left: 4px;
}

.team-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.team-checkbox input {
    width: auto;
}

@media (max-width: 530px) {
    .filter-form .form-row {
        flex-direction: column;
        gap: 0;
    }

    .filter-form .form-group {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .project-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .material-plan-summary {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .material-plan-comparison {
        grid-template-columns: 1fr;
    }

    .material-plan-edit .form-row,
    .material-plan-add .form-row {
        grid-template-columns: 1fr;
    }

    .order-overview-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .dashboard-company-card {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-company-summary div {
        flex: 1 1 140px;
    }

    .profile-layout,
    .profile-summary-grid {
        grid-template-columns: 1fr;
    }

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

    .project-list {
        grid-template-columns: 1fr;
    }

    .project-card-body {
        padding: 18px;
    }

    .page-header .btn,
    .card .btn,
    form .btn,
    .pagination .btn,
    .bulk-action-bar .btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        padding: 14px 16px;
        font-size: 16px;
    }

    .filter-form .form-actions .btn {
        height: 48px;
    }

    .page-header .btn + .btn,
    .card .btn + .btn,
    form .btn + .btn,
    .pagination .btn + .btn,
    .bulk-action-bar .btn + .btn {
        margin-top: 10px;
    }
}

@media (min-width: 768px) {
    .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: auto;
        padding: 10px 14px;
        font-size: 14px;
    }

    .btn + .btn {
        margin-top: 0;
        margin-left: 8px;
    }

    .project-layout {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 24px;
        align-items: start;
    }
}

@media (min-width: 601px) and (max-width: 900px) {
    .order-overview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* @media (max-width: 765px) {

    .card-title-row .status-badge {

        align-self: flex-start;

        margin-top: 2px;
    }

    .header-inner {
        display: block;
    }

    .brand {
        display: block;
        text-align: center;
        font-size: 1.4rem;
        margin-bottom: 12px;
    }

    .nav-toggle-label {
        display: block;
        width: 100%;
        padding: 10px 12px;
        border-radius: 10px;
        background: #f3f4f6;
        text-align: center;
        font-weight: 700;
        box-sizing: border-box;
        color: #333;
        cursor: pointer;
    }

    

    .main-nav {
        display: none;
        margin-top: 12px;
        margin-left: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .nav-toggle:checked ~ .main-nav {
        display: flex;
    }

    .main-nav a,
    .nav-close {
        display: block;
        width: 100%;
        padding: 11px 12px;
        border-radius: 10px;
        background: #f8f9fa;
        text-align: center;
        box-sizing: border-box;
    }

    .logout-form {
        width: 100%;
    }

    .nav-logout {
        display: block;
        width: 100%;
        padding: 11px 12px;
        border-radius: 10px;
        background: #dc3545;
        color: white;
        text-align: center;
        box-sizing: border-box;
    }

    .nav-close {
        display: block;
        background: #eeeeee;
        font-weight: 700;
    }
} */

@media (max-width: 900px) {
    .card-title-row {
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 8px;
    }

    .card-title-row .card-title,
    .card-title-row strong {
        width: 100%;
    }

    .card-title-row .status-badge {
        align-self: flex-start;
        margin-top: 0;
    }

    .header-inner {
        display: block;
    }

    .brand {
        display: block;
        text-align: center;
        font-size: 1.4rem;
        margin-bottom: 12px;
        color: #ffffff;
    }

    .nav-toggle-label {
        display: block;
        width: 100%;
        padding: 10px 12px;
        border-radius: 10px;
        background: #374151;
        text-align: center;
        font-weight: 700;
        box-sizing: border-box;
        color: #ffffff;
        cursor: pointer;
    }

    .main-nav {
        display: none;
        margin-top: 12px;
        margin-left: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        background: #1f2937;
        border-radius: 12px;
        padding: 10px;
        box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    }

    .nav-toggle:checked ~ .main-nav {
        display: flex;
    }

    .main-nav a {
        display: block;
        width: 100%;
        padding: 11px 12px;
        border-radius: 8px;
        background: transparent;
        color: #e5e7eb;
        text-align: center;
        box-sizing: border-box;
    }

    .main-nav a.active {
        background: #374151;
        color: #ffffff;
    }

    .main-nav a:hover {
        background: #374151;
        color: #ffffff;
    }

    .logout-form {
        width: 100%;
    }

    .nav-logout {
        display: block;
        width: 100%;
        padding: 11px 12px;
        border-radius: 8px;
        background: #dc3545;
        color: white;
        text-align: center;
        box-sizing: border-box;
        border: none;
    }

    .nav-close {
        display: block;
        width: 100%;
        padding: 11px 12px;
        border-radius: 8px;
        background: #374151;
        color: #e5e7eb;
        text-align: center;
        box-sizing: border-box;
        font-weight: 700;
        cursor: pointer;
    }
}
