/* Shared by every page. Each screen layout's look is in layouts/. */
:root {
    color-scheme: light;
    font-family: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    color: #1e1f22;
    background: #f6f5f1;
}

body {
    margin: 0;
}

/* Screens fill the window themselves; plain pages such as sign-in get a margin. */
main:not(:has(> .screen)) {
    padding: 24px;
}

h1:focus {
    outline: none;
}

/* Menus: the behaviour both layouts share. Each layout's stylesheet gives them their look. */
.menu {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.menu details {
    position: relative;
}

.menu summary {
    display: block;
    list-style: none;
    white-space: nowrap;
    cursor: default;
    user-select: none;
}

.menu summary::-webkit-details-marker {
    display: none;
}

.menu button {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    text-align: left;
    white-space: nowrap;
    cursor: default;
}

.menu-items {
    position: absolute;
    left: 0;
    z-index: 20;
    min-width: 240px;
    display: flex;
    flex-direction: column;
}

.menu-items form {
    display: contents;
}

.menu-items button {
    position: relative;
    width: 100%;
}

.menu-items button[aria-current="true"]::before {
    content: "✓";
    position: absolute;
    left: 9px;
}

.menu a {
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.menu-items a {
    position: relative;
    display: block;
}

/* Click Search is the last menu and can be long, so it opens leftwards and scrolls. */
.search-menu .menu-items {
    left: auto;
    right: 0;
    max-height: 60vh;
    overflow-y: auto;
}

.record-nav {
    min-width: 22px;
    font: inherit;
    cursor: pointer;
}

.record-nav[disabled] {
    cursor: default;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Dialog steps, such as Property Maintenance confirmations: a box near the top of the window. */
.dialog-screen {
    align-items: center;
    padding: 10vh 16px 16px;
    box-sizing: border-box;
}

.dialog {
    width: 100%;
    max-width: 560px;
    box-sizing: border-box;
}

.dialog-title {
    margin: 0;
}

.dialog-body p {
    margin: 0 0 12px;
}

.dialog-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.dialog-field input,
.dialog-field select {
    box-sizing: border-box;
    font: inherit;
}

.dialog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.dialog .button,
.dialog button {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}

.dialog-table {
    overflow-x: auto;
}

.dialog-table table {
    width: 100%;
    border-collapse: collapse;
}

.dialog-table th,
.dialog-table td {
    padding: 4px 6px;
    text-align: left;
    white-space: nowrap;
}

/* Printing a screen prints its content, without menus, toolbars or status bar. */
@media print {
    .menu,
    .tools,
    .seg,
    .accounts,
    .status,
    .record-status,
    .dialog-actions {
        display: none !important;
    }

    .screen {
        height: auto !important;
        min-height: 0 !important;
    }

    .record-body,
    .gridbox,
    .grid {
        overflow: visible !important;
    }

    .record .panel {
        break-inside: avoid;
    }
}

/* Property Data Record: the arrangement both layouts share, after the current program's screen. */
.record-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.record {
    margin: 0;
}

/* Three columns of panels, as on the current program's screen. Each layout sets the gap. */
.record-grid {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 3.2fr) minmax(0, 3fr);
}

.record-column {
    display: flex;
    flex-direction: column;
    gap: inherit;
    min-width: 0;
}

.record .panel {
    min-width: 0;
    margin: 0;
}

.record .notes {
    flex: 1;
}

.record input:not([type=checkbox]),
.record textarea {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    font: inherit;
}

.record textarea {
    height: calc(100% - 1.5em);
    min-height: 12em;
    resize: vertical;
}

.record input.letter {
    width: 3em;
}

.record input.short {
    max-width: 7em;
}

.record .fields {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    gap: 3px 8px;
}

.record .fields.quad {
    grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr);
    margin-top: 4px;
}

.record .fields .span {
    grid-column: 1 / -1;
}

.record .fields .span3 {
    grid-column: 2 / -1;
}

.record .center {
    text-align: center;
}

.record .with-button {
    display: flex;
    gap: 4px;
    min-width: 0;
}

.record .with-button button {
    flex: none;
    font: inherit;
    cursor: default;
}

.record .gl-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
    gap: 4px;
}

.record .renewal-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) repeat(3, minmax(0, 1fr));
    align-items: center;
    gap: 3px 4px;
}

.record .supplement {
    display: grid;
    grid-template-columns: auto repeat(3, minmax(0, 1fr));
    align-items: end;
    gap: 4px 6px;
    margin-top: 6px;
}

.record .supplement label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.record .defined-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto;
    align-items: center;
    gap: 3px 6px;
}

.record .charges-grid {
    display: grid;
    grid-template-columns: minmax(5.5em, auto) minmax(0, 1fr);
    align-items: center;
    gap: 3px 6px;
}

.record .check {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.record legend span + span {
    margin-left: 3.5em;
}

.record .note {
    margin: 4px 0 0;
}

/* Six account cells don't fit a phone, so the strip scrolls within itself rather than widening the page. */
.accounts {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
}

/* Narrower windows put the third column under the first two, then stack all three. */
@media (max-width: 1100px) {
    .record-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .record-column:last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 700px) {
    .record-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .record .fields.quad {
        grid-template-columns: max-content minmax(0, 1fr);
    }

    .record .fields .span3 {
        grid-column: auto;
    }
}

.signin {
    max-width: 320px;
    margin: 12vh auto;
}

.signin form,
.signin label {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.signin label {
    gap: 4px;
    font-size: 14px;
}

.signin label.check {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.signin input[type=email],
.signin .password input {
    height: 38px;
    padding: 0 10px;
    border: 1px solid #cfccc3;
    border-radius: 6px;
    font: inherit;
}

.signin .password {
    position: relative;
    display: flex;
}

.signin .password input {
    flex: 1;
    min-width: 0;
    padding-right: 64px;
}

.signin .show-password {
    position: absolute;
    top: 4px;
    right: 4px;
    bottom: 4px;
    height: auto;
    padding: 0 10px;
    border-radius: 4px;
    background: transparent;
    color: #243b6b;
    font-size: 13px;
}

.signin .show-password:hover {
    background: #eef0f5;
}

.signin button {
    height: 38px;
    padding: 0 16px;
    border: 0;
    border-radius: 6px;
    background: #243b6b;
    color: #ffffff;
    font: inherit;
    cursor: pointer;
}

.error,
.validation-message {
    margin: 0;
    color: #b3261e;
    font-size: 14px;
}

.blazor-error-boundary {
    padding: 1rem;
    background: #b32121;
    color: #ffffff;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}
