:root {
}

* {
	box-sizing: border-box;
	font-family: monospace;
	user-select: none;
	-webkit-user-select: none;
}

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

main.narrow {
	max-width: 200px;
	margin: 0 auto;
}

.connect label {
	margin-bottom: 0.6rem;
}

.connect input {
}

.connect button {
	margin-top: 0.6rem;
}

.connect .params {
	margin-top: 2rem;
}

.connect .calendars {
	margin-top: 1rem;
}

.month {
	height: 100%;
	flex: 1 1 0;

	display: flex;
	flex-direction: column;
	row-gap: 1px;

	outline: 1px solid gainsboro;
	row-rule: 1px solid gainsboro;
	row-rule-break: none;
}

.month .week { /* Row */
	flex: 1 1 0;
	position: relative;

	display: grid;
	grid-template-columns: repeat(var(--days-in-week), 1fr);
	grid-template-rows: auto;
	grid-auto-flow: column;
	grid-auto-rows: 1fr;
	column-gap: 1px;

	column-rule: 1px solid gainsboro;
	column-rule-break: none;
}

.month .header {
	flex-grow: 0;
	padding: 0.2rem 0;
	text-align: center;
	font-weight: bold;
}

.month .weekday {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.month .monthbreak {
	text-align: center;
}

.month .day-overlay {
	position: absolute;
	width: calc(100% / var(--days-in-week));
	height: 100%;
	cursor: pointer;
	text-align: center;
}

.month .day-overlay > * {
	visibility: hidden;
}

.month .day-overlay:hover > * {
	visibility: visible;
}

.month .day-overlay:hover {
	background-color: silver;
}

.month .day {
	grid-row: 1;
	padding: 0.2rem;
	text-align: right;
}

.month .day .label {
	position: relative;
	z-index: 1;
}

.month .slot {
	overflow: hidden;
}

.month .event {
	margin: 0 0.5rem 0.4rem 0.5rem;
	padding: 0.2rem;
	position: relative;
	z-index: 1;

	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	cursor: pointer;
	border: 1px solid gainsboro;
	background-color: gainsboro;
}

.month .event:hover {
	background-color: silver;
}

.month .event:active {
	background-color: darkgrey;
}

.month .event.flush-start {
	margin-left: 0;
}

.month .event.flush-end {
	margin-right: 0;
}

.calendars {
	padding: 0.5rem;
}

.calendars strong {
	display: block;
	margin-bottom: 0.5rem;
}

.calendars ul {
	list-style-type: none;
	padding: 0rem;
}

div[role=alert] {
	position: fixed;
	top: 0;
	right: 0;
	margin: 1rem;
	padding: 1rem;
	white-space: pre-line;
	background-color: lightcoral;
}

div[role=alert] button {
	float: right;
	margin-left: 0.5rem;
}

form.event label > *:not([type=radio]) {
	width: 400px;
	max-width: 100%;
}

form label {
	display: block;
	margin-bottom: 0.4rem;
}

form input:not([type=radio]), form textarea, form select {
	display: block;
	width: 100%;
}

form .inline {
	display: inline;
}

ul {
	margin: 0;
	padding-left: 1em;
}

.error {
	margin-top: 1rem;
	color: crimson;
}

dialog {
	display: flex;
	flex-direction: column;
}

.close {
	align-self: end;
}

.close button::before {
	content: "X" / "Close";
}

.hflex {
	height: 100%;
	display: flex;
}


/*
 * From gamja, AGPLv3 licensed, Copyright (C) 2020 The gamja Contributors
 * https://codeberg.org/emersion/gamja
 */
.dialog {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: rgba(0, 0, 0, 0.5);
	overflow: auto;
	z-index: 10;  /* added by us */
}
.dialog .dialog-body {
	background-color: white;
	color: var(--main-color);
	margin: 20px auto;
	max-width: 500px;
	padding: 15px;
	border: 1px solid rgba(0, 0, 0, 0.6);
}
.dialog .dialog-header {
	display: flex;
	flex-direction: row;
	align-items: center;
	margin-bottom: 1em;
}
.dialog .dialog-header h2 {
	flex-grow: 1;
	margin: 0;
}
.dialog .dialog-header button.dialog-close {
	font-size: 1.5em;
	padding: 0 5px;
}
.dialog h2 {
	margin-top: 0;
}
.dialog form button:not([type="button"]) {
	float: right;
}
.dialog form {
	overflow: auto; /* hack to clear floating elements */
}
