:root {
    color-scheme: light dark;
}

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

body {
    font-family: Arial, sans-serif;
    background-image: linear-gradient(to bottom, #FFFFFF 0%, #E6E6E6 73%, #A1A1A1 100%);
    background-attachment: fixed;
    color: black;
    border-color: #C7C7C7;
    display: grid;
    grid-template-areas: "header" "sidebar-left" "main" "sidebar-right";
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto;
    justify-content: center;
    gap: 1rem;
    margin: 0 auto;
    padding: 0 1rem;
    min-height: 100vh;
}
@media (min-width: 61rem) {  /* Medium+ screens */
    body.sidebar {
        grid-template-areas: "header header" "sidebar-left main" "sidebar-right main";
        grid-template-columns: 20rem 40rem;
        grid-template-rows: auto auto 1fr;
    }
}
@media (min-width: 84rem) {  /* Large+ screens */
    body {
        grid-template-areas: "header header header" "sidebar-left main sidebar-right";
        grid-template-columns: 20rem 40rem 20rem;
        grid-template-rows: auto 1fr;
    }
}
@media (prefers-color-scheme: dark) {
    body {
        background-image: linear-gradient(to bottom, #2a2a2a 0%, #1c1c1c 73%, #111 100%);
        color: white;
        border-color: #4A4A4A;
    }
}

header {
    grid-area: header;
    width: 100%;
    padding: 1rem;
    max-width: 40rem;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

hr {
    border-width: 1px;
    border-style: solid;
    max-width: 36rem;
    width: calc(100% - 6rem);
    margin: 1rem auto;
}

h1 {
    max-width: 40rem;
    margin: 0 auto;
    padding: 1rem;
    font-size: 1.75rem;
}

h1 img {
    max-width: 16rem;
    margin: auto;
    display: block;
    height: auto;
}

h2 {
    max-width: 40rem;
    margin: 0 auto;
    padding: 1rem 1rem 0;
    font-size: 1.25rem;
    opacity: 0.7;
}

h3 {
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
}

h4 {
    font-size: 1rem;
    font-weight: bold;
}

p {
    font-size: 0.9rem;
    color: #444;
    margin-top: 0.25rem;
}
@media (prefers-color-scheme: dark) {
    p {
        color: #ccc;
    }
}

aside.sidebar-left {
    grid-area: sidebar-left;
}

.collapsable-sidebar-group {
    margin: 0 auto;
    padding: 0.5rem;
    background-color: white;
    border-width: 1px;
    border-style: solid;
    border-radius: 0.5rem;
    max-width: 40rem;
}
@media (prefers-color-scheme: dark) {
    .collapsable-sidebar-group {
        background-color: #181818;
    }
}

.collapsable-sidebar-group input[type="checkbox"] {
    display: none;
}

.collapsable-sidebar-group label {
    display: flex;
    cursor: pointer;
    font-size: 1.25rem;
    width: 100%;
    padding: 0.5rem;
}
.collapsable-sidebar-group label::before {
    content: "▶";
    display: inline-block;
    width: 1em;
    margin-right: 0.25em;
}

.collapsable-sidebar-group nav {
    margin-top: 0.5rem;
    padding: 0.5rem 0.25rem;
    border-top: 1px solid;
    border-color: inherit;
    width: 100%;
}
.collapsable-sidebar-group nav a {
    display: block;
    margin: 0.25rem 0;
    text-decoration: none;
    color: inherit;
    padding: 0.25rem;
}
.collapsable-sidebar-group nav a:hover {
    text-decoration: underline;
}

/* Small screen: collapsed by default */
.collapsable-sidebar-group > *:not(label):not(input) {
    display: none;
}
.collapsable-sidebar-group input:checked ~ *:not(label):not(input) {
    display: block;
}
.collapsable-sidebar-group input:checked + label::before {
    content: "▼";
}

/* Medium / Large screen: open by default, arrow logic inverted */
@media (min-width: 61rem) {
    .collapsable-sidebar-group > *:not(label):not(input) {
        display: block;
    }
    .collapsable-sidebar-group input:checked ~ *:not(label):not(input) {
        display: none;
    }
    .collapsable-sidebar-group label::before {
        content: "▼";
    }
    .collapsable-sidebar-group input:checked + label::before {
        content: "▶";
    }
}

main {
    grid-area: main;
}

aside.sidebar-right {
    grid-area: sidebar-right;
}

section {
    max-width: 40rem;
    margin: 0.5rem auto;
    padding: 1rem;
    background-color: white;
    border-width: 1px;
    border-style: solid;
    border-radius: 0.5rem;
}
@media (prefers-color-scheme: dark) {
    section {
        background-color: #181818;
    }
}

dialog {
    margin: auto;
    width: calc(100% - 4rem);
    padding: 1.5rem 2rem;
    border: 3px solid orangered;
    border-radius: 1rem;
    max-width: 30rem;
}
dialog::backdrop {
    background: rgba(0, 0, 0, 0.65);
}

dialog h3 {
    text-align: center;
    width: 100%;
    display: inline-block;
    padding: 0 1rem 1rem;
    line-height: 1rem;
    border-bottom-width: 2px;
    border-bottom-style: solid;
    border-bottom-color: inherit;
}

button {
    background-color: #002554;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}
button[disabled] {
    background-color: gray !important;
    cursor: not-allowed;
}
button:hover {
    background-color: #3a7fd1;
}

button.red {
    background-color: #e14647;
}
button.red:hover {
    background-color: #c33434;
}

button.wide {
    width: 100%;
}

.error {
    color: red;
    border: 1px solid red;
    padding: 1em 1.4em;
    background-color: rgba(255,0,0, 0.1);
    border-radius: 0.5rem;
}

.button-set {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

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

table thead tr th {
    border-bottom: 1px solid;
    border-color: inherit;
    padding: 0 0.5rem 0.5rem;
}

table tbody tr {
    position: relative;
}

table tbody tr td {
    padding: 0.5rem;
    border-width: 0 0 1px 0;
    border-style: solid;
}

table tbody tr:last-child td {
    border-width: 0;
}

.text-field {
    position:relative;
    margin:2em 0;
}
.text-field input {
    font-size:1.3em;
    line-height:1.3em;
    border:1px none #0077c8;
    border-bottom-style:solid;
    width:100%;
    background: transparent;
    resize: vertical;
}
.text-field input:focus {
    outline:none;
}
.text-field input:invalid {
    box-shadow:none;
}
.text-field label {
    color:#aaa;
    font-size:1.2em;
    position:absolute;
    pointer-events:none;
    left:0.5em;
    top:0.1em;
    transition:300ms ease all;
    user-select:none;
}
.text-field input:disabled ~ label,
.text-field input:read-only ~ label,
.text-field input:focus ~ label,
.text-field input:not(:placeholder-shown) ~ label {
    top:-1.1em;
    font-size:0.8em;
    color:#888;
}

.table-toolbar {
    display: flex;
    gap: 0.5rem 1rem;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    padding: 0.5rem;
    background: #8881;
    border-radius: 4px;
}

.table-toolbar .text-field {
    margin: 0;
    flex: 1 1 12rem;
    min-width: 10rem;
}

.toolbar-status {
    display: flex;
    gap: 0.5rem;
}

.toolbar-status input[type="radio"] {
    display: none;
}

.toolbar-status label {
    padding: 0.35rem 0.75rem;
    border: 1px solid;
    border-color: inherit;
    border-radius: 4px;
    font-size: 0.9rem;
    line-height:1.4rem;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}
.toolbar-status label:hover {
    background-color: #3a7fd1;
}
.toolbar-status input[type="radio"]:checked + label {
    background-color: #002554;
    color: white;
}

th.sorted-asc::after {
    content: " ▲";
}
th.sorted-desc::after {
    content: " ▼";
}

.csv-export {
    flex: 0 0 auto;
    margin-left: auto;
}

.toolbar-counter {
    flex: 0 0 auto;
    font-size: 0.9rem;
    opacity: 0.7;
}


section.my-profile a {
    display: inline-block;
    margin-top: 1rem;
    color: #4a90e2;
    font-size: 0.9rem;
    text-decoration: none;
}

section.my-profile a:hover {
    text-decoration: underline;
}

section.my-profile form.editing button.edit-profile {
    display: none;
}
section.my-profile form:not(.editing) button[data-action] {
    display: none;
}
section.my-profile form:not(.editing) input:disabled {
    color:inherit;
    border-bottom-color:#888;
}

section.account-group[data-group-type=family] header {
    flex-direction: column;
    border-width: 0 0 1px;
    border-style: solid;
    padding: 0 1rem 0.5rem;
    margin-bottom: 1rem;
}

section.account-group[data-group-type=family] aside.subscription-info {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
    padding-left: 1rem;
    border-left: 3px solid #4a90e2;
}

section.account-group[data-group-type=family] ul.members {
    list-style-type: none;
    padding: 0;
    margin-top: 1rem;
}

section.account-group[data-group-type=family] ul.members li.family-member {
    margin-top: 1rem;
    padding: 0.5rem;
    background-color: rgba(128,128,128,0.15);
    border-radius: 0.25rem;
    box-shadow: 0 1px 3px rgba(128, 128, 128, 0.1);
}

section.login button.forgot-password {
    color: inherit;
    background: none;
}

section.app {
    text-align: center;
}

section.app details {
    font-size: 0.8rem;
}

section.app details summary {
    cursor: pointer;
    margin: 2rem 0 0.75rem;
}

section.app details ul {
    list-style: none;
}

section.app details ul li a {
    margin-top: 0.5em;
    line-height: 1.5rem;
}

section.school-chart figure {
    display: flex;
    align-items: center;
    justify-content: space-around;
    flex-direction: column;
}
@media (min-width: 42rem) {
    section.school-chart figure {
        flex-direction: row;
    }
}

section.students table thead #name {
    width: 80%;
    text-align: left;
}
section.students table tbody tr td:first-child {
    text-align: center;
}
section.students table tbody tr td:last-child {
    width: 100%;
    position: absolute;
    left: 0;
    top: 1.5rem;
    border-bottom: none;
    padding-left: 6.5em;
    height: 2rem;
    font-size: 0.9rem;
    opacity: 0.7;
}
section.students tbody tr:has(> td:last-child:not(:empty)) td {
    /* if the last cell has content, make the row taller */
    padding-bottom: 2rem;
}

section.account-group[data-group-type=school] {
    display: none;
}
label[for='alias'],
label[for='locale'],
label[for='timezone'] {
    display: none;
}
input[id='alias'],
input[id='locale'],
input[id='timezone']{
    display: none;
}

.icon-active { --fa: "\f14a"; color: #238823; }
.icon-inactive { --fa: "\f056"; color: #88888852; }
.icon-disabled { --fa: "\f057"; color: #d2222c; }
