@charset "UTF-8";

.household {
	width: min(100%, 760px);
	margin: 0 auto;
	padding: 20px 14px 60px;
	color: #222;
	font-size: 14px;
	line-height: 1.6;
	box-sizing: border-box;
}

.household *,
.household *::before,
.household *::after {
	box-sizing: border-box;
}

.household section {
	margin-bottom: 28px;
	padding: 18px 14px;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 10px;
}

.household-title {
	margin: 0 0 18px;
	font-size: 22px;
	line-height: 1.4;
}

.household-heading {
	margin: 0 0 14px;
	font-size: 18px;
	line-height: 1.4;
}

.household-form {
	display: grid;
	gap: 14px;
}

.household-form__item {
	display: grid;
	gap: 6px;
}

.household-form__item label,
.household-form__label {
	font-weight: 700;
}

.household-form input[type="text"],
.household-form input[type="number"],
.household-form input[type="month"] {
	width: 100%;
	min-height: 44px;
	padding: 9px 10px;
	font: inherit;
	background: #fff;
	border: 1px solid #bbb;
	border-radius: 6px;
}

.household-type {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 8px;
}

.household-type label {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 8px;
	background: #f5f5f5;
	border: 1px solid #ccc;
	border-radius: 6px;
	cursor: pointer;
}

.household-type input {
	margin-right: 6px;
}

.household-form__buttons {
	display: grid;
	grid-template-columns: 1fr;
	gap: 8px;
}

.household-button {
	min-height: 44px;
	padding: 9px 14px;
	font: inherit;
	font-weight: 700;
	border: 0;
	border-radius: 6px;
	cursor: pointer;
}

.household-button--primary {
	color: #fff;
	background: #222;
}

.household-button--sub {
	color: #222;
	background: #e8e8e8;
}

.household-message {
	min-height: 1.5em;
	margin: 0;
	font-size: 13px;
}

.household-summary__items {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	border: 1px solid #ddd;
	border-radius: 8px;
	overflow: hidden;
}

.household-summary__item {
	display: grid;
	gap: 4px;
	padding: 12px 6px;
	text-align: center;
	border-right: 1px solid #ddd;
}

.household-summary__item:last-child {
	border-right: 0;
}

.household-summary__item span {
	font-size: 12px;
}

.household-summary__item strong {
	font-size: 15px;
	white-space: nowrap;
}

.household-records__group + .household-records__group {
	margin-top: 22px;
}

.household-records__group h3 {
	margin: 0 0 8px;
	font-size: 15px;
}

.household-table-wrap {
	width: 100%;
	overflow-x: auto;
}

.household-table {
	width: 100%;
	border-collapse: collapse;
	table-layout: fixed;
	font-size: 12px;
}

.household-table th,
.household-table td {
	padding: 7px 5px;
	border-bottom: 1px solid #ddd;
	vertical-align: middle;
}

.household-table th {
	background: #f5f5f5;
	font-weight: 700;
	text-align: left;
}

.household-table th:nth-child(1),
.household-table td:nth-child(1) {
	width: auto;
	word-break: break-word;
}

.household-table th:nth-child(2),
.household-table td:nth-child(2) {
	width: 88px;
	text-align: right;
	white-space: nowrap;
}

.household-table th:nth-child(3),
.household-table td:nth-child(3) {
	width: 76px;
	text-align: center;
	white-space: nowrap;
}

.household-history-table th,
.household-history-table td {
	text-align: right;
	white-space: nowrap;
}

.household-history-table th:first-child,
.household-history-table td:first-child {
	width: 70px;
	text-align: left;
}

.household-month-navigation {
	display: grid;
	grid-template-columns: 44px 1fr 44px;
	align-items: center;
	gap: 8px;
	margin-bottom: 14px;
	text-align: center;
}

.household-month-navigation button {
	min-height: 40px;
	font-size: 24px;
	line-height: 1;
	background: #f1f1f1;
	border: 1px solid #ccc;
	border-radius: 6px;
	cursor: pointer;
}

.household-month-navigation strong {
	font-size: 17px;
}

@media screen and (min-width: 700px) {

	.household {
		padding-top: 36px;
		font-size: 15px;
	}

	.household section {
		padding: 24px;
	}

	.household-form {
		grid-template-columns: 150px 1fr;
		align-items: center;
	}

	.household-form__item {
		display: contents;
	}

	.household-form__buttons,
	.household-message {
		grid-column: 2;
	}

	.household-form__buttons {
		grid-template-columns: repeat(2, minmax(0, 180px));
	}

	.household-table {
		font-size: 14px;
	}

	.household-table th,
	.household-table td {
		padding: 9px 8px;
	}

	.household-table th:nth-child(2),
	.household-table td:nth-child(2) {
		width: 130px;
	}

	.household-table th:nth-child(3),
	.household-table td:nth-child(3) {
		width: 80px;
	}
}

.household-message--success {
	color: #17733b;
}

.household-message--error {
	color: #c62828;
}

.household-summary__item strong.is-negative {
	color: #c62828;
}

.household-table__buttons {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 3px;
}

.household-table__button {
	margin: 0;
	padding: 3px 4px;
	color: #333;
	font-size: 10px;
	line-height: 1.3;
	white-space: nowrap;
	background: #f2f2f2;
	border: 1px solid #ccc;
	border-radius: 3px;
	cursor: pointer;
}

.household-delete-button {
	color: #b42318;
}

.household-table__button:disabled,
.household-button:disabled {
	cursor: wait;
	opacity: 0.5;
}

.household-history-row {
	cursor: pointer;
}

.household-history-row:hover,
.household-history-row:focus {
	background: #f7f7f7;
	outline: none;
}

@media screen and (min-width: 700px) {

	.household-table__buttons {
		gap: 6px;
	}

	.household-table__button {
		padding: 4px 7px;
		font-size: 12px;
	}
}
