:root {
	--primary: #4361ee;
	--primary-light: #eef2ff;
	--secondary: #3f37c9;
	--success: #4cc9f0;
	--danger: #f72585;
	--warning: #f8961e;
	--info: #4895ef;
	--dark: #212529;
	--light: #f8f9fa;
	--gray: #6c757d;
	--gray-light: #e9ecef;
	--border-radius: 8px;
	--shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
	--shadow-md: 0 4px 6px rgba(0,0,0,0.1);
	--shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
	--transition: all 0.2s ease;
	
	--bg:#f6f7f9;
	--card:#fff;
	--muted:#7b7f87;
	--accent:#2463ff;
	--danger:#e74c3c;
	--radius:8px;
	--gap:8px;
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

body {
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
	line-height: 1.6;
	color: var(--dark);
	background-color: #f5f7fa;
	-webkit-font-smoothing: antialiased;
}

.tab-content {
	display: none;
}

.tab-content.active {
	display: block;
}

.hidden {
	display: none !important;
}

.container {
	max-width: 1400px;
	margin: 0 auto;
	padding: 0 20px;
}

/* Header */
.app-header {
	background-color: white;
	box-shadow: var(--shadow-sm);
	padding: 16px 0;
	position: sticky;
	top: 0;
	z-index: 100;
}

.header-content {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.app-title {
	font-size: 20px;
	font-weight: 600;
	color: var(--primary);
	display: flex;
	align-items: center;
	gap: 10px;
}

.app-title svg {
	width: 24px;
	height: 24px;
}

.user-info {
	display: flex;
	align-items: center;
	gap: 12px;
}

.user-avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background-color: var(--primary-light);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--primary);
	font-weight: 600;
	font-size: 14px;
}

.logout-btn {
	background: none;
	border: none;
	color: var(--gray);
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 14px;
	padding: 6px 10px;
	border-radius: var(--border-radius);
	transition: var(--transition);
}

.logout-btn:hover {
	background-color: var(--gray-light);
	color: var(--danger);
}

/* Main layout */
.main-layout {
	display: grid;
	grid-template-columns: 240px 1fr;
	gap: 24px;
	padding: 24px 0;
    height: calc(100vh - 80px); /* Высота минус высота header */
}

/*Order Vkladka*/

.order-tab {
	padding: 8px 16px;
	background-color: var(--gray-light);
	border-radius: var(--border-radius);
	cursor: pointer;
	font-size: 14px;
	white-space: nowrap;
	display: flex;
	align-items: center;
	gap: 8px;
	transition: var(--transition);
}

.order-tab.active {
	background-color: var(--primary);
	color: white;
}

.order-tab .close-tab {
	background: none;
	border: none;
	color: inherit;
	cursor: pointer;
	display: flex;
	align-items: center;
	padding: 0;
}

.order-form {
	display: none;
}

.order-form.active {
	display: block;
}

/* Sidebar */
.sidebar {
	background-color: white;
	border-radius: var(--border-radius);
	box-shadow: var(--shadow-sm);
	padding: 20px 0;
	height: fit-content;
	position: sticky;
	top: 80px;
    max-height: calc(100vh - 104px); /* Максимальная высота с учетом отступов */
}

.nav-item {
	display: flex;
	align-items: center;
	padding: 12px 20px;
	color: var(--dark);
	text-decoration: none;
	font-weight: 500;
	transition: var(--transition);
	border-left: 3px solid transparent;
}

.nav-item:hover {
	background-color: var(--primary-light);
	color: var(--primary);
}

.nav-item.active {
	background-color: var(--primary-light);
	color: var(--primary);
	border-left-color: var(--primary);
}

.nav-item svg {
	width: 20px;
	height: 20px;
	margin-right: 12px;
}

/* Content area */
.content-area {
	background-color: white;
	border-radius: var(--border-radius);
	box-shadow: var(--shadow-sm);
	padding: 24px;
	height: calc(100vh - 128px); /* Высота с учетом отступов */
    overflow-y: auto; /* Включаем прокрутку */
}

.content-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 24px;
}

.content-title {
	font-size: 20px;
	font-weight: 600;
}

/* Search and filters */
.search-bar {
	display: flex;
	gap: 12px;
	margin-bottom: 20px;
}

.search-input {
	flex: 1;
	padding: 10px 16px;
	border: 1px solid var(--gray-light);
	border-radius: var(--border-radius);
	font-size: 14px;
	transition: var(--transition);
}

.search-input:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
}

/* Buttons */
.btn {
	padding: 10px 16px;
	border-radius: var(--border-radius);
	font-weight: 500;
	font-size: 14px;
	cursor: pointer;
	transition: var(--transition);
	border: none;
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.btn svg {
	width: 16px;
	height: 16px;
}

.btn-primary {
	background-color: var(--primary);
	color: white;
}

.btn-primary:hover {
	background-color: var(--secondary);
}

.btn-outline {
	background-color: white;
	border: 1px solid var(--gray-light);
	color: var(--dark);
}

.btn-outline:hover {
	background-color: var(--gray-light);
}

.btn-success {
	background-color: #10b981;
	color: white;
}

.btn-danger {
	background-color: var(--danger);
	color: white;
}

.btn-sm {
	padding: 6px 12px;
	font-size: 13px;
}

/* Table */
.orders-table-container {
	scrollbar-width: thin;
	scrollbar-color: var(--gray-light) white;
}

.orders-table-container::-webkit-scrollbar {
	width: 8px;
	height: 8px;
}

.orders-table-container::-webkit-scrollbar-track {
	background: white;
}

.orders-table-container::-webkit-scrollbar-thumb {
	background-color: var(--gray-light);
	border-radius: 4px;
}

.orders-table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	font-size: 14px;
}

.orders-table th {
	background-color: var(--light);
	color: var(--gray);
	font-weight: 600;
	text-align: left;
	padding: 8px 12px;
	border-bottom: 1px solid var(--gray-light);
	top: 0;
}

.orders-table td {
	padding: 8px 12px;
	border-bottom: 1px solid var(--gray-light);
	vertical-align: middle;
}

.orders-table tr:last-child td {
	border-bottom: none;
}

.orders-table tr:hover td {
	background-color: var(--primary-light);
}

/* Status badges */
.status-badge {
	display: inline-flex;
	align-items: center;
	padding: 6px 12px;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 500;
	color: white;
}

.status-new {
	background-color: var(--warning);
}

.status-ready {
	background-color: var(--success);
}

.status-deleted {
	background-color: #ff0000;
	color: #000000;
}

.status-delivered {
	background-color: var(--info);
}

.status-completed {
	background-color: #8b5cf6;
}

.status-notinstalled {
	background-color: #ff5029;
}

/* Order ID */
.order-id {
	font-weight: 600;
	color: var(--primary);
}

/* Finance info */
.finance-no-debt {
	color: var(--success);
}

.finance-debt {
	color: var(--danger);
}

/* Previews */
.previews-mini {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 120px; /* ширина ячейки, подбираешь под себя */
  scrollbar-width: thin; /* тонкий скролл в Firefox */
}

.previews-mini::-webkit-scrollbar {
  height: 6px; /* высота скроллбара */
}

.previews-mini::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
}

.preview-mini {
	flex: 0 0 auto;
	width: 48px;
	height: 48px;
	object-fit: cover;
	border-radius: 6px;
	border: 1px solid var(--gray-light);
	cursor: pointer;
	transition: var(--transition);
}

.preview-mini:hover {
	transform: scale(1.1);
	box-shadow: var(--shadow-sm);
	z-index: 1000;
}

/* Action buttons */
.table-actions {
	display: flex;
	gap: 8px;
}

.action-btn {
	width: 32px;
	height: 32px;
	border-radius: 6px;
	border: none;
	background-color: var(--primary-light);
	color: var(--primary);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: var(--transition);
}

.action-btn:hover {
	background-color: var(--primary);
	color: white;
}

.action-btn.danger {
	background-color: #fee2e2;
	color: var(--danger);
}

.action-btn.danger:hover {
	background-color: var(--danger);
	color: white;
}

.action-btn.success {
	background-color: #dcfce7;
	color: #10b981;
}

.action-btn.success:hover {
	background-color: #10b981;
	color: white;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

.loan-card {
	transition: var(--transition);
}

.loan-card:hover {
	box-shadow: var(--shadow-sm);
}

/* Стили для прокрутки */
.modal-body {
	scrollbar-width: thin;
	scrollbar-color: var(--gray-light) white;
}

.modal-body::-webkit-scrollbar {
	width: 8px;
}

.modal-body::-webkit-scrollbar-track {
	background: white;
}

.modal-body::-webkit-scrollbar-thumb {
	background-color: var(--gray-light);
	border-radius: 4px;
}


/* Modal */
.modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0,0,0,0.5);
	z-index: 1000;
	justify-content: center;
	align-items: center;
}

.modal-content {
	background-color: white;
	border-radius: var(--border-radius);
	width: 90%;
	max-width: 800px;
	max-height: 90vh;
	overflow-y: auto;
	padding: 24px;
	box-shadow: var(--shadow-lg);
	position: relative;
}

.modal-content-debtoraddnew {
	background-color: white;
	border-radius: var(--border-radius);
	max-width: 400px;
	max-height: 90vh;
	overflow-y: auto;
	padding: 24px;
	box-shadow: var(--shadow-lg);
	position: relative;
}

.modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--gray-light);
}

.modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.compact-view {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    padding: 16px;
    background: var(--primary-light);
    border-radius: var(--border-radius);
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 12px;
    color: var(--gray);
    font-weight: 500;
}

.info-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--dark);
}

.finance-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 16px;
    background: var(--light);
    border-radius: var(--border-radius);
}

.finance-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.finance-label {
    font-size: 12px;
    color: var(--gray);
}

.finance-value {
    font-size: 16px;
    font-weight: 600;
}

.finance-value.success {
    color: var(--success);
}

.finance-value.danger {
    color: var(--danger);
}

.payments-section {
    padding: 16px;
    background: var(--light);
    border-radius: var(--border-radius);
}

.payments-list.compact {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.payment-item.compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid var(--gray-light);
}

.order-details {
    padding: 16px;
    background: var(--light);
    border-radius: var(--border-radius);
}

.details-content {
    font-size: 14px;
    line-height: 1.5;
    color: var(--dark);
    padding: 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid var(--gray-light);
}

.previews-section {
    padding: 16px;
    background: var(--light);
    border-radius: var(--border-radius);
}

.previews-container.compact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
}

.preview-image.compact {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid var(--gray-light);
    cursor: pointer;
    transition: var(--transition);
}

.preview-image.compact:hover {
    transform: scale(1.05);
    border-color: var(--primary);
}

.modal-footer.compact {
    padding: 16px;
    border-top: 1px solid var(--gray-light);
    background: var(--light);
}

.close-modal {
	background: none;
	border: none;
	font-size: 24px;
	cursor: pointer;
	color: var(--gray);
	transition: var(--transition);
}

.close-modal:hover {
	color: var(--danger);
}

.modal-body {
	display: grid;
	gap: 24px;
}

.modal-section {
	margin-bottom: 20px;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: "";
    width: 4px;
    height: 16px;
    background: var(--primary);
    border-radius: 2px;
}

.info-row {
	display: flex;
	margin-bottom: 12px;
}

.info-label {
	width: 120px;
	color: var(--gray);
	font-size: 14px;
}

.info-value {
	flex: 1;
	font-weight: 500;
}

/* Previews in modal */
.previews-container {
	display: flex;
	gap: 12px;
	overflow-x: auto;
	padding: 0px 0;
	margin: 0px 0;
}

.preview-image {
	width: 150px;
	height: 150px;
	object-fit: cover;
	border-radius: 8px;
	border: 1px solid var(--gray-light);
	cursor: pointer;
	transition: var(--transition);
}

.preview-image:hover {
	transform: scale(1.03);
	box-shadow: var(--shadow-sm);
}

/* Payments */
.payments-list {
	margin-top: 16px;
}

.payment-item {
	display: flex;
	justify-content: space-between;
	padding: 12px 0;
	border-bottom: 1px solid var(--gray-light);
}

.payment-item:last-child {
	border-bottom: none;
}

.payment-method {
	font-weight: 500;
}

.payment-amount {
	font-weight: 600;
	color: #10b981;
}

/* Modal footer */
.modal-footer {
	display: flex;
	justify-content: flex-end;
	gap: 12px;
	margin-top: 24px;
	padding-top: 16px;
	border-top: 1px solid var(--gray-light);
}

/* Login screen */
.login-screen {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 100vh;
	background-color: #f5f7fa;
	padding: 20px;
}

.login-card {
	background-color: white;
	border-radius: var(--border-radius);
	box-shadow: var(--shadow-lg);
	padding: 40px;
	width: 100%;
	max-width: 500px;
	
	text-align: center;
}

.login-logo {
	margin-bottom: 24px;
}

.login-title {
	font-size: 24px;
	font-weight: 600;
	margin-bottom: 24px;
	color: var(--primary);
}

.form-group {
	margin-bottom: 20px;
	text-align: left;
}

.form-label {
	display: block;
	margin-bottom: 2px;
	font-weight: 500;
	font-size: 14px;
}

.form-control {
	width: 100%;
	padding: 12px 16px;
	border: 1px solid var(--gray-light);
	border-radius: var(--border-radius);
	font-size: 14px;
	transition: var(--transition);
}

.form-control:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
}

.login-btn {
	width: 100%;
	margin-top: 16px;
}

/* Empty state */
.empty-state {
	text-align: center;
	padding: 40px 20px;
}

.empty-icon {
	margin-bottom: 16px;
	color: var(--gray-light);
}

.empty-text {
	color: var(--gray);
	margin-bottom: 24px;
}


@media (max-width: 768px) {
	.modal-body {
		grid-template-columns: 1fr;
	}
	
	.orders-table th, 
	.orders-table td {
		padding: 12px;
		font-size: 13px;
	}
	
	.preview-mini {
		width: 36px;
		height: 36px;
	}
	
	.login-card {
		padding: 30px 20px;
	}
}

/* Icons */
.icon {
	width: 20px;
	height: 20px;
}

/* Checkbox */
.checkbox-container {
	display: flex;
	align-items: center;
	margin-bottom: 16px;
}

.checkbox-input {
	margin-right: 8px;
}

.checkbox-label {
	font-size: 14px;
}

/* Добавьте в секцию стилей */
.form-section {
	background-color: var(--light);
	border-radius: var(--border-radius);
	padding: 20px;
	margin-bottom: 24px;
}

.radio-group {
	display: flex;
	gap: 16px;
	margin-top: 2px;
}

.radio-label {
	display: flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
}

.payment-block {
	background-color: white;
	border: 1px solid var(--gray-light);
	border-radius: var(--border-radius);
	padding: 12px;
	margin-bottom: 12px;
}

.payment-row {
	display: flex;
	gap: 12px;
	align-items: flex-end;
}

.preview-upload {
	border: 2px dashed var(--gray-light);
	border-radius: var(--border-radius);
	padding: 2px;
	text-align: center;
	cursor: pointer;
	transition: var(--transition);
	margin-bottom: 16px;
}

.preview-upload:hover {
	border-color: var(--primary);
	background-color: var(--primary-light);
}


.file-upload {
	border: 2px dashed var(--gray-light);
	border-radius: var(--border-radius);
	padding: 5px;
	text-align: center;
	cursor: pointer;
	transition: var(--transition);
	margin-bottom: 10px;
}

.file-upload:hover {
	border-color: var(--primary);
	background-color: var(--primary-light);
}

.preview-item {
	position: relative;
	width: 60px;
	height: 60px;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: var(--shadow-sm);
}

.file-item {
	position: relative;
	width: 100px;
	height: 100px;
	border-radius: 8px;
	overflow: hidden;
	background-color: var(--primary-light);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 8px;
	box-shadow: var(--shadow-sm);
	text-align: center;
}		

/* Вкладка / контейнер ограничение по высоте */
.addorder-form-shell{
	max-height:500px;
	max-width: 1048px;
	display:flex;
	gap:30px;
	align-items:flex-start;
	overflow:hidden;
}

/* Left column with inputs, right column scrollable */
.addorder-left, .addorder-right, .addorder-center { 
	display:flex; 
	flex-direction:column; 
	gap:8px; 
}

.addorder-left { 
	flex: 1 1 320px;
	min-width:320px; 
}

.addorder-center {
	width:360px; 
	max-width:35%;
}

.addorder-right { 
	width:400px; 
	max-width:35%;
}

.addorder-input[type="text"], .addorder-input[type="number"], .addorder-textarea {
	width:100%;
	box-sizing:border-box;
	border:1px solid #e0e4ea;
	border-radius:8px;
	padding:8px 10px;
	background:#fff;
	outline: none;
	font-size:13px;
}

.addorder-textarea{
	resize: none;
	height: 100px;
	line-height: 1.2;
	overflow: auto
}
.addorder-label-small{font-size:12px;color:var(--muted);display:block;margin-bottom:4px}

/* кнопки */
.addorder-btn {
	display:inline-flex;
	align-items:center;
	gap:8px;
	background:#fff;
	border:1px solid #e0e4ea;
	padding:8px 10px;
	border-radius:8px;
	cursor:pointer;
	user-select:none;
	font-size:13px;
}

.addorder-btn-primary{
	background:linear-gradient(180deg,var(--accent),#174dbb);
	color:#fff;
	border:0;
}

.addorder-btn-ghost{background:transparent;border:1px dashed #e0e4ea}

.addorder-small{
	padding: 8px 10px;
	font-size: 12px;
	border-radius: 6px
}

.addorder-row { 
	display:flex; 
	gap:8px; 
	align-items:center;
	flex-wrap:wrap; 
	flex-wrap: nowrap;
}

.addorder-muted{color:var(--muted);font-size:13px}

/* previews */
.addorder-thumbs {
	display:flex;
	gap:8px;
	align-items:center;
	overflow-x:auto;
	padding-bottom:4px;
}

.addorder-thumb {
	width:56px;height:42px;border-radius:6px;
	border:1px solid #e6e9ee; background:#fafafa;
	position:relative; flex:0 0 56px; display:flex;align-items:center;justify-content:center;
}

.addorder-thumb img{max-width:100%; max-height:100%; border-radius:6px; object-fit:cover;}

.addorder-thumb .addorder-del {
	position:absolute; top:-8px; right:-8px; width:20px;height:20px;border-radius:50%;
	display:flex;align-items:center;justify-content:center;font-weight:bold;
	background:var(--danger); color:#fff; cursor:pointer; font-size:12px; box-shadow:0 2px 6px rgba(0,0,0,0.15)
}

/* toggle group for Цех/Офис */
.addorder-toggle-group{display:flex; gap:6px; align-items:center;}

.addorder-toggle-btn{
	padding:6px 10px; 
	border-radius:8px; 
	border:1px solid #e0e4ea; 
	cursor:pointer; 
	background:#fff; 
	font-size:13px;
}

.addorder-toggle-btn-active{
	background: var(--accent); 
	color: #fff; 
	border-color: transparent
}

/* payments */
.addorder-payments {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-top: 8px;
}

.addorder-payment-row {
	display: flex;
	flex-direction: column;
	gap: 5px;
	width: 100%;
	padding: 6px;
	border: 1px solid #dfe7f3;
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 4px 14px rgba(15,23,42,.05);
}

.addorder-payment-top {
	display: flex;
	align-items: center;
	gap: 5px;
	width: 100%;
}

.addorder-payment-amount-input,
.addorder-payment-row input[type="number"] {
	flex: 1 1 auto;
	min-width: 0;
	width: auto !important;
	height: 32px;
	padding: 5px 10px;
	font-size: 13px;
	font-weight: 700;
	border-radius: 10px;
}

.addorder-payment-bottom {
	display: flex;
	align-items: center;
	gap: 5px;
	width: 100%;
}

.addorder-method-switch {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 4px;
	flex: 1 1 auto;
	min-width: 0;
}

.addorder-method-btn {
	height: 28px;
	padding: 0 6px;
	border-radius: 9px;
	font-size: 11px;
	min-width: 0;
}

.addorder-percent-buttons {
	display: flex;
	gap: 4px;
	flex: 0 0 auto;
}

.addorder-percent-buttons button,
.addorder-payment-delete {
	height: 32px;
	min-width: 42px;
	padding: 0 8px;
	border-radius: 9px;
	font-size: 11px;
	font-weight: 800;
	white-space: nowrap;
}

.addorder-payment-delete {
	height: 28px;
	min-width: 30px;
	padding: 0;
	font-size: 17px;
	line-height: 1;
}

@media (max-width: 1100px) {
	.addorder-center {
		width: 340px;
	}
	.addorder-method-btn span:last-child {
		display: none;
	}
}

@media (max-width: 768px) {
	.addorder-payment-row {
		padding: 5px;
		gap: 5px;
	}
	.addorder-payment-top,
	.addorder-payment-bottom {
		flex-wrap: nowrap;
	}
	.addorder-percent-buttons button {
		min-width: 38px;
		padding: 0 6px;
	}
	.addorder-method-switch {
		width: auto;
	}
}

/* files area */
.addorder-dropzone {
border:1px dashed #e0e4ea;border-radius:8px;padding:8px; min-height:68px; display:flex; align-items:center; gap:8px;
background:#fff;
}

.drop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.9);
  border: 2px dashed var(--accent);
  border-radius: 8px;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  pointer-events: none;
}

.drop-text {
  font-size: 18px;
  font-weight: bold;
  color: var(--accent);
  text-align: center;
}

.drop-overlay.visible {
  display: flex;
}


.addorder-files-list {
display: flex;
flex-direction: column;
gap: 6px;
max-height: 70px;
overflow: auto;
padding-right: 6px;
flex: 1;         /* вот это ключевое */
min-width: 0;    /* важно для flex-элементов, чтобы не ломать размеры */
}

.addorder-file-item{display:flex;align-items:center;gap:8px;background:#f7f8fb;padding:6px;border-radius:6px}

.addorder-file-item .addorder-name{flex:1; font-size:13px; color:#111}

.addorder-file-item .addorder-del{cursor:pointer;color:var(--danger);font-weight:bold;padding:4px 6px}

/* bottom action */
.addorder-footer {
	margin-top: auto; display:flex; justify-content:flex-end; gap:8px; align-items:center;
}

/* compact helpers */
.addorder-muted-small{
	font-size:12px;
	color:var(--muted)
}

.addorder-scrollable-right{overflow:auto;max-height:220px;padding-right:6px}

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

	.addorder-form-shell{
		flex-direction:column; 
		max-height:none
	}
	
	.addorder-right {
		width:auto
	}
}

.method-buttons {
	display: flex;
	gap: 8px;
	margin-top: 5px;
}

.method-btn {
	flex: 1;
	padding: 8px 12px;
	border: 1px solid #e0e4ea;
	border-radius: 8px;
	background: white;
	cursor: pointer;
	transition: all 0.2s ease;
}

.method-btn.active {
	background: var(--primary);
	color: white;
	border-color: var(--primary);
}

#payment-modal .modal-content {
	width: 500px; /* Оптимальный размер */
}


.loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,0,0,.3);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.status-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.status-filter-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    border-radius: 4px;
    cursor: pointer;
}

.status-filter-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.no-results .empty-state {
    text-align: center;
    padding: 40px 0;
    color: #666;
}

.error-message .empty-state.error {
    color: #ff4d4f;
}

.btn-retry {
    background: #1890ff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 16px;
}

.btn-retry:hover {
    background: #40a9ff;
}

tr.updating {
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

tr.updated {
    background-color: rgba(46, 204, 113, 0.2);
    transition: background-color 2s ease;
}

.month-filter {
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background-color: white;
    font-size: 14px;
    margin-right: 10px;
    cursor: pointer;
}

.password-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-container input {
    padding-right: 40px;
    width: 100%;
}

.toggle-password {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--gray);
    border-radius: 4px;
}

.toggle-password:hover {
    color: var(--dark);
    background-color: var(--light-gray);
}

.status-active {
    background-color: var(--success);
    color: white;
}

.status-inactive {
    background-color: var(--gray);
    color: var(--text);
}

.finance-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.finance-filter-btn {
    padding: 8px 12px;
    border: 1px solid #e0e4ea;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.finance-filter-btn:hover {
    background: #f8f9fa;
    border-color: #4361ee;
}

.finance-filter-btn.active {
    background: #4361ee;
    color: white;
    border-color: #4361ee;
}

.finance-filters .form-control {
    min-width: 120px;
    height: 36px;
}

.finance-filters input[type="date"] {
    min-width: 140px;
    height: 36px;
}

/* Добавьте эти стили в styles.css */
.today-orders-sidebar {
    margin-top: 20px;
    padding: 16px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.today-orders-header {
    margin-bottom: 12px;
}

.today-orders-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.today-orders-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    max-height: 400px;
    
    /* Скрываем scrollbar по умолчанию */
    scrollbar-width: none; /* Для Firefox */
}

/* Скрываем scrollbar по умолчанию для Webkit */
.today-orders-list::-webkit-scrollbar {
    width: 0;
    background: transparent;
}

/* Показываем scrollbar при наведении */
.today-orders-list:hover {
    /* Для Firefox */
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f8f9fa;
}

.today-orders-list:hover::-webkit-scrollbar {
    width: 4px; /* Очень тонкий ползунок */
}

.today-orders-list:hover::-webkit-scrollbar-track {
    background: #f8f9fa; /* Светлый фон трека */
    border-radius: 2px;
    margin: 4px 0;
}

.today-orders-list:hover::-webkit-scrollbar-thumb {
    background: #c1c1c1; /* Цвет ползунка */
    border-radius: 2px;
}

.today-orders-list:hover::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8; /* Цвет при наведении */
}

.today-order-number {
    font-weight: 600;
    color: #4361ee;
    margin-bottom: 0px;
	
	display: flex;
    justify-content: space-between;
    align-items: center;
}

.today-order-phone {
    color: #6c757d;
    font-size: 14px;
    margin-bottom: 0px;
}

.today-order-notify-btn {
	position: static; /* или static */
    right: 20px;
    margin-left: auto; /* выравнивание вправо */
    padding: 6px 6px;
    background: #4361ee;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px;
    transition: background-color 0.2s;
}

.today-order-notify-btn:hover {
    background: #3a56d4;
}

.today-order-item {
	border-bottom: 3px solid #cfd7fa; 
}

.today-order-empty {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 20px;
}

/*уведомления*/
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 350px;
}

.notification {
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease-out;
    transition: transform 0.3s ease, opacity 0.3s ease;
    position: relative;
    overflow: hidden;
}

.notification.success {
    background-color: #4caf50;
    color: white;
    border-left: 4px solid #2e7d32;
}

.notification.error {
    background-color: #f44336;
    color: white;
    border-left: 4px solid #c62828;
}

.notification.fade-out {
    animation: slideOut 0.3s ease-in forwards;
}

.notification-close {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 16px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.notification-close:hover {
    opacity: 1;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Стили для модального окна редактирования */
#edit-previews-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
}

#edit-previews-container img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid #e0e4ea;
}

#edit-previews-container img:hover {
  border-color: #4361ee;
}

.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  margin-bottom: 10px;
}

.checkbox-label input[type="checkbox"] {
  margin-right: 10px;
}

.checkmark {
  position: relative;
  height: 20px;
  width: 20px;
  background-color: #fff;
  border: 2px solid #ccc;
  border-radius: 3px;
  margin-right: 10px;
}

.checkbox-label input[type="checkbox"]:checked ~ .checkmark {
  background-color: #4361ee;
  border-color: #4361ee;
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-label input[type="checkbox"]:checked ~ .checkmark:after {
  display: block;
}

/* Стили для группировки платежей */
.payment-group-row {
    background-color: #f8f9fa;
    cursor: pointer;
    font-weight: 500;
}

.payment-group-row:hover {
    background-color: #e9ecef;
}

.payment-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-group-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.toggle-group-btn:hover {
    background-color: #dee2e6;
}

.toggle-group-btn svg {
    transition: transform 0.2s ease;
}

.payment-child-row {
    background-color: #fafafa;
}

.payment-child-name {
    padding-left: 20px !important;
    color: #6c757d;
}

.hidden {
    display: none;
}

.customer-dropdown-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: #666;
}

.customer-dropdown-btn:hover {
    background-color: #f0f0f0;
}

.customer-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.customer-suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.customer-suggestion-item:hover,
.customer-suggestion-item.selected {
    background-color: #f5f5f5;
}

.customer-suggestion-item:last-child {
    border-bottom: none;
}

.customer-name {
    font-weight: 500;
}

.customer-phone {
    font-size: 13px;
    color: #666;
}


.custom-confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

.custom-confirm-modal {
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  width: 90%;
  text-align: center;
  animation: slideUp 0.3s ease;
}

.custom-confirm-message {
  font-size: 16px;
  margin-bottom: 20px;
  color: #333;
  line-height: 1.5;
}

.custom-confirm-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.custom-confirm-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  min-width: 100px;
}

.custom-confirm-cancel {
  background: #f0f0f0;
  color: #666;
}

.custom-confirm-cancel:hover {
  background: #e0e0e0;
}

.custom-confirm-continue {
  background: #007bff;
  color: white;
}

.custom-confirm-continue:hover {
  background: #0056b3;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { 
    opacity: 0;
    transform: translateY(20px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}


.preview-zoomed {
  position: fixed;
  max-width: 400px;
  max-height: 400px;
  border: 2px solid white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  z-index: 1001;
  pointer-events: none;
  background: white;
  object-fit: contain;
}

.preview-wrapper {
  position: relative;
  display: inline-block;
  margin-right: 5px;
}

.search-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

#search-payments {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

#search-payments:focus {
    outline: none;
    border-color: #4361ee;
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}

.install-deadline-block {
    display:flex;
    gap:10px;
    align-items:flex-start;
    margin-top:2px;
    flex-wrap:wrap;
}

.install-deadline-picker {
    display:flex;
    align-items:center;
    gap:8px;
    padding:8px 10px;
    background:#f8f9ff;
    border:1px solid var(--gray-light);
    border-radius:10px;
    flex-wrap:wrap;
}

.install-deadline-input {
    min-width:140px;
}

.install-deadline-quick {
    display:flex;
    gap:6px;
    flex-wrap:wrap;
}

.install-deadline-btn {
    border:none;
    background:var(--primary-light);
    color:var(--primary);
    border-radius:999px;
    padding:6px 10px;
    font-size:12px;
    font-weight:600;
    cursor:pointer;
    transition:var(--transition);
}

.install-deadline-btn:hover {
    background:var(--primary);
    color:#fff;
}

.install-deadline-cell {
    font-size:13px;
    line-height:1.35;
    white-space:nowrap;
}

.install-deadline-cell.overdue {
    color:var(--danger);
    font-weight:700;
}

.install-deadline-cell.soon {
    color:var(--warning);
    font-weight:700;
}

.details-content {
    white-space: pre-wrap;
    word-break: break-word;
}


.payment-user-assignment {
  width: 100%;
}

.payment-user-assignment-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.payment-user-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  margin: 0;
  font-size: 14px;
  white-space: nowrap;
}

.payment-user-checkbox input {
  margin: 0;
}

.payment-user-select {
  min-width: 180px;
  max-width: 240px;
}

.payment-user-assignment.compact {
  margin-top: 10px;
  margin-bottom: 0;
}

.payment-user-assignment.compact .payment-user-assignment-row {
  gap: 8px;
}

.payment-user-assignment.compact .payment-user-checkbox {
  font-size: 13px;
}

.payment-user-assignment.compact .payment-user-select {
  min-width: 170px;
  max-width: 220px;
  padding: 7px 10px;
  font-size: 13px;
}

.finance-payment-assignment {
  margin-top: 10px;
}

.addorder-global-payment-assignment {
  margin: 2px 0 10px;
}


.finance-user-stat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.finance-user-stat-name {
  font-weight: 600;
  color: #212529;
  min-width: 0;
  flex: 1 1 180px;
  line-height: 1.2;
}

.finance-user-stat-metrics {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.finance-user-stat-chip {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 1px 8px;
  min-width: 140px;
  padding: 6px 8px;
  background: #f8f9fa;
  border-radius: 7px;
}

.finance-user-stat-chip-label {
  grid-column: 1 / 2;
  font-size: 12px;
  color: #6c757d;
}

.finance-user-stat-chip-value {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  justify-self: end;
  font-size: 16px;
  font-weight: 700;
  color: #212529;
}

.finance-user-stat-chip-sub {
  grid-column: 1 / 2;
  font-size: 11px;
  color: #6c757d;
}

@media (max-width: 768px) {
  .finance-user-stat-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .finance-user-stat-metrics {
    width: 100%;
  }

  .finance-user-stat-chip {
    flex: 1 1 100%;
    min-width: 0;
  }
}

/* =========================================================
   ADAPTIVE RESPONSIVE FIXES — desktop / tablet / mobile
   Добавлено для нормального отображения на телефоне
   ========================================================= */

html {
    -webkit-text-size-adjust: 100%;
}

body {
    min-width: 0;
    overflow-x: hidden;
}

img, svg, video, canvas {
    max-width: 100%;
}

button, input, select, textarea {
    font: inherit;
}

.content-area,
.sidebar,
.orders-table-container,
.addorder-form-shell,
.modal-content,
.modal-content-debtoraddnew {
    max-width: 100%;
}

.orders-table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--gray-light);
    border-radius: 12px;
}

.orders-table {
    min-width: 760px;
}

.status-filters,
.finance-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.status-filter-btn,
.finance-filter-btn,
.month-filter,
.form-control,
.search-input,
.btn,
.addorder-btn,
.addorder-toggle-btn,
.logout-btn {
    min-height: 40px;
}

.addorder-form-shell {
    width: 100%;
    max-width: none;
    min-width: 0;
}

.addorder-left,
.addorder-center,
.addorder-right {
    min-width: 0;
}

.addorder-center,
.addorder-right {
    max-width: none;
}

.phone-row {
    display:flex;
    gap:10px;
    margin-bottom:10px;
}

.client-phone-input {
    flex:1;
}

.remove-phone {
    width:40px;
    height:38px;
    background:#dc3545;
    color:white;
    border:none;
    border-radius:6px;
    cursor:pointer;
}

@media (max-width: 1100px) {
    .container {
        max-width: 100%;
        padding-left: 14px;
        padding-right: 14px;
    }

    .main-layout {
        grid-template-columns: 210px minmax(0, 1fr);
        gap: 14px;
    }

    .content-area {
        padding: 18px;
    }

    .addorder-form-shell {
        gap: 16px;
    }

    .addorder-left {
        flex-basis: 260px;
        min-width: 260px;
    }

    .addorder-center,
    .addorder-right {
        width: 32%;
    }
}

@media (max-width: 900px) {
    .app-header {
        padding: 10px 0;
    }

    .header-content {
        gap: 10px;
    }

    .app-title {
        min-width: 0;
        font-size: 16px;
    }

    .app-title span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .user-info {
        gap: 8px;
        flex-shrink: 0;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
    }

    .logout-btn {
        padding: 8px;
        font-size: 0;
    }

    .logout-btn svg {
        width: 20px;
        height: 20px;
    }

    .main-layout {
        display: block;
        height: auto;
        padding: 12px 0 18px;
    }

    .sidebar {
        position: sticky;
        top: 56px;
        z-index: 90;
        height: auto;
        max-height: none;
        padding: 8px;
        margin-bottom: 12px;
        overflow: hidden;
        border-radius: 14px;
    }

    .sidebar nav {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 3px;
        scrollbar-width: none;
    }

    .sidebar nav::-webkit-scrollbar {
        display: none;
    }

    .nav-item {
        flex: 0 0 auto;
        border-left: 0;
        border-radius: 12px;
        padding: 10px 12px;
        font-size: 13px;
        white-space: nowrap;
        background: #f8fafc;
    }

    .nav-item.active {
        border-left: 0;
        background: var(--primary);
        color: #fff;
    }

    .nav-item svg {
        width: 18px;
        height: 18px;
        margin-right: 7px;
    }

    .today-orders-sidebar {
        display: none !important;
    }

    .content-area {
        height: auto;
        min-height: calc(100vh - 150px);
        overflow: visible;
        padding: 16px;
        border-radius: 14px;
    }

    .content-header {
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 16px;
    }

    .content-title {
        font-size: 19px;
    }

    .search-bar {
        margin-bottom: 12px;
    }

    .status-filters,
    .finance-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .status-filter-btn,
    .finance-filter-btn,
    .month-filter {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .addorder-form-shell {
        display: grid;
        grid-template-columns: 1fr;
        gap: 14px;
        max-height: none;
        overflow: visible;
    }

    .addorder-left,
    .addorder-center,
    .addorder-right {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        flex-basis: auto;
        background: #fff;
    }

    .addorder-row,
    .addorder-payment-top,
    .addorder-payment-bottom,
    .addorder-footer {
        flex-wrap: wrap;
    }

    .addorder-row input,
    .addorder-row button,
    .addorder-payment-row input,
    .addorder-payment-row button,
    .addorder-footer button {
        min-width: 0;
    }

    .addorder-footer {
        justify-content: stretch;
    }

    .addorder-toggle-group,
    .addorder-btn-primary {
        width: 100%;
    }

    .addorder-toggle-btn,
    .addorder-btn-primary {
        flex: 1;
        justify-content: center;
    }

    .modal {
        padding: 10px;
        align-items: flex-start;
        overflow-y: auto;
    }

    .modal-content,
    .modal-content-debtoraddnew {
        width: 100%;
        max-height: none;
        margin: 10px 0;
        border-radius: 14px;
    }

    .modal-body {
        max-height: none;
    }
}

@media (max-width: 560px) {
    :root {
        --border-radius: 12px;
    }

    .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    .login-screen {
        padding: 14px;
    }

    .login-card {
        width: 100%;
        padding: 24px 16px;
        border-radius: 18px;
    }

    .login-title {
        font-size: 20px;
    }

    .app-title svg {
        width: 22px;
        height: 22px;
        flex: 0 0 22px;
    }

    .main-layout {
        padding-top: 10px;
    }

    .sidebar {
        top: 52px;
        margin-left: -2px;
        margin-right: -2px;
    }

    .content-area {
        padding: 12px;
        box-shadow: none;
        border: 1px solid var(--gray-light);
    }

    .content-header {
        display: block;
    }

    .content-title {
        font-size: 18px;
        margin-bottom: 10px;
    }

    .search-input,
    .form-control,
    .month-filter,
    .addorder-input[type="text"],
    .addorder-input[type="number"],
    .addorder-textarea {
        font-size: 16px; /* убирает авто-зум Safari/iPhone */
        padding: 10px 12px;
    }

    .status-filter-btn,
    .finance-filter-btn {
        padding: 9px 11px;
        border-radius: 999px;
        font-size: 12px;
    }

    .orders-table-container {
        margin-left: -4px;
        margin-right: -4px;
        width: calc(100% + 8px);
    }

    .orders-table {
        min-width: 680px;
        font-size: 13px;
    }

    .orders-table th,
    .orders-table td {
        padding: 9px 10px;
    }

    .preview-mini,
    .preview-item {
        width: 44px;
        height: 44px;
    }

    .addorder-dropzone {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .addorder-files-list,
    .addorder-thumbs {
        width: 100%;
    }

    .addorder-payment-top,
    .addorder-payment-bottom,
    .addorder-method-switch,
    .addorder-percent-buttons {
        width: 100%;
    }

    .addorder-payment-row input[type="number"] {
        width: 100%;
    }

    .addorder-method-btn,
    .addorder-percent-buttons button {
        flex: 1;
    }

    .modal-header,
    .modal-footer {
        padding-left: 14px;
        padding-right: 14px;
    }

    .modal-body {
        padding: 14px;
    }

    .btn,
    .addorder-btn {
        justify-content: center;
    }
}

/* =========================================================
   IMPROVEMENTS: desktop modal limits + mobile order cards
   ========================================================= */
@media (min-width: 901px) {
    .modal {
        padding: 24px;
    }

    .modal-content,
    .modal-content-debtoraddnew {
        width: min(90vw, 820px);
        max-width: 820px;
        max-height: 88vh;
    }

    #order-modal .modal-content {
        width: min(90vw, 860px);
        max-width: 860px;
    }

    #payment-modal .modal-content {
        width: min(90vw, 500px);
        max-width: 500px;
    }
}

@media (max-width: 700px) {
    /* Только основная таблица просмотра заказов превращается в карточки */
    #orders .orders-table-container {
        overflow: visible;
        border: 0;
        background: transparent;
        margin-left: 0;
        margin-right: 0;
        width: 100%;
    }

    #orders .orders-table,
    #orders .orders-table thead,
    #orders .orders-table tbody,
    #orders .orders-table tr,
    #orders .orders-table th,
    #orders .orders-table td {
        display: block;
    }

    #orders .orders-table {
        min-width: 0;
        width: 100%;
        border-collapse: separate;
        border-spacing: 0;
        font-size: 12px;
    }

    #orders .orders-table thead {
        display: none;
    }

    #orders #orders-table-body {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        width: 100%;
    }

    #orders #orders-table-body tr {
        min-width: 0;
        background: #fff;
        border: 1px solid #e6eaf3;
        border-radius: 14px;
        box-shadow: 0 4px 14px rgba(16, 24, 40, .06);
        padding: 8px;
        overflow: hidden;
    }

    #orders .orders-table tr:hover td {
        background: transparent;
    }

    #orders .orders-table td {
        border: 0;
        padding: 3px 0;
        min-width: 0;
        overflow-wrap: anywhere;
    }

    #orders .orders-table td:nth-child(1) {
        font-size: 13px;
        font-weight: 800;
        color: #1f2937;
        padding-bottom: 5px;
        border-bottom: 1px solid #eef2f7;
        margin-bottom: 4px;
    }

    #orders .orders-table td:nth-child(1)::before {
        content: '№ ';
        color: var(--primary);
    }

    #orders .orders-table td:nth-child(2) {
        font-weight: 600;
        color: #374151;
        line-height: 1.25;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        min-height: 30px;
    }

    #orders .orders-table td:nth-child(3) {
        font-size: 13px;
        font-weight: 800;
        color: #111827;
    }

    #orders .orders-table td:nth-child(3)::before {
        content: 'Сумма: ';
        font-weight: 600;
        color: #7b8794;
    }

    #orders .orders-table td:nth-child(4) {
        min-height: 42px;
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 5px 0;
    }

    #orders .preview-mini,
    #orders .preview-item,
    #orders .orders-table td:nth-child(4) img {
        width: 38px;
        height: 38px;
        border-radius: 8px;
        object-fit: cover;
    }

    #orders .orders-table td:nth-child(5) {
        padding-top: 2px;
    }

    #orders .orders-table td:nth-child(5) .status-badge,
    #orders .orders-table td:nth-child(5) span {
        max-width: 100%;
        white-space: normal;
    }

    #orders .status-badge {
        padding: 5px 7px;
        border-radius: 999px;
        font-size: 10px;
        line-height: 1.15;
    }

    #orders .orders-table td:nth-child(6),
    #orders .table-actions {
        display: flex;
        gap: 5px;
        flex-wrap: wrap;
        padding-top: 6px;
    }

    #orders .orders-table td:nth-child(6) .btn,
    #orders .table-actions .btn,
    #orders .orders-table td:nth-child(6) button,
    #orders .table-actions button {
        min-height: 30px;
        min-width: 30px;
        padding: 6px;
        border-radius: 8px;
        flex: 1 1 30px;
        font-size: 0;
    }

    #orders .orders-table td:nth-child(6) svg,
    #orders .table-actions svg {
        width: 16px;
        height: 16px;
        margin: 0;
    }
}

@media (max-width: 380px) {
    #orders #orders-table-body {
        gap: 6px;
    }

    #orders #orders-table-body tr {
        padding: 7px;
        border-radius: 12px;
    }

    #orders .orders-table {
        font-size: 11px;
    }

    #orders .orders-table td:nth-child(1),
    #orders .orders-table td:nth-child(3) {
        font-size: 12px;
    }

    #orders .preview-mini,
    #orders .preview-item,
    #orders .orders-table td:nth-child(4) img {
        width: 32px;
        height: 32px;
    }
}

/* =========================================================
   FULL MODERN REDESIGN — desktop + mobile
   Добавлено поверх старых стилей без изменения логики JS
   ========================================================= */
:root {
    --primary: #2563eb;
    --primary-light: #eff6ff;
    --secondary: #1d4ed8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --dark: #0f172a;
    --light: #f8fafc;
    --gray: #64748b;
    --gray-light: #e2e8f0;
    --border-radius: 16px;
    --radius: 16px;
    --card: rgba(255, 255, 255, .92);
    --bg: #f1f5f9;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow-md: 0 10px 25px rgba(15, 23, 42, .08);
    --shadow-lg: 0 24px 70px rgba(15, 23, 42, .16);
    --transition: all .22s ease;
}

html {
    background: #f1f5f9;
}

body {
    color: var(--dark);
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, .12), transparent 30%),
        radial-gradient(circle at top right, rgba(14, 165, 233, .10), transparent 32%),
        linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    min-height: 100vh;
}

.container {
    max-width: 1480px;
}

/* Login */
.login-screen {
    background:
        radial-gradient(circle at 20% 15%, rgba(37, 99, 235, .22), transparent 34%),
        radial-gradient(circle at 80% 85%, rgba(16, 185, 129, .16), transparent 30%),
        linear-gradient(135deg, #f8fafc, #e2e8f0);
}

.login-card {
    border: 1px solid rgba(255, 255, 255, .8);
    border-radius: 28px;
    box-shadow: 0 30px 90px rgba(15, 23, 42, .16);
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(18px);
}

.login-logo {
    width: 68px;
    height: 68px;
    margin: 0 auto 16px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #dbeafe, #eff6ff);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 12px 30px rgba(37,99,235,.18);
}

.login-title {
    letter-spacing: -.03em;
}

.form-label {
    color: #334155;
    font-weight: 700;
}

.form-control,
.search-input,
.month-filter,
.addorder-input[type="text"],
.addorder-input[type="number"],
.addorder-textarea,
.install-deadline-input {
    border: 1px solid #dbe3ef;
    border-radius: 14px;
    background: #fff;
    box-shadow: inset 0 1px 0 rgba(15, 23, 42, .02);
}

.form-control:focus,
.search-input:focus,
.month-filter:focus,
.addorder-input:focus,
.addorder-textarea:focus,
.install-deadline-input:focus {
    outline: none;
    border-color: rgba(37, 99, 235, .75);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

/* Header */
.app-header {
    padding: 14px 0;
    background: rgba(255, 255, 255, .82);
    border-bottom: 1px solid rgba(226, 232, 240, .9);
    box-shadow: 0 8px 30px rgba(15, 23, 42, .05);
    backdrop-filter: blur(16px);
}

.app-title {
    color: #0f172a;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -.025em;
}

.app-title svg {
    padding: 5px;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: #eff6ff;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    color: #fff;
    box-shadow: 0 10px 25px rgba(37, 99, 235, .24);
}

.logout-btn {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
    border-radius: 14px;
    min-height: 38px;
}

.logout-btn:hover {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #e11d48;
}

/* Layout */
.main-layout {
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 22px;
    padding: 22px 0;
}

.sidebar,
.content-area {
    border: 1px solid rgba(226, 232, 240, .88);
    background: rgba(255, 255, 255, .88);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(14px);
}

.sidebar {
    border-radius: 24px;
    padding: 14px;
}

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

.nav-item {
    border-left: 0;
    border-radius: 16px;
    padding: 12px 14px;
    color: #475569;
    font-weight: 700;
}

.nav-item svg {
    width: 19px;
    height: 19px;
    margin-right: 10px;
}

.nav-item:hover {
    background: #f1f5f9;
    color: var(--primary);
    transform: translateX(2px);
}

.nav-item.active {
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 14px 28px rgba(37, 99, 235, .22);
}

.today-orders-sidebar {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #e2e8f0;
}

.today-orders-header h3 {
    color: #334155;
    font-size: 14px;
    font-weight: 800;
}

.today-order-item,
.today-orders-list > div {
    border-radius: 5px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

.content-area {
    border-radius: 26px;
    padding: 26px;
}

.content-header {
    margin-bottom: 18px;
}

.content-title {
    font-size: 24px;
    font-weight: 850;
    letter-spacing: -.035em;
    color: #0f172a;
}

.search-bar {
    margin-bottom: 14px;
}

.search-input {
    min-height: 48px;
    padding: 12px 16px 12px 44px;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 16px center,
        #fff;
}

/* Buttons and filters */
.btn,
.addorder-btn,
.status-filter-btn,
.finance-filter-btn,
.method-btn,
.addorder-toggle-btn,
.addorder-method-btn,
.install-deadline-btn,
.customer-dropdown-btn {
    border-radius: 14px;
    font-weight: 750;
    transition: var(--transition);
}

.btn,
.addorder-btn {
    box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
}

.btn-primary,
.addorder-btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 12px 24px rgba(37, 99, 235, .22);
}

.btn-primary:hover,
.addorder-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 32px rgba(37, 99, 235, .28);
}

.status-filters,
.finance-filters {
    gap: 10px;
    margin-bottom: 18px;
}

.status-filter-btn,
.finance-filter-btn,
.month-filter {
    min-height: 40px;
    border: 1px solid #dbe3ef;
    background: #fff;
    color: #475569;
    padding: 9px 13px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.status-filter-btn:hover,
.finance-filter-btn:hover {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: var(--primary);
}

.status-filter-btn.active,
.finance-filter-btn.active {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 12px 22px rgba(37, 99, 235, .22);
}

/* Desktop: compact status buttons */
@media (min-width: 901px) {
    .status-filter-btn,
    .finance-filter-btn {
        min-height: 36px;
        padding: 7px 12px;
        font-size: 13px;
        border-radius: 999px;
        flex: 0 0 auto;
        width: auto !important;
    }

    #payment-modal .modal-content {
        width: min(90vw, 420px) !important;
        max-width: 420px !important;
    }
}

/* Tables */
.orders-table-container {
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    overflow: auto;
    background: #fff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .05);
}

.orders-table {
    border-collapse: separate;
    border-spacing: 0;
}

.orders-table th {
    position: sticky;
    z-index: 1;
    top: 0;
    background: #f8fafc;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .045em;
    font-size: 11px;
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
}

.orders-table td {
    padding: 13px 14px;
    border-bottom: 1px solid #eef2f7;
}

.orders-table tr:hover td {
    background: #f8fbff;
}

.order-id {
    color: #1d4ed8;
    font-weight: 850;
}

.status-badge {
    border-radius: 999px;
    padding: 7px 10px;
    font-weight: 800;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}

.preview-mini {
    border-radius: 12px;
    border-color: #e2e8f0;
    box-shadow: 0 5px 14px rgba(15, 23, 42, .09);
}

.action-btn {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
}

/* Add order form */
.addorder-form-shell {
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(248,250,252,.9), rgba(255,255,255,.96));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 16px 40px rgba(15, 23, 42, .06);
    padding: 16px;
}

.addorder-left,
.addorder-center,
.addorder-right {
    border-radius: 10px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .04);
}

.addorder-label-small,
.addorder-muted,
.addorder-muted-small {
    color: #475569;
    font-weight: 800;
}

.addorder-dropzone {
    border: 1.5px dashed #cbd5e1;
    border-radius: 18px;
    background: #f8fafc;
}

.addorder-dropzone:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.addorder-payment-row,
.addorder-file-item,
.loan-card,
.finance-summary,
.info-grid,
.modal-section {
    border-radius: 18px;
    border: 1px solid #e2e8f0;
    background: #fff;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .04);
}

.addorder-method-switch,
.addorder-percent-buttons {
    gap: 6px;
}

.addorder-method-btn,
.addorder-percent-buttons button,
.install-deadline-btn {
    border-color: #dbe3ef;
    background: #fff;
}

.addorder-method-btn-active,
.addorder-percent-buttons button.addorder-secondary,
.addorder-toggle-btn-active {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

/* Modals */
.modal {
    background: rgba(15, 23, 42, .58);
    backdrop-filter: blur(8px);
}

.modal-content,
.modal-content-debtoraddnew {
    border-radius: 26px;
    border: 1px solid rgba(255,255,255,.72);
    background: rgba(255,255,255,.96);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid #e2e8f0;
}

.modal-title {
    font-weight: 850;
    letter-spacing: -.025em;
}

.close-modal {
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.close-modal:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* Mobile polish */
@media (max-width: 900px) {
    body {
        background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    }

    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .app-header {
        padding: 10px 0;
    }

    .app-title {
        font-size: 16px;
    }

    .app-title svg {
        width: 32px;
        height: 32px;
        flex-basis: 32px;
    }

    .sidebar {
        top: 58px;
        border-radius: 20px;
        padding: 8px;
        box-shadow: 0 10px 26px rgba(15, 23, 42, .08);
    }

    .sidebar nav {
        flex-direction: row;
    }

    .nav-item {
        border-radius: 14px;
        padding: 10px 12px;
        background: #f8fafc;
    }

    .nav-item:hover {
        transform: none;
    }

    .content-area {
        border-radius: 22px;
        padding: 14px;
    }

    .content-title {
        font-size: 21px;
    }

    .search-input {
        min-height: 46px;
    }

    .status-filters,
    .finance-filters {
        gap: 8px;
        margin-left: -2px;
        margin-right: -2px;
    }

    .status-filter-btn,
    .finance-filter-btn,
    .month-filter {
        border-radius: 999px;
        min-height: 38px;
        padding: 8px 12px;
        font-size: 12px;
    }

    .addorder-form-shell {
        border-radius: 22px;
        padding: 10px;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    .addorder-left,
    .addorder-center,
    .addorder-right {
        border-radius: 20px;
        padding: 14px;
    }

    .modal-content,
    .modal-content-debtoraddnew {
        border-radius: 22px;
        padding: 16px;
    }
}

@media (max-width: 700px) {
    #orders #orders-table-body {
        gap: 10px;
    }

    #orders #orders-table-body tr {
        border-radius: 18px;
        border: 1px solid #e2e8f0;
        box-shadow: 0 10px 25px rgba(15, 23, 42, .08);
        background: linear-gradient(180deg, #fff, #fbfdff);
    }

    #orders .orders-table td:nth-child(1) {
        color: #0f172a;
        border-bottom-color: #e2e8f0;
    }

    #orders .orders-table td:nth-child(3) {
        color: #1d4ed8;
    }

    #orders .table-actions .btn,
    #orders .table-actions button,
    #orders .orders-table td:nth-child(6) button {
        border-radius: 12px;
        background: #eff6ff;
        color: #1d4ed8;
    }
}

@media (max-width: 420px) {
    .container {
        padding-left: 8px;
        padding-right: 8px;
    }

    .content-area {
        padding: 10px;
        border-radius: 18px;
    }

    #orders #orders-table-body {
        gap: 8px;
    }

    #orders #orders-table-body tr {
        padding: 8px;
        border-radius: 16px;
    }

    #orders .status-badge {
        font-size: 9.5px;
        padding: 5px 7px;
    }
}

/* Compact add-order payment row override */
#addOrderPayments .addorder-payment-top,
#addOrderPayments .addorder-payment-bottom {
    display: flex;
    align-items: center;
    flex-wrap: nowrap !important;
    width: 100%;
}
#addOrderPayments .addorder-payment-top { gap: 5px; }
#addOrderPayments .addorder-payment-bottom { gap: 5px; }
#addOrderPayments .addorder-payment-amount-input {
    flex: 1 1 auto;
    min-width: 0;
    width: auto !important;
}
#addOrderPayments .addorder-percent-buttons {
    width: auto !important;
    flex: 0 0 auto;
}
#addOrderPayments .addorder-method-switch {
    width: auto !important;
    flex: 1 1 auto;
    min-width: 0;
}
#addOrderPayments .addorder-payment-delete {
    flex: 0 0 30px;
}
@media (max-width: 480px) {
    #addOrderPayments .addorder-method-btn span:last-child { display: none; }
    #addOrderPayments .addorder-percent-buttons button { min-width: 36px; padding: 0 5px; }
}

/* Новый аккуратный редактор заказа */
#edit-order-modal .modal-content-debtoraddnew {
  width: min(980px, calc(100vw - 24px));
  max-height: 92vh;
  overflow: hidden;
}

#edit-order-modal .modal-body {
  max-height: calc(92vh - 74px);
  overflow-y: auto;
  padding: 18px;
  background: #f5f7fb;
}

.edit-order-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.edit-order-card {
  background: #fff;
  border: 1px solid #e6eaf2;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.edit-order-grid {
  display: grid;
  gap: 14px;
}

.edit-order-top-grid {
  grid-template-columns: minmax(220px, 0.9fr) minmax(300px, 1.3fr);
  align-items: stretch;
}

.edit-order-meta-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
}

.edit-order-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#edit-order-modal .form-group {
  margin-bottom: 0;
}

.edit-info-group textarea {
  min-height: 132px;
  resize: vertical;
}

.edit-section-title {
  font-size: 14px;
  font-weight: 800;
  color: #111827;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.edit-section-title::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #4361ee;
  display: inline-block;
}

.edit-muted-hint {
  display: block;
  margin-top: 6px;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.35;
}

.edit-place-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.edit-place-toggle .addorder-toggle-btn {
  width: 100%;
  justify-content: center;
}

.edit-install-box {
  background: #f8fafc;
  border: 1px solid #e7edf5;
  border-radius: 12px;
  padding: 12px;
}

.edit-install-check {
  margin: 0;
  font-weight: 600;
  color: #374151;
}

#edit-install-deadline-picker {
  margin-top: 10px;
}

.edit-payments-summary {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) repeat(2, minmax(140px, 0.8fr));
  gap: 12px;
  margin-bottom: 12px;
}

.edit-payment-stat {
  background: #f8fafc;
  border: 1px solid #e7edf5;
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.edit-payment-stat span {
  font-size: 12px;
  color: #6b7280;
  font-weight: 700;
}

.edit-payment-stat strong {
  font-size: 19px;
  color: #111827;
}

.edit-payment-stat strong.edit-negative {
  color: #ef4444;
}

.edit-payments-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow: auto;
}

.edit-payment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #edf1f7;
  border-radius: 12px;
}

.edit-payment-row div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.edit-payment-row strong {
  font-size: 15px;
  color: #111827;
}

.edit-payment-row span,
.edit-payment-row em,
.edit-empty-payments {
  font-size: 12px;
  color: #6b7280;
  font-style: normal;
}

.edit-empty-payments {
  padding: 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  text-align: center;
}

#edit-previews-container {
  min-height: 92px;
  padding: 10px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
}

#edit-previews-container .preview-wrapper {
  position: relative;
  width: 86px;
  height: 86px;
}

#edit-previews-container .preview-wrapper img {
  width: 86px;
  height: 86px;
  border-radius: 12px;
}

.edit-add-preview-btn {
  margin-top: 10px;
}

@media (max-width: 900px) {
  .edit-order-top-grid,
  .edit-order-meta-grid,
  .edit-payments-summary {
    grid-template-columns: 1fr;
  }

  #edit-order-modal .modal-body {
    padding: 12px;
  }

  .edit-order-card {
    padding: 13px;
    border-radius: 14px;
  }
}

/* Улучшенный блок "Статус и производство" в редакторе заказа */
.edit-production-card {
  padding: 16px;
}

.edit-production-grid {
  display: grid;
  grid-template-columns: minmax(210px, 1.1fr) minmax(210px, 1.1fr) minmax(180px, 0.9fr) minmax(210px, 1fr);
  gap: 12px;
  align-items: stretch;
}

.edit-field-card {
  min-height: 118px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #e4ebf5;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 8px;
}

.edit-field-card .form-label {
  margin: 0;
  color: #1f2937;
  font-size: 13px;
  font-weight: 800;
}

.edit-status-select,
.edit-field-card .form-control {
  height: 46px;
  border-radius: 12px;
  border-color: #d8e2f0;
  background-color: #fff;
  font-weight: 600;
}

.edit-status-card {
  border-left: 4px solid #4361ee;
}

.edit-place-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 1px;
}

.edit-place-toggle .addorder-toggle-btn {
  height: 46px;
  border-radius: 12px;
  width: 100%;
  justify-content: center;
  font-weight: 800;
}

.edit-place-toggle .addorder-toggle-btn-active {
  box-shadow: 0 8px 18px rgba(67, 97, 238, 0.16);
}

.edit-accepted-card .edit-muted-hint,
.edit-status-card .edit-muted-hint {
  min-height: 32px;
  margin-top: 0;
}

.edit-install-card {
  background: #f8fafc;
}

.edit-install-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #1f2937;
  font-size: 13px;
  font-weight: 800;
}

.edit-install-caption {
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
}

.edit-switch {
  position: relative;
  display: inline-flex;
  width: 48px;
  height: 28px;
  flex: 0 0 auto;
  cursor: pointer;
}

.edit-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.edit-switch i {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: #dbe3ef;
  border: 1px solid #ccd7e5;
  transition: 0.2s ease;
}

.edit-switch i::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.22);
  transition: 0.2s ease;
}

.edit-switch input:checked + i {
  background: #4361ee;
  border-color: #4361ee;
}

.edit-switch input:checked + i::after {
  transform: translateX(20px);
}

#edit-install-deadline-picker {
  margin-top: 4px;
}

#edit-install-deadline-picker .install-deadline-input {
  height: 42px;
}

#edit-install-deadline-picker .install-deadline-quick {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
}

#edit-install-deadline-picker .install-deadline-btn {
  min-height: 34px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 980px) {
  .edit-production-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .edit-production-grid {
    grid-template-columns: 1fr;
  }

  .edit-field-card {
    min-height: auto;
  }
}


/* ===== Compact edit order modal v2 ===== */
#edit-order-modal {
  padding: 8px;
}

#edit-order-modal .modal-content-debtoraddnew {
  width: min(940px, calc(100vw - 16px));
  max-height: 96vh;
  border-radius: 22px;
}

#edit-order-modal .modal-header {
  margin-bottom: 0;
  padding: 14px 18px 12px;
}

#edit-order-modal .modal-title {
  font-size: 18px;
  line-height: 1.2;
}

#edit-order-modal .close-modal {
  width: 34px;
  height: 34px;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  font-size: 24px;
  line-height: 1;
}

#edit-order-modal .modal-body {
  background: #eef2f7;
}

.edit-order-layout {
  gap: 10px;
}

.edit-order-card,
.edit-production-card {
  padding: 12px;
  border-radius: 14px;
  box-shadow: none;
}

.edit-order-grid,
.edit-order-top-grid,
.edit-production-grid,
.edit-payments-summary {
  gap: 10px;
}

.edit-order-top-grid {
  grid-template-columns: minmax(240px, .95fr) minmax(320px, 1.3fr);
}

.edit-order-stack {
  gap: 8px;
}

#edit-order-modal .form-label,
.edit-field-card .form-label {
  font-size: 12px;
  line-height: 1.2;
  margin-bottom: 5px;
  font-weight: 800;
}

#edit-order-modal .form-control,
.edit-status-select,
.edit-field-card .form-control {
  height: 38px;
  padding: 8px 12px;
  border-radius: 11px;
  font-size: 13px;
}

.edit-info-group textarea,
#edit-info.form-control {
  min-height: 96px;
  height: 96px;
  padding-top: 10px;
}

.edit-section-title {
  margin-bottom: 9px;
  font-size: 14px;
}

.edit-production-grid {
  grid-template-columns: minmax(155px, 1fr) minmax(175px, 1fr) minmax(150px, .85fr) minmax(170px, .9fr);
}

.edit-field-card {
  min-height: 86px;
  padding: 10px 12px;
  border-radius: 13px;
  gap: 6px;
}

.edit-status-card {
  border-left-width: 3px;
}

.edit-muted-hint,
.edit-accepted-card .edit-muted-hint,
.edit-status-card .edit-muted-hint,
.edit-install-caption {
  min-height: 0;
  margin-top: 0;
  font-size: 11px;
  line-height: 1.25;
}

.edit-place-toggle {
  gap: 6px;
}

.edit-place-toggle .addorder-toggle-btn {
  height: 38px;
  min-height: 38px;
  border-radius: 11px;
  font-size: 13px;
  padding: 0 10px;
}

.edit-install-head {
  gap: 8px;
  font-size: 12px;
  line-height: 1.2;
}

.edit-switch {
  width: 42px;
  height: 24px;
}

.edit-switch i::after {
  width: 18px;
  height: 18px;
  top: 2px;
  left: 2px;
}

.edit-switch input:checked + i::after {
  transform: translateX(18px);
}

#edit-install-deadline-picker {
  margin-top: 2px;
}

#edit-install-deadline-picker .install-deadline-input {
  height: 36px;
}

#edit-install-deadline-picker .install-deadline-quick {
  gap: 5px;
  margin-top: 6px;
}

#edit-install-deadline-picker .install-deadline-btn {
  min-height: 30px;
  border-radius: 9px;
  font-size: 11px;
}

.edit-payments-summary {
  grid-template-columns: minmax(220px, 1.25fr) repeat(2, minmax(125px, .8fr));
  margin-bottom: 10px;
}

.edit-payment-stat {
  min-height: 74px;
  padding: 10px 12px;
  border-radius: 13px;
  gap: 6px;
}

.edit-payment-stat span {
  font-size: 11px;
}

.edit-payment-stat strong {
  font-size: 18px;
  line-height: 1.15;
}

.edit-payment-row {
  padding: 8px 10px;
  border-radius: 11px;
}

.edit-payments-list {
  gap: 6px;
  max-height: 130px;
}

#edit-previews-container {
  min-height: 72px;
  padding: 8px;
  border-radius: 12px;
}

#edit-previews-container .preview-wrapper,
#edit-previews-container .preview-wrapper img {
  width: 66px;
  height: 66px;
  border-radius: 10px;
}

.edit-add-preview-btn {
  margin-top: 8px;
  padding: 8px 12px;
}

#edit-order-modal .form-actions,
#edit-order-modal .modal-footer,
#edit-order-form .form-actions {
  margin-top: 10px;
  padding-top: 10px;
  gap: 8px;
}

@media (max-width: 980px) {
  .edit-production-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  #edit-order-modal {
    padding: 0;
  }

  #edit-order-modal .modal-content-debtoraddnew {
    width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }

  #edit-order-modal .modal-body {
    max-height: calc(100vh - 58px);
    padding: 8px !important;
  }

  .edit-order-top-grid,
  .edit-production-grid,
  .edit-payments-summary {
    grid-template-columns: 1fr;
  }

  .edit-order-card,
  .edit-production-card {
    padding: 10px;
    border-radius: 12px;
  }

  .edit-field-card {
    min-height: auto;
  }
}

/* Ручное объединение платежей */
.payment-manual-merge-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

#payment-select-mode-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.payment-select-cell {
    width: 44px;
    text-align: center;
}

.manual-payment-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.payment-group-row {
    cursor: pointer;
}

.payment-group-row .payment-select-cell,
.payment-child-row .payment-select-cell {
    opacity: .45;
}

.payments-manual-merge-table:not(.manual-payment-selection-active) thead th:first-child,
.payments-manual-merge-table:not(.manual-payment-selection-active) .payment-select-cell {
    display: none;
}

.payments-manual-merge-table.manual-payment-selection-active thead th:first-child,
.payments-manual-merge-table.manual-payment-selection-active .payment-select-cell {
    display: table-cell;
}

.today-order-highlight {
    background: #fff8b3;
    border-left: 5px solid #ffb300;
    animation: todayOrderPulse 1s ease-in-out infinite;
    transition: background .3s;
}

@keyframes todayOrderPulse {
    0%,100% {
        background: #fff8b3;
    }
    50% {
        background: #ffe46b;
    }
}
/* ===== Файлы заказа (js/order-files.js) ===== */
.order-files-section { margin-bottom: 16px; }
.order-files-section:empty { display: none; }
.of-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.of-header .section-title { margin-bottom: 8px; }
.of-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.of-archive { border: 1px solid var(--gray-light); border-radius: var(--border-radius); padding: 10px 12px; margin-bottom: 8px; background: #fff; font-size: 13px; }
.of-archive.of-current { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.of-archive.of-old { background: var(--light); }
.of-archive-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.of-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 6px 12px; }
.of-label { color: var(--gray); }
.of-muted { color: var(--gray); font-size: 12px; }
.of-error { color: var(--danger); font-size: 12px; margin-top: 2px; word-break: break-word; }
.of-note { font-size: 12px; color: var(--secondary); background: var(--primary-light); border-radius: 6px; padding: 6px 10px; margin-bottom: 8px; }
.of-stage { margin-top: 8px; font-size: 12px; }
.of-badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; vertical-align: middle; }
.of-badge.of-ok { background: #e6f7ee; color: #18733a; }
.of-badge.of-err { background: #fdecec; color: #b42318; }
.of-badge.of-wait { background: #fff4e0; color: #9a5b00; }
.of-badge.of-off { background: var(--gray-light); color: var(--gray); }
.of-progress { height: 6px; background: var(--gray-light); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.of-progress-fill { height: 100%; background: var(--primary); transition: width .3s ease; }
.of-files summary, .of-history summary { cursor: pointer; color: var(--primary); font-size: 12px; margin-top: 6px; }
.of-files ul { margin: 6px 0 0 16px; padding: 0; }
.of-files li { margin: 2px 0; word-break: break-all; }
.of-history { margin-top: 4px; }
.of-history > .of-archive { margin-top: 8px; }
#of-toast { position: fixed; right: 16px; bottom: 16px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; max-width: 320px; }
.of-toast-row { background: #fff; border: 1px solid var(--gray-light); box-shadow: var(--shadow-md); border-radius: var(--border-radius); padding: 10px 12px; font-size: 13px; }
.of-subtitle { font-weight: 600; margin: 12px 0 6px; }
.of-table-wrap { overflow-x: auto; }
.of-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.of-table th, .of-table td { border-bottom: 1px solid var(--gray-light); padding: 4px 6px; text-align: left; vertical-align: top; }
.of-log { max-height: 240px; overflow: auto; font-size: 12px; line-height: 1.5; margin-top: 6px; }
.of-log-error { color: var(--danger); }
.of-log-warn { color: #9a5b00; }
.action-btn.files-warning { color: var(--danger); }
