:root {
    color-scheme: dark;
    --ink: #f8edf2;
    --muted: #b1a0aa;
    --accent: #ed0039;
    --line: #ffffff1d;
    --paper: #11090e;
    --surface: #1b1119;
    --surface2: #23141e;
    --field: #160c13;
    --soft: #3c1423;
    --green: #80d4ad;
    --amber: #efc16c
}

html[data-theme=light] {
    color-scheme: light;
    --ink: #271c23;
    --muted: #776b73;
    --line: #e4dbe1;
    --paper: #f8f4f6;
    --surface: #fff;
    --surface2: #f4edf1;
    --field: #fff;
    --soft: #fbe6ed;
    --green: #237b55;
    --amber: #956118
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    color: var(--ink);
    background: radial-gradient(ellipse at 40% -20%,#ed003918,transparent 55%),var(--paper);
    font: 14px/1.6 Arial,'DejaVu Sans',sans-serif
}

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

button {
    cursor: pointer;
    border: 1px solid var(--line);
    background: var(--surface2);
    color: var(--ink);
    border-radius: 9px;
    padding: 10px 14px
}

button:hover {
    border-color: #ac526b
}

button:disabled {
    opacity: .45;
    cursor: wait
}

button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white
}

button.quiet {
    background: transparent
}

button.danger {
    color: #fa6b89
}

button.small {
    font-size: 12px;
    padding: 6px 9px
}

input,select,textarea {
    width: 100%;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--field);
    color: var(--ink)
}

textarea {
    resize: vertical;
    min-height: 95px
}

input[type=checkbox] {
    width: auto;
    accent-color: var(--accent)
}

:focus-visible {
    outline: 3px solid #c45d79;
    outline-offset: 3px
}

label {
    font-size: 12px;
    color: var(--muted);
    display: block
}

label input,label select,label textarea {
    margin-top: 7px
}

h1,h2,h3,p {
    margin: 0
}

h1 {
    font-size: 28px;
    line-height: 1.5
}

h2 {
    font-size: 19px
}

h3 {
    font-size: 15px
}

p {
    margin: 8px 0
}

small,.muted {
    font-size: 12px;
    color: var(--muted)
}

header {
    min-height: 86px;
    padding: 18px 30px;
    display: flex;
    align-items: center;
    gap: 24px;
    border-bottom: 1px solid var(--line);
    background: var(--surface)
}

.brand {
    font-size: 31px;
    letter-spacing: -2px;
    font-weight: 900;
    text-decoration: none;
    color: var(--ink);
    display: flex;
    align-items: center
}

.brand span {
    font-weight: 400
}

.brand i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    margin: 0 0 12px 4px
}

.brand-sub {
    border-left: 1px solid var(--line);
    padding-left: 24px;
    font-size: 12px
}

.header-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap
}

.shell {
    display: grid;
    grid-template-columns: 235px 1fr;
    min-height: calc(100vh - 86px)
}

aside {
    padding: 32px 20px;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    justify-content: space-between
}

.eyebrow {
    font-size: 10px;
    letter-spacing: 1.6px;
    color: var(--muted);
    display: block;
    margin-bottom: 12px
}

aside h3 {
    margin-bottom: 28px
}

nav button {
    width: 100%;
    text-align: left;
    display: flex;
    gap: 14px;
    background: transparent;
    border-color: transparent;
    margin: 8px 0;
    padding: 14px 12px;
    font-size: 12px
}

nav button.active {
    background: var(--soft);
    border-color: #ed00393f;
    color: var(--ink)
}

nav button.active:first-letter {
    color: var(--accent)
}

.side-note {
    border-top: 1px solid var(--line);
    padding: 24px 10px 0;
    margin-top: 60px
}

.side-note p {
    font-size: 12px;
    color: var(--muted)
}

.mark {
    font-size: 36px;
    color: var(--accent);
    margin-bottom: 10px
}

main {
    padding: 34px;
    min-width: 0;
    max-width: 1800px;
    width: 100%;
    margin: auto
}

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

.heading p {
    color: var(--muted);
    font-size: 13px
}

.row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 14px;
    margin: 22px 0 28px
}

.stat {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px 22px;
    background: var(--surface)
}

.stat strong {
    display: block;
    font-size: 30px;
    font-weight: 500;
    margin-bottom: 4px
}

.stat small {
    font-size: 11px
}

.tabs {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 22px;
    padding-bottom: 12px
}

.tabs button {
    background: transparent;
    border: 0
}

.tabs button.active {
    background: var(--soft);
    color: var(--ink)
}

.toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 18px
}

.toolbar input {
    max-width: 380px
}

.toolbar select {
    max-width: 210px
}

.panel {
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface);
    padding: 23px;
    margin-bottom: 20px
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface)
}

table {
    border-collapse: collapse;
    width: 100%;
    text-align: left;
    font-size: 13px
}

th {
    font-size: 10px;
    letter-spacing: .3px;
    color: var(--muted);
    font-weight: 400;
    background: var(--surface2)
}

th,td {
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle
}

tr:last-child td {
    border: 0
}

.person {
    display: flex;
    align-items: center;
    gap: 12px
}

.avatar {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 12px;
    background: var(--soft);
    color: #f3849e;
    font-size: 12px
}

.pill {
    display: inline-block;
    border: 1px solid var(--line);
    padding: 4px 9px;
    border-radius: 18px;
    font-size: 10px;
    color: var(--muted)
}

.pill.green {
    color: var(--green);
    background: #48b28512
}

.pill.amber {
    color: var(--amber);
    background: #c79c3412
}

.pill.red {
    color: #ee7894
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill,minmax(270px,1fr));
    gap: 18px
}

.team-card {
    padding: 23px;
    border-radius: 13px;
    border: 1px solid var(--line);
    background: var(--surface);
    border-top: 3px solid #c92d54
}

.team-card .team-icon {
    color: var(--accent);
    font-size: 26px;
    margin-bottom: 17px
}

.team-card p {
    min-height: 40px;
    font-size: 12px;
    color: var(--muted)
}

.team-card footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--line);
    padding-top: 16px;
    margin-top: 20px
}

.empty {
    text-align: center;
    border: 1px dashed var(--line);
    padding: 48px 24px;
    border-radius: 12px;
    color: var(--muted)
}

.empty h2 {
    color: var(--ink);
    margin-bottom: 8px
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px
}

.full {
    grid-column: 1/-1
}

dialog {
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 16px;
    width: min(660px,94vw);
    max-height: 90vh;
    overflow: auto;
    padding: 26px
}

dialog::backdrop {
    background: #08030ab8
}

dialog h2 {
    margin-bottom: 22px
}

dialog .actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px
}

dialog .error {
    color: #ff8ba5;
    font-size: 13px;
    margin-top: 14px
}

.comment {
    border-left: 2px solid #a53c58;
    padding: 10px 15px;
    background: var(--surface2);
    margin: 12px 0;
    border-radius: 0 8px 8px 0
}

.comment p {
    white-space: pre-wrap;
    overflow-wrap: anywhere
}

.subheading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 24px 0 14px
}

.note {
    padding: 12px 16px;
    background: var(--soft);
    border-radius: 9px;
    font-size: 12px;
    color: var(--muted)
}

#toast {
    position: fixed;
    bottom: 22px;
    right: 22px;
    max-width: 500px;
    background: var(--surface2);
    border: 1px solid #ac526b;
    padding: 16px 22px;
    border-radius: 12px;
    z-index: 50
}

body.busy {
    cursor: wait
}

a {
    color: inherit
}

[hidden] {
    display: none!important
}

@media(max-width: 1000px) {
    header {
        padding:16px;
        flex-wrap: wrap
    }

    .header-actions {
        margin-left: 0
    }

    .shell {
        grid-template-columns: 190px 1fr
    }

    main {
        padding: 24px
    }

    .stats {
        grid-template-columns: repeat(2,1fr)
    }
}

@media(max-width: 700px) {
    .shell {
        display:block
    }

    aside {
        padding: 16px;
        border-right: 0;
        border-bottom: 1px solid var(--line)
    }

    aside h3,.side-note,aside .eyebrow {
        display: none
    }

    nav {
        display: flex;
        gap: 8px
    }

    nav button {
        margin: 0
    }

    .brand-sub {
        display: none
    }

    main {
        padding: 20px 14px
    }

    .heading {
        align-items: flex-start;
        flex-direction: column
    }

    .toolbar {
        flex-wrap: wrap
    }

    .form-grid {
        grid-template-columns: 1fr
    }

    .full {
        grid-column: auto
    }

    h1 {
        font-size: 24px
    }

    .header-actions button {
        font-size: 11px
    }

    .stats {
        gap: 8px
    }

    .stat {
        padding: 14px
    }

    td,th {
        padding: 12px
    }

    .row {
        gap: 6px
    }
}

.brand {
    gap: 10px;
    letter-spacing: normal
}

.brand-logo {
    display: block;
    width: 115px;
    height: 28px;
    flex-shrink: 0
}

.brand .scrum-badge {
    font: 600 10px/1 Arial,sans-serif;
    letter-spacing: .4px;
    background: #ed0039;
    color: #fff;
    padding: 6px 8px;
    border-radius: 6px;
    align-self: center
}

html[data-theme=light] .brand-logo {
    filter: brightness(0)
}

.users-nav {
    display: flex;
    gap: 14px;
    font-size: 12px;
    text-decoration: none;
    padding: 14px 12px;
    border-radius: 9px;
    margin-top: 8px;
    order: 3
}

.users-nav:hover {
    background: var(--soft)
}

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

.users-nav.active {
    background: var(--soft)
}

body[data-role=viewer] [data-action],body[data-role=viewer] [data-person],body[data-role=viewer] [data-role],body[data-role=viewer] [data-team],body[data-role=viewer] [data-position],body[data-role=viewer] [data-delete-role],body[data-role=viewer] #import {
    display: none
}

.users-table form {
    display: inline
}

.user-form {
    margin-top: 20px
}

.success {
    color: var(--green)
}

@media(max-width: 700px) {
    nav {
        flex-direction:row;
        flex-wrap: wrap
    }

    .users-nav {
        margin: 0
    }
}

/* Shared navigation: links and buttons deliberately use the same component. */
nav .workspace-nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    margin: 8px 0;
    padding: 14px 12px;
    min-height: 48px;
    text-align: left;
    text-decoration: none;
    font: 400 12px/1.6 Arial,'DejaVu Sans',sans-serif;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--ink);
    transition: background .16s,border-color .16s
}

nav .workspace-nav-item:hover {
    background: var(--surface2);
    border-color: var(--line)
}

nav .workspace-nav-item.active {
    background: var(--soft);
    border-color: #ed00393f;
    color: var(--ink)
}

.nav-number {
    color: var(--muted);
    font-variant-numeric: tabular-nums
}

.workspace-nav-item.active .nav-number {
    color: #f47694
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid var(--line);
    background: var(--surface2);
    color: var(--ink);
    border-radius: 9px;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.6;
    transition: background .16s,border-color .16s
}

.button-link:hover {
    border-color: #ac526b
}

.button-link.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white
}

.button-link.primary:hover {
    background: #d60034
}

.button-link.small {
    padding: 6px 12px;
    font-size: 12px
}

.admin-main {
    align-self: start
}

.settings-tabs {
    border-bottom: 1px solid var(--line);
    display: flex;
    margin-bottom: 24px
}

.settings-tab {
    display: block;
    padding: 0 0 14px;
    font-size: 13px
}

.settings-tab.active {
    border-bottom: 2px solid var(--accent);
    color: var(--ink)
}

.admin-stats {
    margin-top: 0
}

.stat strong {
    font-variant-numeric: tabular-nums
}

.accounts-panel {
    padding: 0;
    overflow: hidden
}

.accounts-heading {
    padding: 23px 24px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px
}

.accounts-heading p {
    margin-bottom: 0
}

.accounts-toolbar {
    padding: 0 24px;
    margin-bottom: 22px
}

.accounts-toolbar .search-field {
    flex: 1;
    max-width: 420px
}

.accounts-toolbar input,.accounts-toolbar select {
    margin-top: 0;
    max-width: none
}

.accounts-toolbar>label:not(.search-field) {
    width: 175px
}

.users-table {
    border: 0;
    border-radius: 0
}

.users-table th {
    padding-top: 12px;
    padding-bottom: 12px
}

.users-table th:first-child,.users-table td:first-child {
    padding-left: 24px
}

.users-table th:last-child,.users-table td:last-child {
    padding-right: 24px
}

.users-table td {
    padding-top: 18px;
    padding-bottom: 18px
}

.users-table tr:hover td {
    background: var(--surface2)
}

.account-name {
    font-weight: 600;
    margin-bottom: 2px
}

.account-avatar {
    border: 1px solid #ed003926;
    background: var(--soft);
    color: var(--ink)
}

.self-label {
    font-size: 10px;
    color: var(--muted);
    font-weight: 400;
    margin-left: 6px
}

.role-label {
    display: inline-block;
    font-size: 11px;
    padding: 5px 10px;
    background: var(--surface2);
    border: 1px solid var(--line);
    border-radius: 7px;
    white-space: nowrap
}

.role-admin {
    color: #f68ba4;
    border-color: #ed003930;
    background: var(--soft)
}

html[data-theme=light] .role-admin {
    color: #b4133b
}

.account-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    white-space: nowrap
}

.account-status.enabled {
    color: var(--green)
}

.account-status.disabled {
    color: var(--muted)
}

.status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    flex-shrink: 0;
    border-radius: 50%;
    background: currentColor
}

.align-right {
    text-align: right
}

.accounts-footer {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 15px 24px;
    border-top: 1px solid var(--line);
    background: var(--surface)
}

.permission-guide summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: list-item
}

.permission-guide summary .muted {
    font-weight: 400;
    margin-left: 14px
}

.permission-guide .table-wrap {
    margin-top: 20px
}

.filter-empty {
    text-align: center;
    padding: 40px 20px
}

.filter-empty button {
    margin-top: 12px
}

.notice-success {
    padding: 12px 16px;
    border: 1px solid #48b28540;
    background: #48b2850a;
    border-radius: 9px;
    color: var(--green);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 13px
}

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

.account-dialog {
    width: min(680px,94vw);
    padding: 28px
}

.dialog-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px
}

.dialog-heading h2 {
    margin: 0
}

.dialog-heading .eyebrow {
    font-size: 9px;
    letter-spacing: .7px;
    margin-bottom: 8px
}

.dialog-close {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    text-decoration: none;
    font-size: 25px;
    line-height: 1;
    border-radius: 8px;
    color: var(--muted)
}

.dialog-close:hover {
    background: var(--surface2)
}

.field-hint {
    display: block;
    font-size: 11px;
    color: var(--muted);
    margin-top: 8px;
    line-height: 1.6
}

.account-section {
    border-top: 1px solid var(--line);
    margin-top: 24px;
    padding-top: 20px
}

.account-section .form-grid {
    margin-top: 16px
}

.account-access {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 16px;
    margin-top: 24px;
    background: var(--surface2)
}

.account-access p {
    margin-bottom: 0
}

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

.access-check input {
    margin: 0;
    width: 17px;
    height: 17px
}

.session-note {
    margin-top: 12px;
    font-size: 11px
}

.account-dialog .actions {
    border-top: 1px solid var(--line);
    padding-top: 20px
}

.form-error {
    padding: 12px 16px;
    margin-bottom: 20px;
    border: 1px solid #ed003940;
    background: var(--soft);
    color: #ff8ba5;
    border-radius: 9px;
    font-size: 13px
}

html[data-theme=light] .form-error {
    color: #ab1639
}

@media(max-width: 700px) {
    nav .workspace-nav-item {
        width:auto;
        margin: 0;
        min-height: 44px;
        font-size: 11px;
        padding: 10px;
        gap: 8px;
        flex: 1
    }

    .accounts-heading {
        align-items: flex-start;
        flex-direction: column;
        padding: 20px 16px
    }

    .accounts-toolbar {
        padding: 0 16px;
        gap: 10px
    }

    .accounts-toolbar .search-field {
        flex-basis: 100%;
        max-width: none
    }

    .accounts-toolbar>label:not(.search-field) {
        flex: 1;
        width: auto
    }

    .accounts-footer {
        padding: 14px 16px;
        flex-direction: column;
        gap: 5px
    }

    .account-dialog {
        padding: 20px
    }

    .permission-guide summary .muted {
        display: block;
        margin: 8px 0 0
    }

    .admin-indicator {
        display: none
    }

    .account-access {
        align-items: flex-start
    }

    .users-table table {
        min-width: 580px
    }
}
