:root {
    --sidebar-width: 250px;
    --sidebar-background: #17212b;
    --sidebar-hover: #243443;
    --sidebar-text: #d9e2ea;
    --sidebar-muted: #8493a1;

    --page-background: #f3f5f7;
    --panel-background: #ffffff;
    --border-color: #dfe4e8;

    --text-color: #1f2933;
    --muted-text: #667784;

    --primary-color: #2767a5;
    --primary-hover: #1f568b;

    --danger-background: #fff0f0;
    --danger-text: #a32323;

    --shadow: 0 10px 30px rgba(20, 30, 40, 0.12);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

    color: var(--text-color);
    background: var(--page-background);
}

button,
input {
    font: inherit;
}

a {
    color: inherit;
}

.app-layout {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;

    z-index: 30;

    display: flex;
    flex-direction: column;

    width: var(--sidebar-width);
    min-height: 100vh;

    background: var(--sidebar-background);
    color: var(--sidebar-text);
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    gap: 3px;

    min-height: 74px;
    padding: 18px 22px;

    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.brand-title {
    font-size: 20px;
    font-weight: 700;
}

.brand-subtitle {
    color: var(--sidebar-muted);
    font-size: 12px;
}

.sidebar-nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 4px;

    padding: 18px 12px;
}

.nav-link {
    display: block;

    padding: 12px 14px;

    color: var(--sidebar-text);
    text-decoration: none;

    border-radius: 7px;
}

.nav-link:hover,
.nav-link.active {
    background: var(--sidebar-hover);
}

.nav-link.active {
    font-weight: 600;
}

.nav-link.disabled {
    color: #657481;
    cursor: not-allowed;
}

.nav-link.disabled:hover {
    background: transparent;
}

.sidebar-footer {
    padding: 18px 22px;

    color: var(--sidebar-muted);
    font-size: 13px;
    line-height: 1.5;

    border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.sidebar-footer strong {
    color: var(--sidebar-text);
}

.page-area {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;

    display: flex;
    align-items: center;

    min-height: 74px;
    padding: 0 28px;

    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
}

.topbar-title {
    font-size: 18px;
    font-weight: 600;
}

.account-area {
    position: relative;
    margin-left: auto;
}

.login-button,
.account-button {
    padding: 10px 15px;

    color: var(--text-color);
    background: #ffffff;

    border: 1px solid var(--border-color);
    border-radius: 7px;

    cursor: pointer;
}

.login-button:hover,
.account-button:hover {
    background: #f6f8fa;
}

.dropdown-arrow {
    margin-left: 6px;
}

.login-dropdown,
.account-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;

    z-index: 50;

    display: none;

    width: 310px;
    padding: 20px;

    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    box-shadow: var(--shadow);
}

.account-dropdown {
    width: 230px;
    padding: 8px;
}

.login-dropdown.open,
.account-dropdown.open {
    display: block;
}

.login-dropdown h2 {
    margin: 0 0 18px;
    font-size: 20px;
}

.login-dropdown form {
    display: flex;
    flex-direction: column;
}

.login-dropdown label {
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
}

.login-dropdown input {
    width: 100%;
    margin-bottom: 15px;
    padding: 10px 11px;

    border: 1px solid #cbd4dc;
    border-radius: 6px;
}

.login-dropdown input:focus {
    outline: 2px solid rgba(39, 103, 165, 0.2);
    border-color: var(--primary-color);
}

.submit-button,
.primary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 11px 18px;

    color: #ffffff;
    background: var(--primary-color);

    border: 0;
    border-radius: 7px;

    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.submit-button:hover,
.primary-action:hover {
    background: var(--primary-hover);
}

.form-error {
    margin-bottom: 14px;
    padding: 10px 12px;

    color: var(--danger-text);
    background: var(--danger-background);

    border-radius: 6px;
    font-size: 13px;
}

.account-summary {
    display: flex;
    flex-direction: column;
    gap: 3px;

    padding: 10px;
    margin-bottom: 5px;

    border-bottom: 1px solid var(--border-color);
}

.account-summary span {
    color: var(--muted-text);
    font-size: 12px;
}

.dropdown-link {
    display: block;

    padding: 10px;

    text-decoration: none;
    border-radius: 5px;
}

.dropdown-link:hover {
    background: #f1f4f6;
}

.content {
    padding: 30px;
}

.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;

    margin-bottom: 26px;
}

.page-heading h1 {
    margin: 0 0 5px;
    font-size: 30px;
}

.page-heading p {
    margin: 0;
    color: var(--muted-text);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;

    margin-bottom: 24px;
}

.dashboard-card,
.content-panel,
.welcome-panel {
    background: var(--panel-background);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.dashboard-card {
    display: flex;
    flex-direction: column;
    gap: 10px;

    padding: 22px;
}

.card-label {
    color: var(--muted-text);
    font-size: 14px;
    font-weight: 600;
}

.card-value {
    font-size: 34px;
}

.card-note {
    color: var(--muted-text);
    font-size: 13px;
}

.content-panel {
    overflow: hidden;
}

.panel-heading {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
}

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

.empty-state {
    padding: 50px 22px;
    color: var(--muted-text);
    text-align: center;
}

.welcome-panel {
    display: flex;
    align-items: center;

    min-height: calc(100vh - 135px);
    padding: 60px;
}

.welcome-content {
    max-width: 720px;
}

.welcome-label {
    display: inline-block;

    margin-bottom: 14px;

    color: var(--primary-color);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.welcome-content h1 {
    max-width: 680px;
    margin: 0 0 20px;

    font-size: clamp(36px, 5vw, 58px);
    line-height: 1.08;
}

.welcome-content p {
    max-width: 600px;
    margin: 0 0 28px;

    color: var(--muted-text);
    font-size: 18px;
    line-height: 1.6;
}

.mobile-menu-button {
    display: none;

    margin-right: 14px;
    padding: 8px 10px;

    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .page-area {
        margin-left: 0;
    }

    .mobile-menu-button {
        display: inline-block;
    }

    .topbar {
        padding: 0 16px;
    }

    .content {
        padding: 18px;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .welcome-panel {
        min-height: calc(100vh - 110px);
        padding: 30px;
    }

    .login-dropdown {
        position: fixed;
        top: 84px;
        right: 16px;
        left: 16px;

        width: auto;
    }

}

.panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;

    padding: 18px 22px;

    border-bottom: 1px solid var(--border-color);
}

.customer-filters {
    display: flex;
    align-items: center;
    gap: 10px;

    width: 100%;
}

.search-field {
    flex: 1;
    max-width: 420px;
}

.search-field input,
.status-filter select {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;

    color: var(--text-color);
    background: #ffffff;

    border: 1px solid #cbd4dc;
    border-radius: 6px;
}

.search-field input:focus,
.status-filter select:focus {
    outline: 2px solid rgba(39, 103, 165, 0.2);
    border-color: var(--primary-color);
}

.secondary-button {
    min-height: 42px;
    padding: 9px 16px;

    color: var(--text-color);
    background: #ffffff;

    border: 1px solid #cbd4dc;
    border-radius: 6px;

    font-weight: 600;
    cursor: pointer;
}

.secondary-button:hover {
    background: #f3f6f8;
}

.text-button {
    padding: 9px 6px;

    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}

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

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

.data-table th,
.data-table td {
    padding: 14px 16px;

    text-align: left;
    vertical-align: middle;

    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    color: var(--muted-text);
    background: #f8fafb;

    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.data-table tbody tr:hover {
    background: #fafcfd;
}

.data-table a {
    color: var(--primary-color);
    text-decoration: none;
}

.data-table a:hover {
    text-decoration: underline;
}

.actions-column {
    width: 180px;
}

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

.table-action {
    display: inline-block;
    margin-right: 10px;

    font-size: 13px;
    font-weight: 600;
}

.danger-action {
    color: #ad2929 !important;
}

.status-badge {
    display: inline-flex;
    align-items: center;

    padding: 4px 9px;

    border-radius: 999px;

    font-size: 12px;
    font-weight: 700;
}

.status-active {
    color: #17663a;
    background: #e8f6ee;
}

.status-inactive {
    color: #6d7880;
    background: #edf0f2;
}

.panel-footer {
    padding: 14px 22px;

    color: var(--muted-text);
    background: #fafbfc;

    border-top: 1px solid var(--border-color);

    font-size: 13px;
}

.empty-state strong {
    display: block;
    margin-bottom: 8px;

    color: var(--text-color);
    font-size: 17px;
}

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

.sr-only {
    position: absolute;

    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;

    overflow: hidden;
    clip: rect(0, 0, 0, 0);

    white-space: nowrap;
    border: 0;
}

@media (max-width: 800px) {
    .customer-filters {
        align-items: stretch;
        flex-direction: column;
    }

    .search-field {
        max-width: none;
    }

    .status-filter,
    .secondary-button,
    .text-button {
        width: 100%;
    }

    .text-button {
        text-align: center;
    }
}

.customer-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.form-panel {
    overflow: hidden;

    background: var(--panel-background);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.form-panel-heading {
    padding: 20px 22px;

    background: #f8fafb;
    border-bottom: 1px solid var(--border-color);
}

.form-panel-heading h2 {
    margin: 0 0 5px;
    font-size: 18px;
}

.form-panel-heading p {
    margin: 0;
    color: var(--muted-text);
    font-size: 13px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;

    padding: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-group-wide {
    grid-column: 1 / -1;
}

.form-group label {
    color: var(--text-color);
    font-size: 13px;
    font-weight: 700;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 11px;

    color: var(--text-color);
    background: #ffffff;

    border: 1px solid #cbd4dc;
    border-radius: 6px;
}

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

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: 2px solid rgba(39, 103, 165, 0.2);
    border-color: var(--primary-color);
}

.required-mark {
    color: #b42323;
}

.field-error {
    color: #b42323;
    font-size: 12px;
    font-weight: 600;
}

.checkbox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    cursor: pointer;
}

.checkbox-label input {
    width: auto;
    margin: 0;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;

    padding-bottom: 30px;
}

.secondary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 10px 17px;

    color: var(--text-color);
    background: #ffffff;

    border: 1px solid #cbd4dc;
    border-radius: 7px;

    font-weight: 600;
    text-decoration: none;
}

.secondary-action:hover {
    background: #f3f6f8;
}

@media (max-width: 700px) {
    .form-grid {
        grid-template-columns: 1fr;
        padding: 18px;
    }

    .form-group-wide {
        grid-column: auto;
    }

    .checkbox-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .primary-action,
    .form-actions .secondary-action {
        width: 100%;
    }
}

.success-message {
    margin-bottom: 20px;
    padding: 13px 16px;

    color: #17663a;
    background: #e8f6ee;

    border: 1px solid #b8dfc8;
    border-radius: 7px;

    font-weight: 600;
}

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

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;

    padding: 24px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.detail-item-wide {
    grid-column: 1 / -1;
}

.detail-label {
    color: var(--muted-text);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.detail-value {
    font-size: 15px;
    line-height: 1.55;
}

.detail-value a {
    color: var(--primary-color);
    text-decoration: none;
}

.detail-value a:hover {
    text-decoration: underline;
}

.detail-notes {
    white-space: normal;
}

.confirmation-panel {
    max-width: 700px;
    padding: 28px;

    background: var(--panel-background);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.confirmation-panel h2 {
    margin: 0 0 12px;
}

.confirmation-panel p {
    margin: 0 0 24px;
    color: var(--muted-text);
    line-height: 1.6;
}

.confirmation-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 10px 17px;

    color: #ffffff;
    background: #b42323;

    border: 0;
    border-radius: 7px;

    font-weight: 600;
    cursor: pointer;
}

.danger-button:hover {
    background: #921d1d;
}

@media (max-width: 700px) {
    .heading-actions {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
    }

    .heading-actions a {
        width: 100%;
    }

    .detail-grid {
        grid-template-columns: 1fr;
        padding: 18px;
    }

    .detail-item-wide {
        grid-column: auto;
    }

    .confirmation-actions {
        flex-direction: column-reverse;
    }

    .confirmation-actions a,
    .confirmation-actions button {
        width: 100%;
    }
}

.dashboard-card-link {
    color: inherit;
    text-decoration: none;
}

.dashboard-card-link:hover {
    border-color: #b9c8d5;
    box-shadow: 0 8px 20px rgba(20, 30, 40, 0.08);
    transform: translateY(-1px);
}

.work-order-status-open {
    color: #17663a;
    background: #e8f6ee;
}

.work-order-status-final {
    color: #7a5600;
    background: #fff4cc;
}

.work-order-status-invoiced {
    color: #275b8c;
    background: #e7f1fa;
}

.page-error {
    margin-bottom: 20px;
}

.section-heading-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.section-heading-actions p {
    margin: 5px 0 0;
}

.compact-action {
    flex-shrink: 0;
    padding: 9px 14px;
    font-size: 13px;
}

.data-table tfoot td {
    background: #f8fafb;
    border-top: 2px solid var(--border-color);
}

.work-order-total-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 22px 26px;

    background: var(--sidebar-background);
    color: #ffffff;

    border-radius: 10px;
}

.work-order-total-panel span {
    font-size: 16px;
    font-weight: 600;
}

.work-order-total-panel strong {
    font-size: 28px;
}

@media (max-width: 700px) {
    .section-heading-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .section-heading-actions .primary-action {
        width: 100%;
    }
}

.editable-table-wrapper {
    padding-bottom: 4px;
}

.editable-entry-table {
    min-width: 1200px;
}

.editable-entry-table input,
.editable-entry-table select {
    width: 100%;
    min-width: 90px;
    padding: 8px 9px;

    color: var(--text-color);
    background: #ffffff;

    border: 1px solid #cbd4dc;
    border-radius: 5px;
}

.editable-entry-table input:focus,
.editable-entry-table select:focus {
    outline: 2px solid rgba(39, 103, 165, 0.2);
    border-color: var(--primary-color);
}

.editable-entry-table td {
    padding: 8px;
    vertical-align: top;
}

.remove-row-button {
    padding: 8px 10px;

    color: #a32323;
    background: #ffffff;

    border: 1px solid #d7aaaa;
    border-radius: 5px;

    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.remove-row-button:hover {
    color: #ffffff;
    background: #a32323;
}

.editable-entry-table {
    width: 100%;
    min-width: 1100px;
    border-collapse: collapse;
}

.editable-entry-table th,
.editable-entry-table td {
    padding: 4px;
    border: 1px solid #b9c1c8;
}

.editable-entry-table th {
    padding: 8px 6px;
    background: #f3f5f7;
    font-size: 12px;
    white-space: nowrap;
}

.editable-entry-table input,
.editable-entry-table select {
    width: 100%;
    height: 42px;
    min-width: 0;
    padding: 7px 9px;
    background: #ffffff;
    border: 1px solid #aeb7bf;
    border-radius: 0;
}

.editable-entry-table input[type="date"] {
    min-width: 165px;
}

.editable-entry-table input[type="time"] {
    min-width: 135px;
}

.editable-entry-table td:nth-child(4) {
    min-width: 180px;
}

.editable-entry-table td:nth-child(5) {
    min-width: 280px;
}

.editable-entry-table td:nth-child(6),
.editable-entry-table td:nth-child(7),
.editable-entry-table td:nth-child(8) {
    width: 100px;
}

.editable-entry-table td:last-child {
    width: 48px;
}

.remove-row-button {
    width: 38px;
    height: 42px;
    padding: 0;
    color: #a32323;
    background: #ffffff;
    border: 1px solid #c5a2a2;
    border-radius: 0;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
}
