* {
    box-sizing: border-box;
    letter-spacing: 0;
}

html {
    font: 16px/1.5 var(--font);
    background: var(--bg);
    color: var(--text);
}

body {
    margin: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    color: var(--primary);
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a,
summary,
select,
input[type="checkbox"] {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

button,
a,
summary,
select {
    cursor: pointer;
}

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

[hidden] {
    display: none !important;
}

svg.lucide {
    width: 18px;
    height: 18px;
    stroke-width: 1.8;
    flex-shrink: 0;
}

p {
    margin: 0 0 12px;
}

h1,
h2,
h3,
p,
a,
label {
    overflow-wrap: anywhere;
}

h2 {
    font-size: 1.125rem;
    font-weight: 650;
    line-height: 1.4;
    margin: 0 0 16px;
}

h3 {
    font-size: 1rem;
    font-weight: 650;
    line-height: 1.4;
    margin: 0 0 10px;
}

small {
    font-size: .8125rem;
}

.muted,
small {
    color: var(--muted);
}

.positive {
    color: var(--lime);
}

.negative,
.danger {
    color: var(--red);
}

.accent {
    color: var(--cyan);
}

.eyebrow {
    font-size: .75rem;
    font-weight: 650;
    color: var(--muted);
    margin-bottom: 7px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip {
    position: fixed;
    top: -80px;
    left: 16px;
    z-index: 100;
    padding: 12px 20px;
    background: var(--primary);
    color: var(--on-primary);
}

.skip:focus {
    top: 12px;
}

.shell {
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--sidebar);
    color: var(--sidebar-text);
    padding: 28px 14px 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px 28px;
    color: var(--sidebar-text);
}

.brand:hover {
    color: var(--sidebar-text);
}

.brand strong {
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1.1;
}

.brand-dot {
    color: var(--sidebar-active);
}

.brand small {
    display: block;
    font-size: .75rem;
    margin-top: 4px;
    color: var(--sidebar-muted);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    background: var(--sidebar-active);
    color: var(--on-sidebar-active);
    border-radius: 8px;
    flex: none;
}

.brand-mark svg {
    width: 25px;
    height: 25px;
}

.primary-nav {
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--sidebar-line) transparent;
    padding: 3px 4px;
}

.nav-group+.nav-group {
    margin-top: 19px;
}

.nav-label {
    margin: 0 12px 7px;
    color: var(--sidebar-muted);
    font-size: .75rem;
    font-weight: 500;
}

.primary-nav a {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 5px;
    color: var(--sidebar-muted);
    font-size: .8125rem;
    font-weight: 500;
    transition: background var(--motion), color var(--motion);
    margin: 2px 0;
}

.primary-nav a:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.primary-nav a[aria-current="page"] {
    background: var(--sidebar-active);
    color: var(--on-sidebar-active);
    font-weight: 650;
}

.count {
    margin-left: auto;
    min-width: 22px;
    text-align: center;
    font-size: .75rem;
}

.sidebar-footer {
    margin-top: auto;
    padding: 20px 8px 0;
}

.source-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    color: var(--sidebar-text);
    font-size: .8125rem;
}

.source-link:hover {
    color: var(--sidebar-active);
}

.source-link>span:nth-child(2) {
    flex: 1;
}

.source-link strong,
.account strong {
    display: block;
    font-size: .8125rem;
    font-weight: 550;
}

.source-link small,
.account small {
    display: block;
    font-size: .75rem;
    color: var(--sidebar-muted);
    margin-top: 3px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex: none;
    background: var(--sidebar-muted);
}

.status-dot.is-current {
    background: var(--sidebar-active);
}

.account {
    display: flex;
    gap: 10px;
    align-items: center;
    border-top: 1px solid var(--sidebar-line);
    padding-top: 16px;
    margin-top: 8px;
}

.account>span:nth-child(2) {
    flex: 1;
}

.avatar {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    background: var(--sidebar-hover);
    color: var(--sidebar-muted);
    border-radius: 50%;
}

.workspace {
    min-width: 0;
}

.topbar {
    height: 72px;
    padding: 0 32px;
    display: flex;
    gap: 20px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.workspace-name {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: .8125rem;
    white-space: nowrap;
}

.workspace-name>svg {
    color: var(--primary);
}

.workspace-name>span {
    color: var(--muted);
}

.workspace-name strong {
    font-weight: 600;
}

.topbar-divider {
    opacity: .6;
}

.global-search {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-left: auto;
    width: 330px;
    min-width: 120px;
    color: var(--muted);
}

.global-search input {
    min-width: 0;
    width: 100%;
    border: 0;
    padding: 8px 0;
    background: transparent;
}

.topbar-tools {
    display: flex;
    align-items: center;
    gap: 6px;
}

.alert-shortcut {
    position: relative;
}

.notification-dot {
    position: absolute;
    top: 9px;
    right: 9px;
    width: 6px;
    height: 6px;
    background: var(--red);
    border-radius: 50%;
}

.mobile-menu {
    display: none !important;
}

html:not(.js) #theme-toggle {
    display: none;
}

.theme-sun,
[data-theme="dark"] .theme-moon {
    display: none;
}

[data-theme="dark"] .theme-sun {
    display: block;
}

main {
    width: 100%;
    max-width: 1680px;
    padding: 32px 36px 24px;
    margin: 0 auto;
    min-width: 0;
}

main:focus {
    outline: none;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-bottom: 28px;
}

.page-title {
    min-width: 0;
}

.page-header h1 {
    font-size: 1.875rem;
    font-weight: 650;
    line-height: 1.25;
    margin: 0;
}

.actions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.actions form {
    margin: 0;
}

.page-footer {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 28px 0 0;
    font-size: .75rem;
    color: var(--muted);
    margin-top: 24px;
    border-top: 1px solid var(--line);
}

.page-footer>span:first-child {
    font-weight: 650;
}

.navigation-dialog {
    position: fixed;
    inset: 0 auto 0 0;
    max-width: min(320px, 90vw);
    width: 320px;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    padding: 24px 16px;
    background: var(--sidebar);
    color: var(--sidebar-text);
}

.navigation-dialog::backdrop {
    background: #101a24a6;
}

.navigation-dialog .primary-nav {
    overflow: visible;
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.drawer-header .brand {
    padding: 0;
}

.drawer-header .quiet {
    color: var(--sidebar-text);
}

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

    main {
        padding: 28px 24px;
    }

    .topbar {
        padding: 0 24px;
    }

    .workspace-name>span:not(.topbar-divider),
    .workspace-name .topbar-divider {
        display: none;
    }
}

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

    .sidebar {
        position: relative;
        height: auto;
    }

    .js .sidebar {
        display: none;
    }

    .js .mobile-menu {
        display: inline-flex !important;
    }

    .topbar {
        height: 64px;
        padding: 0 16px;
        gap: 12px;
    }

    .workspace-name {
        display: none;
    }

    .global-search {
        margin-left: 0;
        flex: 1;
    }

    .topbar-tools {
        margin-left: auto;
    }

    main {
        padding: 24px 20px;
    }

    .page-header {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 16px;
    }

    .page-header h1 {
        font-size: 1.625rem;
    }

    .actions {
        justify-content: flex-start;
    }
}

@media (max-width: 520px) {
    main {
        padding: 24px 16px 16px;
    }

    .page-header {
        margin-bottom: 24px;
    }

    .topbar {
        gap: 8px;
        padding: 0 8px;
    }

    .global-search>svg {
        display: none;
    }

    .global-search input {
        font-size: 1rem;
    }

    .global-search button {
        display: none;
    }

    .topbar-tools {
        gap: 0;
    }

    .page-footer {
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
        scroll-behavior: auto !important;
    }
}
