:root {
    --accent-color: #000000;
    --light-background-color: rgb(237, 237, 237);
    --lighter-background-color: rgb(222, 222, 222);
    --border-color: rgb(182, 182, 182);
    --text-color: #383838;
    --secondary-text-color: #595959;
    --background-color: #fff;
    --border-radius-modal: 25px;
    --default-border-radius: 12px;
    --small-font-size: 12px;
    --application-max-width: 75px;
    --content-max-width: 500px;
    --user-default-height: 50px;
    --box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1);
    --error-text-color: #720000;
    --error-background-color: rgb(255, 226, 226);
}

@media (prefers-color-scheme: dark) {
    :root {
        --accent-color: #ffffff;
        --light-background-color: rgb(40, 40, 40);
        --lighter-background-color: rgb(60, 60, 60);
        --border-color: rgb(100, 100, 100);
        --text-color: #eee;
        --secondary-text-color: #d0d0d0;
        --background-color: #18171a;
        --error-text-color: #ffc9c9;
        --error-background-color: rgb(93, 0, 0);
    }
}

html {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    color: var(--text-color);
    background-color: var(--background-color);
    margin: 0px;
    height: 100%;
}

.hide {
    display: none !important;
}

.icon {
    fill: var(--text-color);
}

button,
a {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

a {
    color: var(--text-color);
    text-decoration: none;
}

.content {
    display: flex;
    align-items: center;
    justify-content: center;
}

.content.full-height {
    height: 100%;
}

.content>.wrapper {
    width: 100%;
    max-width: var(--content-max-width);
    margin: 10px;
    padding: 50px;
    border-radius: 15px;
    border: 1px solid var(--light-background-color);
}

.container .title,
.authorization .information .title {
    font-size: 24px;
}

.container .title,
.container .description,
.authorization .information .title,
.authorization .information .description {
    text-align: center;
}

.authorization .information .button {
    width: 100%;
}

.authorization .information {
    display: grid;
    gap: 10px;
}

.authorization .information .scopes {
    padding: 0px 25px;
    list-style: none;
}

.authorization .information .scopes>* {
    margin: 10px 0px;
}

.authorization .information .scopes>*::before {
    position: absolute;
    content: "✓";
    color: var(--background-color);
    text-align: center;
    margin-left: -25px;
    width: 20px;
    height: 20px;
    border-radius: 5px;
    background-color: var(--text-color);
    opacity: 0.7;
    cursor: not-allowed;
}

.input.field {
    position: relative;
    display: inline-block;
    border-radius: var(--default-border-radius);
    height: 50px;
    padding: 0px !important;
    display: inline-block;
    margin-top: 10px;
    background-color: var(--light-background-color);
    overflow: hidden;
}

.input.field:focus-within {
    z-index: 1;
}

.input.checkbox {
    display: flex;
    accent-color: var(--accent-color);
}

.input.checkbox>input[type="checkbox"] {
    transform: scale(1.2);
    cursor: pointer;
}

.input.checkbox>input[type="checkbox"]+label {
    flex: 1;
    text-align: left;
    margin-left: 10px;
    cursor: pointer;
}

.input.field:focus-within>label,
input.field:not(:invalid)+label {
    z-index: 1;
    font-size: 10px;
    transform: translateY(-10px);
}

input.field {
    padding: 20px 10px 15px 10px;
    border: none;
    outline: none;
    left: 0px;
    display: inline-block;
    width: calc(100% - 20px);
    background-color: transparent;
    color: var(--text-color);
}

input.field+label {
    position: absolute;
    top: 15px;
    left: 5px;
    padding-left: 5px;
    padding-right: 5px;
    color: var(--secondary-text-color);
    transition: 0.1s font-size, 0.3s transform;
    user-select: none;
    z-index: 0;
    pointer-events: none;
}

input.field:is(:-webkit-autofill, :autofill)+label {
    color: #000;
}

input.field,
.button {
    font-size: 16px;
}

.button {
    border-radius: 40px;
}

.inputs {
    display: grid;
    grid-template-columns: 1fr;
}

.inputs>* {
    margin-top: 10px;
}

.button {
    background-color: var(--accent-color);
    color: var(--background-color);
    border: none;
    padding: 15px;
    cursor: pointer;
}

.button.outline {
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--text-color);
}

.button>* {
    vertical-align: middle;
}

.button:hover {
    opacity: 0.85;
}

#authentication {
    margin-top: 25px;
}

.error {
    background-color: var(--error-background-color);
    padding: 10px;
    border-radius: 10px;
    color: var(--error-text-color);
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 10px;
}

.error::before {
    content: "⚠︎";
    font-size: 24px;
    font-weight: 200;
}

.password-reset-link.hide {
    opacity: 0;
    pointer-events: none;
    display: block !important;
}

.user-wrapper {
    width: calc(100% - 32px);
    position: sticky;
    top: 16px;
    left: 16px;
    right: 16px;
    margin-bottom: 24px;
    z-index: 2;
}

.user {
    max-width: var(--content-max-width);
    margin-left: 50%;
    transform: translateX(-50%);
    display: grid;
    width: 100%;
    background-color: var(--light-background-color);
    box-shadow: var(--box-shadow);
    transition: 0.15s transform;
}

@keyframes expand {
    0%    {opacity: 0; margin-top: -20px}
    100%  {opacity: 1; margin-top: 0px}
}

.user:focus-within,
.user[open] {
    transform: translateX(-50%) scale(1.02);
}

.user[open] summary ~ * {
    animation: expand .35s ease-in-out;
}

.user .avatar {
    z-index: 2;
    cursor: pointer;
    list-style-type: none;
}

.user,
.user .avatar {
    border-radius: calc(var(--user-default-height) / 2);
}

.user .avatar::marker,
.user .avatar::-webkit-details-marker {
    display: none;
}

.user .avatar .wrapper {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    height: calc(var(--user-default-height) - 2 * 10px);
    margin: 10px;
}

.user .avatar .expand-button {
    display: grid;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: calc((var(--user-default-height) - 2 * 10px) / 2);
    transition: transform 0.3s;
}

.user[open] .avatar .expand-button {
    transform: rotateZ(180deg);
}

.user .avatar .expand-button:focus,
.user .avatar .expand-button:hover {
    background-color: var(--lighter-background-color);
}

.user .avatar .expand-button,
.user .avatar .expand-button .icon,
.user .avatar .wrapper>.icon {
    height: calc(var(--user-default-height) - 2 * 10px);
    width: calc(var(--user-default-height) - 2 * 10px);
}

.user .avatar .expand-button .icon {
    transform-origin: center;
    transition: all 0.3s;
}

.user .avatar .wrapper>.icon {
    background-color: var(--lighter-background-color);
    border-radius: 100%;
}

.user .avatar .info {
    display: grid;
    grid-template-rows: auto auto;
    grid-template-columns: auto auto 1fr;
    column-gap: 5px;
    grid-template-areas:
        "name dot-separator realm"
        "email email email";
    align-self: center;
}

.user .avatar .info .name {
    grid-area: name;
}

.user .avatar .info .dot-separator {
    grid-area: dot-separator;
}

.user .avatar .info .realm {
    grid-area: realm;
}

.user .avatar .info .name,
.user .avatar .info .dot-separator,
.user .avatar .info .realm {
    font-size: 14px;
    font-weight: 500;
    line-height: 14px;
}

.user .avatar .info * {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user .avatar .info .email {
    font-size: var(--small-font-size);
    color: var(--secondary-text-color);
    grid-area: email;
}

.user .actions {
    display: flex;
    flex-direction: column;
    align-items: first;
    margin: 0px;
    transition: all 0.5s;
}

.user .actions>.action {
    border: none;
    cursor: pointer;
    display: grid;
    grid-template-columns: auto 1fr;
    text-align: left;
    gap: 14px;
    padding: 10px;
    padding-left: 14px;
    font-size: 14px;
    color: var(--text-color);
    background: transparent;
}

.user .actions>.action:hover,
.user .actions>.action:focus  {
    background-color: var(--lighter-background-color);
}

.user .actions .action .icon {
    width: 25px;
    height: 25px;
}

.user .actions .action .label {
    align-self: center;
}

.user .actions .action:last-child {
    border-bottom-left-radius: calc(var(--user-default-height) / 2);
    border-bottom-right-radius: calc(var(--user-default-height) / 2);
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
}

.loading-ring-wrapper {
    width: 100%;
    display: grid;
    justify-items: center;
    padding: 16px;
}

.loading-ring {
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-left: 11px;
    vertical-align: middle;
    transform: translateX(-50%);
}

.loading-ring div {
    box-sizing: border-box;
    display: inline-block;
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    animation: loading-ring-animation 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    border-color: var(--accent-color) transparent transparent transparent;
}

.loading-ring div:nth-child(1) {
    animation-delay: -0.45s;
}

.loading-ring div:nth-child(2) {
    animation-delay: -0.3s;
}

.loading-ring div:nth-child(3) {
    animation-delay: -0.15s;
}

@keyframes loading-ring-animation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.applications {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(calc(1.2 * var(--application-max-width)), 1fr));
    grid-auto-rows: auto;
    gap: 8px;
    max-width: var(--content-max-width);
    margin-left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
}

.application {
    display: flex;
    flex-direction: column;
    align-items: center;
    border-bottom: none;
    margin: 0px;
    border-radius: 8px;
}

.application>.logo {
    margin-top: 8px;
    width: calc(var(--application-max-width) - 12px);
    height: calc(var(--application-max-width) - 12px);
    background-color: #fff;
    border-radius: 16px;
    transition: opacity 0.2s;
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.application>.logo:hover {
    opacity: 0.75;
}

.application>.logo>.image {
    width: 100%;
    height: 100%;
}

.application>.name {
    text-align: center;
    font-size: var(--small-font-size);
    margin: 2px;
    white-space: nowrap;
    padding: 3px 7px;
    max-width: calc(1.2 * var(--application-max-width));
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal {
    grid-template-columns: 1fr auto;
    grid-template-rows: min-content 1fr;
    grid-template-areas:
        "modal-title modal-close"
        "modal-content modal-content";
    margin: 25px;
    width: inherit;
    width: calc(100% - 80px);
    max-height: calc(100% - 80px);
    max-width: var(--content-max-width);
    transform: translateX(-50%);
    margin-left: 50%;
    border: none;
    border-radius: var(--border-radius-modal);
    height: min-content;
    background: var(--background-color);
    color: var(--text-color);
}

@keyframes bounce {
    0% { transform: translateX(-50%) scale(0.90); opacity: 0; }
    75% { transform: translateX(-50%) scale(1.01); }
    100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

.modal[open] {
    display: grid;
    animation: bounce 0.25s ease-out;
}

.modal::backdrop {
    background: rgba(0, 0, 0, 0.8);
}

.modal>.close-button {
    grid-area: modal-close;
    cursor: pointer;
    padding: 0px;
    background: transparent;
    border: none;
}

.modal>.close-button>.icon {
    height: 32px;
    width: 32px;
}

.modal>.title {
    grid-area: modal-title;
    font-weight: unset;
    font-size: 18px;
    margin: 0px;
    padding: 0px;
    font-weight: bold;
}

.modal>.title,
.modal>.close-button {
    position: sticky;
    top: -16px;
    background-color: var(--background-color);
    padding-top: 16px;
    margin-top: -16px;
}

.modal>.content {
    grid-area: modal-content;
    display: grid;
    grid-auto-flow: row;
    gap: 10px;
    grid-template-columns: 1fr;
    overflow: auto;
    height: fit-content;
}

.sessions-wrapper>.sessions>.session {
    border-radius: var(--default-border-radius);
    display: grid;
    padding: 4px;
    grid-template-columns: 1fr auto;
    row-gap: 2px;
    column-gap: 10px;
    grid-template-areas:
        "last-user-agent logout self"
        "last-used-at logout self"
        "last-ip-address logout self"
}

.sessions-wrapper>.sessions>.session:has(.self) {
    background-color: var(--light-background-color);
}

.sessions-wrapper>.sessions>.session>.self {
    grid-area: self;
    width: fit-content;
    height: 16px;
    padding: 6px 10px;
    border-radius: 14px;
    justify-self: end;
    align-self: center;
    align-content: center;
    vertical-align: middle;
    background-color: var(--text-color);
    color: var(--background-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
    
.sessions-wrapper>.sessions>.session>.last-used-at {
    grid-area: last-used-at;
}

.sessions-wrapper>.sessions>.session>.last-ip-address {
    grid-area: last-ip-address;
}

.sessions-wrapper>.sessions>.session>.last-user-agent {
    grid-area: last-user-agent;
    color: var(--text-color);
    font-weight: bold;
}

.sessions-wrapper>.sessions>.session>.logout {
    grid-area: logout;
    justify-self: end;
    align-self: center;
}

.sessions-wrapper>.sessions>.session>.self,
.sessions-wrapper>.sessions>.session>.logout.logged-out {
    font-size: 14px;
}

.sessions-wrapper>.sessions>.session>.last-ip-address,
.sessions-wrapper>.sessions>.session>.last-used-at {
    color: var(--secondary-text-color);
}

.access-grants-wrapper>.access-grants>.access-grant {
    display: grid;
    grid-template-columns: auto auto 1fr;
    column-gap: 10px;
    grid-template-areas:
        "application-logo application-name revoke"
        "application-logo granted-at revoke";
}

.access-grants-wrapper>.access-grants>.access-grant>.application-logo {
    grid-area: application-logo;
    height: 50px;
    width: 50px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.access-grants-wrapper>.access-grants>.access-grant>.application-name {
    grid-area: application-name;
    font-weight: bold;
    color: var(--text-color);
}

.access-grants-wrapper>.access-grants>.access-grant>.granted-at {
    grid-area: granted-at;
    color: var(--secondary-text-color);
}

.access-grants-wrapper>.access-grants>.access-grant>.revoke {
    grid-area: revoke;
    justify-self: end;
    align-self: center;
}