/* Modern accounts page and dashboard accounts widget. */

.accounts-page {
	padding: 14px;
	border: 1px solid #e5e9ee;
	border-radius: 14px;
	background: #f4f6f8;
}

.accounts-page-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 12px;
}

.accounts-page-toolbar h3 {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	color: #33424f;
}

.accounts-page-toolbar p {
	margin: 2px 0 0;
	font-size: 12px;
	color: #8a96a1;
}

.accounts-summary {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
	margin-bottom: 14px;
}

.accounts-summary-card {
	padding: 12px 14px;
	border: 1px solid #e5e9ee;
	border-radius: 12px;
	background: #fff;
}

.accounts-summary-card span {
	display: block;
	margin-bottom: 4px;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .4px;
	text-transform: uppercase;
	color: #8b97a3;
}

.accounts-summary-values {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 16px;
}

.accounts-summary-value {
	font-size: 16px;
	font-weight: 700;
	color: #33424f;
	white-space: nowrap;
}

.accounts-summary-card.summary-current .accounts-summary-value {
	color: #1a8f3c;
}

.accounts-summary-count {
	margin-left: auto;
	font-size: 11px;
	font-weight: 600;
	color: #9aa4ae;
	white-space: nowrap;
}

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

.account-card {
	display: flex;
	flex-direction: column;
	gap: 9px;
	min-width: 0;
	padding: 12px;
	border: 1px solid #e5e9ee;
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 1px 3px rgba(16, 24, 40, .06);
}

.account-card-head {
	display: flex;
	align-items: flex-start;
	gap: 11px;
}

.account-card-icon {
	flex: 0 0 auto;
	width: 42px;
	height: 42px;
	object-fit: contain;
}

.account-card-main {
	flex: 1 1 auto;
	min-width: 0;
}

.account-card-name {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	color: #26333f;
	overflow-wrap: anywhere;
}

.account-card-name a {
	color: #3276b1;
	text-decoration: none;
}

.account-card-name a:hover,
.account-card-name a:focus {
	color: #1d4f7a;
	text-decoration: none;
}

.account-card-flags {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-top: 4px;
}

.account-card-flag {
	display: inline-block;
	padding: 1px 6px;
	border-radius: 999px;
	background: #f1f4f7;
	color: #7a8792;
	font-size: 10px;
	font-weight: 600;
	line-height: 16px;
}

.account-card-flag.flag-credit {
	background: #fff4df;
	color: #a86a00;
}

.account-card-actions {
	display: flex;
	flex: 0 0 auto;
	gap: 3px;
}

.account-card-actions .btn {
	border-radius: 8px;
}

.account-card-balances {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
	padding-top: 10px;
	border-top: 1px solid #eef1f4;
}

.account-balance-column {
	min-width: 0;
}

.account-balance-column > span {
	display: block;
	margin-bottom: 4px;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .4px;
	text-transform: uppercase;
	color: #9aa4ae;
}

.account-balance-line {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px;
	font-size: 13px;
	line-height: 1.3;
	color: #40505f;
}

.account-balance-line b {
	font-weight: 400;
	color: #26333f;
	white-space: nowrap;
}

.account-balance-line.current b {
	color: #1a8f3c;
}

.accounts-empty {
	padding: 36px 20px;
	border: 1px dashed #d6dde5;
	border-radius: 12px;
	background: #fafbfc;
	color: #6b7680;
	font-size: 14px;
	text-align: center;
}

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

@media (max-width: 767px) {
	.accounts-page {
		padding: 10px;
	}

	.accounts-summary {
		grid-template-columns: 1fr;
		gap: 8px;
	}

	.accounts-summary-card {
		padding: 10px 12px;
	}

	.accounts-summary-value {
		font-size: 15px;
	}

	.accounts-grid {
		grid-template-columns: 1fr;
		gap: 10px;
	}

	.account-card {
		padding: 12px;
	}

	.account-card-balances {
		gap: 12px;
	}
}

/* Explicit account sorting mode. */
.accounts-page-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
}

.accounts-sort-status {
	margin-right: 2px;
	color: #8b97a3;
	font-size: 11px;
}

.accounts-sort-toggle.active {
	border-color: #3276b1;
	background: #3276b1;
	color: #fff;
}

.account-card-actions .account-sort-up,
.account-card-actions .account-sort-down {
	display: none;
}

.accounts-sort-mode .account-card-actions .account-sort-up,
.accounts-sort-mode .account-card-actions .account-sort-down {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.account-card-actions .account-sort-up:disabled,
.account-card-actions .account-sort-down:disabled {
	cursor: default;
	opacity: .35;
}

@media (max-width: 767px) {
	.accounts-sort-label {
		display: none;
	}
}

/* Transfer description shown under the accounts in the transfer history. */
.transfer-comment {
	margin-top: 3px;
	color: #8b97a3;
	font-size: 11px;
	line-height: 1.35;
	overflow-wrap: anywhere;
}

/* Empty state for the dashboard "Последние операции" widget. */
.recent-empty-row > td {
	padding: 0 !important;
	border: 0 !important;
	background: transparent !important;
}

.recent-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 26px 18px 22px;
	text-align: center;
}

.recent-empty-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin-bottom: 10px;
	border-radius: 12px;
	background: var(--bg-soft, #eef4fa);
	color: var(--indigo, #3276b1);
	font-size: 19px;
}

.recent-empty strong {
	color: var(--ink, #26333f);
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
}

.recent-empty p {
	max-width: 320px;
	margin: 4px 0 14px;
	color: var(--muted, #8b97a3);
	font-size: 12px;
	line-height: 1.45;
}

.recent-empty-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 7px;
}

.recent-empty-actions .btn {
	padding: 6px 14px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.3;
}

.recent-empty-actions .btn i {
	margin-right: 3px;
}

@media (max-width: 400px) {
	.recent-empty {
		padding: 20px 12px 18px;
	}

	.recent-empty-actions {
		width: 100%;
	}

	.recent-empty-actions .btn {
		flex: 1 1 auto;
	}
}

/* Operation titles in the dashboard "Последние операции" widget. */
.recent-operation-name {
	font-family: 'Inter', Arial, Helvetica, sans-serif;
	font-size: 14px;
	font-weight: 500;
}

/* Keep the Recent operations and Accounts widgets on the same gutters when
   they stack on narrower screens. */
#wid-id-1 #recent-list-area tbody td:first-child {
	padding-left: 12px;
}

#wid-id-1 #recent-list-area tbody td:nth-child(4) {
	padding-right: 12px;
}

/* Dashboard accounts widget card. */
#main #wid-id-8.accounts-widget {
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 1px 3px rgba(16, 24, 40, .08);
	overflow: hidden;
}

#main #wid-id-8 > header.accounts-widget-head {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	height: auto;
	min-height: 0;
	padding: 14px 16px 10px;
	border: 0;
	border-radius: 14px 14px 0 0;
	background: #fff !important;
	color: #26333f;
	line-height: 1.2;
	cursor: default;
}

#main #wid-id-8 > header.accounts-widget-head:before,
#main #wid-id-8 > header.accounts-widget-head:after {
	display: none;
}

#main #wid-id-8 .accounts-widget-heading {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

#main #wid-id-8 .accounts-widget-title {
	font-size: 19px;
	font-weight: 400;
	line-height: 1.2;
	color: #26333f;
	white-space: nowrap;
}

#wid-id-8 a.accounts-widget-date,
#wid-id-8 a.accounts-widget-date.editable-click {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 30px;
	padding: 0 12px;
	border: 0;
	border-radius: 999px;
	background: #eef1f5;
	color: #26333f;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	transition: background .15s ease;
}

#wid-id-8 a.accounts-widget-date:hover,
#wid-id-8 a.accounts-widget-date:focus {
	background: #e6ebf1;
	color: #26333f;
	text-decoration: none;
}

#wid-id-8 a.accounts-widget-date:after {
	content: "";
	display: block;
	width: 7px;
	height: 7px;
	margin-top: -3px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	opacity: .55;
	transform: rotate(45deg);
}

.accounts-widget-head-actions {
	display: flex;
	align-items: center;
	flex: 0 0 auto;
	gap: 8px;
}

.accounts-widget-sort-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 30px;
	height: 30px;
	padding: 0;
	border: 1px solid #e9edf2;
	border-radius: 10px;
	background: #f5f7fa;
	color: #40505f;
	cursor: pointer;
	transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.accounts-widget-sort-btn svg {
	display: block;
	width: 18px;
	height: 18px;
}

.accounts-widget-sort-btn:hover {
	border-color: #cfd9e2;
	background: #fff;
	color: #26333f;
}

.accounts-widget-sort-btn.active {
	border-color: #3276b1;
	background: #3276b1;
	color: #fff;
}

.accounts-widget-add {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	gap: 7px;
	height: 30px;
	padding: 0 13px;
	border-radius: 10px;
	background: #1b2433;
	color: #fff;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	transition: background .15s ease;
}

.accounts-widget-add svg {
	display: block;
	width: 17px;
	height: 17px;
}

.accounts-widget-add:hover,
.accounts-widget-add:focus {
	background: #263349;
	color: #fff;
	text-decoration: none;
}

#main #wid-id-8.accounts-widget > div {
	padding: 0;
	border: 0;
	background: #fff;
	border-radius: 0 0 14px 14px;
}

#wid-id-8 .widget-body {
	margin: 0;
	padding: 0 !important;
}

.accounts-widget-list {
	display: flex;
	flex-direction: column;
}

.account-widget-row {
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 5px 16px;
	border-bottom: 1px solid #eef1f4;
	transition: background .12s ease;
}

.account-widget-row:hover {
	background: #fbfcfd;
}

.account-widget-row:last-child {
	border-bottom: 0;
}

.account-widget-icon-tile {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 9px;
	background: #fff;
	box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.account-widget-icon {
	display: block;
	width: auto;
	max-height: 26px;
	height: auto;
	object-fit: contain;
}

.account-widget-main {
	flex: 1 1 auto;
	min-width: 0;
}

.account-widget-name {
	display: block;
	overflow: hidden;
	color: #1f2a37;
	font-family: 'Inter', Arial, Helvetica, sans-serif;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.2;
	text-decoration: none;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.account-widget-name:hover,
.account-widget-name:focus {
	color: #3276b1;
	text-decoration: none;
}

.account-widget-flags {
	margin-top: 1px;
	overflow: hidden;
	color: #9aa4ae;
	font-size: 12px;
	line-height: 1.2;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.account-widget-balances {
	display: flex;
	flex-direction: column;
	flex: 0 0 auto;
	gap: 1px;
	text-align: right;
}

.account-widget-balance {
	display: flex;
	align-items: baseline;
	justify-content: flex-end;
	gap: 5px;
	color: #1f2a37;
	font-size: 16px;
	font-weight: 500;
	line-height: 1.2;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.account-widget-balance:not(.is-default) {
	color: #8a96a1;
	font-size: 14px;
	font-weight: 400;
}

.account-widget-amount {
	font-variant-numeric: tabular-nums;
}

.account-widget-currency {
	flex: 0 0 auto;
	min-width: .7em;
	text-align: left;
}

.account-widget-total {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	border-top: 1px solid #eef1f4;
	background: #fff;
}

.account-widget-total-label {
	flex: 0 0 auto;
	color: #8a96a1;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.2;
}

.account-widget-total-values {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 1px;
	min-width: 0;
	text-align: right;
}

.account-widget-total .account-widget-balance {
	font-size: 21px;
	font-weight: 500;
	color: #1f2a37;
}

.account-widget-total .account-widget-balance:not(.is-default) {
	color: #8a96a1;
	font-size: 17px;
	font-weight: 400;
}

.accounts-widget-empty {
	padding: 20px 16px;
	color: #8b97a3;
	font-size: 13px;
	text-align: center;
}

/* Reordering is only shown while the sort button is active. */
.account-widget-actions {
	display: none;
	align-items: center;
	flex: 0 0 auto;
	gap: 6px;
	margin-left: 4px;
}

#wid-id-8.accounts-sort-mode .account-widget-actions {
	display: flex;
}

.account-widget-actions button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid #e5e9ee;
	border-radius: 10px;
	background: #fff;
	color: #40505f;
	cursor: pointer;
	transition: background .15s ease, border-color .15s ease;
}

.account-widget-actions button svg {
	display: block;
	width: 18px;
	height: 18px;
}

.account-widget-actions button:hover {
	border-color: #cfd9e2;
	background: #f6f8fa;
}

.account-widget-actions button:disabled {
	cursor: default;
	background: #fff;
	opacity: .3;
}

@media (max-width: 767px) {
	#main #wid-id-8 > header.accounts-widget-head {
		padding: 12px 14px 8px;
		gap: 8px;
	}

	#main #wid-id-8 .accounts-widget-title {
		font-size: 18px;
	}

	#wid-id-8 a.accounts-widget-date,
	#wid-id-8 a.accounts-widget-date.editable-click {
		height: 28px;
		padding: 0 10px;
		font-size: 13px;
	}

	.accounts-widget-head-actions {
		gap: 6px;
	}

	.accounts-widget-sort-btn {
		width: 28px;
		height: 28px;
		border-radius: 9px;
	}

	.accounts-widget-sort-btn svg {
		width: 17px;
		height: 17px;
	}

	.accounts-widget-add {
		gap: 6px;
		height: 28px;
		padding: 0 10px;
		border-radius: 9px;
		font-size: 13.5px;
	}

	.accounts-widget-add svg {
		width: 16px;
		height: 16px;
	}

	.account-widget-row {
		gap: 8px;
		padding: 5px 16px;
	}

	.account-widget-icon-tile {
		width: 36px;
		height: 36px;
		border-radius: 8px;
	}

	.account-widget-icon {
		max-height: 22px;
	}

	.account-widget-name {
		font-size: 14.5px;
	}

	.account-widget-flags {
		font-size: 11.5px;
	}

	.account-widget-balance {
		gap: 4px;
		font-size: 14.5px;
	}

	.account-widget-balance:not(.is-default) {
		font-size: 13px;
	}

	.account-widget-total {
		padding: 12px 14px;
	}

	.account-widget-total-label {
		font-size: 14.5px;
	}

	.account-widget-total .account-widget-balance {
		font-size: 18px;
	}

	.account-widget-total .account-widget-balance:not(.is-default) {
		font-size: 15px;
	}

	.account-widget-actions {
		gap: 4px;
		margin-left: 2px;
	}

	.account-widget-actions button {
		width: 32px;
		height: 32px;
		border-radius: 8px;
	}

	.account-widget-actions button svg {
		width: 16px;
		height: 16px;
	}
}

/* Clickable account total: toggles conversion to the base currency */
.account-widget-total {
	cursor: pointer;
	transition: background .15s ease;
}

.account-widget-total:hover,
.account-widget-total:focus-visible {
	background: #f8fafc;
	outline: 0;
}

.account-widget-total.is-converted {
	background: #f7fbff;
}

.account-widget-total.is-converted:hover,
.account-widget-total.is-converted:focus-visible {
	background: #f1f8ff;
}

.account-widget-total-rate {
	max-width: 100%;
	margin-top: 4px;
	color: #98a4b0;
	font-size: 10.5px;
	font-weight: 400;
	line-height: 1.4;
	text-align: right;
	white-space: normal;
}

.account-widget-total .account-widget-balance.is-unconverted {
	color: #98a4b0;
	font-size: 14px;
	font-weight: 400;
}
