:root {
    --bg: #f3efe6;
    --surface: #fffdf8;
    --surface-soft: #e9e6dd;
    --sidebar: #1c3429;
    --sidebar-deep: #14271f;
    --green: #145d46;
    --green-dark: #0c4735;
    --lime: #bcef62;
    --orange: #ffb547;
    --ink: #15201b;
    --muted: #657068;
    --line: #b9c0b5;
    --line-soft: #d8dbd3;
    --danger: #a13d36;
    --shadow: 3px 3px 0 rgba(20, 52, 41, .12);
}

* { box-sizing: border-box; }

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

body {
    color: var(--ink);
    background: var(--bg);
    font-family: Inter, Lato, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
}

a { color: var(--green); }
form { margin: 0; }

.layout-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.layout-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex: 0 0 175px;
    flex-direction: column;
    height: 100vh;
    padding: 14px 10px 12px;
    color: #fff;
    background: var(--sidebar);
    border-right: 1px solid rgba(255, 255, 255, .08);
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    margin: 0 3px 16px;
    color: #fff;
    text-decoration: none;
}

.brand:hover { color: #fff; }

.brand-mark {
    position: relative;
    display: grid;
    width: 37px;
    height: 37px;
    place-items: center;
    color: #fff;
    border: 3px solid #fff;
    font-size: 22px;
    font-weight: 900;
    line-height: 1;
}

.brand-mark > span {
    position: absolute;
    top: -11px;
    right: -11px;
    color: var(--lime);
    background: var(--sidebar);
    font-size: 20px;
    line-height: 1;
}

.brand-name {
    font-size: 19px;
    font-weight: 900;
    letter-spacing: .02em;
    line-height: 1;
}

.brand-name > span { color: var(--lime); }

.brand-name small {
    display: block;
    max-width: 98px;
    margin-top: 4px;
    color: #b9c8c0;
    font-size: 7px;
    font-weight: 700;
    letter-spacing: .12em;
    line-height: 1.25;
}

.sidebar-start {
    display: block;
    margin: 0 0 14px;
    padding: 10px 11px;
    color: #17251f;
    background: var(--orange);
    border-radius: 2px;
    box-shadow: 5px 5px 0 var(--sidebar-deep);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

.sidebar-start:hover {
    color: #17251f;
    background: #ffc363;
    transform: translateY(-1px);
}

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

.sidebar-caption {
    margin: 15px 10px 4px;
    color: #8fa69a;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 41px;
    padding: 10px 12px;
    color: #dce6e1;
    border-radius: 2px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.sidebar-nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, .07);
}

.sidebar-nav a.active {
    color: #1d2d25;
    background: var(--lime);
    font-weight: 800;
}

.sidebar-nav a > span { color: var(--lime); }

.sidebar-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding: 14px 10px 2px;
    color: #aebfb6;
    border-top: 1px solid rgba(255, 255, 255, .14);
    font-size: 11px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--lime);
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(188, 239, 98, .14);
}

.layout-page {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    flex-direction: column;
}

.page-topbar {
    display: flex;
    min-height: 116px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 30px;
    border-bottom: 1px solid var(--line);
}

.page-eyebrow {
    display: block;
    margin-bottom: 6px;
    color: var(--green);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .18em;
}

.page-topbar h1 {
    margin: 0;
    color: #101814;
    font-size: clamp(25px, 2.5vw, 34px);
    font-weight: 900;
    letter-spacing: -.035em;
    line-height: 1.05;
}

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

.page-content {
    min-width: 0;
    flex: 1 1 auto;
    padding: 22px 30px 30px;
}

.button, .ui.button, button {
    display: inline-flex;
    min-height: 37px;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    color: #fff;
    background: var(--green);
    border: 1px solid var(--green-dark);
    border-radius: 2px;
    box-shadow: 3px 3px 0 rgba(20, 52, 41, .13);
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
    text-decoration: none;
    text-transform: none;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}

.button:hover, .ui.button:hover, button:hover {
    color: #fff;
    background: var(--green-dark);
    transform: translateY(-1px);
    box-shadow: 4px 4px 0 rgba(20, 52, 41, .16);
}

.button-secondary {
    color: var(--green);
    background: var(--surface);
    border-color: var(--line);
}

.button-secondary:hover {
    color: var(--green-dark);
    background: #fff;
}

.button-primary {
    color: #fff;
    background: var(--green);
}

input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="date"], input[type="datetime-local"], select, textarea {
    min-height: 36px;
    padding: 7px 9px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 2px;
    outline: none;
    font: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 2px rgba(20, 93, 70, .12);
}

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--green);
}

.ui.segment {
    margin: 0;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 3px;
    box-shadow: var(--shadow);
}

.ui.segment .ui.form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.header-buttons { margin: 0 0 20px; }
.header-buttons > .ui.buttons { margin-bottom: 15px; }

.header-buttons h4.header {
    margin: 0 0 10px;
    color: var(--ink);
    font-size: 15px;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.source-companies {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 8px;
}

.source-company-column {
    display: flex;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    background: #f7f8f4;
    border: 1px solid #b9c7bd;
    border-radius: 4px;
    box-shadow: 2px 2px 0 rgba(20, 52, 41, .08);
}

.source-line {
    min-width: 0;
    padding: 5px 7px;
    color: var(--ink);
    background: #f9faf7;
    border-bottom: 1px solid #ccd5ce;
}

.source-line:nth-child(even) { background: #f1f4ef; }

.source-line.is-mail-connected,
.source-line.is-mail-connected:nth-child(even) {
	background: #e7f4fb;
	box-shadow: inset 3px 0 0 #59a9d1;
}

.source-line.is-mail-connected .company-title-input,
.source-line.is-mail-connected .company-contragent-input,
.source-line.is-mail-connected .company-percent-input {
	background: #f7fcff;
	border-color: #9cc9df;
}

.source-line:last-child { border-bottom: 0; }

.company-primary-row {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) minmax(100px, 150px) 50px 90px 26px;
    align-items: center;
    gap: 5px;
    min-height: 29px;
}

.company-primary-row > .company-details-toggle {
    grid-column: -2;
    grid-row: 1;
}

.company-select {
	display: grid;
	grid-template-columns: 15px minmax(0, 1fr) 25px;
    min-width: 0;
    align-items: center;
    gap: 5px;
    margin: 0;
}

.company-title-input {
	width: 100%;
	min-width: 0;
	min-height: 29px;
	padding: 4px 6px;
	overflow: hidden;
	color: var(--green-dark);
	background: transparent;
	border: 1px solid transparent;
	border-radius: 3px;
	font-size: 12px;
	font-weight: 800;
	letter-spacing: .01em;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.company-title-input:not([readonly]):hover,
.company-title-input:not([readonly]):focus {
	background: #fff;
	border-color: var(--green);
	box-shadow: 0 0 0 2px rgba(20, 93, 70, .1);
}

.company-title-input[readonly] {
	cursor: default;
}

.company-name-edit {
	display: inline-flex;
	width: 25px;
	height: 25px;
	align-items: center;
	justify-content: center;
	padding: 0;
	color: var(--green);
	background: transparent;
	border: 1px solid transparent;
	border-radius: 3px;
	cursor: pointer;
}

.company-name-edit:hover,
.company-name-edit:focus,
.company-name-edit.is-editing {
	background: #e5f1e8;
	border-color: #aebdb3;
}

.company-name-edit svg {
	width: 15px;
	height: 15px;
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 1.8;
}

.company-title-input.is-saving { opacity: .6; }
.company-title-input.is-saved { border-color: #78a98c; }
.company-title-input.is-error {
	border-color: var(--danger);
	box-shadow: 0 0 0 2px rgba(161, 67, 55, .12);
}

.source-company-add {
	display: flex;
	align-items: center;
	gap: 9px;
	margin: 0 0 8px;
}

.source-company-add .button {
	min-height: 31px;
	padding: 6px 10px;
	font-size: 11px;
}

.source-company-add [data-company-add-status] {
	color: var(--muted);
	font-size: 11px;
	font-weight: 700;
}

.source-line input[type="checkbox"] {
    width: 15px;
    height: 15px;
    min-height: 15px;
    flex: 0 0 15px;
    margin: 0;
    padding: 0;
}

.source-line [data-company-total] {
    overflow: hidden;
    padding: 4px 5px;
    color: var(--green-dark);
    background: #dff1e5;
    border-radius: 2px;
    font-size: 11px;
    font-weight: 800;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.company-contragent-input,
.company-percent-input {
    min-width: 0;
    min-height: 29px;
    color: var(--ink);
    background: #fff;
    border: 1px solid #aebdb3;
    border-radius: 3px;
}

.source-line .company-contragent-input {
    width: 100%;
    min-height: 29px;
    padding: 4px 7px;
    font-size: 11px;
}

.company-contragent-input::placeholder,
.company-percent-input input::placeholder { color: #7e8982; opacity: 1; }

.company-contragent-input:focus,
.company-percent-input:focus-within {
    border-color: var(--green);
    box-shadow: 0 0 0 2px rgba(20, 93, 70, .1);
    outline: 0;
}

.company-percent-input {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18px;
    align-items: center;
    overflow: hidden;
}

.company-percent-input input {
    width: 100%;
    min-width: 0;
    min-height: 27px;
    padding: 3px 1px 3px 4px;
    color: var(--ink);
    background: transparent;
    border: 0;
    outline: 0;
    font-size: 11px;
    text-align: right;
}

.company-percent-input > span {
    color: var(--green);
    font-size: 11px;
    font-weight: 900;
}

.company-details-toggle {
    display: grid;
    width: 26px;
    height: 29px;
    min-height: 29px;
    place-items: center;
    padding: 0;
    color: var(--green-dark);
    background: #e8eee9;
    border: 1px solid #b6c3ba;
    border-radius: 3px;
    cursor: pointer;
}

.company-details-toggle:hover,
.company-details-toggle[aria-expanded="true"] {
    color: #fff;
    background: var(--green);
    border-color: var(--green);
}

.company-details-toggle svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
    transition: transform .15s ease;
}

.company-details-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }

.company-extra-settings {
    display: grid;
    grid-template-columns: 72px 80px 100px minmax(92px, 1fr) minmax(125px, 1.35fr);
    gap: 5px;
    align-items: end;
    margin-top: 5px;
    padding: 6px 0 1px;
    border-top: 1px dashed #aebdb3;
}

.company-extra-settings[hidden] { display: none; }

.company-field {
    display: grid;
    min-width: 0;
    gap: 3px;
    margin: 0;
}

.company-field > span {
    color: #647069;
    font-size: 10px;
    font-weight: 700;
}

.company-field input,
.company-field select {
    width: 100%;
    min-width: 0;
    min-height: 29px;
    padding: 4px 6px;
    color: var(--ink);
    background: #fff;
    border: 1px solid #aebdb3;
    border-radius: 3px;
    font-size: 11px;
}

.company-field select option { color: var(--ink); background: #fff; }

.company-extra-settings input[name="num"] { text-align: right; }

.company-integration-actions {
	display: flex;
	grid-column: 1 / -1;
	align-items: center;
	gap: 8px;
	padding: 4px 0 2px;
}

.company-integration-actions .button {
	min-height: 28px;
	padding: 5px 8px;
	font-size: 10px;
}

.company-integration-actions .button-elba-disconnect {
	color: var(--danger);
	background: #fff;
	border: 1px solid #c9938e;
}

.company-integration-actions .button-elba-disconnect:hover {
	color: #fff;
	background: var(--danger);
	border-color: var(--danger);
}

.company-integration-actions .button-elba-disconnect[hidden] { display: none; }

.elba-connection-status {
	color: var(--muted);
	font-size: 10px;
	font-weight: 700;
}

.elba-connection-status.is-configured { color: var(--green); }

.company-seal-field {
    grid-template-columns: auto 16px;
    align-items: center;
    align-self: end;
    padding-bottom: 5px;
}

.company-template-panel {
    grid-column: 1 / -1;
    margin-top: 2px;
    padding: 10px;
    color: var(--ink);
    background: #eef3ef;
    border: 1px solid #b6c5bb;
    border-left: 3px solid var(--green);
    border-radius: 2px;
}

.company-template-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.company-template-head > div:first-child {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.company-template-head strong {
    color: var(--green-dark);
    font-size: 12px;
}

.company-template-head [data-template-status] {
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.company-template-head [data-template-status].is-ready {
    color: var(--green);
    font-weight: 800;
}

.company-template-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 4px;
}

.company-template-actions .button {
    min-height: 28px;
    padding: 5px 7px;
    font-size: 10px;
    line-height: 1;
}

.company-template-actions .button[disabled] {
    cursor: default;
    opacity: .45;
}

.company-template-actions .is-hidden { display: none; }

.company-danger-actions {
	display: flex;
	grid-column: 1 / -1;
	align-items: center;
	justify-content: flex-end;
	gap: 10px;
	padding-top: 6px;
	border-top: 1px dashed #c8b7b3;
}

.company-danger-actions span {
	color: var(--muted);
	font-size: 10px;
}

.company-danger-actions .button-danger {
	flex: 0 0 auto;
	min-height: 28px;
	padding: 5px 9px;
	color: var(--danger);
	background: #fff;
	border: 1px solid #c9938e;
}

.company-danger-actions .button-danger:hover {
	color: #fff;
	background: var(--danger);
	border-color: var(--danger);
}

.company-template-pick {
    color: var(--green-dark);
    background: #fff;
    border: 1px solid #9fb2a5;
    cursor: pointer;
}

.company-template-panel p {
    margin: 7px 0 5px;
    color: #526158;
    font-size: 10px;
    line-height: 1.35;
}

.company-template-panel > small {
    display: block;
    margin-top: 5px;
    color: #65736b;
    font-size: 10px;
}

.company-template-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

.company-template-tags button {
    min-height: 24px;
    padding: 4px 6px;
    color: var(--green-dark);
    background: #fff;
    border: 1px solid #b3c2b8;
    border-radius: 2px;
    cursor: pointer;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 9px;
}

.company-template-tags button:hover,
.company-template-tags button.is-copied {
    color: #fff;
    background: var(--green);
    border-color: var(--green);
}

.template-tag-tooltip {
    position: fixed;
    z-index: 1000;
    width: max-content;
    max-width: min(320px, calc(100vw - 20px));
    padding: 8px 10px;
    color: #fff;
    background: #173b2f;
    border: 1px solid #6f9d88;
    border-radius: 4px;
    box-shadow: 0 8px 20px rgba(17, 44, 34, .24);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    opacity: 0;
    pointer-events: none;
    transform: translateY(3px);
    transition: opacity .12s ease, transform .12s ease;
}

.template-tag-tooltip.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.company-template-feedback {
    min-height: 0;
    margin-top: 5px;
    color: var(--green-dark);
    font-size: 10px;
    font-weight: 800;
}

.company-template-feedback.is-error { color: var(--danger); }

.source-line .ui.button {
    min-height: 29px;
    padding: 4px 6px;
    font-size: 11px;
}

.source-download-actions {
    display: grid;
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 3px 0;
}

.source-download-actions .ui.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 34px;
    margin: 0;
    padding: 7px 10px;
    font-size: 12px;
    line-height: 1.25;
    white-space: nowrap;
}

.source-download-actions .button-pdf {
    color: var(--green-dark);
    background: #fff;
    border-color: #8fa89a;
}

.source-download-actions .button-elba {
	color: #526158;
	background: #eef1ed;
	border-color: #aebdb3;
}

.source-download-actions .button-elba.is-configured {
	color: #fff;
	background: #146f55;
	border-color: #146f55;
}

.source-download-actions .button-elba.is-success { background: #3b8f43; }

body.integration-modal-open { overflow: hidden; }

.integration-modal {
	position: fixed;
	z-index: 1100;
	inset: 0;
	display: grid;
	place-items: center;
	padding: 20px;
}

.integration-modal[hidden] { display: none; }

.integration-modal-backdrop {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	padding: 0;
	background: rgba(12, 30, 23, .76);
	border: 0;
	border-radius: 0;
	box-shadow: none;
	backdrop-filter: blur(4px);
}

.integration-modal-backdrop:hover {
	background: rgba(12, 30, 23, .76);
	box-shadow: none;
	transform: none;
}

.integration-modal-card {
	position: relative;
	z-index: 1;
	display: grid;
	width: min(540px, 100%);
	gap: 16px;
	padding: 0 24px 22px;
	background: var(--surface);
	border: 1px solid #799182;
	border-top: 6px solid var(--lime);
	border-radius: 5px;
	box-shadow: 14px 14px 0 rgba(5, 20, 14, .28);
}

.integration-modal-card > header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 20px;
	margin: 0 -24px;
	padding: 22px 24px 18px;
	color: #fff;
	background: var(--sidebar);
}

.integration-modal-eyebrow {
	display: block;
	margin-bottom: 5px;
	color: var(--lime);
	font-size: 9px;
	font-weight: 900;
	letter-spacing: .16em;
	text-transform: uppercase;
}

.integration-modal-card h2 {
	margin: 0 0 4px;
	color: #fff;
	font-size: 23px;
	line-height: 1.1;
}

.integration-modal-card header p {
	margin: 0;
	color: #c9d8d0;
	font-size: 12px;
}

.integration-modal-close {
	width: 32px;
	height: 32px;
	min-height: 32px;
	padding: 0;
	color: #fff;
	background: transparent;
	border-color: rgba(255, 255, 255, .35);
	box-shadow: none;
	font-size: 24px;
	line-height: 1;
}

.integration-modal-close:hover {
	background: var(--green);
	box-shadow: none;
	transform: none;
}

.integration-modal-field {
	display: grid;
	gap: 6px;
	margin: 0;
}

.integration-modal-field[hidden] { display: none; }

.integration-modal-field > span {
	color: var(--green-dark);
	font-size: 12px;
	font-weight: 900;
}

.integration-modal-field input,
.integration-modal-field select {
	width: 100%;
	min-height: 42px;
}

.integration-modal-field small {
	color: var(--muted);
	font-size: 10px;
	line-height: 1.4;
}

.integration-modal-status {
	min-height: 18px;
	color: var(--muted);
	font-size: 11px;
	font-weight: 800;
}

.integration-modal-status.is-error { color: var(--danger); }
.integration-modal-status.is-success { color: var(--green); }

.integration-modal-card > footer {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
}

.elba-toast {
	position: fixed;
	z-index: 1200;
	right: 20px;
	bottom: 20px;
	max-width: min(520px, calc(100vw - 40px));
	padding: 12px 15px;
	color: #fff;
	background: var(--green-dark);
	border-left: 5px solid var(--lime);
	border-radius: 3px;
	box-shadow: 6px 6px 0 rgba(5, 20, 14, .22);
	font-size: 12px;
	font-weight: 800;
	opacity: 0;
	pointer-events: none;
	transform: translateY(12px);
	transition: opacity .18s ease, transform .18s ease;
}

.elba-toast.is-visible { opacity: 1; transform: translateY(0); }
.elba-toast.is-error { background: #7a2f29; border-left-color: #f0a59d; }

.source-download-actions .button-pdf:hover {
    color: #fff;
    background: var(--green-dark);
}

.source-download-actions .ui.button:not(.button-pdf) {
    color: #fff;
    background: #14745d;
    border-color: #14745d;
}

.source-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 7px 0;
    padding: 5px 7px;
    color: var(--green-dark);
    background: #f3f6f2;
    border: 1px solid #b9c7bd;
    border-radius: 3px;
}

.source-summary input[name="filename"] {
    width: min(300px, 31vw);
    min-height: 28px;
    margin-right: 5px;
    padding: 3px 6px;
    background: #fff;
    border: 1px solid #aebdb3;
    border-radius: 2px;
    font-size: 12px;
    font-weight: 700;
}

.source-filename-field {
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 700;
}

.source-filename-field [data-filename-error] {
    position: absolute;
    top: calc(100% + 4px);
    left: 112px;
    display: none;
    color: var(--danger);
    font-size: 11px;
    font-weight: 800;
}

.source-filename-field.is-invalid input[name="filename"] {
    border-color: var(--danger);
    box-shadow: 0 0 0 2px rgba(159, 57, 48, .14);
}

.source-filename-field.is-invalid [data-filename-error] { display: block; }

.source-summary [data-download="selected"] {
    min-height: 29px;
    padding: 4px 9px;
    color: #fff;
    background: var(--green);
    border: 1px solid var(--green-dark);
    border-radius: 2px;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .02em;
}

.source-summary [data-download="selected"]:hover { background: var(--green-dark); }

.source-total {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.source-total strong {
    color: var(--green-dark);
    font-size: 12px;
    font-weight: 900;
}

.source-summary-options {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    white-space: nowrap;
}

.source-summary-options strong {
    color: var(--green-dark);
    font-size: 13px;
    font-weight: 900;
}

.round-prices-toggle {
    display: inline-flex;
    min-height: 29px;
    align-items: center;
    gap: 5px;
    padding: 4px 7px;
    color: var(--green-dark);
    background: #eaf2ec;
    border: 1px solid #aec0b3;
    border-radius: 2px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
}

.round-prices-toggle input {
    width: 15px;
    height: 15px;
    accent-color: var(--green);
}

.temp-table {
    max-width: 100%;
    overflow: auto;
    background: #fff;
    border: 1px solid #aebdb3;
    border-radius: 3px;
    box-shadow: 2px 2px 0 rgba(20, 52, 41, .08);
}

.temp-table table {
    min-width: 720px;
    border-collapse: collapse;
}

.page-source .temp-table table.styled {
    width: 100%;
    table-layout: fixed;
    color: #1c2822;
    font-family: Inter, Lato, "Helvetica Neue", Arial, sans-serif;
    font-size: 13px;
}

.page-source table.styled th:nth-child(1),
.page-source table.styled td:nth-child(1) { width: 8ch !important; }

.page-source table.styled th:nth-child(2),
.page-source table.styled td:nth-child(2) { width: auto !important; }

.page-source table.styled th:nth-child(3),
.page-source table.styled td:nth-child(3) { width: 7ch !important; }

.page-source table.styled th:nth-child(4),
.page-source table.styled td:nth-child(4) { width: 7ch !important; }

.page-source table.styled th:nth-child(5),
.page-source table.styled td:nth-child(5),
.page-source table.styled th:nth-child(6),
.page-source table.styled td:nth-child(6) { width: 16ch !important; }

.page-source table.styled th:nth-child(7),
.page-source table.styled td:nth-child(7) { width: 42px !important; }

.page-source .page-topbar {
    min-height: 88px;
    padding-top: 15px;
    padding-bottom: 15px;
}

.page-source .page-content { padding: 13px 20px 24px; }

.page-source .header-buttons { margin-bottom: 10px; }

.page-source table.styled th {
    padding: 9px 7px;
    color: #fff;
    background: #153f31;
    border-right: 1px solid rgba(255, 255, 255, .16);
    border-bottom: 1px solid #153f31;
    font-size: 11px;
    letter-spacing: .045em;
    line-height: 1.15;
    text-align: left;
}

.page-source table.styled th:last-child { border-right: 0; }
.page-source table.styled th:nth-child(n+3) { text-align: center; }

.page-source table.styled td {
    padding: 5px;
    background: #fff;
    border-right: 1px solid #d0d9d3;
    border-bottom: 1px solid #d0d9d3;
}

.page-source table.styled td:last-child { border-right: 0; }
.page-source table.styled tr:nth-child(even) td { background: #f7f9f7; }
.page-source table.styled tr:hover td { background: #edf5ef; }

.page-source table.styled td input,
.page-source table.styled td .source-name-field {
	display: block;
	width: 100%;
    min-height: 31px;
    padding: 4px 6px;
    color: #1c2822;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 2px;
    font-size: 13px;
}

.page-source table.styled td:nth-child(2) input,
.page-source table.styled td:nth-child(2) .source-name-field { font-weight: 700; }

.page-source table.styled td input:hover,
.page-source table.styled td input:focus,
.page-source table.styled td .source-name-field:hover,
.page-source table.styled td .source-name-field:focus {
    background: #fff;
    border-color: var(--green);
    box-shadow: 0 0 0 1px rgba(20, 93, 70, .08);
}

.page-source table.styled td:first-child input[readonly] {
	color: var(--green-dark);
	background: transparent;
	border-color: transparent;
	box-shadow: none;
	cursor: default;
	font-weight: 800;
}

.page-source table.styled td .source-name-field {
	height: 31px;
	line-height: 21px;
	overflow: hidden;
	resize: none;
	white-space: nowrap;
}

.page-source table.styled td .source-name-field.is-expanded {
	height: auto;
	overflow: hidden;
	overflow-wrap: anywhere;
	white-space: pre-wrap;
}

.page-source table.styled .new-line td {
    padding: 10px;
    background: #eef2ee;
    border-top: 1px solid #b8c6bc;
}
.page-source table.styled .new-line td input { background: transparent; }

table.styled.fluid { width: 100%; }

table.styled.sticky-head thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

table.styled th {
    padding: 11px 9px;
    color: #445048;
    background: #dfddd5;
    border: 0;
    border-bottom: 1px solid var(--line);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}

table.styled td {
    padding: 8px;
    background: var(--surface);
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    transition: background .15s ease;
}

table.styled tr:nth-child(even) td { background: #f3f0e9; }
table.styled tr:hover td { background: #edf3e7; }

table.styled td input {
    width: 100%;
    min-height: 32px;
    padding: 5px 7px;
    background: rgba(255, 255, 255, .7);
    border: 1px solid transparent;
    border-radius: 2px;
    font: inherit;
}

table.styled td input[type="checkbox"] {
    width: 16px;
    height: 16px;
    min-height: 16px;
    padding: 0;
}

table.styled td input:hover, table.styled td input:focus {
    background: #fff;
    border-color: var(--green);
}

table.styled .new-line td {
    padding: 10px;
    background: #e8e7df;
    text-align: center;
}

table.styled .new-line td input { background: transparent; }

table.styled [data-delete-btn] {
    width: 30px;
    height: 30px;
    min-height: 30px;
    padding: 5px;
    color: var(--danger);
    background: transparent;
    border-color: #d7b5b1;
    box-shadow: none;
    font-size: 0;
}

table.styled [data-delete-btn] svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

table.styled [data-delete-btn]:hover {
    color: #fff;
    background: var(--danger);
}

.temp-table tr { opacity: 1; transition: opacity .3s ease; }
.temp-table tr.deleted { opacity: 0; }
.temp-table tr.selected td { background: #e5f2d2; }

.inputfile {
    position: absolute;
    z-index: -1;
    width: .1px;
    height: .1px;
    opacity: 0;
    overflow: hidden;
}

.create-source-card {
    max-width: 920px;
    padding: 28px !important;
    background: var(--surface) !important;
    border: 1px solid var(--line) !important;
    border-top: 5px solid var(--lime) !important;
    box-shadow: var(--shadow) !important;
}

.create-source-card h2,
.import-mapping-head h2 {
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 900;
}

.create-source-card > p,
.import-mapping-head p {
    max-width: 760px;
    color: var(--muted);
}

.create-source-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 24px 0;
}

.import-requirements {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 14px;
    background: #edf3e7;
    border-left: 4px solid var(--green);
}

.import-requirements strong { margin-right: 4px; }

.import-requirements span {
    padding: 5px 8px;
    color: var(--green-dark);
    background: #fff;
    border: 1px solid #b8cabd;
    border-radius: 2px;
    font-size: 12px;
    font-weight: 800;
}

.import-hint {
    margin: 14px 0 0 !important;
    font-size: 12px;
}

.import-alert {
    margin-bottom: 16px;
    padding: 13px 15px;
    color: #742b25;
    background: #f7dfdc;
    border: 1px solid #d8a6a1;
    font-weight: 700;
}

.import-mapping-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
}

.import-mapping-head p { margin: 0; }

.header-row-form {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding: 12px 14px;
    background: #e6e3da;
    border: 1px solid var(--line);
}

.header-row-form label { font-weight: 800; }

.header-row-form select {
    min-width: min(650px, 70vw);
    min-height: 37px;
    padding: 7px 10px;
    background: #fff;
    border: 1px solid var(--line);
}

.import-table-wrap {
    max-width: 100%;
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.import-table {
    width: 100%;
    min-width: 850px;
    border-collapse: collapse;
}

.import-table th,
.import-table td {
    min-width: 150px;
    padding: 9px 10px;
    border-right: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    vertical-align: top;
}

.import-table th {
    color: #344039;
    background: #dfddd5;
    font-size: 12px;
}

.import-table th small {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 9px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.import-table td {
    max-width: 330px;
    overflow: hidden;
    background: var(--surface);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.import-table tbody tr:nth-child(even) td { background: #f3f0e9; }

.mapping-controls th {
    padding: 8px;
    background: var(--sidebar);
}

.mapping-controls select {
    width: 100%;
    min-height: 38px;
    padding: 7px 9px;
    color: var(--ink);
    background: #fff;
    border: 2px solid var(--lime);
    font-weight: 800;
}

.mapping-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 0;
    color: var(--muted);
}

.mapping-footer .button { flex: 0 0 auto; }

[data-table-changed] {
    top: auto !important;
    right: 24px !important;
    bottom: 24px !important;
    left: auto !important;
    padding: 12px 14px !important;
    color: #fff;
    background: var(--sidebar) !important;
    border: 1px solid var(--lime);
    border-radius: 3px;
    box-shadow: 6px 6px 0 rgba(20, 39, 31, .2) !important;
    font-weight: 700;
}

[data-table-changed] button {
    min-height: 31px;
    margin-left: 10px;
    color: #1d2d25;
    background: var(--lime);
    border-color: var(--lime);
    box-shadow: none;
}

.page-journal .page-topbar {
    min-height: 78px;
    gap: 16px;
    padding: 11px 20px;
}

.page-journal .page-eyebrow {
    margin-bottom: 3px;
    font-size: 9px;
}

.page-journal .page-topbar h1 {
    font-size: 27px;
    line-height: 1;
}

.page-journal .page-actions { gap: 7px; }

.page-journal .page-actions .button {
    min-height: 32px;
    padding: 6px 11px;
    font-size: 12px;
}

.page-journal .page-content { padding-top: 10px; }

.page-journal [data-btn="delete-selected"] {
    color: var(--danger);
    background: #fffaf9;
    border-color: #c99e99;
    box-shadow: none;
}

.page-journal [data-btn="delete-selected"]:hover {
    color: #fff;
    background: var(--danger);
    border-color: var(--danger);
}

.page-journal .temp-table {
    border-color: #aebdb3;
    border-radius: 3px;
    box-shadow: 2px 2px 0 rgba(20, 52, 41, .08);
}

.page-journal table.styled {
    width: 100%;
    min-width: 1040px;
    border-collapse: collapse;
    color: #1c2822;
    font-family: Inter, Lato, "Helvetica Neue", Arial, sans-serif;
    font-size: 13px;
}

.page-journal table.styled th {
    padding: 9px 8px;
    color: #fff;
    background: #153f31;
    border-right: 1px solid rgba(255, 255, 255, .16);
    border-bottom: 1px solid #153f31;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .045em;
    line-height: 1.15;
    text-align: left;
    vertical-align: middle;
}

.page-journal table.styled td {
    padding: 7px 8px;
    background: #fff;
    border-right: 1px solid #d0d9d3;
    border-bottom: 1px solid #d0d9d3;
    vertical-align: middle;
}

.page-journal table.styled th:last-child,
.page-journal table.styled td:last-child { border-right: 0; }

.page-journal table.styled tr:nth-child(even) td { background: #f7f9f7; }
.page-journal table.styled tr:hover td { background: #edf5ef; }

.page-journal table.styled th:nth-child(1),
.page-journal table.styled td:nth-child(1) { text-align: center; }

.page-journal table.styled th:nth-child(2),
.page-journal table.styled td:nth-child(2),
.page-journal table.styled th:nth-child(5),
.page-journal table.styled td:nth-child(5) { text-align: right; }

.page-journal table.styled input[type="checkbox"] { accent-color: var(--green); }

.page-journal table.styled a {
    color: var(--green);
    font-weight: 800;
    text-decoration: none;
}

.page-journal table.styled a:hover { text-decoration: underline; }

.history-generations {
    display: grid;
    min-width: 250px;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.history-generations li {
    display: flex;
    flex-wrap: wrap;
    gap: 3px 7px;
    align-items: baseline;
}

.history-generations strong { color: var(--green-dark); }

.history-generations span {
    color: var(--muted);
    font-size: 12px;
}

.company-mail-actions { border-top: 1px dashed var(--line); padding-top: 8px; }
.company-mail-actions .is-configured { color: #fff; background: var(--green); border-color: var(--green); }
.mail-connection-status { color: var(--muted); font-size: 11px; font-weight: 800; }
.mail-connection-status.is-configured { color: var(--green); background: transparent; border: 0; }
.modal-spacer { flex: 1; }
.mail-settings-card { width: min(760px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; }
.mail-settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mail-secret-field, .mail-template-wide { grid-column: 1 / -1; }
.mail-manual-settings { display: grid; grid-column: 1 / -1; grid-template-columns: 2fr 100px 1fr; gap: 12px; padding: 12px; background: #eef3ef; border: 1px solid var(--line); }
.mail-manual-settings[hidden] { display: none; }
.integration-modal-field textarea { width: 100%; resize: vertical; }
.email-recipient-field { position: relative; }
.email-recipient-field > input { width: 230px; min-height: 31px; font-size: 12px; }
.email-suggestions { position: absolute; z-index: 40; top: calc(100% + 4px); right: 0; left: 0; overflow: hidden; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.email-suggestions[hidden] { display: none; }
.email-suggestions > div { display: grid; grid-template-columns: 1fr 32px; border-bottom: 1px solid var(--line-soft); }
.email-suggestions button { min-height: 32px; padding: 5px 8px; color: var(--ink); background: #fff; border: 0; box-shadow: none; text-align: left; }
.email-suggestions button:hover { color: var(--green); background: #eef5f0; transform: none; box-shadow: none; }
.email-suggestions .email-suggestion-remove { color: var(--danger); text-align: center; }
.source-summary [data-email-preview] { min-height: 31px; padding: 5px 10px; font-size: 11px; }

.send-summary-card { width: min(920px, 100%); max-height: calc(100vh - 30px); gap: 12px; overflow: hidden; }
.send-summary-card > header { padding-top: 17px; padding-bottom: 14px; }
.send-summary-common { display: grid; gap: 8px; padding: 9px 11px 10px; background: #eaf2ec; border: 1px solid #b8cbbf; border-left: 4px solid var(--green); }
.send-summary-common-title { display: flex; align-items: baseline; gap: 7px; padding-bottom: 6px; border-bottom: 1px solid rgba(30, 99, 72, .18); }
.send-summary-common-title strong { color: var(--green-dark); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.send-summary-common-title span { color: var(--muted); font-size: 10px; font-weight: 700; }
.send-summary-common-grid { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(360px, 1.55fr); align-items: end; gap: 12px; }
.send-summary-recipient { display: grid; min-width: 0; gap: 4px; }
.send-summary-recipient > span { color: var(--green-dark); font-size: 10px; font-weight: 900; }
.send-summary-recipient > strong { overflow: hidden; min-height: 31px; padding: 7px 9px; background: #fff; border: 1px solid var(--line); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.send-schedule-controls { display: grid; grid-template-columns: 1fr 145px; gap: 9px; }
.send-schedule-controls label, .send-edit-field { display: grid; gap: 5px; color: var(--green-dark); font-size: 11px; font-weight: 900; }
.send-schedule-controls input { width: 100%; min-height: 31px; padding-top: 5px; padding-bottom: 5px; }
.send-summary-warning { padding: 10px 12px; color: #6d3b0e; background: #fff3d4; border: 1px solid #dfba71; font-size: 12px; font-weight: 800; }
.send-message-list { display: grid; max-height: min(48vh, 520px); gap: 7px; overflow-y: auto; padding-right: 4px; }
.send-message-card { display: grid; gap: 0; padding: 7px 9px; background: #fafbf8; border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 3px; }
.send-message-card.is-dragging { opacity: .45; }
.send-message-head { display: grid; grid-template-columns: minmax(170px, 1.25fr) minmax(285px, 2fr) minmax(112px, .8fr) 14px auto; align-items: center; gap: 7px; }
.send-drag { color: var(--muted); cursor: grab; font-size: 16px !important; letter-spacing: -4px; }
.send-company-chip { display: grid; min-width: 0; gap: 2px; padding: 6px 8px; background: #e5f2f8; border: 1px solid #9cc9df; border-radius: 3px; }
.send-company-chip strong { overflow: hidden; color: #174d65; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.send-company-chip span { overflow: hidden; color: #55717d; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.send-finance { display: grid; grid-template-columns: repeat(3, minmax(82px, 1fr)); gap: 5px; }
.send-finance > span { display: grid; min-width: 0; gap: 1px; padding: 5px 7px; background: #f0f2ef; border: 1px solid var(--line-soft); border-radius: 3px; }
.send-finance small, .send-message-schedule small { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.send-finance strong { overflow: hidden; color: #34443b; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.send-finance .is-percent { background: #fff5dc; border-color: #ead39a; }
.send-finance .is-total { background: #e8f4eb; border-color: #a9ceb3; }
.send-finance .is-total strong { color: var(--green-dark); }
.send-message-schedule { display: grid; min-width: 0; gap: 2px; }
.send-message-schedule time { color: #43554b; font-size: 10px; font-weight: 800; line-height: 1.25; }
.send-preview-pdf { min-height: 29px !important; padding: 5px 8px !important; white-space: nowrap; }
.send-message-details { margin-top: 1px; border-top: 1px solid var(--line-soft); }
.send-message-details > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0 1px; color: var(--green); cursor: pointer; font-size: 11px; font-weight: 900; list-style: none; }
.send-message-details > summary::-webkit-details-marker { display: none; }
.send-message-details > summary::before { content: '›'; flex: 0 0 auto; font-size: 17px; line-height: 1; transition: transform .15s ease; }
.send-message-details[open] > summary::before { transform: rotate(90deg); }
.send-message-details-action { margin-left: auto; color: var(--muted); font-size: 10px; font-weight: 700; }
.send-message-editor { display: grid; gap: 7px; padding-top: 8px; }
.send-edit-field input, .send-edit-field textarea { width: 100%; }
.send-card-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.send-card-actions .button, .send-message-head .button { min-height: 27px; padding: 4px 7px; font-size: 10px; }
.send-summary-card > footer { padding-top: 2px; }

.history-mailings { display: grid; width: 100%; min-width: 0; gap: 6px; margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line); }
.history-mailing { overflow: hidden; background: #fff; border: 1px solid var(--line); border-left: 4px solid #89958d; border-radius: 3px; }
.history-mailing:target { box-shadow: 0 0 0 2px rgba(30, 99, 72, .15); }
.history-mailing.status-running { border-left-color: #2c78b6; }
.history-mailing.status-completed { border-left-color: var(--green); }
.history-mailing.status-failed, .history-mailing.status-partial_error { border-left-color: var(--danger); }
.history-mailing-summary { display: grid; width: 100%; min-height: 42px; grid-template-columns: minmax(150px,1fr) auto auto 16px; align-items: center; gap: 8px; padding: 6px 8px; color: var(--ink); background: #f6f8f5; border: 0; box-shadow: none; text-align: left; }
.history-mailing-summary:hover { color: var(--ink); background: #edf4ef; box-shadow: none; transform: none; }
.mailing-summary-main { display: grid; min-width: 0; gap: 1px; }
.history-mailing-summary small { overflow: hidden; color: var(--muted); font-size: 10px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.mailing-progress-copy, .mailing-status { color: var(--green-dark); font-size: 11px; font-weight: 900; }
.mailing-toggle-icon { color: var(--muted); font-size: 17px; line-height: 1; transform: rotate(0); transition: transform .18s ease; }
.history-mailing-summary[aria-expanded="true"] .mailing-toggle-icon { transform: rotate(180deg); }
.status-failed .mailing-status, .status-partial_error .mailing-status { color: var(--danger); }
.mailing-progress { height: 4px; background: #dfe6e1; }
.mailing-progress span { display: block; height: 100%; background: var(--green); transition: width .25s ease; }
.history-mailing-details { display: grid; gap: 6px; padding: 7px; }
.history-mailing-details[hidden] { display: none; }
.mailing-actions, .mailing-message-actions { display: flex; gap: 6px; }
.mailing-actions [hidden], .mailing-message-actions [hidden] { display: none !important; }
.mailing-actions .button, .mailing-message-actions .button { min-height: 24px; padding: 3px 6px; font-size: 9px; }
.mailing-message-list { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.mailing-message-list > li { display: grid; gap: 4px; padding: 6px 7px; background: #f8faf7; border: 1px solid var(--line-soft); }
.mailing-company-top { display: flex; align-items: center; gap: 7px; }
.mailing-company-top > strong { min-width: 0; overflow: hidden; color: var(--green-dark); text-overflow: ellipsis; white-space: nowrap; }
.mailing-company-top .mailing-message-result { margin-left: auto; white-space: nowrap; }
.mailing-company-meta { display: flex; min-width: 0; flex-wrap: wrap; gap: 2px 9px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.mailing-company-meta > span { overflow-wrap: anywhere; }
.mailing-finance { color: #43554b; font-weight: 700; }
.mailing-message-result { color: var(--muted); font-size: 10px; }
.mailing-copy summary { cursor: pointer; color: var(--green); font-size: 11px; font-weight: 800; }
.mailing-copy pre { max-height: 160px; overflow: auto; padding: 7px; white-space: pre-wrap; background: #fff; border: 1px solid var(--line-soft); font: inherit; font-size: 11px; }
.mailing-message-error { display: block; color: var(--danger); font-size: 10px; font-style: normal; }
.mailing-message-error[hidden] { display: none; }

@media (max-width: 720px) {
    .history-mailing-summary { grid-template-columns: minmax(125px, 1fr) auto 16px; }
    .mailing-progress-copy { display: none; }
    .mailing-company-top { align-items: flex-start; flex-wrap: wrap; }
    .mailing-company-top .mailing-message-result { margin-left: 0; }
}

.page-login .layout-sidebar { flex-basis: 280px; }

.page-login .page-content {
    display: grid;
    place-items: start center;
    padding-top: 70px;
}

.page-login .page-content > form {
    display: grid;
    width: min(420px, 100%);
    gap: 12px;
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 5px solid var(--lime);
    border-radius: 3px;
    box-shadow: var(--shadow);
}

.page-login .page-content > form input, .page-login .page-content > form button {
    width: 100%;
    min-height: 43px;
}

body.whats-new-open { overflow: hidden; }

.whats-new-modal {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(12, 30, 23, .76);
    backdrop-filter: blur(4px);
}

.whats-new-modal[hidden] { display: none; }

.whats-new-dialog {
    position: relative;
    display: flex;
    width: min(900px, 100%);
    max-height: min(860px, calc(100vh - 48px));
    flex-direction: column;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid #799182;
    border-top: 7px solid var(--lime);
    border-radius: 5px;
    box-shadow: 14px 14px 0 rgba(5, 20, 14, .28);
    outline: none;
}

.whats-new-close {
    position: absolute;
    z-index: 1;
    top: 14px;
    right: 16px;
    display: grid;
    width: 38px;
    height: 38px;
    padding: 0;
    place-items: center;
    color: #fff;
    background: var(--green-dark);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 28px;
    font-weight: 400;
    line-height: 1;
}

.whats-new-close:hover { background: var(--green); }

.whats-new-header {
    padding: 30px 70px 22px 32px;
    color: #fff;
    background: var(--sidebar);
}

.whats-new-kicker {
    display: block;
    margin-bottom: 7px;
    color: var(--lime);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .18em;
}

.whats-new-header h2 {
    margin: 0 0 8px;
    color: #fff;
    font-size: clamp(27px, 4vw, 40px);
    font-weight: 900;
    letter-spacing: -.035em;
    line-height: 1;
}

.whats-new-header p {
    max-width: 640px;
    margin: 0;
    color: #c9d8d0;
    font-size: 14px;
}

.whats-new-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    overflow-y: auto;
    background: var(--line-soft);
}

.whats-new-item {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 13px;
    min-height: 126px;
    padding: 20px 22px;
    background: var(--surface);
}

.whats-new-item:last-child { grid-column: 1 / -1; }

.whats-new-number {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: #1a3026;
    background: var(--lime);
    border-radius: 2px;
    font-size: 11px;
    font-weight: 900;
}

.whats-new-item h3 {
    margin: 1px 0 6px;
    color: var(--green-dark);
    font-size: 15px;
    font-weight: 900;
}

.whats-new-item p {
    margin: 0;
    color: #56625b;
    font-size: 13px;
    line-height: 1.45;
}

.whats-new-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 17px 24px;
    background: #e9e6dd;
    border-top: 1px solid var(--line);
}

.whats-new-dismiss {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    font-weight: 800;
}

.whats-new-dismiss input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--green);
}

@media (max-width: 1050px) {
    .layout-sidebar { flex-basis: 155px; }
    .brand-name { font-size: 20px; }
    .page-topbar, .page-content { padding-right: 20px; padding-left: 20px; }
    .source-summary { align-items: stretch; flex-direction: column; }
    .source-summary input[name="filename"] { width: 100%; }
	.source-summary-options { justify-content: space-between; }
}

@media (max-width: 1200px) {
    .source-companies { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .layout-container { display: block; }
    .layout-sidebar { position: relative; width: 100%; height: auto; min-height: 0; }
    .sidebar-nav { display: grid; grid-template-columns: 1fr 1fr; }
    .sidebar-caption, .sidebar-footer { display: none; }
    .page-topbar { min-height: 100px; align-items: flex-start; flex-direction: column; }
	.source-summary-options { align-items: stretch; flex-direction: column; }
    .import-mapping-head, .mapping-footer, .header-row-form { align-items: stretch; flex-direction: column; }
    .header-row-form select { min-width: 0; width: 100%; }
	.company-primary-row { grid-template-columns: minmax(0, 1fr) 50px 80px 26px; }
	.company-primary-row > .company-select { grid-column: 1 / -1; }
	.company-primary-row > .company-details-toggle { grid-row: 2; }
	.source-download-actions { grid-row: 3; grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.company-extra-settings { grid-template-columns: 1fr 1fr; }
    .whats-new-modal { padding: 10px; }
    .whats-new-dialog { max-height: calc(100vh - 20px); }
    .whats-new-header { padding: 25px 58px 19px 20px; }
    .whats-new-list { grid-template-columns: 1fr; }
    .whats-new-item:last-child { grid-column: auto; }
    .whats-new-item { min-height: 0; padding: 16px 18px; }
    .whats-new-footer { align-items: stretch; flex-direction: column; }
    .whats-new-footer .button { width: 100%; }
	.mail-settings-grid, .mail-manual-settings, .send-schedule-controls, .send-summary-common-grid { grid-template-columns: 1fr; }
	.send-summary-card { overflow-y: auto; }
	.send-message-list { max-height: none; overflow: visible; padding-right: 0; }
	.send-message-head { grid-template-columns: minmax(150px, 1fr) 14px auto; }
	.send-finance { grid-column: 1 / -1; }
	.send-message-schedule { grid-column: 1; }
	.source-total { align-items: stretch; flex-wrap: wrap; white-space: normal; }
	.email-recipient-field, .email-recipient-field > input { width: 100%; }
}
