:root {
    --app-font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

html {
    font-family: var(--app-font);
}

body,
button,
input,
select,
textarea,
table {
    font-family: var(--app-font);
}

body {
    background-color: #f4f4f4;
}

.content {
    margin-left: 220px;
    padding: 20px;
}

.title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin: 2px 0 12px;
}

.title h1 {
    margin: 0;
    font-size: 18px;
    line-height: 1.25;
}

.title .action-btn {
    padding: 7px 14px;
    font-size: 14px;
}

.thin-line {
        border: none;
        height: 1px;
        background-color: #afcfd0; /* оригінальний бірюзовий + 50% білого */
        width: 100%; /* можна змінити ширину */
        margin: 10px 0; /* Відступи зверху та знизу */
}
/* Оформлення таблиці */
.styled-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: #fff;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    overflow: hidden;
}

/* Оформлення заголовків */
.styled-table th {
    background-color: #afcfd0;
    color: #254f51;
    text-align: left;
    padding: 12px;
}

/* Оформлення рядків */
.styled-table td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

/* Наведення */
.styled-table tr:hover {
    background-color: #f5f5f5;
}

.styled-table .clickable-row {
    cursor: pointer;
}

.styled-table .clickable-row:focus {
    outline: 2px solid #a3c1da;
    outline-offset: -2px;
}

/* Стилі для кнопок */
.btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    margin-right: 5px;
}

/* Кнопка "Update" */
.update-btn {
    background-color: #a3c1da;
    color: #29485f;
}

.update-btn:hover {
    background-color: #80c0c0;
}

/* Кнопка "Delete" */
.delete-btn {
    background-color: #a3c1da;
    color: #29485f;
}

.delete-btn:hover {
    background-color: #a71d2a;
}

.action-btn{
    display:inline-block;
    padding:10px 20px;
    background:#a7c4e3;
    color:#29485f;
    text-decoration:none;
    border-radius:4px;
    border:none;
    cursor:pointer;
    font-weight:700;
}

.button-panel{
    display:flex;
    gap:10px;
    margin-bottom:20px;
}

.form-container {
    width: 100%;
    max-width: none;
    margin: 0;
    box-sizing: border-box;
    background: white;
    padding: 14px 16px;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

label {
    font-weight: bold;
    display: block;
    margin-top: 6px;
    font-size: 14px;
}

.task-filter {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 280px));
    gap: 16px;
    align-items: end;
    margin-top: 16px;
    padding: 10px 12px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, .08);
}

.task-filter label {
    margin: 0;
}

.task-filter .input-field {
    width: 100%;
    box-sizing: border-box;
}

.empty-row {
    text-align: center;
    color: #607078;
}

.pagination { display:flex; align-items:center; justify-content:center; gap:12px; margin-top:14px; color:var(--muted); font-size:13px; }
.pagination button { padding:6px 11px; border:1px solid var(--border); border-radius:5px; background:#fff; color:var(--primary); font:inherit; cursor:pointer; }
.pagination button:disabled { color:#a3adb3; background:#f5f6f7; cursor:default; }

.settings-container {
    width: 100%;
    box-sizing: border-box;
    padding: 14px 16px 18px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, .1);
}

.settings-title {
    margin: 2px 0 12px;
    font-size: 18px;
    line-height: 1.25;
}

.settings-section {
    margin-top: 20px;
    padding: 14px 16px 16px;
    border: 1px solid #b8dddd;
    border-radius: 6px;
}

.settings-section h2 {
    margin: 0 0 12px;
    font-size: 18px;
    line-height: 1.25;
}

.settings-container .button-panel {
    margin-bottom: 12px;
}

.settings-container .styled-table {
    margin-top: 12px;
    box-shadow: none;
    border: 1px solid #dce8e8;
}

.settings-container .styled-table th {
    background-color: #f1f3f4;
    color: #33484a;
}

.settings-container .form-container {
    box-shadow: none;
    border: 1px solid #dce8e8;
}

.bank-account-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(280px, 2fr) auto auto auto;
    gap: 10px;
    align-items: end;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    margin: 0;
}

.checkbox-cell {
    text-align: center;
}

.input-field {
    width: 100%;
    padding: 5px 7px;
    margin-top: 3px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    font-family: var(--app-font);
    font-weight: 400;
    line-height: 1.25;
    box-sizing: border-box;
}

textarea.input-field {
    height: 60px;
    resize: vertical;
}

/* Sidebar */
.sidebar {
    position: fixed;      /* завжди збоку */
    top: 0;
    left: 0;
    width: 200px;         /* ширина меню */
    height: 100%;         /* на всю висоту */
    background-color: #afcfd0;
    padding-top: 18px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.sidebar a {
    display: block;       /* посилання блоком */
    color: #254f51;
    text-decoration: none;
    padding: 7px 20px;
    border-radius: 0;
    margin: 0;
    transition: background-color 0.3s;
    text-align: left;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
}

.sidebar a:hover {
    background-color: #a3c1da;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sidebar-user {
    margin-top: auto;
    padding: 14px 20px 18px;
    color: #254f51;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.sidebar-user form {
    margin-top: 7px;
}

.sidebar-user button {
    padding: 0;
    border: 0;
    background: transparent;
    color: #29485f;
    font-weight: 700;
    cursor: pointer;
}

.login-page {
    display: grid;
    min-height: 100vh;
    margin: 0;
    place-items: center;
    background: #eef6f6;
}

.login-card {
    width: min(380px, calc(100% - 40px));
    box-sizing: border-box;
    padding: 28px;
    background: white;
    border: 1px solid #afcfd0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .1);
}

.login-card h1 {
    margin: 0 0 8px;
    font-size: 22px;
}

.login-card p {
    color: #607078;
}

.login-card > p {
    margin: 8px 0 18px;
    line-height: 1.45;
}

.login-card label {
    margin-top: 16px;
}

.login-card .input-field {
    margin-top: 7px;
}

.login-card .login-hint {
    margin: 7px 0 0;
    color: #78858d;
    font-size: 12px;
    line-height: 1.4;
}

.login-card .login-message {
    margin: 12px 0;
    padding: 10px 12px;
    border-radius: 5px;
    background: #e7f3ea;
    color: #356645;
}

.login-card .action-btn {
    margin-top: 16px;
}

.login-recovery-link {
    display: inline-block;
    margin-top: 14px;
    color: #426b88;
    font-size: 14px;
    text-decoration: none;
}

.login-recovery-link:hover {
    text-decoration: underline;
}

.menu-group {
    margin: 0;
    padding: 0;
}

.menu-group-title {
    padding: 0 20px 5px;
    color: rgba(37, 79, 81, .72);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
}

/* Контент з відступом справа від меню */
.content {
    margin-left: 200px;
    padding: 20px;
    width: calc(100% - 200px);
    box-sizing: border-box;
}

.content .form-container {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.form-actions {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 5px;
}

.form-command-bar {
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.form-command-bar .btn,
.form-command-bar .action-btn {
    margin: 0;
    padding: 7px 14px;
    box-sizing: border-box;
    font-size: 14px;
    line-height: 1.35;
}

.form-message {
    margin: 0 0 10px;
    padding: 9px 12px;
    border-radius: 6px;
    font-size: 14px;
}

.form-message-error {
    border: 1px solid #e9caca;
    background: #fbefef;
    color: #874141;
}

.saved-indicator {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 5px;
    background: #f0f4f5;
    color: #526771;
    font-size: 13px;
    font-weight: 400;
}

/* Позиції та підсумок рахунка */
.invoice-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 6px 0 10px;
}

.invoice-summary {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin: 0;
}

.invoice-heading h1 {
    margin: 0;
    font-size: 18px;
    line-height: 1.25;
}

.invoice-total {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    padding: 4px 8px;
    border: 0;
    border-radius: 5px;
    background: #f1f2f2;
    color: #65727a;
    font-size: 12px;
}

.invoice-total strong {
    color: #2e3d45;
    font-size: 13px;
    font-weight: 600;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
    gap: 10px;
}

.summary-card {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    padding: 4px 8px;
    border: 0;
    border-radius: 5px;
    background: #f1f2f2;
    color: #65727a;
    font-size: 12px;
}

.summary-card strong {
    color: #2e3d45;
    font-size: 13px;
    font-weight: 600;
}

.summary-card-compact {
    min-width: 0;
    padding: 3px 7px;
}

.summary-card-field {
    min-width: 0;
    min-height: 30px;
}

.section-summary-heading {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.section-summary-heading h2 {
    margin: 0;
}

.summary-card-under-heading {
    width: fit-content;
    margin: 0 0 12px;
}

.invoice-balance {
    display: grid;
    grid-template-columns: repeat(2, auto);
    gap: 6px;
    margin: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.invoice-balance > div {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 5px;
    background: #f1f2f2;
    color: #65727a;
    font-size: 12px;
}

.invoice-balance strong {
    color: #2e3d45;
    font-size: 13px;
    font-weight: 600;
}

.invoice-print-link {
    margin-left: 0;
}

.invoice-first-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.invoice-first-row label,
.invoice-first-row .input-field {
    min-width: 0;
}

.invoice-first-row .input-field {
    width: 100%;
    box-sizing: border-box;
}

.invoice-second-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    width: 100%;
}

.invoice-details-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.invoice-second-row label,
.invoice-details-left .input-field {
    width: 100%;
}

.invoice-comment {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.invoice-comment textarea {
    flex: 1;
    min-height: 160px;
    resize: vertical;
}

.shipment-fields-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.shipment-main-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.contract-fields-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(180px, 1fr);
    gap: 10px;
}

.contract-fields-row label,
.contract-fields-row .input-field {
    min-width: 0;
}

.contract-text {
    height: 900px !important;
    min-height: 700px !important;
    resize: vertical;
    line-height: 1.5;
}

.contract-template-menu {
    position: relative;
    width: max-content;
    margin: 8px 0 10px;
}

.contract-template-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.contract-template-options {
    position: absolute;
    z-index: 20;
    top: calc(100% + 5px);
    left: 0;
    min-width: 100%;
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(35, 54, 62, .14);
}

.contract-template-options button {
    display: block;
    width: 100%;
    padding: 8px 11px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.contract-template-options button:hover,
.contract-template-options button:focus {
    outline: none;
    background: var(--nav-active);
}

.customer-contacts {
    margin-top: 20px;
}

.contact-list-row {
    display: grid;
    grid-template-columns: minmax(110px, .8fr) minmax(100px, .8fr) minmax(120px, .8fr) minmax(180px, 1.2fr) 100px 130px 140px;
    gap: 14px;
    align-items: center;
}

.contact-edit-row {
    align-items: end;
}

.contact-edit-row label {
    margin: 0;
}

.contact-list-row .action-btn {
    justify-self: end;
}

.contact-list-row .contact-field[readonly] {
    padding-left: 0;
    padding-right: 0;
    border-color: transparent;
    background: transparent;
    color: var(--text);
    font-weight: 600;
}

.contact-list-row.is-editing .contact-field {
    padding-left: 8px;
    padding-right: 8px;
    border-color: #c9d1d5;
    background: #fff;
}

.shipment-fields-row label,
.shipment-fields-row .input-field {
    min-width: 0;
}

.shipment-fields-row .input-field {
    width: 100%;
    box-sizing: border-box;
}

.shipment-line-header,
.shipment-line-row {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(120px, 180px) 34px;
    gap: 8px;
    align-items: center;
}

.shipment-line-header {
    margin-bottom: 4px;
    font-weight: 700;
}

.shipment-line-row {
    margin-bottom: 8px;
}

.task-fields-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.task-fields-row label,
.task-fields-row .input-field {
    min-width: 0;
}

.task-fields-row .input-field {
    width: 100%;
    box-sizing: border-box;
}

.task-time-section {
    margin-top: 24px;
}

.task-attachments-section {
    margin-top: 24px;
}

.attachment-hint,
.attachment-status {
    color: #607078;
    font-size: 13px;
    margin: 7px 0 0;
}

.attachment-status.error {
    color: #b42318;
}

.attachment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.attachment-card {
    background: white;
    border-radius: 6px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, .12);
    padding: 8px;
}

.attachment-card img {
    display: block;
    width: 100%;
    height: 130px;
    object-fit: cover;
    border-radius: 4px;
}

.attachment-card form {
    margin-top: 8px;
}

.back-link {
    display: inline-block;
    color: #6d8495;
    font-size: 14px;
    font-weight: 400;
    line-height: 1;
    text-decoration: none;
    margin: 2px 0 8px;
}

.back-link:hover {
    color: #408080;
    text-decoration: underline;
}

.back-link-bottom {
    margin-top: 20px;
    margin-bottom: 4px;
}

.time-entry-row {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(110px, 1fr) minmax(260px, 3fr) auto;
    gap: 10px;
    align-items: end;
}

.report-filter {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
    padding: 16px;
    background: #fff;
    border: 1px solid #dce5e8;
    border-radius: 8px;
}

.report-client {
    margin-bottom: 18px;
    padding: 16px;
    background: #fff;
    border: 1px solid #dce5e8;
    border-radius: 8px;
}

.report-client-heading {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
}

.report-client-heading h2 {
    margin: 0;
    font-size: 17px;
}

.report-hours {
    width: 170px;
    text-align: right;
}

.report-empty {
    padding: 28px;
    text-align: center;
    color: #6d7d87;
    background: #fff;
    border: 1px solid #dce5e8;
    border-radius: 8px;
}

/* Спрощена візуальна ієрархія форми рахунку */
.invoice-form-card {
    padding: 18px 20px 20px;
    border: 0;
    box-shadow: 0 2px 8px rgba(31, 43, 51, .06);
}

.invoice-form-card .form-command-bar {
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.invoice-form-card .invoice-primary-action {
    padding: 8px 18px;
    background: var(--button-bg);
    color: var(--button-text);
    font-weight: 700;
}

.invoice-form-card .invoice-secondary-action {
    padding: 7px 13px;
    background: #fff;
    color: #426b88;
    border: 1px solid #b9cbd6;
    font-size: 13px;
    font-weight: 600;
}

.invoice-form-card .invoice-secondary-action:hover {
    background: #f1f6f8;
    color: #315b78;
    border-color: #8eacbe;
}

.invoice-form-card label {
    color: #34444e;
    font-size: 13px;
    font-weight: 600;
}

.invoice-items {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.invoice-items-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
}

.invoice-items-heading h2 {
    margin: 0;
    color: #263741;
    font-size: 16px;
    line-height: 1.3;
}

.invoice-add-line {
    display: block;
    padding: 5px 8px;
    margin: 2px 0 6px;
    background: transparent;
    color: #426f8e;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.invoice-add-line:hover {
    background: #eef5f7;
}

.invoice-items .line-header {
    color: #6b7881;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.invoice-items .line-row {
    padding: 8px 0;
    margin: 0;
    border-top: 1px solid #edf0f2;
}

.invoice-items .line-row .remove {
    align-self: center;
    width: 26px;
    height: 26px;
    padding: 0;
    background: transparent;
    color: #8b6262;
    border: 0;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
}

.invoice-items .line-row .remove:hover {
    background: #faeeee;
    color: #a43b3b;
}

.payment-fields-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 12px;
}

.payment-header-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.payment-header-row label,
.payment-header-row .input-field { min-width: 0; }

.payment-line-header,
.payment-line-row {
    grid-template-columns: minmax(260px, 1fr) minmax(140px, 220px) 34px;
}

.invoice-list-card {
    padding: 4px 0 0;
    background: #fff;
    border: 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(31, 43, 51, .06);
    overflow: hidden;
}

.invoice-list-card .styled-table {
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.invoice-list-card .styled-table th {
    color: #6b7881;
    background: #f7f8f9;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.invoice-list-card .styled-table td {
    padding-top: 13px;
    padding-bottom: 13px;
}

.progress-value {
    display: inline-block;
    min-width: 58px;
    padding: 4px 8px;
    color: #315f65;
    background: #eaf4f3;
    border-radius: 999px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
}

.invoice-form-card fieldset {
    margin-top: 16px;
    padding: 14px 0 0;
    border: 0;
    border-top: 1px solid var(--border);
}

.invoice-form-card fieldset legend {
    padding: 0;
    color: #263741;
    font-size: 16px;
    font-weight: 700;
}

@media (max-width: 650px) {
    .payment-fields-row {
        grid-template-columns: 1fr;
    }

    .payment-line-header {
        display: none;
    }

    .payment-line-row {
        grid-template-columns: 1fr 1fr 30px;
    }
}

@media (max-width: 850px) {
    .report-filter {
        grid-template-columns: repeat(2, minmax(150px, 1fr));
    }
}

@media (max-width: 520px) {
    .report-filter {
        grid-template-columns: 1fr;
    }
}

.field-hint {
    display: block;
    margin-top: 6px;
    color: #687983;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
}

.annual-limit-card {
    box-sizing: border-box;
    min-width: 280px;
    padding: 5px 8px;
    border: 0;
    border-radius: 5px;
    background: #f1f8f3;
}

.annual-limit-heading,
.annual-limit-details {
    display: flex;
    justify-content: space-between;
    gap: 18px;
}

.annual-limit-heading span,
.annual-limit-details {
    color: #5c7164;
    font-size: 12px;
}

.annual-limit-heading strong {
    color: #244f36;
    font-size: 13px;
    font-weight: 600;
}

.annual-limit-progress {
    height: 4px;
    margin: 3px 0;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, .75);
}

.annual-limit-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #78b58b;
}

.annual-limit-card.limit-warning {
    background: #fff8df;
}

.annual-limit-card.limit-warning .annual-limit-heading strong { color: #735d18; }
.annual-limit-card.limit-warning .annual-limit-heading span,
.annual-limit-card.limit-warning .annual-limit-details { color: #796b3c; }
.annual-limit-card.limit-warning .annual-limit-progress span { background: #dfbd50; }

.annual-limit-card.limit-danger {
    background: #fceeee;
}

.annual-limit-card.limit-danger .annual-limit-heading strong { color: #813f3f; }
.annual-limit-card.limit-danger .annual-limit-heading span,
.annual-limit-card.limit-danger .annual-limit-details { color: #805858; }
.annual-limit-card.limit-danger .annual-limit-progress span { background: #d87979; }

.annual-limit-card > a {
    display: inline-block;
    margin-top: 6px;
    color: var(--primary);
    font-size: 12px;
}

@media (max-width: 760px) {
    .invoice-second-row {
        grid-template-columns: 1fr;
    }

    .invoice-summary {
        flex-direction: column;
        gap: 10px;
    }

    .invoice-heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .invoice-summary {
        align-items: flex-start;
    }

    .invoice-balance {
        grid-template-columns: 1fr;
    }

    .invoice-first-row,
    .shipment-fields-row,
    .contract-fields-row,
    .task-fields-row,
    .time-entry-row,
    .task-filter,
    .bank-account-row {
        grid-template-columns: 1fr;
    }

    .shipment-line-header {
        display: none;
    }

    .shipment-line-row {
        grid-template-columns: 1fr 1fr 34px;
    }
}

/* Компактні списки у налаштуваннях */
.settings-list {
    overflow: hidden;
    margin-top: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.settings-list-header,
.settings-list-row {
    display: grid;
    gap: 20px;
    align-items: center;
}

.bank-account-list-row {
    grid-template-columns: minmax(180px, 1.05fr) minmax(250px, 1fr) 100px 100px 140px;
}

.status-list-row,
.category-list-row {
    grid-template-columns: minmax(240px, 1fr) 100px;
}

.category-add-form {
    display: grid;
    grid-template-columns: minmax(280px, 480px) 110px;
    gap: 12px;
    align-items: end;
    max-width: 602px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.category-add-form label {
    margin: 0;
}

.category-add-form .update-btn {
    width: 110px;
    margin: 0;
    white-space: nowrap;
}

.category-list {
    width: 100%;
    max-width: none;
    margin-top: 10px;
}

.category-settings-panel {
    padding: 0;
    border: 0;
    background: transparent;
}

.settings-category-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.category-count-summary {
    white-space: nowrap;
}

.category-list .settings-list-header > :last-child {
    text-align: right;
}

.category-list .settings-list-empty {
    padding: 11px 12px;
    text-align: left;
}

.settings-list-header {
    padding: 11px 14px;
    box-sizing: border-box;
    background: #f8f9fa;
    color: #73808a;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.settings-list-row {
    margin: 0;
    padding: 12px 14px;
    box-sizing: border-box;
    border-bottom: 1px solid var(--border);
    transition: background-color 140ms ease;
}

.settings-list-row:last-child {
    border-bottom: 0;
}

.settings-list-row:hover {
    background: #f7f9fa;
}

.settings-list-row .input-field {
    min-width: 0;
    margin: 0;
}

.settings-list-row .input-field[readonly] {
    padding-left: 0;
    padding-right: 0;
    border-color: transparent;
    background: transparent;
    color: var(--text);
    font-weight: 600;
    cursor: default;
}

.settings-list-row .action-btn {
    justify-self: end;
    margin-right: 0;
    padding: 6px 0 6px 14px;
    background: transparent;
    color: var(--primary);
    box-shadow: none;
}

.bank-account-list-row > :nth-child(3),
.bank-account-list-row > :nth-child(4) {
    text-align: center;
    justify-self: stretch;
}

.settings-list-row .action-btn:hover {
    background: transparent;
    color: var(--primary-hover);
    text-decoration: underline;
}

.settings-list-row.is-editing .action-btn {
    padding: 7px 14px;
    background: var(--button-bg);
    color: var(--button-text);
    text-decoration: none;
}

.settings-list-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.settings-list-row:not(.is-editing) .settings-list-checkbox input {
    display: none;
}

.settings-list-row.is-editing .boolean-value {
    display: none;
}

.boolean-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 22px;
    padding: 1px 7px;
    box-sizing: border-box;
    border-radius: 999px;
    background: #f0f2f3;
    color: #76818a;
    font-size: 12px;
    font-weight: 700;
}

.boolean-value.is-yes {
    background: #e5f2e8;
    color: #3d7048;
}

.boolean-value.is-primary {
    background: #e5f0f8;
    color: #356685;
}

.mobile-field-label {
    display: none;
}

.settings-list-empty {
    padding: 18px 10px;
    color: var(--muted);
    text-align: center;
}

@media (max-width: 900px) {
    .settings-list-header {
        display: none;
    }

    .bank-account-list-row,
    .status-list-row,
    .category-list-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .category-add-form {
        grid-template-columns: 1fr;
    }

    .settings-list-row {
        padding: 12px;
    }

    .settings-list-checkbox {
        justify-content: flex-start;
    }

    .mobile-field-label {
        display: inline;
        margin-left: 6px;
    }
}

/* Категорії: одна тиха картка без зайвих вкладених рамок */
.settings-container .category-settings-panel {
    padding: 0;
    border: 0;
    background: transparent;
}

.settings-container .category-add-form {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.settings-simple-add-form .update-btn {
    margin-top: 10px;
}

/* Налаштування використовують ту саму ієрархію, що й решта сторінок */
.settings-page-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
    margin: 0 0 8px;
}

.settings-page-header .settings-title {
    margin: 0;
    color: var(--text);
    font-size: 18px;
    line-height: 1.25;
}

.settings-page-actions {
    display: flex;
    justify-content: flex-start;
    margin: 0 0 14px;
}

.settings-page-actions .update-btn {
    margin: 0;
    padding: 7px 14px;
    font-size: 14px;
    line-height: 1.35;
}

.settings-container {
    padding: 16px;
    border-color: var(--border);
    background: var(--surface);
    box-shadow: 0 2px 8px rgba(31, 43, 51, .05);
}

.settings-company-form {
    padding-bottom: 4px;
}

.settings-section {
    margin-top: 18px;
    padding: 14px 16px 16px;
    border-color: var(--border);
    background: #fbfcfc;
}

.settings-section h2 {
    margin: 0 0 10px;
    color: #33434b;
    font-size: 16px;
    line-height: 1.3;
}

.settings-section-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 10px;
    margin-bottom: 14px;
}

.settings-section-header h2 {
    margin: 0;
}

.settings-section-header .action-btn {
    flex: 0 0 auto;
    padding: 8px 16px;
    font-size: 14px;
}

.settings-container .button-panel {
    margin-bottom: 10px;
}

.settings-container .styled-table {
    margin-top: 10px;
    border-color: var(--border);
    background: var(--surface);
    box-shadow: 0 1px 4px rgba(31, 43, 51, .04);
}

.settings-container .styled-table th {
    background: #f3f5f6;
    color: #36454e;
}

.settings-container .styled-table th:last-child,
.settings-container .styled-table td:last-child {
    width: 1%;
    padding-right: 16px;
    text-align: right;
    white-space: nowrap;
}

.settings-tabs {
    display: flex;
    gap: 4px;
    margin: 4px 0 18px;
    padding: 0 4px;
    border-bottom: 1px solid var(--border);
}

.settings-tabs a {
    position: relative;
    padding: 10px 16px;
    color: #52636e;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.settings-tabs a:hover {
    color: #315b78;
    background: #f3f7f8;
}

.settings-tabs a.active {
    color: #315f7d;
}

.settings-tabs a.active::after {
    content: "";
    position: absolute;
    right: 12px;
    bottom: -1px;
    left: 12px;
    height: 3px;
    background: var(--nav-accent);
    border-radius: 3px 3px 0 0;
}

.settings-section-standalone {
    margin-top: 0;
}

.contract-templates-form .form-command-bar {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.contract-template-editor + .contract-template-editor {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.contract-template-editor h2 {
    margin: 0 0 4px;
    font-size: 17px;
}

.contract-template-editor p {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 13px;
}

textarea.settings-template-text {
    width: 100%;
    height: 520px;
    min-height: 320px;
    resize: vertical;
    line-height: 1.5;
}

@media (max-width: 600px) {
    .settings-tabs {
        overflow-x: auto;
    }
}

.settings-container .form-container {
    border-color: var(--border);
    background: var(--surface);
}

@media (max-width: 760px) {
    .settings-page-header {
        align-items: flex-start;
    }

    .settings-container,
    .settings-section {
        padding: 12px;
    }
}

.line-header, .line-row {
    display: grid;
    grid-template-columns: minmax(210px, 3fr) minmax(90px, 1fr) minmax(90px, 1fr) minmax(100px, 1fr) 34px;
    gap: 8px;
    align-items: end;
}

.line-header {
    font-weight: bold;
    margin: 8px 0 4px;
}

.line-row {
    margin-bottom: 8px;
}

.line-row .input-field {
    min-width: 0;
    box-sizing: border-box;
}

textarea.input-field {
    height: 42px;
    min-height: 42px;
}

textarea.requisites-field {
    height: 150px;
    min-height: 100px;
    resize: vertical;
}

.line-row .remove {
    background: #a3c1da;
    color: #29485f;
    border: none;
    border-radius: 4px;
    height: 34px;
    cursor: pointer;
}

/* Єдина UI-система застосунку */
:root {
    --page-bg: #f6f7f8;
    --surface: #ffffff;
    --text: #202b33;
    --muted: #6b7881;
    --border: #e1e6e9;
    --primary: #4f7fa3;
    --button-bg: #a8dcd2;
    --button-hover: #91cec2;
    --button-text: #183746;
    --primary-hover: #3f6d8f;
    --nav-active: #e7f2f2;
    --nav-accent: #5f9ea0;
}

body {
    margin: 0;
    background-color: var(--page-bg);
    color: var(--text);
}

.content {
    margin-left: 200px;
    width: calc(100% - 200px);
    padding: 28px max(24px, calc((100% - 1240px) / 2));
    box-sizing: border-box;
}

.title {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 0 0 16px;
}

.title h1 {
    font-size: 22px;
    line-height: 1.2;
}

.title-heading-group {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.customer-count-summary,
.catalog-count-summary {
    white-space: nowrap;
}

.title .action-btn {
    padding: 8px 16px;
    font-size: 14px;
}

.action-btn,
.update-btn,
.delete-btn {
    background: var(--button-bg);
    color: var(--button-text);
    transition: background-color 140ms ease, box-shadow 140ms ease;
}

.btn,
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    height: 36px;
    min-height: 36px;
    padding-top: 0;
    padding-bottom: 0;
    line-height: 1;
    font-family: inherit;
}

.action-btn:hover,
.update-btn:hover {
    background: var(--button-hover);
}

.action-btn:focus-visible,
.btn:focus-visible {
    outline-color: #238578;
}

.action-btn:focus-visible,
.btn:focus-visible,
.sidebar a:focus-visible,
.input-field:focus-visible {
    outline: 3px solid rgba(79, 127, 163, .28);
    outline-offset: 2px;
}

.form-container,
.settings-container,
.task-filter {
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(31, 43, 51, .05);
}

.styled-table {
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 2px 7px rgba(31, 43, 51, .05);
}

.styled-table th {
    padding: 11px 10px;
    background-color: #f3f5f6;
    color: #36454e;
    font-size: 14px;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
}

.styled-table td {
    padding: 10px;
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
}

.styled-table tr:last-child td {
    border-bottom: 0;
}

.styled-table tr:hover td {
    background-color: #f7f9fa;
}

.styled-table .clickable-row {
    transition: background-color 140ms ease;
}

.styled-table .clickable-row:focus {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.sidebar {
    width: 200px;
    height: 100vh;
    box-sizing: border-box;
    padding-top: 10px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    box-shadow: none;
    overflow: hidden;
}

.sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
    gap: 6px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #c5d1d6 transparent;
}

.sidebar-brand {
    width: 100%;
    height: 40px;
    margin: 0 0 3px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 0 0 auto;
}

.sidebar-brand img {
    display: block;
    width: 124px;
    max-height: 33px;
    height: auto;
    margin-left: 22px;
}

.menu-group-title {
    margin: 2px 9px 3px;
    padding: 4px 8px 5px;
    color: #66747d;
    background: transparent;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    line-height: 1.2;
    text-transform: uppercase;
    list-style: none;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.menu-group-title::-webkit-details-marker {
    display: none;
}

.menu-group-title::after {
    content: "›";
    color: #60717b;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    transform: rotate(0deg);
    transition: transform 140ms ease;
}

.menu-group[open] > .menu-group-title::after {
    transform: rotate(90deg);
}

.menu-group-title:hover {
    color: #344851;
    background: #f3f6f7;
}

.sidebar a {
    padding: 5px 16px 5px 22px;
    color: #344851;
    border-left: 3px solid transparent;
    font-size: 15px;
    font-weight: 700;
    transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.sidebar a:hover {
    background-color: #f1f5f6;
}

.sidebar a.active {
    color: #28585a;
    background-color: var(--nav-active);
    border-left-color: var(--nav-accent);
}

.sidebar-user {
    padding: 9px 16px 11px;
    color: var(--muted);
    border-top: 1px solid var(--border);
}

.sidebar-user button {
    color: var(--primary);
}

.invoice-list-table th:nth-child(3),
.invoice-list-table td:nth-child(3) {
    text-align: center;
}

.invoice-list-table th:nth-child(4),
.invoice-list-table td:nth-child(4) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.catalog-list-table th:nth-child(5),
.catalog-list-table td:nth-child(5) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.shipment-list-table th:nth-child(5),
.shipment-list-table td:nth-child(5) {
    text-align: center;
}

.shipment-list-table th:nth-child(6),
.shipment-list-table td:nth-child(6) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.act-list-table th:nth-child(5),
.act-list-table td:nth-child(5) {
    text-align: center;
}

.act-list-table th:nth-child(6),
.act-list-table td:nth-child(6) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    box-sizing: border-box;
    padding: 3px 9px;
    border-radius: 999px;
    background: #eef0f2;
    color: #59636b;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.status-new { background: #eef0f2; color: #59636b; }
.status-ready_to_ship { background: #e5f0f8; color: #356685; }
.status-shipped { background: #eee9f7; color: #665482; }
.status-signed { background: #e5f2e8; color: #3d7048; }
.status-closed { background: #e5f2e8; color: #3d7048; }
.status-cancelled { background: #f8e7e7; color: #944848; }

/* Єдиний вигляд сторінок зі списками */
.list-section,
.task-time-section {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fbfcfc;
}

.list-section .title {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 10px;
    margin-bottom: 14px;
}

.list-section .title h1 {
    font-size: 18px;
}

.list-section .styled-table,
.task-time-section .styled-table {
    margin-top: 14px;
    border-radius: 8px;
    box-shadow: none;
}

.list-section .styled-table th,
.task-time-section .styled-table th {
    padding: 11px 14px;
    background: #f8f9fa;
    color: #73808a;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.list-section .styled-table td,
.task-time-section .styled-table td {
    padding: 14px;
    font-weight: 400;
}

.list-section .styled-table td:first-child {
    font-weight: 400;
}

.customer-filter {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 14px;
    width: min(1100px, 100%);
    margin-bottom: 14px;
}

.customer-filter label {
    margin: 0;
}

.contract-filter {
    display: grid;
    grid-template-columns: minmax(160px, .8fr) minmax(150px, .7fr) minmax(220px, 1.2fr) minmax(150px, .7fr);
    gap: 14px;
    align-items: end;
    margin-bottom: 14px;
}

.contract-filter label {
    margin: 0;
}

@media (max-width: 760px) {
    .customer-filter,
    .contract-filter {
        grid-template-columns: 1fr;
    }
}

.list-section .task-filter {
    margin: 0 0 14px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.catalog-filter {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(150px, 200px) minmax(180px, 240px);
    gap: 14px;
    align-items: end;
    margin-bottom: 14px;
}

.catalog-filter label {
    margin: 0;
}

.catalog-filter .input-field {
    width: 100%;
    box-sizing: border-box;
}

.sortable {
    cursor: pointer;
    user-select: none;
}

.sortable::after {
    content: " ↕";
    color: #a7b0b6;
    font-size: 11px;
}

.sortable.sort-asc::after {
    content: " ↑";
    color: var(--primary);
}

.sortable.sort-desc::after {
    content: " ↓";
    color: var(--primary);
}

.sortable:focus-visible {
    outline: 2px solid var(--nav-accent);
    outline-offset: -2px;
}

.is-hidden {
    display: none !important;
}

.document-table-scroll {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
}

.document-list-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    align-items: end;
    margin: 0 0 16px;
}

.document-list-filters > label,
.document-list-filters fieldset label {
    margin: 0;
}

.document-list-filters .input-field {
    width: 100%;
}

.document-list-filters fieldset {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0;
    padding: 0;
    border: 0;
    grid-column: span 2;
}

.document-list-filters fieldset legend {
    padding: 0;
    font-weight: 600;
}

.document-list-table {
    min-width: 900px;
    margin: 0;
    border: 0;
}

.document-list-table th button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.document-list-table th button::after {
    content: "↕";
    color: #9aa7b2;
    font-size: 12px;
}

.document-list-table th button.sort-asc::after { content: "↑"; color: var(--primary); }
.document-list-table th button.sort-desc::after { content: "↓"; color: var(--primary); }

.document-list-table .table-filter-row th {
    padding: 7px 8px 10px;
    background: #f8fafb;
}

.document-list-table .table-filter-row input {
    width: 100%;
    min-width: 90px;
    padding: 7px 8px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-weight: 400;
}

.document-list-table .table-filter-row input:focus {
    border-color: var(--primary);
    outline: 2px solid rgba(79, 127, 163, .15);
}

.document-list-table .description-cell {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-list-table tr[hidden] { display: none; }

.overview-menu-link {
    margin-bottom: 2px;
    border-bottom: 1px solid var(--border);
}

.title-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

.view-mode-switch {
    display: inline-flex;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #f3f6f7;
}

.view-mode-switch button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 30px;
    padding: 4px 9px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #667780;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.view-mode-switch button:hover {
    color: #355d70;
}

.view-mode-switch button.active {
    background: #fff;
    color: #28585a;
    box-shadow: 0 1px 3px rgba(35, 58, 69, .13);
}

.tree-view-table .tree-group-row th {
    padding: 7px 14px;
    background: #edf3f4;
    color: #3f5965;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}

.tree-group-row th {
    display: table-cell;
}

.tree-group-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.tree-group-arrow {
    display: inline-block;
    width: 12px;
    color: #69808a;
    transition: transform 140ms ease;
}

.tree-group.is-collapsed .tree-group-arrow {
    transform: rotate(-90deg);
}

.tree-group.is-collapsed .tree-item-row {
    display: none;
}

.tree-group-row small {
    display: inline-flex;
    min-width: 20px;
    justify-content: center;
    padding: 1px 6px;
    border-radius: 9px;
    background: #dde7e9;
    color: #657780;
    font-size: 11px;
    font-weight: 500;
}

.tree-view-table .tree-item-row td:first-child {
    padding-left: 28px;
}

.subscription-add-form {
    grid-template-columns: minmax(180px, 240px) minmax(180px, 240px) auto;
    align-items: end;
}

.subscription-list-row {
    grid-template-columns: minmax(180px, 240px) minmax(180px, 240px) minmax(110px, 1fr);
}

.subscription-list-row .action-btn {
    justify-self: end;
}

.overview-page > h1 {
    margin: 0 0 18px;
}

.overview-charts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.overview-card {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(31, 43, 51, .05);
}

.overview-card > header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.overview-card h2 {
    margin: 0;
    font-size: 17px;
}

.overview-card header > span {
    color: #73828b;
    font-size: 12px;
    white-space: nowrap;
}

.bar-chart {
    display: grid;
    grid-template-columns: repeat(12, minmax(16px, 1fr));
    gap: 5px;
    height: 235px;
    padding-top: 20px;
}

.bar-chart > a {
    display: grid;
    grid-template-rows: 22px 1fr 42px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.bar-value {
    overflow: hidden;
    color: #526872;
    font-size: 10px;
    text-align: center;
    text-overflow: ellipsis;
}

.bar-track {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    min-height: 0;
    border-bottom: 1px solid #dce4e8;
}

.bar-fill {
    width: min(22px, 74%);
    min-height: 2px;
    border-radius: 4px 4px 0 0;
    transition: filter .15s ease, transform .15s ease;
}

.invoice-bar { background: #5f8dac; }
.shipment-bar { background: #65a29c; }
.payment-bar { background: #7e99bd; }
.bar-chart > a:hover .bar-fill { filter: brightness(.9); transform: scaleX(1.08); }

.bar-label {
    padding-top: 7px;
    overflow: hidden;
    color: #687983;
    font-size: 10px;
    line-height: 1.15;
    text-align: center;
}

.task-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
}

.task-summary-grid a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #dce5e8;
    border-radius: 7px;
    background: #f8fafb;
    color: var(--text);
    text-decoration: none;
}

.task-summary-grid a:hover { border-color: #aec6cf; background: #f1f6f7; }
.task-summary-grid strong { color: #245b5e; font-size: 20px; }
.overview-empty { margin: 0; color: #73828b; }

.sales-report-filter {
    display: grid;
    grid-template-columns: minmax(300px, 1fr) minmax(240px, 1fr) auto;
    gap: 14px;
    align-items: end;
    margin-bottom: 16px;
}

.sales-report-filter fieldset {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0;
    padding: 0;
    border: 0;
}

.sales-report-filter label { margin: 0; }
.sales-report-filter .input-field { width: 100%; }
.sales-report-detailed {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    white-space: nowrap;
}
.sales-report-actions {
    display: flex;
    grid-column: 1 / -1;
    gap: 8px;
    align-items: center;
}
.sales-report-table { min-width: 920px; margin: 0; border: 0; }
.sales-report-table .money-cell { text-align: right; white-space: nowrap; }
.sales-report-table tbody td { font-weight: 400; }
.sales-report-table th,
.sales-report-table td {
    padding-top: 6px;
    padding-bottom: 6px;
    line-height: 1.3;
}
.sales-report-table tbody a { color: var(--primary); text-decoration: none; }
.sales-report-table tbody a:hover { text-decoration: underline; }
.sales-report-table .report-closing { font-weight: 400; }
.sales-report-table .negative-balance { color: #31735c; }
.sales-report-table tfoot th { padding: 13px 12px; border-top: 2px solid var(--border); background: #f4f7f8; }
.sales-report-totals { margin: 0 0 14px; }
.sales-report-note { margin: 12px 0 0; color: #697983; font-size: 13px; }

.report-grouped-table-wrap {
    border-radius: 7px;
}

.report-grouped-table {
    margin: 0;
    border: 0;
}

.report-grouped-table tbody + tbody .report-group-row th,
.sales-report-table tbody + tbody .report-group-row th {
    border-top: 1px solid #cbd6db;
}

.report-group-row th {
    padding: 10px 12px;
    background: #edf2f4;
    color: #2f4551;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
}

.report-group-row th a {
    color: inherit;
    font-weight: inherit;
    text-decoration: none;
}

.report-group-row th a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.report-detail-row td {
    background: #fff;
}

.report-indent {
    position: relative;
    padding-left: 34px !important;
}

.report-indent::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 18px;
    width: 7px;
    height: 1px;
    background: #aebcc3;
}

.task-report-table {
    min-width: 720px;
}

.task-report-filter {
    display: grid;
    grid-template-columns: minmax(280px, 1.2fr) minmax(190px, 1fr) minmax(170px, .8fr) auto;
    gap: 14px;
    align-items: end;
    margin-bottom: 16px;
}

.task-report-filter fieldset {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0;
    padding: 0;
    border: 0;
}

.task-report-filter label { margin: 0; }
.task-report-filter .input-field { width: 100%; }
.task-report-detailed { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; white-space: nowrap; }
.task-report-actions { display: flex; grid-column: 1 / -1; }
.task-report-actions,
.sales-report-actions { gap: 8px; }

.report-print-period { display: none; }

.task-report-table .report-group-row .report-hours {
    color: #31596d;
    white-space: nowrap;
}

.task-report-table .report-hours {
    text-align: right;
}

.task-time-section h2 {
    margin: 0 0 10px;
    font-size: 18px;
}

.task-time-section .button-panel {
    margin-bottom: 14px;
}

.task-time-section .styled-table .input-field[readonly] {
    padding-left: 0;
    padding-right: 0;
    border-color: transparent;
    background: transparent;
    color: var(--text);
    font-weight: 600;
    cursor: default;
}

.task-time-section .styled-table .action-btn {
    padding: 6px 0 6px 14px;
    background: transparent;
    color: var(--primary);
}

.task-time-section .styled-table .action-btn:hover {
    background: transparent;
    color: var(--primary-hover);
    text-decoration: underline;
}

.task-time-section .styled-table tr.is-editing .action-btn {
    padding: 7px 14px;
    background: var(--button-bg);
    color: var(--button-text);
    text-decoration: none;
}

/* Дані у списках мають звичайне накреслення; акцент лишається у заголовках. */
.list-section .styled-table td,
.list-section .styled-table td a,
.list-section .styled-table td span,
.task-time-section .styled-table td,
.task-time-section .styled-table td a,
.task-time-section .styled-table td span,
.task-time-section .styled-table .input-field[readonly] {
    font-weight: 400;
}

.sales-report-table th + th,
.sales-report-table td + td {
    border-left: 1px solid #d8e1e5;
}

.list-section .sales-report-table .sales-report-total-row td {
    padding-top: 6px;
    padding-bottom: 6px;
    background: #e8eff2;
    color: #263f4d;
    font-weight: 600;
    border-bottom: 1px solid #c5d1d7;
}

.list-section .sales-report-table .sales-report-customer-row td:first-child {
    padding-left: 24px;
}

.list-section .sales-report-table .sales-report-customer-row td:first-child a {
    font-weight: 600;
}

.list-section .sales-report-table .sales-report-detail-row td {
    padding-top: 6px;
    padding-bottom: 6px;
    background: #fbfcfc;
    color: #60717b;
    font-size: 13px;
}

.list-section .sales-report-table .sales-report-detail-row td:first-child {
    padding-left: 42px;
}

.sales-report-detail-row td:first-child a {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.list-section .sales-report-table .sales-report-invoice-row td {
    height: 34px;
    padding-top: 5px;
    padding-bottom: 5px;
    background: #f6f8f9;
    border-top: 1px solid #ccd8df;
    font-weight: 600;
}

.sales-report-invoice-row td:first-child {
    padding-left: 28px;
}

.sales-report-detail-row td:first-child {
    padding-left: 48px;
}

.sales-report-detail-row small {
    color: #84919a;
    white-space: nowrap;
}

.product-service-report-table {
    min-width: 760px;
}

.list-section .product-service-report-table .product-service-group-row td {
    height: 34px;
    padding-top: 5px;
    padding-bottom: 5px;
    background: #fbfcfc;
}

.product-service-group-row td:first-child {
    padding-left: 28px;
}

.product-service-group-row td:first-child a {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.product-service-group-row small {
    color: #84919a;
    white-space: nowrap;
}

.product-service-report-table .sales-report-invoice-row td:first-child {
    padding-left: 46px;
}

.product-service-report-table .sales-report-detail-row td:first-child {
    padding-left: 64px;
}

.task-report-table th + th,
.task-report-table td + td {
    border-left: 1px solid #d8e1e5;
}

.list-section .task-report-table .task-report-total-row td {
    padding-top: 6px;
    padding-bottom: 6px;
    background: #e8eff2;
    color: #263f4d;
    font-weight: 600;
    border-bottom: 1px solid #c5d1d7;
}

.task-report-table .report-group-row th {
    padding-top: 6px;
    padding-bottom: 6px;
    border-top: 1px solid #cbd6db;
}

.task-report-table th,
.task-report-table td { padding-top: 6px; padding-bottom: 6px; line-height: 1.3; }

.task-report-time-row td {
    background: #fbfcfc;
    color: #60717b;
    font-size: 13px;
}

.task-report-time-row td:first-child { padding-left: 42px; white-space: nowrap; }
.task-report-time-description { padding-left: 42px !important; }

.list-section .task-report-table th,
.list-section .task-report-table td {
    padding-top: 6px;
    padding-bottom: 6px;
    line-height: 1.3;
}

@media print {
    @page { margin: 12mm; }

    body {
        background: #fff;
        color: #111;
        font-size: 10pt;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .sidebar,
    .sales-report-filter,
    .task-report-filter,
    .sales-report-note {
        display: none !important;
    }

    .content {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .sales-report-section,
    .task-report-section {
        padding: 0;
        border: 0;
        border-radius: 0;
        background: #fff;
        box-shadow: none;
    }

    .sales-report-section .title,
    .task-report-section .title {
        margin-bottom: 2mm;
    }

    .sales-report-section .title h1,
    .task-report-section .title h1 {
        color: #111;
        font-size: 16pt;
    }

    .report-print-period {
        display: block;
        margin: 0 0 5mm;
        color: #333;
        font-size: 10pt;
    }

    .document-table-scroll,
    .report-grouped-table-wrap {
        overflow: visible;
        border: 1px solid #bbb;
    }

    .sales-report-table,
    .task-report-table {
        width: 100%;
        min-width: 0;
        font-size: 9pt;
    }

    .sales-report-table a,
    .task-report-table a {
        color: #111 !important;
        text-decoration: none !important;
    }

    .sales-report-table th,
    .sales-report-table td,
    .task-report-table th,
    .task-report-table td {
        padding: 4px 6px !important;
    }

    thead { display: table-header-group; }
    tr { break-inside: avoid; }
}

@media (max-width: 760px) {
    .task-report-filter {
        grid-template-columns: 1fr;
    }
    .sales-report-filter {
        grid-template-columns: 1fr;
    }

    .overview-charts {
        grid-template-columns: 1fr;
    }

    .annual-limit-card {
        min-width: 0;
        width: 100%;
    }

    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        padding: 14px 0;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-brand {
        height: 37px;
        margin: 0 0 3px;
    }

    .sidebar-brand img {
        width: 116px;
        max-height: 31px;
        margin-left: 22px;
    }

    .sidebar-user {
        margin-top: 14px;
    }

    .content {
        margin-left: 0;
        width: 100%;
        padding: 20px 14px;
    }

    .catalog-filter {
        grid-template-columns: 1fr;
    }

    .document-list-filters {
        grid-template-columns: 1fr;
    }

    .document-list-filters fieldset {
        grid-column: auto;
    }

    .contact-list-row {
        grid-template-columns: 1fr;
    }

    .contact-list-row .action-btn {
        justify-self: start;
    }

    .title {
        align-items: flex-start;
    }
}

/* Остаточні перевизначення компактної сторінки категорій */
.settings-container .category-settings-panel {
    padding: 0;
    border: 0;
    background: transparent;
}

.settings-container .category-add-form {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
.searchable-select {
    position: relative;
    width: 100%;
    min-width: 0;
}

.searchable-select-input {
    width: 100%;
    box-sizing: border-box;
    padding-right: 32px;
    background-image: linear-gradient(45deg, transparent 50%, #607080 50%), linear-gradient(135deg, #607080 50%, transparent 50%);
    background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

.searchable-native-select {
    position: absolute;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: 0 !important;
    opacity: 0;
    pointer-events: none;
}

.searchable-select-list {
    position: absolute;
    z-index: 1000;
    top: calc(100% + 3px);
    left: 0;
    right: 0;
    max-height: 240px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid #cbd7df;
    border-radius: 5px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(34, 57, 73, .14);
}

.searchable-select-option {
    display: block;
    width: 100%;
    padding: 7px 9px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.searchable-select-option:hover,
.searchable-select-option.active {
    background: #edf4f7;
}

.searchable-select-empty {
    padding: 8px 9px;
    color: #6b7c88;
}

.invoice-related-page {
    margin-top: 12px;
}

.invoice-related-list {
    margin-top: 14px;
    overflow: hidden;
    border: 1px solid #dbe3e8;
    border-radius: 6px;
    background: #fff;
}

.invoice-related-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 38px;
    padding: 0 14px;
    border-bottom: 1px solid #e2e8ec;
    color: #294f68;
    text-decoration: none;
}

.invoice-related-row:last-of-type {
    border-bottom: 0;
}

.invoice-related-row:hover {
    background: #f4f8fa;
}

.invoice-related-row strong {
    color: #1d3443;
    font-weight: 600;
    white-space: nowrap;
}

.task-timer-column { width: 64px; text-align: center; }
.active-timer-icon { color: #dc2626; font-size: 20px; line-height: 1; }
.time-entry-form-actions { margin-top: 16px; }
.task-time-section .time-entry-timestamp {
    font-family: var(--app-font);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.25;
}
.form-actions:has([form='task-timer-form']) { gap: 8px; flex-wrap: wrap; }
button[form='task-timer-form']:disabled { opacity: .45; cursor: not-allowed; }

.subscription-offers { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 20px; margin-top: 22px; }
.subscription-offer { display: flex; flex-direction: column; padding: 24px; border: 1px solid #d8e1e5; border-radius: 10px; background: #fff; }
.subscription-offer h3 { margin: 0 0 20px; font-size: 20px; }
.subscription-offer-price { margin: 0 0 18px; color: #263f4d; }
.subscription-offer-price strong { font-size: 32px; }
.subscription-offer-full-price { margin: 0 0 8px; min-height: 24px; color: #78858d; font-size: 18px; }
.subscription-offer-discount { margin: 0 0 24px; color: #dc2626; }
.subscription-offer .field-hint { margin: 0 0 24px; }
.subscription-offer .subscription-choose { margin-top: auto; width: 100%; }
.subscription-summary { max-width: 440px; width: calc(100% - 48px); box-sizing: border-box; border: 1px solid #d8e1e5; border-radius: 10px; padding: 24px; color: var(--text); }
.subscription-summary::backdrop { background: rgba(24, 39, 50, .4); }
.subscription-summary h2 { margin-top: 0; }
.subscription-summary dl { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.subscription-summary dd { margin: 0; font-weight: 600; }
.subscription-summary p { line-height: 1.5; }

/* Contact fields keep readable widths; narrow screens use labelled cards. */
.customer-contacts { min-width: 0; }
.contact-list { overflow-x: auto; }
.contact-list-row > * { min-width: 0; }
.without-task-notifications .contact-list-row {
    grid-template-columns: minmax(110px, .8fr) minmax(100px, .8fr) minmax(120px, .8fr) minmax(180px, 1.2fr) 100px 140px;
}
.customer-contacts .contact-edit-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 768px) {
    .customer-contacts .contact-list-row { grid-template-columns: 1fr; }
    .customer-contacts .settings-list-header { display: none; }
    .contact-list-row .settings-list-checkbox::before { content: 'Основний підписант'; }
    .contact-list-row .settings-list-checkbox:has([name="notifyTaskChanges"])::before { content: 'Оповіщати про зміни в задачах'; }
    .contact-list-row .settings-list-checkbox { gap: 8px; }
}

/* Compact actions shared by task observers and time entries. */
.task-row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; white-space: nowrap; }
.task-row-actions form { margin: 0; display: flex; }
.task-row-actions .row-delete-button {
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 32px; width: 32px; height: 32px; padding: 0;
    border: 0; border-radius: 6px; background: transparent;
    color: var(--text); font: inherit; font-size: 25px; line-height: 1; cursor: pointer;
}
.task-row-actions .row-delete-button:hover,
.task-row-actions .row-delete-button:focus-visible { color: #c62828; background: #ffebee; }
.task-row-actions .row-delete-button:focus-visible { outline: 2px solid #c62828; outline-offset: 2px; }
html[data-theme="dark"] .task-row-actions .row-delete-button:hover,
html[data-theme="dark"] .task-row-actions .row-delete-button:focus-visible { color: #ff9494; background: #492b32; }

/* Shared page heading for create/edit forms, matching the invoice form. */
.content h1.form-page-title {
    font-family: inherit;
    font-size: 18px;
    line-height: 1.25;
    font-weight: 700;
    color: var(--text);
    margin: 6px 0 10px;
}
.content .invoice-heading h1.form-page-title { margin: 0; }

.document-tree-dialog { width:min(900px,calc(100vw - 32px)); max-height:85vh; overflow:auto; padding:24px; border:1px solid var(--line,#cbd5da); border-radius:10px; background:var(--surface,#fff); color:var(--text); }
.document-tree-dialog::backdrop { background:rgba(0,0,0,.45); }
.document-tree-heading { display:flex; justify-content:space-between; align-items:center; gap:20px; }
.document-tree-heading h2 { font-size:18px; margin:0; }
.document-tree,.document-tree ul { list-style:none; padding-left:20px; }
.document-tree ul { border-left:1px solid #94a8b2; margin-left:6px; }
.document-tree li { padding:8px 0; overflow-wrap:anywhere; }
.document-tree a { color:inherit; text-decoration:none; }
.document-tree a:hover { text-decoration:underline; }
.document-tree summary { cursor:pointer; }
html[data-theme="dark"] .document-tree-dialog { background:#1b2a32; }

.invoice-print-menu { position:relative; }
.invoice-print-menu summary { list-style:none; cursor:pointer; }
.invoice-print-menu summary::-webkit-details-marker { display:none; }
.invoice-print-options { position:absolute; top:calc(100% + 5px); left:0; z-index:30; min-width:240px; padding:6px; background:#fff; border:1px solid #ccd8df; border-radius:6px; box-shadow:0 5px 16px #0002; }
.invoice-print-options a { display:block; padding:10px; color:inherit; text-decoration:none; border-radius:4px; }
.invoice-print-options a:hover,.invoice-print-options a:focus-visible { background:#a8ded555; }
[data-theme="dark"] .invoice-print-options { background:#1b2a32; border-color:#3b515c; }

.task-filter { flex-wrap:wrap; align-items:end; gap:16px; }
.task-status-filter { border:1px solid #ccd5da;border-radius:4px;padding:7px;min-width:220px; }
.task-status-filter summary { cursor:pointer; }
.task-status-filter label { display:flex;gap:8px;align-items:center;margin:8px 0; }
.task-board { display:flex;gap:16px;overflow-x:auto;align-items:flex-start;padding-bottom:16px; }
.task-board-column { flex:0 0 290px;background:#edf4f3;border-radius:8px;padding:12px; }
.task-board-column h2 { font-size:16px;margin:0 0 12px; }
.task-board-column h2 small { margin-left:8px; }
.task-board-card { background:white;border:1px solid #d9e2e6;border-radius:6px;padding:12px;margin-bottom:12px;overflow-wrap:anywhere; }
.task-board-card>a { display:block;font-weight:600;margin-top:6px;color:inherit; }
.task-board-card p { font-size:13px;margin:8px 0; }
.task-board-card form { margin-top:10px; }
[data-theme="dark"] .task-board-column { background:#16252d; }
[data-theme="dark"] .task-board-card { background:#22343d;border-color:#3b515c; }

.content.tasks-content { padding-left:20px; padding-right:20px; }
.tasks-content .task-filter { grid-template-columns:minmax(180px,280px) minmax(220px,280px) auto; }
.tasks-content .task-filter>button { justify-self:start; }
@media(max-width:900px) { .tasks-content .task-filter { grid-template-columns:1fr; } }

/* Shared compact application layout; printed documents retain their spacing. */
@media screen {
    .content,
    .content.tasks-content {
        padding-left: max(6px, calc((100% - 1240px) / 8));
        padding-right: max(6px, calc((100% - 1240px) / 8));
    }

    .content .styled-table th,
    .content .styled-table td {
        padding-top: 6px;
        padding-bottom: 6px;
        line-height: 1.3;
    }

    .content .settings-list-row {
        padding-top: 6px;
        padding-bottom: 6px;
    }

    .content .form-container label { margin-top: 4px; }
    .content .input-field { margin-top: 2px; padding-top: 4px; padding-bottom: 4px; }
    .content .styled-table .input-field,
    .content .settings-list-row .input-field { margin-top: 0; }
    .content .invoice-details-left { gap: 4px; }
    .content .form-command-bar { margin-bottom: 8px; }
    .content .invoice-form-card .form-command-bar { padding-bottom: 8px; }
    .content .task-time-section,
    .content .task-attachments-section { margin-top: 16px; }
}

@media screen and (max-width: 760px) {
    .content,
    .content.tasks-content { padding-left: 8px; padding-right: 8px; }
}
/* Compact controls across application forms, lists and dialogs. */
@media screen {
    body .content :is(.btn, .action-btn),
    body .login-card :is(.btn, .action-btn),
    body .content .task-time-section .styled-table tr.is-editing .action-btn,
    body .content .settings-list-row.is-editing .action-btn {
        padding: 4px 10px;
        height: auto;
        min-height: 30px;
        font-size: 13px;
        box-sizing: border-box;
        line-height: 1.25;
    }
    body .content :is(.pagination, .view-mode-switch) button {
        padding: 3px 7px;
        min-height: 22px;
        font-size: 12px;
        line-height: 1.25;
    }
    body .content :is(.contract-template-options button, .invoice-print-options a, .searchable-select-option) {
        padding: 5px 8px;
    }
    body .content .task-row-actions .row-delete-button {
        flex-basis: 26px;
        width: 26px;
        height: 26px;
        min-height: 26px;
        padding: 0;
        font-size: 22px;
    }

}
/* Reference scale for the application UI. */
@media screen {
    .content, .sidebar, .login-card { font-size: 13px; line-height: 1.4; }
    .content :is(label, .input-field, .styled-table, .time-entry-timestamp),
    .content .task-time-section .time-entry-timestamp { font-size: 13px; }
    .content .input-field:not(textarea):not(.searchable-native-select) {
        height: 30px;
        min-height: 30px;
        box-sizing: border-box;
    }
    .sidebar a { font-size: 13px; font-weight: 600; line-height: 1.4; }
    .content :is(h1, h1.form-page-title, .title h1, .settings-title) { font-size: 18px; }
    .content :is(h2, .task-time-section h2, .settings-section h2) { font-size: 16px; }
    .content .styled-table th { font-size: 11px; }
    .content .styled-table td { font-size: 13px; }
    .content .line-row .remove { height: 30px; font-size: 13px; }
    .content .settings-tabs a { font-size: 13px; }
}
/* Status multi-select opens above the list without shifting the page. */
.tasks-content .task-filter { grid-template-columns: repeat(2, minmax(0, 280px)); }
.tasks-content .task-status-filter { position: relative; padding: 0; min-width: 0; border: 0; margin-top: 2px; }
.task-status-filter summary { display: flex; align-items: center; gap: 4px; min-height: 30px; box-sizing: border-box; padding: 5px 10px; border: 1px solid var(--border); border-radius: 5px; background: var(--nav-active); color: var(--text); list-style: none; font-size: 13px; }
.task-status-filter summary::-webkit-details-marker { display: none; }
.task-status-filter summary::after { content: ''; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); margin: -3px 2px 0 auto; }
.task-status-filter[open] summary::after { transform: rotate(225deg); margin-top: 3px; }
.task-status-filter summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.task-status-popover { position: absolute; top: calc(100% + 5px); left: 0; z-index: 50; width: max(100%, 260px); max-width: calc(100vw - 32px); box-sizing: border-box; padding: 16px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); box-shadow: 0 6px 18px #0003; }
.task-status-options { max-height: min(320px, 50vh); overflow-y: auto; }
.task-status-options label { display: flex; align-items: center; gap: 9px; margin: 0; padding: 7px 4px; border-radius: 4px; font-size: 13px; font-weight: 400; cursor: pointer; overflow-wrap: anywhere; }
.task-status-options label:hover { background: var(--nav-active); }
.task-status-options input { width: 15px; height: 15px; margin: 0; flex-shrink: 0; accent-color: var(--nav-accent); }
.task-status-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.task-status-reset { border: 0; background: transparent; color: var(--primary); padding: 5px 0; font: inherit; cursor: pointer; }
.task-status-reset:hover { text-decoration: underline; }
@media (max-width: 900px) { .tasks-content .task-filter { grid-template-columns: 1fr; } }
/* Observer defaults and task-specific overrides share one row. */
.content .observer-add-row:not([hidden]) { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(180px, 1fr) minmax(150px, .8fr) auto; align-items: end; gap: 12px; }
.observer-add-row > label { margin: 0; min-width: 0; }
.observer-add-row .checkbox-label { min-height: 30px; font-weight: 400; }
.observer-add-row .form-actions { margin: 0; }
.observer-add-row > .field-hint { grid-column: 1 / -1; }
@media (max-width: 900px) { .content .observer-add-row:not([hidden]) { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .content .observer-add-row:not([hidden]) { grid-template-columns: 1fr; } }

.task-board-card[draggable="true"] { cursor: grab; }
.task-board-card.is-dragging { opacity: .5; cursor: grabbing; }
.task-board-column.drop-target { outline: 2px dashed var(--nav-accent); outline-offset: -2px; background: var(--nav-active); }
.task-board[aria-busy="true"] { opacity: .7; pointer-events: none; }

.status-list .status-list-row { grid-template-columns: minmax(0, 1fr) auto; }
.status-order-actions { display: flex; align-items: center; gap: 8px; }
.content .status-order-actions .action-btn { padding: 4px 8px; }
.status-order-actions button:disabled { opacity: .3; cursor: default; }

.category-filter { min-width: 0; }
.category-filter .category-multiselect { position: relative; min-width: 0; padding: 0; border: 0; margin-top: 2px; }

.directory-comment { max-width: 360px; white-space: pre-wrap; overflow-wrap: anywhere; }

.print-name { display: none; }
@media print { .screen-name { display: none; } .print-name { display: inline; } }

.category-list .status-list-row { grid-template-columns: minmax(0,1fr) auto; }
.settings-list-row > .task-row-actions { justify-self: end; gap: 6px; flex-wrap: wrap; }

/* Dates must remain complete and readable in every list. */
.content table td.date-cell {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
    min-width: 10ch;
}

.customer-contacts .contact-list-row > .task-row-actions { flex-wrap: nowrap; }
.contact-name-text { display: block; white-space: normal; overflow-wrap: anywhere; }
.contact-name-cell .contact-field[readonly] { display: none; }
.contact-list-row.is-editing .contact-name-text { display: none; }
