/* ========================================
   FiveM Manager - Modern Monochrome Design
   ======================================== */

/* --- Base & Variables --- */
:root {
    /* Pure monochrome palette */
    --bg: #050505;
    --bg-secondary: #0a0a0a;
    --surface: #111111;
    --surface-hover: #1a1a1a;
    --border: #2a2a2a;
    --border-light: #3a3a3a;
    --text: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #707070;
    --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.6);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --container: 1200px;
    --sidebar-width: 280px;
}

html[data-theme="light"] {
    --bg: #fafafa;
    --bg-secondary: #f0f0f0;
    --surface: #ffffff;
    --surface-hover: #f5f5f5;
    --border: #e5e5e5;
    --border-light: #d5d5d5;
    --text: #111111;
    --text-secondary: #555555;
    --text-muted: #888888;
    --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.08);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 15px;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    line-height: 1.5;
}

body.is-modal-open {
    overflow: hidden;
}

body.is-modal-open .dashboard-content {
    overflow: hidden;
}

html {
    scrollbar-color: #5a5a5a #0e0e0e;
    scrollbar-width: thin;
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: #0e0e0e;
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #5f5f5f 0%, #383838 100%);
    border: 2px solid #0e0e0e;
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #787878 0%, #4a4a4a 100%);
}

/* --- Dashboard Body --- */
.dashboard-body {
    min-height: 100vh;
    height: 100vh;
    max-height: 100vh;
    min-height: 100dvh;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

img {
    display: block;
    max-width: 100%;
}

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

button {
    cursor: pointer;
    border: none;
    background: none;
}

svg {
    display: block;
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* --- Public Shell --- */
.public-shell {
    min-height: 100vh;
}

.public-container {
    width: min(100% - 48px, var(--container));
    margin: 0 auto;
}

/* --- Header --- */
.public-header {
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid var(--border);
    background: rgba(5, 5, 5, 0.85);
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

.public-header-inner,
.public-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 72px;
}

/* --- Brand --- */
.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 14px;
}

.brand-lockup-sidebar {
    margin-bottom: 28px;
}

.brand-mark {
    display: inline-flex;
    width: 46px;
    height: 46px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.brand-copy {
    display: grid;
    gap: 2px;
}

.brand-copy strong {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand-copy span {
    color: var(--text-secondary);
    font-size: 12px;
}

/* --- Public Navigation --- */
.public-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.public-nav > a:not(.button),
.footer-links a {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    padding: 10px 14px;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.public-nav > a:not(.button):hover,
.public-nav > a.is-active,
.footer-links a:hover {
    background: var(--surface);
    color: var(--text);
}

/* --- Main Content --- */
.public-main {
    padding: 64px 0 104px;
}

/* --- Footer --- */
.public-footer {
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.public-footer-inner {
    padding: 28px 0;
}

.public-footer p,
.footer-links {
    color: var(--text-secondary);
    font-size: 14px;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* --- Page Blocks --- */
.page-block {
    margin-bottom: 32px;
}

.page-header,
.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.page-header h1,
.section-header h2,
.hero-title {
    margin: 0;
    letter-spacing: -0.06em;
}

.page-header h1 {
    font-size: clamp(2.1rem, 5vw, 3.8rem);
    line-height: 1.05;
    font-weight: 800;
}

.page-header p,
.section-header p,
.hero-copy p,
.surface p,
.item-meta,
.data-table td,
.data-table th,
.section-copy {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* --- Eyebrow --- */
.eyebrow {
    display: inline-flex;
    margin-bottom: 18px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.eyebrow-tight {
    margin-bottom: 10px;
}

/* --- Hero Section --- */
.hero {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 40px;
    align-items: center;
    padding: 56px 0 72px;
}

.hero-copy {
    grid-column: span 7;
}

.hero-visual {
    grid-column: span 5;
}

.hero-title {
    font-size: clamp(2.6rem, 6vw, 4.8rem);
    line-height: 0.98;
    max-width: 16ch;
    font-weight: 900;
}

.hero-actions,
.button-row,
.toolbar,
.toolbar-group,
.toolbar-actions,
.stat-grid,
.section-grid,
.surface-actions,
.meta-row,
.status-row,
.list-inline,
.support-layout,
.profile-grid,
.settings-grid,
.detail-grid {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.hero-actions,
.button-row {
    margin-top: 36px;
}

/* --- Buttons --- */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.button:hover {
    transform: translateY(-1px);
    border-color: var(--border-light);
}

.button-primary {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}

.button-primary:hover {
    background: var(--text-secondary);
    border-color: var(--text-secondary);
}

.button-secondary {
    background: transparent;
    color: var(--text);
}

.button-secondary:hover {
    background: var(--surface);
}

.button-full {
    width: 100%;
}

/* --- Surfaces & Cards --- */
.surface,
.mockup,
.stat-tile,
.list-item,
.conversation-thread,
.split-panel,
.table-wrap,
.empty-state {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
}

.surface {
    padding: 24px;
}

.surface-compact {
    padding: 18px;
}

/* --- Grids --- */
.section-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 20px;
}

.section-grid > .surface,
.section-grid > .mockup {
    min-width: 0;
}

.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }

/* --- Mockup --- */
.mockup {
    padding: 20px;
}

.mockup-window {
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg);
}

.mockup-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.mockup-dots {
    display: flex;
    gap: 6px;
}

.mockup-dots span {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--text-muted);
}

.mockup-content {
    display: grid;
    grid-template-columns: 200px 1fr;
    min-height: 440px;
}

.mockup-sidebar {
    padding: 20px 16px;
    border-right: 1px solid var(--border);
    background: var(--surface);
}

.mockup-sidebar .pill {
    margin-bottom: 10px;
}

.mockup-main {
    padding: 24px;
}

.mockup-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.mockup-stat,
.stat-tile {
    padding: 16px 18px;
    border-radius: var(--radius-lg);
}

.stat-tile {
    min-height: 84px;
    display: grid;
    align-content: space-between;
    gap: 6px;
    transition: all 0.2s ease;
}

.stat-tile:hover {
    transform: translateY(-2px);
    border-color: var(--border-light);
}

.stat-tile small,
.mockup-stat small {
    display: block;
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.stat-tile strong,
.mockup-stat strong {
    display: block;
    font-size: 32px;
    line-height: 1;
    letter-spacing: -0.05em;
    font-weight: 800;
}

/* --- Toolbar --- */
.toolbar {
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.toolbar-group {
    align-items: center;
}

.toolbar-search {
    min-width: 280px;
}

/* --- Pills & Badges --- */
.pill,
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.badge-neutral,
.badge-priority,
.badge-status {
    background: var(--surface);
}

/* --- Surface Titles --- */
.surface-title {
    margin: 0 0 8px;
    font-size: 18px;
    letter-spacing: -0.04em;
    font-weight: 700;
}

.surface-subtitle {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

/* --- Stacks --- */
.stack {
    display: grid;
    gap: 12px;
}

.stack-lg {
    display: grid;
    gap: 18px;
}

.stack-sm {
    display: grid;
    gap: 10px;
}

/* --- List Items --- */
.list-reset {
    margin: 0;
    padding: 0;
    list-style: none;
}

.list-item {
    padding: 16px 18px;
    transition: all 0.2s ease;
}

.list-item:hover,
.support-ticket:hover,
.permission-row:hover,
.data-table tbody tr:hover {
    background: var(--surface-hover);
}

.list-item-header,
.support-ticket-head,
.permission-row,
.settings-row,
.profile-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.item-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.item-description {
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.meta-row {
    margin-top: 12px;
    align-items: center;
}

/* --- Form Elements --- */
.field,
.field-group {
    display: grid;
    gap: 8px;
}

.field-label {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.field-help {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: -2px;
}

.surface-divider {
    height: 1px;
    margin: 6px 0 2px;
    background: var(--border);
}

input,
textarea,
select {
    width: 100%;
    min-height: 46px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-secondary);
    color: var(--text);
    transition: all 0.2s ease;
}

.invite-field {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text);
}

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 48px;
    cursor: pointer;
}

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

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--text);
    background: var(--surface);
}

.field-tight {
    margin-top: 10px;
}

.select-shell {
    position: relative;
    display: block;
}

.select-shell select {
    position: relative;
    z-index: 1;
}

.select-indicator {
    position: absolute;
    top: 50%;
    right: 16px;
    width: 10px;
    height: 10px;
    border-right: 1.5px solid var(--text-secondary);
    border-bottom: 1.5px solid var(--text-secondary);
    transform: translateY(-65%) rotate(45deg);
    pointer-events: none;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.select-shell:focus-within .select-indicator {
    border-color: var(--text);
    transform: translateY(-45%) rotate(45deg);
}

.select-shell-inline {
    min-width: 180px;
}

fieldset {
    margin: 0;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

legend {
    padding: 0 8px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.check-grid {
    display: grid;
    gap: 14px;
}

.check-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    color: var(--text-secondary);
}

.check-container {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg-secondary);
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
    cursor: pointer;
}

.check-container:hover {
    background: var(--surface);
    border-color: var(--border-light);
    transform: translateY(-1px);
}

.check-control {
    position: relative;
    display: inline-flex;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    margin-top: 2px;
}

.check-control input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.check-box {
    width: 20px;
    height: 20px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg);
    transition: all 0.2s ease;
}

.check-control input:checked + .check-box {
    background: linear-gradient(180deg, #f2f2f2 0%, #b5b5b5 100%);
    border-color: #d9d9d9;
    box-shadow: inset 0 0 0 4px #121212;
}

.check-control input:focus-visible + .check-box {
    outline: 2px solid rgba(255, 255, 255, 0.35);
    outline-offset: 2px;
}

.check-copy {
    display: grid;
    gap: 4px;
}

.check-copy strong {
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
}

.check-copy span {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.form-actions .button {
    min-width: 160px;
}

/* --- Tables --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.table-wrap {
    overflow: auto;
    scrollbar-width: thin;
}

.data-table thead {
    background: var(--bg-secondary);
}

.data-table th,
.data-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 14px;
}

.data-table th {
    color: var(--text-secondary);
    font-weight: 600;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* --- Split Layout --- */
.split-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 20px;
}

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

.split-panel-header {
    padding: 20px 22px;
    border-bottom: 1px solid var(--border);
}

.split-panel-body {
    padding: 18px;
    overflow: auto;
}

/* --- Support Tickets --- */
.support-ticket {
    padding: 16px;
    border: 1px solid transparent;
    border-radius: 14px;
    transition: all 0.2s ease;
}

.support-ticket + .support-ticket {
    margin-top: 8px;
}

.conversation-thread {
    padding: 24px;
    overflow: auto;
}

.conversation-thread .item-card + .item-card {
    margin-top: 12px;
}

.item-card {
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    transition: all 0.2s ease;
}

.item-card:hover {
    border-color: var(--border-light);
}

/* --- Profile & Settings Grids --- */
.profile-grid,
.settings-grid,
.detail-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 20px;
}

.team-detail {
    height: auto;
    display: grid;
    grid-template-rows: auto;
    gap: 20px;
    overflow: visible;
    align-content: start;
}

.team-detail-top {
    display: grid;
    grid-template-columns: 1.35fr 0.65fr;
    gap: 20px;
    min-height: 0;
    align-items: stretch;
}

.team-detail-top > .surface {
    height: 100%;
}

.team-hero-card {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 18px;
    min-width: 0;
}

.team-hero-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.team-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.team-stat {
    padding: 14px 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg-secondary);
}

.team-stat span {
    display: block;
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.team-stat strong {
    display: block;
    font-size: 18px;
    letter-spacing: -0.04em;
    font-weight: 800;
    line-height: 1.15;
}

.team-kv-card {
    display: grid;
    grid-template-rows: auto 1fr;
    align-content: start;
    min-width: 0;
}

.team-kv-card .kv-item {
    padding: 12px 0;
}

.team-invites-card {
    display: grid;
    gap: 14px;
    min-width: 0;
    overflow: visible;
}

.team-invites-card .section-header {
    flex-wrap: wrap;
}

.invite-list {
    display: grid;
    gap: 12px;
    max-height: none;
    overflow: visible;
    padding-right: 0;
    min-height: 0;
}

.invite-row {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--bg-secondary);
    padding: 16px;
    display: grid;
    gap: 12px;
    min-width: 0;
}

.invite-fields {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
    gap: 16px;
    min-width: 0;
}

.invite-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.team-empty-compact {
    padding: 18px;
    text-align: left;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: none;
}

.team-empty-compact h3 {
    margin: 0 0 8px;
}

.team-empty-compact p {
    margin: 0;
}

.team-members-card {
    --member-rows: 10;
    --member-row-height: 56px;
    --member-thead-height: 46px;
    height: auto;
    display: grid;
    grid-template-rows: auto auto auto;
    gap: 14px;
    min-width: 0;
    overflow: visible;
}

.team-members-card .section-header {
    flex-wrap: wrap;
}

.team-members-table {
    min-height: 0;
    max-height: none;
    overflow: auto;
    height: auto;
}

.team-members-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-secondary);
}

.team-members-table .data-table th,
.team-members-table .data-table td {
    padding: 12px 16px;
    vertical-align: middle;
}

.team-members-table .data-table thead th {
    height: var(--member-thead-height);
}

.team-members-table .data-table tbody tr {
    height: var(--member-row-height);
}

.team-members-table .table-identity,
.team-members-table .metric-inline,
.team-members-table td > div {
    min-width: 0;
}

.team-members-table .table-identity > div {
    min-width: 0;
}

.team-members-table .table-identity strong,
.team-members-table .item-description {
    overflow-wrap: anywhere;
}

.team-members-table .metric-inline {
    gap: 6px;
}

.team-members-table tbody tr.member-row {
    cursor: pointer;
}

.team-members-table tbody tr.member-row:hover td {
    background: rgba(255, 255, 255, 0.08);
    background: color-mix(in srgb, var(--surface) 92%, #ffffff 8%);
}

.team-members-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.member-detail-page {
    display: grid;
    gap: 20px;
    align-content: start;
}

.member-detail-header {
    margin-bottom: 0;
    align-items: center;
    gap: 16px;
}

.member-detail-header-main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    min-width: 0;
}

.member-back-link {
    margin-bottom: 0;
    min-height: 42px;
    padding: 0 16px;
}

.member-detail-meta {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.member-detail-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.member-detail-chip {
    min-height: 42px;
    padding: 0 16px;
    border-radius: 12px;
    justify-content: center;
    white-space: nowrap;
}

.member-detail-grid {
    align-items: stretch;
}

.member-overview-card {
    gap: 24px;
    padding: 28px;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0) 36%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0) 100%),
        var(--surface);
}

.member-overview-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 28px;
    flex-wrap: wrap;
    padding: 0 0 8px;
}

.member-overview-main {
    flex: 1 1 560px;
    min-width: 0;
}

.member-overview-side {
    flex: 0 1 360px;
    min-width: min(100%, 320px);
    display: grid;
    gap: 14px;
}

.member-profile-identity {
    align-items: flex-start;
    gap: 20px;
}

.member-profile-identity .avatar {
    width: 74px;
    height: 74px;
    border-radius: 22px;
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.24);
    flex-shrink: 0;
}

.member-profile-copy {
    min-width: 0;
    display: grid;
    gap: 10px;
}

.member-profile-copy .eyebrow {
    margin-bottom: 0;
}

.member-profile-copy .surface-title {
    margin-bottom: 0;
    font-size: 30px;
    line-height: 1;
}

.member-profile-title-row {
    display: flex;
    align-items: baseline;
    gap: 14px;
    flex-wrap: wrap;
}

.member-profile-title-row .surface-title {
    margin-bottom: 0;
}

.member-profile-discord-id {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.5;
}

.member-profile-copy .surface-subtitle {
    color: var(--text-muted);
}

.member-profile-metrics {
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.member-profile-chip {
    min-height: 36px;
    padding: 0 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.member-info-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.member-info-card {
    min-height: 132px;
    display: grid;
    align-content: start;
    gap: 10px;
    padding: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.025) 0%, rgba(255, 255, 255, 0) 100%),
        rgba(255, 255, 255, 0.012);
    border-radius: 20px;
}

.member-info-card span {
    margin-bottom: 0;
}

.member-info-card strong {
    font-size: 24px;
    line-height: 1.15;
}

.member-info-card p {
    margin-top: auto;
    color: var(--text-muted);
    line-height: 1.6;
}

.pager {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pager-info {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.button.is-disabled {
    opacity: 0.55;
    pointer-events: none;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: none;
    place-items: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.66);
}

.modal-overlay.is-open {
    display: grid;
}

.modal {
    width: min(920px, 100%);
    max-height: min(84vh, 760px);
    overflow: hidden;
    border-radius: 22px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface) 0%, rgba(18, 18, 18, 0.82) 100%);
}

.modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.1;
}

.modal-subtitle {
    margin: 8px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.modal-body {
    padding: 16px 18px 18px;
    overflow: auto;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.modal-card {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--bg-secondary);
    padding: 14px;
}

.modal-card h3 {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.modal-kv {
    display: grid;
    gap: 10px;
}

.modal-kv .kv-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.modal-kv .kv-item:last-child {
    border-bottom: 0;
}

.log-list {
    display: grid;
    gap: 10px;
}

.log-row {
    display: grid;
    gap: 4px;
    padding: 12px 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}

.log-row strong {
    font-size: 13px;
}

.log-row span {
    color: var(--text-muted);
    font-size: 12px;
}

.profile-card,
.settings-card,
.detail-card {
    grid-column: span 6;
}

.profile-card-wide,
.settings-card-wide,
.detail-card-wide {
    grid-column: span 12;
}

/* --- Avatar --- */
.avatar {
    width: 96px;
    height: 96px;
    border-radius: 24px;
    object-fit: cover;
    border: 1px solid var(--border);
}

.avatar-small {
    width: 44px;
    height: 44px;
}

.avatar-shell {
    --presence-color: #ef4444;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 12px;
    overflow: visible;
    isolation: isolate;
}

.avatar-shell::after {
    content: "";
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--presence-color);
    border: 2px solid var(--surface);
    pointer-events: none;
    z-index: 2;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.16);
}

.avatar-shell > .avatar,
.avatar-shell > .table-avatar {
    position: relative;
    z-index: 0;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    border: none;
    overflow: hidden;
    object-fit: cover;
}

.avatar-shell.is-online {
    --presence-color: #22c55e;
}

.avatar-shell.is-inactive {
    --presence-color: #f59e0b;
}

.avatar-shell.is-offline {
    --presence-color: #ef4444;
}

.avatar-shell-small {
    border-radius: 12px;
    width: 38px;
    height: 38px;
}

.avatar-shell-small::after {
    width: 8px;
    height: 8px;
}

.avatar-shell-table {
    border-radius: 12px;
    width: 38px;
    height: 38px;
}

.avatar-shell-table::after {
    width: 8px;
    height: 8px;
}

.avatar-shell-large {
    border-radius: 24px;
    width: 96px;
    height: 96px;
}

.avatar-shell-large::after {
    width: 12px;
    height: 12px;
    border-width: 2px;
    right: 1px;
    bottom: 1px;
}

.avatar-shell.is-online::after {
    animation: presence-discord-pulse 1.9s ease-in-out infinite;
}

.table-avatar-image {
    object-fit: cover;
}

.sidebar-profile-avatar {
    width: 100%;
    height: 100%;
    border-radius: inherit;
}

.avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    font-weight: 800;
}

@keyframes presence-discord-pulse {
    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.16);
    }

    50% {
        transform: scale(1.06);
        box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.16), 0 0 0 4px rgba(34, 197, 94, 0.14);
    }
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    max-height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    border-right: 1px solid var(--border);
    background: var(--bg);
    padding: 24px 20px;
    position: sticky;
    top: 0;
    overflow: hidden;
}

.dashboard-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
    height: 100vh;
    max-height: 100vh;
    min-height: 100dvh;
    height: 100dvh;
    max-height: 100dvh;
}

.sidebar-top,
.sidebar-bottom {
    display: grid;
    gap: 18px;
}

.sidebar-top {
    min-height: 0;
    align-content: start;
    overflow: auto;
    padding-right: 6px;
}

.sidebar-bottom {
    padding-top: 18px;
    border-top: 1px solid var(--border);
    background: transparent;
    position: relative;
    overflow: visible;
    min-width: 0;
    align-content: start;
}

.sidebar-nav {
    display: grid;
    gap: 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-link:hover,
.sidebar-link.is-active {
    background: var(--surface);
    color: var(--text);
}

.sidebar-link.is-active {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.nav-icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
}

.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.sidebar-profile strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
}

.sidebar-profile span {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 12px;
}

.sidebar-actions {
    display: grid;
    gap: 10px;
}

.sidebar-account {
    position: relative;
    width: 100%;
    min-width: 0;
    padding-top: 8px;
}

.sidebar-account-trigger {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text);
    text-align: left;
    box-shadow: none;
    appearance: none;
    cursor: pointer;
    overflow: hidden;
    min-width: 0;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.sidebar-account-trigger:hover {
    border-color: var(--border-light);
    background: var(--surface-hover);
}

.sidebar-account-trigger:focus-visible {
    outline: none;
    border-color: var(--border-light);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.sidebar-account-summary {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-width: 0;
    overflow: hidden;
}

.sidebar-account-copy {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.sidebar-account-copy strong {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

.sidebar-account-team {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.15;
}

.sidebar-account-caret {
    display: inline-flex;
    width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: transform 0.2s ease, color 0.2s ease;
}

.sidebar-account-caret svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-account-menu {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 8px);
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--bg);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 20;
}

.sidebar-account-menu[hidden] {
    display: none !important;
}

.sidebar-account::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 14px;
}

.sidebar-account-menu-head {
    display: grid;
    gap: 10px;
    padding: 0 0 12px;
    border-bottom: 1px solid var(--border);
}

.sidebar-account-menu-profile {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
}

.sidebar-account-menu-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.sidebar-account-menu-copy strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 700;
}

.sidebar-account-menu-copy span {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.25;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-account-menu-meta {
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    line-height: 1.2;
    text-transform: uppercase;
}

.sidebar-account-link,
.sidebar-account-form {
    width: 100%;
}

.sidebar-account-menu-list {
    display: grid;
    gap: 8px;
}

.sidebar-account-link {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.sidebar-account-link:hover {
    border-color: var(--border-light);
    background: var(--surface-hover);
}

.sidebar-account-link-danger {
    width: 100%;
    cursor: pointer;
    margin-top: 0;
}

.presence-badge {
    color: var(--text);
}

.presence-badge-online {
    border-color: rgba(47, 211, 122, 0.32);
    background: rgba(47, 211, 122, 0.12);
}

.presence-badge-inactive {
    border-color: rgba(242, 184, 75, 0.34);
    background: rgba(242, 184, 75, 0.12);
}

.presence-badge-offline {
    border-color: rgba(107, 114, 128, 0.34);
    background: rgba(107, 114, 128, 0.16);
}

.sidebar-account.is-open .sidebar-account-menu,
.sidebar-account.is-open .sidebar-account-caret {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.sidebar-account.is-open .sidebar-account-caret {
    transform: rotate(180deg);
    color: var(--text);
}

.sidebar-account.is-open .sidebar-account-trigger {
    border-color: var(--border-light);
    background: var(--surface-hover);
}

/* --- Dashboard Stage --- */
.dashboard-stage {
    min-width: 0;
    background: var(--bg);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100vh;
    max-height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 28px 0;
    min-height: 76px;
}

.topbar-leading {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(1.6rem, 3.5vw, 2.6rem);
    letter-spacing: -0.06em;
    line-height: 1.1;
    font-weight: 800;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-notifications {
    position: relative;
}

.notification-trigger {
    position: relative;
    width: 52px;
    min-width: 52px;
    height: 52px;
    padding: 0;
    border-radius: 16px;
}

.notification-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.notification-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    display: inline-flex;
    min-width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--text);
    color: var(--bg);
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.9);
}

.notification-trigger.has-unread::after {
    content: "";
    position: absolute;
    inset: -4px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 16px;
    animation: notificationPulse 1.8s ease-in-out infinite;
}

.notification-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: min(420px, calc(100vw - 32px));
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(11, 11, 11, 0.98);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 40;
}

.notification-menu[hidden] {
    display: none !important;
}

.topbar-notifications.is-open .notification-menu {
    display: grid;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.notification-menu-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.notification-menu-head strong {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
}

.notification-menu-head span {
    color: var(--text-muted);
    font-size: 12px;
}

.notification-menu-form {
    margin: 0;
}

.notification-menu-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.notification-list {
    display: grid;
    gap: 10px;
    max-height: 420px;
    overflow: auto;
    padding-top: 2px;
    padding-bottom: 2px;
    padding-right: 4px;
}

.notification-item,
.notification-empty,
.notification-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.01);
}

.notification-item {
    display: grid;
    gap: 6px;
    padding: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.notification-item:hover {
    border-color: var(--border-light);
    background: rgba(255, 255, 255, 0.03);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.34);
}

.notification-item:focus-visible {
    border-color: var(--border-light);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08), 0 14px 28px rgba(0, 0, 0, 0.34);
}

.notification-item.is-unread,
.notification-card.is-unread {
    border-color: rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.035);
}

.notification-item strong,
.notification-card h2 {
    margin: 0;
    font-size: 15px;
    letter-spacing: -0.03em;
}

.notification-item span,
.notification-item time,
.notification-empty span,
.notification-card-copy {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.45;
}

.notification-item time {
    color: var(--text-muted);
    font-size: 11px;
}

.notification-item-source {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-height: 24px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    line-height: 1;
    text-transform: uppercase;
}

.notification-empty {
    display: grid;
    gap: 6px;
    padding: 18px;
}

.notification-empty strong {
    font-size: 14px;
}

.notification-footer-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
}

.notification-page-header {
    margin-bottom: 24px;
    align-items: flex-end;
}

.notification-page-header .section-header {
    margin-bottom: 0;
}

.notification-page-copy p {
    max-width: 52ch;
    margin: 0;
}

.notification-page-actions {
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.notification-filter-form {
    display: block;
    min-width: 180px;
    margin: 0;
}

.notification-filter-select {
    min-width: 180px;
}

.notification-filter-select select {
    min-height: 46px;
    padding-top: 12px;
    padding-bottom: 12px;
    background: var(--surface);
}

.notification-page-actions .pill,
.notification-page-actions .button-secondary {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
}

.notification-page-actions .pill {
    border-radius: 12px;
    white-space: nowrap;
}

.notifications-page-list {
    display: grid;
    gap: 14px;
}

.notification-card {
    padding: 18px;
}

.notification-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.notification-card-head h2 {
    margin-top: 10px;
}

.notification-card-copy {
    margin: 0;
}

.notification-card-actions {
    margin-top: 16px;
}

@keyframes notificationPulse {
    0%,
    100% {
        opacity: 0.25;
        transform: scale(1);
    }
    50% {
        opacity: 0;
        transform: scale(1.08);
    }
}

.dashboard-content {
    padding: 16px 28px 24px;
    overflow: auto;
    min-height: 0;
    height: 100%;
}

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.stats-grid .stat-tile p,
.kpi-label {
    margin: 0;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.stats-grid .stat-tile h3 {
    margin: 8px 0 4px;
    font-size: 26px;
    letter-spacing: -0.06em;
    font-weight: 800;
}

.stats-grid .stat-tile > span,
.dashboard-stat-copy {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.35;
}

/* --- Mobile Nav Toggle --- */
.mobile-nav-toggle {
    display: none;
    width: 46px;
    height: 46px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.mobile-nav-toggle span {
    position: absolute;
    width: 18px;
    height: 2px;
    background: currentColor;
}

.mobile-nav-toggle span:first-child {
    transform: translateY(-5px);
}

.mobile-nav-toggle span:last-child {
    transform: translateY(5px);
}

/* --- Inline Form --- */
.inline-form {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form select,
.inline-form input {
    width: auto;
    min-width: 180px;
    min-height: 46px;
}

.inline-form .button {
    min-height: 46px;
}

.todo-form-card {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
}

.todo-form-scroll {
    min-height: 0;
    overflow: auto;
    padding-right: 8px;
}

.todo-form {
    padding-right: 2px;
}

/* --- Empty State --- */
.empty-state {
    padding: 32px;
    text-align: center;
}

.empty-state h3 {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 700;
}

.empty-state p {
    margin: 0;
}

/* --- Table Identity --- */
.table-identity,
.identity-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-avatar,
.mini-avatar {
    display: inline-flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

/* --- Surface Hero --- */
.surface-hero {
    display: grid;
    gap: 20px;
}

.metric-inline,
.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* --- KV List --- */
.kv-list {
    display: grid;
    gap: 0;
}

.kv-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.kv-item:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.kv-key {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
}

.kv-value {
    font-size: 14px;
    font-weight: 500;
    text-align: right;
}

/* --- Info & Detail Cards --- */
.info-grid,
.ticket-detail-grid,
.settings-tile-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.info-card,
.ticket-detail-card,
.settings-tile,
.role-card,
.support-header-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.info-card,
.ticket-detail-card,
.settings-tile,
.role-card {
    padding: 20px;
    transition: all 0.2s ease;
}

.info-card:hover,
.ticket-detail-card:hover,
.settings-tile:hover,
.role-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-light);
}

.info-card span,
.ticket-detail-card span,
.settings-tile span {
    display: block;
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.info-card strong,
.ticket-detail-card strong,
.settings-tile strong {
    display: block;
    font-size: 20px;
    line-height: 1.2;
    letter-spacing: -0.04em;
    font-weight: 800;
}

.info-card p,
.ticket-detail-card p,
.settings-tile p {
    margin: 10px 0 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
}

/* --- Permission Catalog --- */
.permission-catalog,
.scroll-stack {
    min-height: 0;
    overflow: auto;
    scrollbar-width: thin;
}

.permission-catalog {
    max-height: 260px;
    padding-right: 4px;
}

/* --- Role Card --- */
.role-card {
    display: grid;
    gap: 16px;
}

.role-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.role-card-compact {
    gap: 12px;
}

.role-card-copy {
    display: grid;
    gap: 2px;
}

.role-card-badges {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.role-permission-row {
    flex-wrap: wrap;
    gap: 8px;
}

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

.role-delete-form {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.role-delete-select select {
    min-width: 220px;
}

.roles-form-header,
.roles-list-header {
    align-items: flex-start;
    gap: 12px;
}

.roles-form-actions {
    gap: 10px;
    flex-wrap: wrap;
}

.roles-scroll {
    padding-right: 4px;
}

.roles-scroll .role-card:hover {
    transform: none;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
}

.role-card p,
.support-header-card p {
    margin: 0;
}

/* --- Support Header Card --- */
.support-header-card {
    display: grid;
    gap: 18px;
    padding: 22px;
}

.dashboard-analytics,
.dashboard-index-grid {
    margin-bottom: 12px;
}

.dashboard-index-grid {
    align-items: stretch;
}

.dashboard-analytics .surface,
.dashboard-index-grid .surface {
    display: grid;
    grid-template-rows: auto 1fr;
}

.dashboard-support-overview,
.dashboard-audit-card {
    display: grid;
    grid-template-rows: auto 1fr;
    padding: 18px 20px;
    min-height: 300px;
}

.dashboard-analytics .section-header,
.dashboard-support-overview .section-header,
.dashboard-audit-card .section-header {
    margin-bottom: 14px;
    align-items: flex-start;
    gap: 10px;
}

.dashboard-analytics .section-header h2,
.dashboard-support-overview .section-header h2,
.dashboard-audit-card .section-header h2 {
    font-size: 1.2rem;
    line-height: 1.08;
}

.dashboard-analytics .pill {
    min-height: 28px;
    padding: 0 10px;
    font-size: 10px;
}

.dashboard-compact-list {
    display: grid;
    gap: 10px;
    align-content: start;
    height: 100%;
}

.dashboard-list-item {
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--bg-secondary);
    box-shadow: none;
}

.dashboard-list-item .item-title {
    font-size: 14px;
    line-height: 1.3;
}

.dashboard-list-item .item-description {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.45;
}

.dashboard-list-item .meta-row {
    margin-top: 8px;
    gap: 8px;
}

.dashboard-audit-card .dashboard-list-item {
    min-height: 0;
}

.dashboard-audit-card .dashboard-list-item .item-title {
    font-size: 13px;
}

.dashboard-audit-card .dashboard-list-item .item-description {
    font-size: 11px;
}

.dashboard-item-actions {
    margin-top: 0;
}

.dashboard-button-compact {
    min-height: 32px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 12px;
}

.dashboard-support-overview .button-secondary:not(.dashboard-button-compact) {
    min-height: 30px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 11px;
}

.analytics-card {
    display: grid;
    gap: 10px;
    padding: 18px 20px;
    min-height: 180px;
}

.donut-layout {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.donut-chart {
    width: 108px;
    aspect-ratio: 1;
    border-radius: 50%;
    background:
        conic-gradient(
            #f4f4f4 0deg var(--slice-open),
            #989898 var(--slice-open) calc(var(--slice-open) + var(--slice-progress)),
            #434343 calc(var(--slice-open) + var(--slice-progress)) 360deg
        );
    display: grid;
    place-items: center;
    position: relative;
}

.donut-hole {
    width: 62%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    text-align: center;
}

.donut-hole strong {
    font-size: 19px;
    line-height: 1;
    letter-spacing: -0.05em;
}

.donut-hole span {
    color: var(--text-secondary);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.chart-legend,
.bar-chart {
    display: grid;
    gap: 6px;
}

.legend-row,
.bar-row,
.bar-copy {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.legend-row {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-secondary);
}

.legend-row span:not(.legend-dot),
.bar-copy span {
    color: var(--text-secondary);
    font-size: 12px;
}

.legend-row strong,
.bar-copy strong {
    font-size: 13px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    flex: 0 0 10px;
}

.legend-open {
    background: #f4f4f4;
}

.legend-progress {
    background: #989898;
}

.legend-done {
    background: #434343;
}

.bar-row {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 8px;
}

.bar-track {
    height: 6px;
    border-radius: 999px;
    background: #171717;
    border: 1px solid var(--border);
    overflow: hidden;
}

.bar-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
}

.bar-fill-low {
    background: linear-gradient(90deg, #6f6f6f 0%, #8d8d8d 100%);
}

.bar-fill-medium {
    background: linear-gradient(90deg, #8a8a8a 0%, #b3b3b3 100%);
}

.bar-fill-high {
    background: linear-gradient(90deg, #b2b2b2 0%, #d5d5d5 100%);
}

.bar-fill-critical {
    background: linear-gradient(90deg, #d2d2d2 0%, #f6f6f6 100%);
}

/* --- Thread Notes --- */
.thread-note {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.thread-note + .thread-note {
    margin-top: 14px;
}

/* --- FAQ --- */
.faq-group {
    display: grid;
    gap: 12px;
}

.faq-item {
    padding: 18px 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    transition: all 0.2s ease;
}

.faq-item:hover {
    border-color: var(--border-light);
}

.faq-item summary {
    cursor: pointer;
    list-style: none;
    font-weight: 700;
    font-size: 15px;
}

.faq-item p {
    margin: 14px 0 0;
}

.muted {
    color: var(--text-muted);
}

/* --- Dashboard Fit Classes --- */
.dashboard-fit {
    min-height: 0;
    height: 100%;
}

.dashboard-fit-teams,
.dashboard-fit-roles,
.dashboard-fit-todos,
.dashboard-fit-profile,
.dashboard-fit-settings,
.dashboard-fit-team-detail {
    height: 100%;
    min-height: 0;
}

.dashboard-fit-team-detail {
    height: auto;
    min-height: auto;
}

.dashboard-fit-index > .surface,
.dashboard-fit-teams > .surface,
.dashboard-fit-roles > .surface,
.dashboard-fit-todos > .surface,
.dashboard-fit-todos > article,
.dashboard-fit-support > article,
.dashboard-fit-profile > .surface,
.dashboard-fit-settings > .surface,
.dashboard-fit-team-detail > .surface,
.dashboard-fit-team-detail > .page-block {
    min-height: 0;
}

.dashboard-fit-teams .table-wrap,
.dashboard-fit-roles .stack,
.dashboard-fit-todos .span-8 .stack,
.dashboard-fit-support .split-panel-body,
.dashboard-fit-support .conversation-thread,
.dashboard-fit-profile .table-wrap,
.dashboard-fit-settings .section-grid,
.dashboard-fit-team-detail .table-wrap {
    max-height: calc(100% - 64px);
    overflow: auto;
    scrollbar-width: thin;
}

.dashboard-fit-index .surface,
.dashboard-fit-teams .surface,
.dashboard-fit-roles .surface,
.dashboard-fit-todos .surface,
.dashboard-fit-support .split-panel,
.dashboard-fit-support .conversation-thread,
.dashboard-fit-profile .profile-card,
.dashboard-fit-settings .settings-card,
.dashboard-fit-team-detail .detail-card {
    height: 100%;
}

.dashboard-fit-roles .stack {
    max-height: calc(100% - 64px);
    overflow: auto;
    scrollbar-width: thin;
}

.dashboard-fit-teams .table-wrap {
    max-height: calc(100% - 64px);
}

.dashboard-fit-profile .table-wrap,
.dashboard-fit-team-detail .table-wrap {
    max-height: calc(100% - 68px);
}

.dashboard-fit-team-detail .team-invites-card,
.dashboard-fit-team-detail .team-members-card,
.dashboard-fit-team-detail .team-members-table,
.dashboard-fit-team-detail .invite-list,
.dashboard-fit-team-detail .table-wrap {
    height: auto;
    max-height: none;
    overflow: visible;
}

.dashboard-fit-todos .section-grid,
.dashboard-fit-teams,
.dashboard-fit-roles,
.dashboard-fit-support,
.dashboard-fit-profile,
.dashboard-fit-settings,
.dashboard-fit-team-detail {
    height: 100%;
    min-height: 0;
}

.dashboard-fit-team-detail {
    height: auto;
    min-height: auto;
}

.dashboard-fit-todos {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 20px;
    margin-bottom: 0;
    overflow: hidden;
}

.dashboard-fit-todos > .toolbar {
    margin-bottom: 0;
}

.dashboard-fit-todos .section-grid {
    height: auto;
    align-items: stretch;
    min-height: 0;
}

.dashboard-fit-todos .span-8,
.dashboard-fit-todos .span-4 {
    height: 100%;
    min-height: 0;
}

.dashboard-fit-todos .span-8 {
    overflow: hidden;
}

.dashboard-fit-todos .span-8 > .stack {
    height: 100%;
}

.dashboard-fit-todos .span-8 .stack {
    max-height: 100%;
    overflow: auto;
    padding-right: 4px;
}

.dashboard-fit-todos .todo-form-card {
    height: 100%;
}

.dashboard-fit-todos .todo-form-scroll {
    max-height: 100%;
    overflow: auto;
    padding-right: 4px;
}

.dashboard-fit-support {
    height: 100%;
    min-height: 0;
    align-items: stretch;
}

.dashboard-fit-support .split-panel,
.dashboard-fit-support .conversation-thread {
    max-height: 100%;
}

.dashboard-fit-support .split-panel-body,
.dashboard-fit-support .conversation-thread {
    scrollbar-width: thin;
}

.dashboard-fit-profile .profile-card-wide,
.dashboard-fit-settings .settings-card-wide,
.dashboard-fit-team-detail .detail-card-wide {
    height: 100%;
}

.dashboard-fit-settings .section-grid,
.dashboard-fit-profile .table-wrap,
.dashboard-fit-team-detail .table-wrap {
    overflow: auto;
    scrollbar-width: thin;
}

.dashboard-fit-metrics {
    flex-shrink: 0;
}

.dashboard-top-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 10px;
    width: 100%;
    max-width: none;
}

.dashboard-stat-tile {
    display: grid;
    gap: 12px;
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 96px;
    padding: 16px 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035) 0%, rgba(255, 255, 255, 0) 100%),
        var(--surface);
}

.dashboard-stat-content {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.stats-grid .dashboard-stat-tile h3 {
    margin: 0;
    font-size: 28px;
    line-height: 1;
}

.dashboard-stat-copy {
    font-size: 12px;
    line-height: 1.35;
    max-width: 20ch;
}

.dashboard-stat-inline {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: space-between;
}

.dashboard-stat-inline small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
    min-height: 22px;
    border-radius: 999px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
    white-space: nowrap;
}

/* --- Headings --- */
h2,
h3,
h4 {
    color: var(--text);
    margin-top: 0;
    letter-spacing: -0.05em;
}

/* --- Transitions --- */
.button,
.badge,
.pill,
.sidebar-link,
.support-ticket,
.list-item,
.surface,
.item-card {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.surface:hover,
.item-card:hover {
    border-color: var(--border-light);
}

/* --- Responsive Design --- */
@media (max-width: 1200px) {
    /* Single column: prevents the 12-column gaps from exceeding the viewport width */
    .hero {
        grid-template-columns: minmax(0, 1fr);
        gap: 32px;
    }

    .hero-copy,
    .hero-visual,
    .span-3,
    .span-4,
    .span-5,
    .span-6,
    .span-7,
    .span-8 {
        grid-column: 1 / -1;
    }

    .split-layout {
        grid-template-columns: 1fr;
    }

    .donut-layout {
        grid-template-columns: 1fr;
        justify-items: start;
    }

    .team-detail-top {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 960px) {
    .public-container {
        width: min(100% - 32px, var(--container));
    }

    .public-nav {
        position: fixed;
        inset: 72px 16px auto 16px;
        flex-direction: column;
        align-items: stretch;
        padding: 18px;
        border: 1px solid var(--border);
        border-radius: var(--radius-xl);
        background: var(--surface);
        box-shadow: var(--shadow-soft);
        opacity: 0;
        pointer-events: none;
        transform: translateY(-8px);
        transition: all 0.2s ease;
    }

    .public-nav.is-open {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    .mobile-nav-toggle {
        display: inline-flex;
        position: relative;
    }

    .dashboard-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        z-index: 50;
        inset: 0 auto 0 0;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        max-width: min(88vw, 320px);
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .dashboard-content,
    .topbar {
        padding-left: 16px;
        padding-right: 16px;
    }

    .dashboard-body {
        overflow: auto;
        height: auto;
    }

    .dashboard-stage {
        height: auto;
        overflow: visible;
    }

    .dashboard-content {
        overflow: visible;
    }

    .dashboard-fit-teams,
    .dashboard-fit-roles,
    .dashboard-fit-todos,
    .dashboard-fit-support,
    .dashboard-fit-profile,
    .dashboard-fit-settings,
    .dashboard-fit-team-detail {
        height: auto;
    }

    .dashboard-fit-roles .stack,
    .dashboard-fit-todos .span-8 .stack,
    .dashboard-fit-todos .todo-form-scroll,
    .dashboard-fit-support .split-panel-body,
    .dashboard-fit-support .conversation-thread,
    .dashboard-fit-settings .section-grid {
        max-height: none;
        overflow: visible;
    }

    /* Tables must keep horizontal scrolling on small screens,
       otherwise they push the whole page wider than the viewport. */
    .table-wrap {
        max-height: none;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }

    html,
    body {
        overflow-x: hidden;
    }

    .dashboard-fit-todos {
        display: block;
        overflow: visible;
    }

    .dashboard-fit-todos .span-8 {
        overflow: visible;
    }

    .dashboard-fit-todos .span-8 > .stack,
    .dashboard-fit-todos .todo-form-card {
        height: auto;
    }

    .stats-grid,
    .profile-card,
    .settings-card,
    .detail-card,
    .profile-card-wide,
    .settings-card-wide,
    .detail-card-wide,
    .info-grid,
    .ticket-detail-grid,
    .settings-tile-grid {
        grid-column: 1 / -1;
    }

    .stats-grid,
    .mockup-metrics,
    .info-grid,
    .ticket-detail-grid,
    .settings-tile-grid,
    .bar-row,
    .section-grid,
    .profile-grid,
    .settings-grid,
    .detail-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .dashboard-top-grid {
        display: grid;
        width: 100%;
        max-width: none;
    }

    .mockup-content {
        grid-template-columns: 1fr;
    }

    .mockup-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .team-detail {
        height: auto;
        overflow: visible;
        grid-template-rows: auto;
    }

    .invite-list {
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }
}

@media (max-width: 640px) {
    .public-footer-inner,
    .page-header,
    .section-header,
    .toolbar,
    .list-item-header,
    .support-ticket-head,
    .permission-row,
    .settings-row,
    .profile-row,
    .legend-row,
    .bar-copy {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Topbar stays a single row: hamburger + title left, actions right. */
    .topbar {
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
        gap: 12px;
        padding-top: 14px;
        min-height: 0;
    }

    .topbar-leading {
        gap: 12px;
        min-width: 0;
    }

    .topbar-leading > div {
        min-width: 0;
    }

    .topbar h1 {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .topbar-actions {
        flex-shrink: 0;
    }

    .notification-trigger {
        width: 46px;
        min-width: 46px;
        height: 46px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
        font-size: 13px;
    }

    .hero {
        padding-top: 24px;
    }

    .hero-title {
        font-size: 2.4rem;
    }

    .button,
    .toolbar-search {
        width: 100%;
    }

    .inline-form,
    .inline-form select,
    .inline-form input,
    .form-actions .button {
        width: 100%;
    }

    .toolbar-group,
    .toolbar-actions,
    .hero-actions,
    .button-row {
        width: 100%;
    }

    .team-stat-grid {
        grid-template-columns: 1fr;
    }

    .invite-fields {
        grid-template-columns: 1fr;
    }
    .dashboard-stat-tile {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .notification-page-header {
        align-items: flex-start;
    }

    .notification-page-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .notification-filter-form,
    .notification-filter-select,
    .notification-page-actions .pill,
    .notification-page-actions .inline-form {
        width: 100%;
    }

    .member-detail-header {
        align-items: flex-start;
    }

    .member-detail-header-main,
    .member-detail-tags {
        width: 100%;
    }

    .member-overview-side {
        min-width: 100%;
    }

    .member-profile-metrics {
        justify-content: flex-start;
    }

    .member-info-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Roles Page (Redesign)
   ======================================== */
.rolesx {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 16px;
    height: 100%;
    min-height: 0;
}

.rolesx:not(:has(.rolesx-flash)) {
    grid-template-rows: auto minmax(0, 1fr);
}

/* --- Flash --- */
.rolesx-flash {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    font-size: 14px;
    font-weight: 500;
    animation: rolesx-flash-in 0.25s ease;
}

.rolesx-flash.is-leaving {
    opacity: 0;
    transform: translateY(-4px);
    transition: all 0.3s ease;
}

@keyframes rolesx-flash-in {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rolesx-flash-icon {
    display: inline-flex;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-secondary);
}

.rolesx-flash-icon svg {
    width: 15px;
    height: 15px;
}

.rolesx-flash-success .rolesx-flash-icon {
    color: var(--text);
}

.rolesx-flash-error {
    border-color: var(--border-light);
}

.rolesx-flash-error .rolesx-flash-icon {
    color: var(--text-secondary);
}

.rolesx-flash-close {
    margin-left: auto;
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.rolesx-flash-close:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.rolesx-flash-close svg {
    width: 14px;
    height: 14px;
}

/* --- Stats --- */
.rolesx-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.rolesx-stat {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    transition: all 0.2s ease;
}

.rolesx-stat:hover {
    transform: translateY(-2px);
    border-color: var(--border-light);
}

.rolesx-stat-icon {
    display: inline-flex;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.rolesx-stat-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.rolesx-stat-copy strong {
    font-size: 24px;
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.rolesx-stat-copy span {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Layout --- */
.rolesx-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 20px;
    min-height: 0;
}

.rolesx-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 18px;
    min-height: 0;
    height: 100%;
}

.rolesx-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.rolesx-panel-title {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.rolesx-panel-sub {
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.rolesx-new-button {
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    font-size: 13px;
    white-space: nowrap;
}

.rolesx-new-button svg {
    width: 15px;
    height: 15px;
}

/* --- Role List --- */
.rolesx-list {
    display: grid;
    gap: 12px;
    align-content: start;
    overflow: auto;
    scrollbar-width: thin;
    min-height: 0;
    padding-right: 4px;
}

.rolesx-empty {
    display: grid;
    gap: 6px;
    justify-items: center;
    padding: 48px 20px;
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-lg);
    text-align: center;
}

.rolesx-empty strong {
    font-size: 15px;
}

.rolesx-empty span {
    color: var(--text-muted);
    font-size: 13px;
}

.rolesx-role {
    display: grid;
    gap: 12px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    transition: all 0.2s ease;
}

.rolesx-role:hover {
    border-color: var(--border-light);
    background: var(--surface-hover);
}

.rolesx-role.is-active {
    border-color: var(--text-muted);
    background: var(--surface-hover);
    box-shadow: 0 0 0 1px var(--text-muted);
}

.rolesx-role-main {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.rolesx-role-mark {
    display: inline-flex;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    background: var(--surface);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.rolesx-role-mark.is-system {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}

.rolesx-role-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.rolesx-role-titleline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.rolesx-role-name {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rolesx-role-slug {
    color: var(--text-muted);
    font-size: 12px;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.rolesx-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.rolesx-tag svg {
    width: 11px;
    height: 11px;
}

.rolesx-tag-system {
    border-color: var(--border-light);
    color: var(--text);
}

.rolesx-tag-active {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}

.rolesx-role-metrics {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.rolesx-metric {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.rolesx-metric svg {
    width: 12px;
    height: 12px;
}

.rolesx-meter {
    height: 4px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
}

.rolesx-meter-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--text-muted) 0%, var(--text) 100%);
    transition: width 0.4s ease;
}

.rolesx-role-perms {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.rolesx-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
}

.rolesx-chip-muted {
    border-style: dashed;
    color: var(--text-muted);
    background: transparent;
}

.rolesx-role-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.rolesx-inline-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.rolesx-delete-form {
    margin-left: auto;
}

.rolesx-action {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.rolesx-action:hover {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-light);
    transform: translateY(-1px);
}

.rolesx-action svg {
    width: 13px;
    height: 13px;
}

.rolesx-action-danger:hover {
    color: var(--text);
    border-color: var(--text-muted);
}

.rolesx-action-static {
    cursor: default;
    color: var(--text-muted);
    border-style: dashed;
}

.rolesx-action-static:hover {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
    transform: none;
}

.rolesx-delete-select {
    min-width: 190px;
}

.rolesx-delete-select select {
    min-height: 34px;
    padding: 6px 40px 6px 12px;
    font-size: 12.5px;
    border-radius: 10px;
}

/* --- Form Panel --- */
.rolesx-form {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 18px;
    min-height: 0;
}

.rolesx-field-error {
    color: var(--text);
    font-weight: 600;
}

.rolesx-perm-section {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 12px;
    min-height: 0;
}

.rolesx-perm-toolbar {
    display: grid;
    gap: 10px;
}

.rolesx-perm-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.rolesx-perm-counter {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.rolesx-perm-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rolesx-search {
    position: relative;
    flex: 1;
    min-width: 0;
}

.rolesx-search svg {
    position: absolute;
    top: 50%;
    left: 13px;
    width: 14px;
    height: 14px;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.rolesx-search input {
    min-height: 38px;
    padding: 8px 14px 8px 36px;
    font-size: 13px;
    border-radius: 10px;
}

.rolesx-mini-button {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.rolesx-mini-button:hover {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-light);
}

.rolesx-perm-grid {
    display: grid;
    gap: 10px;
    align-content: start;
    overflow: auto;
    scrollbar-width: thin;
    min-height: 0;
    padding-right: 4px;
}

.rolesx-perm {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.rolesx-perm:hover {
    background: var(--surface-hover);
    border-color: var(--border-light);
}

.rolesx-perm.is-checked {
    border-color: var(--text-muted);
    background: var(--surface-hover);
}

.rolesx-perm-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.rolesx-perm-copy strong {
    color: var(--text);
    font-size: 13.5px;
    font-weight: 600;
}

.rolesx-perm-copy span {
    color: var(--text-secondary);
    font-size: 12.5px;
    line-height: 1.5;
}

.rolesx-perm-noresults {
    display: grid;
    gap: 4px;
    justify-items: center;
    padding: 32px 16px;
    border: 1px dashed var(--border-light);
    border-radius: 14px;
    text-align: center;
}

.rolesx-perm[hidden],
.rolesx-perm-noresults[hidden] {
    display: none;
}

.rolesx-perm-group-label {
    display: grid;
    gap: 2px;
    padding: 6px 2px 0;
}

.rolesx-perm-group-label strong {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
}

.rolesx-perm-group-label span {
    color: var(--text-muted);
    font-size: 12px;
}

.rolesx-perm-noresults strong {
    font-size: 14px;
}

.rolesx-perm-noresults span {
    color: var(--text-muted);
    font-size: 12.5px;
}

.rolesx-form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.rolesx-form-footer .button {
    min-width: 180px;
}

/* --- Responsive --- */
@media (max-width: 1280px) {
    .rolesx-role-metrics {
        display: none;
    }
}

@media (max-width: 1100px) {
    .rolesx {
        height: auto;
        min-height: 0;
        grid-template-rows: auto;
    }

    .rolesx:not(:has(.rolesx-flash)) {
        grid-template-rows: auto;
    }

    .rolesx-layout {
        grid-template-columns: 1fr;
    }

    .rolesx-panel {
        grid-template-rows: auto auto;
        height: auto;
    }

    .rolesx-list,
    .rolesx-perm-grid {
        overflow: visible;
        max-height: none;
        padding-right: 0;
    }

    .rolesx-form {
        grid-template-rows: auto;
    }

    .rolesx-role-metrics {
        display: flex;
    }
}

@media (max-width: 720px) {
    .rolesx-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rolesx-panel-head {
        flex-direction: column;
    }

    .rolesx-perm-tools {
        flex-wrap: wrap;
    }

    .rolesx-search {
        flex: 1 1 100%;
    }

    .rolesx-delete-form {
        margin-left: 0;
        flex-wrap: wrap;
    }

    .rolesx-delete-select {
        min-width: 100%;
    }

    .rolesx-form-footer {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .rolesx-form-footer .button {
        width: 100%;
    }
}

/* ========================================
   Todos Page (Redesign)
   ======================================== */
.todosx {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 16px;
    height: 100%;
    min-height: 0;
}

.todosx:not(:has(.todosx-flash)) {
    grid-template-rows: auto minmax(0, 1fr);
}

/* --- Flash --- */
.todosx-flash {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    font-size: 14px;
    font-weight: 500;
    animation: rolesx-flash-in 0.25s ease;
}

.todosx-flash.is-leaving {
    opacity: 0;
    transform: translateY(-4px);
    transition: all 0.3s ease;
}

.todosx-flash-icon {
    display: inline-flex;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-secondary);
}

.todosx-flash-icon svg {
    width: 15px;
    height: 15px;
}

.todosx-flash-close {
    margin-left: auto;
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.todosx-flash-close:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.todosx-flash-close svg {
    width: 14px;
    height: 14px;
}

/* --- Stats --- */
.todosx-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.todosx-stat {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    transition: all 0.2s ease;
}

.todosx-stat:hover {
    transform: translateY(-2px);
    border-color: var(--border-light);
}

.todosx-stat-alert {
    border-color: var(--border-light);
}

.todosx-stat-alert .todosx-stat-icon {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}

.todosx-stat-icon {
    display: inline-flex;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.todosx-stat-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.todosx-stat-copy strong {
    font-size: 24px;
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.todosx-stat-copy span {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Layout --- */
.todosx-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
    gap: 20px;
    min-height: 0;
}

.todosx-layout:not(:has(.todosx-form-panel)) {
    grid-template-columns: 1fr;
}

.todosx-delete-form {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.todosx-panel {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 16px;
    min-height: 0;
    height: 100%;
}

.todosx-form-panel {
    grid-template-rows: auto minmax(0, 1fr);
}

.todosx-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.todosx-panel-title {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.todosx-panel-sub {
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
}

/* --- Toolbar --- */
.todosx-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.todosx-search {
    position: relative;
    flex: 1;
    min-width: 220px;
}

.todosx-search svg {
    position: absolute;
    top: 50%;
    left: 13px;
    width: 14px;
    height: 14px;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.todosx-search input {
    min-height: 38px;
    padding: 8px 14px 8px 36px;
    font-size: 13px;
    border-radius: 10px;
}

.todosx-filters {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-secondary);
}

.todosx-filter {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 13px;
    border-radius: 9px;
    color: var(--text-muted);
    font-size: 12.5px;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.todosx-filter:hover {
    color: var(--text);
}

.todosx-filter.is-active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-soft);
}

/* --- Todo List --- */
.todosx-list {
    display: grid;
    gap: 12px;
    align-content: start;
    overflow: auto;
    scrollbar-width: thin;
    min-height: 0;
    padding-right: 4px;
}

.todosx-empty,
.todosx-noresults {
    display: grid;
    gap: 6px;
    justify-items: center;
    padding: 48px 20px;
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-lg);
    text-align: center;
}

.todosx-empty strong,
.todosx-noresults strong {
    font-size: 15px;
}

.todosx-empty span,
.todosx-noresults span {
    color: var(--text-muted);
    font-size: 13px;
}

.todosx-item[hidden],
.todosx-noresults[hidden] {
    display: none;
}

.todosx-item {
    display: flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    overflow: hidden;
    transition: all 0.2s ease;
}

.todosx-item:hover {
    border-color: var(--border-light);
    background: var(--surface-hover);
}

.todosx-item.is-done {
    opacity: 0.6;
}

.todosx-item.is-done .todosx-item-title {
    text-decoration: line-through;
}

.todosx-item.is-overdue {
    border-color: var(--border-light);
}

.todosx-item-rail {
    flex: 0 0 4px;
    background: var(--border);
}

.todosx-rail-low {
    background: var(--border-light);
}

.todosx-rail-medium {
    background: var(--text-muted);
    opacity: 0.5;
}

.todosx-rail-high {
    background: var(--text-muted);
}

.todosx-rail-critical {
    background: var(--text);
}

.todosx-item-body {
    display: grid;
    gap: 12px;
    padding: 15px 18px;
    min-width: 0;
    flex: 1;
}

.todosx-item-top {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.todosx-item-copy {
    display: grid;
    gap: 6px;
    min-width: 0;
    flex: 1;
}

.todosx-item-titleline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.todosx-item-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.todosx-item-desc {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.55;
}

.todosx-item-notes {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin: 0;
    color: var(--text-muted);
    font-size: 12.5px;
    line-height: 1.5;
}

.todosx-item-notes svg {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    margin-top: 3px;
}

/* --- Badges --- */
.todosx-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.todosx-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--text-muted);
}

.todosx-status.is-open .todosx-status-dot {
    background: var(--text-muted);
}

.todosx-status.is-progress {
    border-color: var(--border-light);
    color: var(--text);
}

.todosx-status.is-progress .todosx-status-dot {
    background: var(--text);
    animation: todosx-pulse 2s ease infinite;
}

.todosx-status.is-done {
    background: var(--text);
    border-color: var(--text);
    color: var(--bg);
}

.todosx-status.is-done .todosx-status-dot {
    background: var(--bg);
}

@keyframes todosx-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.35;
    }
}

.todosx-priority-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 10px;
}

.todosx-priority-bars span {
    width: 3px;
    border-radius: 2px;
    background: var(--border-light);
}

.todosx-priority-bars span:nth-child(1) { height: 4px; }
.todosx-priority-bars span:nth-child(2) { height: 6px; }
.todosx-priority-bars span:nth-child(3) { height: 8px; }
.todosx-priority-bars span:nth-child(4) { height: 10px; }

.todosx-priority-low .todosx-priority-bars span:nth-child(-n+1),
.todosx-priority-medium .todosx-priority-bars span:nth-child(-n+2),
.todosx-priority-high .todosx-priority-bars span:nth-child(-n+3),
.todosx-priority-critical .todosx-priority-bars span:nth-child(-n+4) {
    background: var(--text);
}

.todosx-priority-critical {
    border-color: var(--text-muted);
    color: var(--text);
}

/* --- Meta Row --- */
.todosx-item-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.todosx-meta {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
}

.todosx-meta svg {
    width: 13px;
    height: 13px;
    color: var(--text-muted);
}

.todosx-meta em {
    font-style: normal;
    padding: 2px 8px;
    border: 1px solid var(--text-muted);
    border-radius: 999px;
    color: var(--text);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.todosx-meta-alert {
    color: var(--text);
    font-weight: 600;
}

.todosx-meta-muted {
    color: var(--text-muted);
}

.todosx-avatar {
    display: inline-flex;
    width: 22px;
    height: 22px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
    border-radius: 999px;
    background: var(--surface);
    font-size: 10px;
    font-weight: 700;
}

.todosx-status-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 0 auto;
}

.todosx-status-select {
    min-width: 150px;
}

.todosx-status-select select {
    min-height: 34px;
    padding: 6px 40px 6px 12px;
    font-size: 12.5px;
    border-radius: 10px;
}

.todosx-action {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.todosx-action:hover {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-light);
    transform: translateY(-1px);
}

.todosx-action svg {
    width: 13px;
    height: 13px;
}

/* --- Form Panel --- */
.todosx-form {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 16px;
    min-height: 0;
}

.todosx-form-fields {
    display: grid;
    gap: 14px;
    align-content: start;
    overflow: auto;
    scrollbar-width: thin;
    min-height: 0;
    padding-right: 4px;
}

.todosx-field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.todosx-form-footer {
    display: grid;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.todosx-form-footer .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.todosx-button-icon {
    width: 15px;
    height: 15px;
}

/* --- Responsive --- */
@media (max-width: 1100px) {
    .todosx {
        height: auto;
        min-height: 0;
        grid-template-rows: auto;
    }

    .todosx:not(:has(.todosx-flash)) {
        grid-template-rows: auto;
    }

    .todosx-layout {
        grid-template-columns: 1fr;
    }

    .todosx-panel {
        grid-template-rows: auto;
        height: auto;
    }

    .todosx-form-panel {
        grid-template-rows: auto;
    }

    .todosx-list,
    .todosx-form-fields {
        overflow: visible;
        max-height: none;
        padding-right: 0;
    }

    .todosx-form {
        grid-template-rows: auto;
    }
}

@media (max-width: 720px) {
    .todosx-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .todosx-panel-head {
        flex-direction: column;
    }

    .todosx-filters {
        width: 100%;
        justify-content: space-between;
    }

    .todosx-filter {
        flex: 1;
        justify-content: center;
        padding: 0 8px;
    }

    .todosx-status-form {
        margin-left: 0;
        width: 100%;
    }

    .todosx-status-select {
        flex: 1;
    }

    .todosx-field-row {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Custom Confirm Dialog
   ======================================== */
.confirmx {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.confirmx[hidden] {
    display: none;
}

.confirmx-backdrop {
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--bg) 70%, transparent);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.18s ease;
}

.confirmx.is-visible .confirmx-backdrop {
    opacity: 1;
}

.confirmx-dialog {
    position: relative;
    display: grid;
    gap: 10px;
    justify-items: center;
    width: min(420px, 100%);
    padding: 28px 26px 24px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
    text-align: center;
    opacity: 0;
    transform: translateY(8px) scale(0.97);
    transition: all 0.18s ease;
}

.confirmx.is-visible .confirmx-dialog {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.confirmx-icon {
    display: inline-flex;
    width: 46px;
    height: 46px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
    border-radius: 14px;
    background: var(--bg-secondary);
    color: var(--text);
    margin-bottom: 4px;
}

.confirmx-icon svg {
    width: 20px;
    height: 20px;
}

.confirmx-title {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.confirmx-message {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13.5px;
    line-height: 1.55;
}

.confirmx-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: 12px;
}

.confirmx-button {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 700;
    transition: all 0.2s ease;
}

.confirmx-cancel {
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.confirmx-cancel:hover {
    background: var(--surface-hover);
    color: var(--text);
    border-color: var(--border-light);
}

.confirmx-accept {
    border: 1px solid var(--text);
    background: var(--text);
    color: var(--bg);
}

.confirmx-accept:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

body.confirmx-open {
    overflow: hidden;
}

/* ========================================
   Ticket Detail Page
   ======================================== */
.ticketx {
    display: grid;
    gap: 16px;
    align-content: start;
}

.support-ticket-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.support-ticket-link:hover {
    border-color: var(--border-light);
    background: var(--surface-hover);
    transform: translateY(-1px);
}

.ticketx-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.ticketx-head-copy {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.ticketx-back {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text-muted);
    font-size: 12.5px;
    font-weight: 600;
    transition: color 0.2s ease;
    width: fit-content;
}

.ticketx-back:hover {
    color: var(--text);
}

.ticketx-back svg {
    width: 14px;
    height: 14px;
}

.ticketx-titleline {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ticketx-title {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.ticketx-meta-line {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.ticketx-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.6fr);
    gap: 20px;
    align-items: start;
}

.ticketx-main,
.ticketx-side {
    display: grid;
    gap: 16px;
    min-width: 0;
}

.ticketx-card {
    display: grid;
    gap: 16px;
}

.ticketx-section-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.ticketx-original,
.ticketx-reply {
    display: flex;
    gap: 13px;
}

.ticketx-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    font-size: 13px;
}

.ticketx-original-copy,
.ticketx-reply-copy {
    display: grid;
    gap: 6px;
    min-width: 0;
    flex: 1;
}

.ticketx-author-line {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ticketx-author-line strong {
    font-size: 13.5px;
    font-weight: 700;
}

.ticketx-time {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}

.ticketx-body {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13.5px;
    line-height: 1.6;
    overflow-wrap: break-word;
}

.ticketx-replies {
    display: grid;
    gap: 14px;
}

.ticketx-reply {
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-secondary);
}

.ticketx-reply.is-internal {
    border-style: dashed;
    border-color: var(--border-light);
}

.ticketx-reply-form {
    display: grid;
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.ticketx-reply-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.ticketx-internal-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
}

.ticketx-status-form {
    display: grid;
    gap: 10px;
}

.ticketx-edit-form {
    display: grid;
    gap: 12px;
}

.ticketx-details {
    display: grid;
    gap: 10px;
    margin: 0;
}

.ticketx-details > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.ticketx-details > div:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.ticketx-details dt {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.ticketx-details dd {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    text-align: right;
}

.ticketx-history {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ticketx-history-item {
    position: relative;
    display: flex;
    gap: 12px;
    padding: 0 0 16px 0;
}

.ticketx-history-item:last-child {
    padding-bottom: 0;
}

.ticketx-history-item:not(:last-child)::before {
    content: "";
    position: absolute;
    top: 14px;
    left: 4px;
    bottom: 2px;
    width: 1px;
    background: var(--border);
}

.ticketx-history-dot {
    position: relative;
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    margin-top: 4px;
    border-radius: 999px;
    background: var(--text-muted);
}

.ticketx-history-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.ticketx-history-copy strong {
    font-size: 13px;
    font-weight: 600;
}

.ticketx-history-copy span {
    color: var(--text-muted);
    font-size: 12px;
}

.ticketx-history-empty {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
}

@media (max-width: 1100px) {
    .ticketx-layout {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Attachments
   ======================================== */
.attachx-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.attachx-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.attachx-item form {
    margin: 0;
    display: inline-flex;
}

.attachx-link {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-secondary);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.attachx-link:hover {
    border-color: var(--border-light);
    background: var(--surface-hover);
}

.attachx-icon {
    display: inline-flex;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-secondary);
}

.attachx-icon svg {
    width: 14px;
    height: 14px;
}

.attachx-copy {
    display: grid;
    gap: 1px;
    min-width: 0;
}

.attachx-copy strong {
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachx-copy span {
    color: var(--text-muted);
    font-size: 11.5px;
}

.attachx-remove {
    display: inline-flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.attachx-remove:hover {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-light);
}

.attachx-remove svg {
    width: 13px;
    height: 13px;
}

.attachx-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.attachx-picker {
    display: grid;
    gap: 4px;
    flex: 1;
    min-width: 200px;
    cursor: pointer;
}

.attachx-picker input[type="file"] {
    font-size: 12.5px;
    color: var(--text-secondary);
}

.attachx-picker input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.attachx-picker input[type="file"]::file-selector-button:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.attachx-picker-hint {
    color: var(--text-muted);
    font-size: 11.5px;
}

.attachx-inline {
    display: grid;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.attachx-inline .attachx-form {
    padding-top: 0;
    border-top: none;
}

/* ========================================
   Audit Log Page
   ======================================== */
.auditx {
    display: grid;
    align-content: start;
}

.auditx-panel {
    display: grid;
    gap: 18px;
}

.auditx-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.auditx-title {
    margin: 4px 0 4px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.auditx-subtitle {
    margin: 0;
    color: var(--text-muted);
    font-size: 12.5px;
}

.auditx-filters {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.auditx-filters .select-shell {
    min-width: 170px;
}

.auditx-date-field {
    display: grid;
    gap: 4px;
}

.auditx-date-field span {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.auditx-date-field input {
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 13px;
}

.auditx-reset {
    color: var(--text-muted);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.auditx-reset:hover {
    color: var(--text);
}

.auditx-empty {
    display: grid;
    gap: 4px;
    justify-items: center;
    padding: 40px 20px;
    border: 1px dashed var(--border);
    border-radius: 14px;
    text-align: center;
}

.auditx-empty strong {
    font-size: 14px;
}

.auditx-empty span {
    color: var(--text-muted);
    font-size: 12.5px;
}

.auditx-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.auditx-item {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-secondary);
}

.auditx-avatar {
    display: inline-flex;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 12.5px;
    font-weight: 700;
    overflow: hidden;
}

.auditx-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 999px;
}

.auditx-item-copy {
    display: grid;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.auditx-item-line {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0;
}

.auditx-item-line strong {
    font-size: 13.5px;
    font-weight: 700;
}

.auditx-action-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 11.5px;
    font-weight: 600;
}

.auditx-target {
    color: var(--text-muted);
    font-size: 12px;
}

.auditx-meta {
    margin: 0;
    color: var(--text-muted);
    font-size: 12px;
}

.auditx-time {
    color: var(--text-muted);
    font-size: 11.5px;
    white-space: nowrap;
}

.auditx-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding-top: 4px;
}

.auditx-page-link {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.auditx-page-link:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.auditx-page-info {
    color: var(--text-muted);
    font-size: 12.5px;
}

@media (max-width: 720px) {
    .auditx-item {
        flex-wrap: wrap;
    }

    .auditx-time {
        width: 100%;
        padding-left: 45px;
    }
}

/* ========================================
   Dashboard Home Hero
   ======================================== */
.homex-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.homex-hero-copy {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.homex-greeting {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.homex-summary {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13.5px;
}

.homex-summary-alert {
    color: var(--text);
    font-weight: 600;
}

.homex-hero-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.homex-stat {
    display: grid;
    gap: 2px;
    justify-items: center;
    min-width: 108px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-secondary);
    text-align: center;
}

.homex-stat.is-alert {
    border-color: var(--text);
}

.homex-stat strong {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.homex-stat span {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

@media (max-width: 900px) {
    .homex-hero-stats {
        width: 100%;
    }

    .homex-stat {
        flex: 1;
        min-width: 100px;
    }
}

/* ========================================
   Team Profile & Timeline
   ======================================== */
.team-detail-bottom {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 20px;
    align-items: start;
}

.teamx-logo {
    object-fit: cover;
    border-radius: 12px;
}

.teamx-logo-preview {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    border: 1px solid var(--border);
}

.teamx-profile-form {
    display: grid;
    gap: 14px;
}

.teamx-textarea {
    min-height: 80px;
    padding: 10px 12px;
    resize: vertical;
    line-height: 1.5;
}

.teamx-logo-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.teamx-timeline-card {
    display: grid;
    gap: 16px;
    align-content: start;
}

@media (max-width: 1000px) {
    .team-detail-bottom {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Todo Subtasks & Comments
   ======================================== */
.todosx-extra {
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

.todosx-extra-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: color 0.2s ease;
}

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

.todosx-extra-summary:hover {
    color: var(--text);
}

.todosx-extra-summary svg {
    width: 14px;
    height: 14px;
}

.todosx-extra[open] .todosx-extra-summary {
    color: var(--text);
    margin-bottom: 10px;
}

.todosx-extra-body {
    display: grid;
    gap: 10px;
}

.todosx-extra-empty {
    margin: 0;
    color: var(--text-muted);
    font-size: 12.5px;
}

.subtaskx-list,
.commentx-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.subtaskx-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--bg-secondary);
}

.subtaskx-item form {
    margin: 0;
    display: inline-flex;
}

.subtaskx-check {
    display: inline-flex;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg);
    color: var(--bg);
    transition: all 0.2s ease;
}

.subtaskx-item.is-done .subtaskx-check {
    background: var(--text);
    border-color: var(--text);
}

.subtaskx-check svg {
    width: 12px;
    height: 12px;
}

.subtaskx-title {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    overflow-wrap: break-word;
}

.subtaskx-item.is-done .subtaskx-title {
    color: var(--text-muted);
    text-decoration: line-through;
}

.subtaskx-remove {
    width: 26px;
    height: 26px;
}

.subtaskx-add-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.subtaskx-add-form input[type="text"] {
    flex: 1;
    min-height: 38px;
    padding: 0 12px;
    font-size: 13px;
    border-radius: 11px;
}

.commentx-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-secondary);
}

.commentx-item form {
    margin: 0;
}

.commentx-avatar {
    margin-top: 2px;
}

.commentx-copy {
    display: grid;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.commentx-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.commentx-head strong {
    font-size: 12.5px;
    font-weight: 700;
}

.commentx-head span {
    color: var(--text-muted);
    font-size: 11px;
}

.commentx-copy p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.55;
    overflow-wrap: break-word;
}

/* ========================================
   Role Member Avatar Stack
   ======================================== */
.rolesx-avatar-stack {
    display: inline-flex;
    align-items: center;
}

.rolesx-stack-avatar {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 2px solid var(--surface);
    object-fit: cover;
    flex: 0 0 26px;
}

.rolesx-stack-avatar + .rolesx-stack-avatar {
    margin-left: -8px;
}

.rolesx-stack-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
}

.rolesx-stack-more {
    font-size: 9px;
    letter-spacing: -0.02em;
}

/* ========================================
   Flatten nested containers
   (keine Karte-in-Karte-Optik in inneren Ebenen)
   ======================================== */

/* --- Todos: Subtasks, Kommentare & Anhaenge innerhalb einer Todo-Karte flach --- */
.todosx-item .subtaskx-item,
.todosx-item .commentx-item,
.todosx-item .attachx-link {
    border: none;
    border-radius: 0;
    background: transparent;
    padding: 8px 0;
}

.todosx-item .attachx-link:hover {
    background: transparent;
}

.todosx-item .attachx-link:hover .attachx-copy strong {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.todosx-item .subtaskx-list,
.todosx-item .commentx-list,
.todosx-item .attachx-list {
    gap: 0;
}

.todosx-item .subtaskx-item + .subtaskx-item,
.todosx-item .commentx-item + .commentx-item,
.todosx-item .attachx-item + .attachx-item {
    border-top: 1px solid var(--border);
}

.todosx-item .attachx-item {
    padding: 0;
}

.todosx-item .attachx-icon {
    border: none;
    background: var(--bg-secondary);
}

.todosx-item .attachx-remove,
.todosx-item .subtaskx-remove {
    border: none;
    background: transparent;
}

.todosx-item .attachx-remove:hover,
.todosx-item .subtaskx-remove:hover {
    background: var(--bg-secondary);
}

/* --- Startseite: Hero-Statistiken als Zeile mit Trennlinien statt Karten --- */
.homex-hero-stats {
    gap: 0;
}

.homex-stat {
    border: none;
    border-radius: 0;
    background: transparent;
    padding: 4px 22px;
}

.homex-stat + .homex-stat {
    border-left: 1px solid var(--border);
}

.homex-stat.is-alert {
    border-color: var(--border);
}

.homex-stat.is-alert strong {
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* --- Audit-Log: Eintraege als Liste mit Trennlinien statt Einzelkarten --- */
.auditx-list {
    gap: 0;
}

.auditx-item {
    border: none;
    border-radius: 0;
    background: transparent;
    padding: 13px 2px;
}

.auditx-item + .auditx-item {
    border-top: 1px solid var(--border);
}

/* --- Team-Detail: Statistiken mit Trennlinien statt Einzelkarten --- */
.team-stat-grid {
    gap: 0;
}

.team-stat {
    border: none;
    border-radius: 0;
    background: transparent;
    padding: 6px 18px;
}

.team-stat:first-child {
    padding-left: 2px;
}

.team-stat + .team-stat {
    border-left: 1px solid var(--border);
}

/* ========================================
   Support: SLA & Textbausteine
   ======================================== */

.support-ticket-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.badge-sla {
    background: rgba(229, 72, 77, 0.12);
    color: #e5484d;
    border-color: rgba(229, 72, 77, 0.4);
    font-weight: 700;
    letter-spacing: 0.04em;
}

.support-ticket.is-sla-breached {
    border-left: 3px solid #e5484d;
}

.templatex {
    margin-top: 22px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.templatex summary {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    list-style: none;
}

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

.templatex summary:hover {
    color: var(--text);
}

.templatex-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 14px;
}

.templatex-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.templatex-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 2px;
}

.templatex-item + .templatex-item {
    border-top: 1px solid var(--border);
}

.templatex-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.templatex-copy strong {
    font-size: 13px;
}

.templatex-copy span {
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.templatex-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.templatex-form .button {
    align-self: flex-start;
}

/* ========================================
   Spieler-Akte
   ======================================== */
.playerx-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    gap: 20px;
    align-items: start;
}

.playerx-back {
    margin-bottom: 4px;
}

.playerx-kv {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
}

.playerx-kv > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 2px;
    font-size: 13px;
}

.playerx-kv > div + div {
    border-top: 1px solid var(--border);
}

.playerx-kv dt {
    color: var(--text-secondary);
}

.playerx-kv dd {
    margin: 0;
    text-align: right;
    overflow-wrap: anywhere;
}

.playerx-section-title {
    font-size: 13px;
    font-weight: 700;
    margin: 0 0 8px;
}

.playerx-section-title-top {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.playerx-notes {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.playerx-note {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 11px 2px;
}

.playerx-note + .playerx-note {
    border-top: 1px solid var(--border);
}

.playerx-note-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-secondary);
}

.playerx-note-head strong {
    color: var(--text);
    font-size: 12.5px;
}

.playerx-note-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.playerx-note-badge.is-warning {
    background: rgba(229, 72, 77, 0.12);
    color: #e5484d;
    border-color: rgba(229, 72, 77, 0.4);
}

.playerx-note p {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-secondary);
    overflow-wrap: break-word;
}

.playerx-note-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.badge-neutral {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-color: var(--border);
}

/* ========================================
   Statistiken
   ======================================== */
.statsx {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.statsx-totals {
    display: flex;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 4px;
}

.statsx-total {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px 22px;
    flex: 1;
    min-width: 140px;
}

.statsx-total + .statsx-total {
    border-left: 1px solid var(--border);
}

.statsx-total-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.statsx-total-value {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.statsx-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
}

.statsx-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.statsx-bars,
.statsx-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.statsx-bar-row,
.statsx-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.statsx-bar-label,
.statsx-list-name {
    flex: 0 0 110px;
    font-size: 12.5px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.statsx-bar-track {
    flex: 1;
    height: 8px;
    border-radius: 999px;
    background: var(--bg-secondary);
    overflow: hidden;
}

.statsx-bar-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--text);
    min-width: 2px;
}

.statsx-bar-value {
    flex: 0 0 52px;
    text-align: right;
    font-size: 12.5px;
    font-weight: 600;
}

/* ========================================
   Kalender
   ======================================== */
.calx {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.calx-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.calx-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.calx-weekday {
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.calx-day {
    min-height: 96px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-top: 1px solid var(--border);
    border-left: 1px solid var(--border);
}

.calx-day:nth-child(7n + 1) {
    border-left: none;
}

.calx-day-empty {
    background: var(--bg-secondary);
    opacity: 0.5;
}

.calx-day.is-today {
    background: var(--bg-secondary);
}

.calx-day.is-today .calx-day-number {
    background: var(--text);
    color: var(--surface);
}

.calx-day-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.calx-chip {
    display: block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 7px;
    border-radius: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text);
}

.calx-chip-event {
    border-left: 3px solid var(--text);
}

.calx-chip-todo {
    color: var(--text-secondary);
}

.calx-chip-todo.is-done {
    text-decoration: line-through;
    opacity: 0.6;
}

.calx-more {
    font-size: 11px;
    color: var(--text-secondary);
}

.calx-bottom {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 20px;
    align-items: start;
}

.calx-event-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.calx-event-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 11px 2px;
}

.calx-event-item + .calx-event-item {
    border-top: 1px solid var(--border);
}

.calx-event-item form {
    margin-left: auto;
}

.calx-event-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 44px;
    padding: 6px 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-secondary);
}

.calx-event-date strong {
    font-size: 15px;
    line-height: 1.2;
}

.calx-event-date span {
    font-size: 10.5px;
    color: var(--text-secondary);
}

.calx-event-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.calx-event-copy strong {
    font-size: 13.5px;
}

.calx-event-copy span {
    font-size: 12.5px;
    color: var(--text-secondary);
}

.calx-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.calx-form .button {
    align-self: flex-start;
}

.calx-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

/* ========================================
   Dienstplan
   ======================================== */
.shiftx {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.shiftx-week {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.shiftx-day {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    min-height: 140px;
    border-left: 1px solid var(--border);
}

.shiftx-day:first-child {
    border-left: none;
}

.shiftx-day.is-today {
    background: var(--bg-secondary);
}

.shiftx-day-head {
    display: flex;
    flex-direction: column;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.shiftx-day-head strong {
    font-size: 12.5px;
}

.shiftx-day-head span {
    font-size: 11px;
    color: var(--text-secondary);
}

.shiftx-day-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shiftx-entry {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
}

.shiftx-entry form {
    margin-left: auto;
}

.shiftx-entry-copy {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.shiftx-entry-copy strong {
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shiftx-entry-copy span {
    font-size: 11px;
    color: var(--text-secondary);
}

.shiftx-entry-note {
    font-style: italic;
}

.shiftx-empty {
    margin: 0;
    font-size: 11.5px;
    color: var(--text-muted);
}

.shiftx-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.shiftx-form .button {
    align-self: flex-start;
}

/* ========================================
   Wissensdatenbank
   ======================================== */
.wikix-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    gap: 20px;
    align-items: start;
}

.wikix-search {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
}

.wikix-search input[type="search"] {
    flex: 1;
    min-height: 40px;
    padding: 0 12px;
    font-size: 13px;
    border-radius: 11px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text);
}

.wikix-category + .wikix-category {
    margin-top: 18px;
}

.wikix-category-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-secondary);
    margin: 0 0 6px;
}

.wikix-page-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.wikix-page-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 2px;
    text-decoration: none;
    color: inherit;
    border-top: 1px solid var(--border);
    transition: color 0.2s ease;
}

.wikix-page-list li:first-child .wikix-page-link {
    border-top: none;
}

.wikix-page-link svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    color: var(--text-secondary);
}

.wikix-page-link:hover .wikix-page-copy strong {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.wikix-page-copy {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.wikix-page-copy strong {
    font-size: 13.5px;
}

.wikix-page-copy span {
    font-size: 12px;
    color: var(--text-secondary);
}

.wikix-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wikix-form .button {
    align-self: flex-start;
}

.wikix-detail-title {
    margin-top: 10px;
}

.wikix-detail-actions {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.wikix-body {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
    overflow-wrap: break-word;
    max-width: 75ch;
}

/* ========================================
   Responsive fuer neue Seiten
   ======================================== */
@media (max-width: 1100px) {
    .statsx-grid,
    .calx-bottom,
    .wikix-layout,
    .playerx-grid {
        grid-template-columns: 1fr;
    }

    .shiftx-week {
        grid-template-columns: 1fr;
    }

    .shiftx-day {
        border-left: none;
        border-top: 1px solid var(--border);
        min-height: 0;
    }

    .shiftx-day:first-child {
        border-top: none;
    }

    .calx-day {
        min-height: 64px;
    }
}

/* ========================================
   Startseite (Landing)
   ======================================== */
.homex-trust {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    list-style: none;
    margin: 20px 0 0;
    padding: 0;
}

.homex-trust li {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
}

.homex-trust svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.homex-features-head {
    max-width: 560px;
    margin-bottom: 28px;
}

.homex-features-head h2 {
    margin: 8px 0 10px;
}

.homex-features {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.homex-feature {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.homex-feature:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
}

.homex-feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text);
}

.homex-feature-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.homex-feature h3 {
    margin: 0;
    font-size: 15px;
}

.homex-feature p {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-secondary);
}

.homex-how {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 32px;
    align-items: center;
}

.homex-how-copy h2 {
    margin: 8px 0 10px;
}

.homex-steps {
    display: flex;
    flex-direction: column;
    list-style: none;
    margin: 0;
    padding: 0;
}

.homex-step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 0;
}

.homex-step + .homex-step {
    border-top: 1px solid var(--border);
}

.homex-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    font-size: 13px;
    font-weight: 700;
}

.homex-step h3 {
    margin: 0 0 3px;
    font-size: 14.5px;
}

.homex-step p {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-secondary);
}

.homex-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 48px 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.homex-cta h2 {
    margin: 0;
    max-width: 480px;
}

.homex-cta p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.homex-cta-actions {
    margin-top: 14px;
    justify-content: center;
}

/* ========================================
   FAQ-Seite
   ======================================== */
.faqx-toolbar {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 22px;
}

.faqx-search {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-secondary);
}

.faqx-search svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    color: var(--text-secondary);
}

.faqx-search input {
    flex: 1;
    min-height: 44px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    outline: none;
}

.faqx-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.faqx-filter {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.faqx-filter:hover {
    border-color: var(--border-light);
    color: var(--text);
}

.faqx-filter.is-active {
    background: var(--text);
    border-color: var(--text);
    color: var(--surface);
}

.faq-item summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.faqx-question {
    flex: 1;
    min-width: 0;
}

.faqx-category {
    flex-shrink: 0;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-secondary);
}

.faqx-no-results {
    margin-top: 14px;
}

.faqx-cta {
    padding: 36px 24px;
}

/* ========================================
   Feedback-Seite
   ======================================== */
.fbx-field-foot {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.fbx-counter {
    flex-shrink: 0;
    font-size: 11.5px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.fbx-tips {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.fbx-tips-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
}

.fbx-tips-list li {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    color: var(--text-secondary);
}

.fbx-tips-list svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    color: var(--text);
}

.fbx-list {
    display: flex;
    flex-direction: column;
    list-style: none;
    margin: 0;
    padding: 0;
}

.fbx-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 15px 2px;
}

.fbx-item + .fbx-item {
    border-top: 1px solid var(--border);
}

.fbx-item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.fbx-item .item-description {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fbx-item-date {
    font-size: 11.5px;
    color: var(--text-muted);
}

.fbx-status-done {
    background: rgba(48, 164, 108, 0.12);
    color: #30a46c;
    border-color: rgba(48, 164, 108, 0.4);
}

.fbx-status-declined {
    background: rgba(229, 72, 77, 0.12);
    color: #e5484d;
    border-color: rgba(229, 72, 77, 0.4);
}

/* ========================================
   Hero-Mockup (kompakte Dashboard-Vorschau)
   ======================================== */
.mockx {
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--bg);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.mockx-topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.mockx-dots {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.mockx-dots i {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--text-muted);
    opacity: 0.5;
}

.mockx-tabs {
    display: flex;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
}

.mockx-tab {
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.mockx-tab.is-active {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
}

.mockx-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px;
}

.mockx-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.mockx-stat {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    min-width: 0;
}

.mockx-stat small {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mockx-stat strong {
    font-size: 24px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.mockx-list {
    display: flex;
    flex-direction: column;
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    overflow: hidden;
}

.mockx-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    min-width: 0;
}

.mockx-row + .mockx-row {
    border-top: 1px solid var(--border);
}

.mockx-check {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border-radius: 999px;
    border: 1.5px solid var(--text-muted);
}

.mockx-check.is-done {
    border-color: #30a46c;
    background:
        linear-gradient(45deg, transparent 45%, #30a46c 45%) no-repeat center / 8px 2px,
        rgba(48, 164, 108, 0.15);
}

.mockx-row-copy {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.mockx-row-copy strong {
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mockx-row-copy small {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mockx-badge {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    white-space: nowrap;
}

.mockx-badge.is-high {
    background: rgba(240, 140, 0, 0.12);
    color: #f08c00;
    border-color: rgba(240, 140, 0, 0.4);
}

.mockx-badge.is-critical {
    background: rgba(229, 72, 77, 0.12);
    color: #e5484d;
    border-color: rgba(229, 72, 77, 0.4);
}

.mockx-badge.is-done {
    background: rgba(48, 164, 108, 0.12);
    color: #30a46c;
    border-color: rgba(48, 164, 108, 0.4);
}

/* ========================================
   Responsive fuer Landing/FAQ/Feedback
   ======================================== */
@media (max-width: 1000px) {
    .homex-features {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .homex-how {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 640px) {
    .homex-features {
        grid-template-columns: 1fr;
    }

    .faq-item summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .mockx-tabs {
        display: none;
    }

    .mockx-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .mockx-stat {
        padding: 10px;
    }

    .mockx-badge {
        display: none;
    }
}

/* ========================================
   Admin-Panel (Site-Admins)
   ======================================== */
.adminx-brand-mark {
    background: #e5484d;
    color: #ffffff;
}

.adminx-eyebrow {
    color: #e5484d;
}

.adminx-nav-link {
    margin-top: 8px;
    border-top: 1px solid var(--border);
    padding-top: 14px;
    border-radius: 0;
}

.adminx-back-link {
    margin-bottom: 8px;
}

.adminx-account {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.adminx-account-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.adminx-account-copy strong {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.adminx-account-copy span {
    font-size: 11px;
    color: var(--text-muted);
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}

.section-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin: 4px 0 0;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: 13.5px;
    font-weight: 500;
    border: 1px solid var(--border);
}

.alert-success {
    background: rgba(48, 164, 108, 0.12);
    border-color: rgba(48, 164, 108, 0.4);
    color: #30a46c;
}

.alert-error {
    background: rgba(229, 72, 77, 0.12);
    border-color: rgba(229, 72, 77, 0.4);
    color: #e5484d;
}

.adminx-search {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}

.adminx-search input[type='search'] {
    flex: 1;
    min-width: 0;
}

.adminx-rows {
    display: flex;
    flex-direction: column;
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.adminx-row,
.adminx-faq-item,
.adminx-feedback-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    min-width: 0;
    background: var(--surface);
}

.adminx-row + .adminx-row,
.adminx-faq-item + .adminx-faq-item,
.adminx-feedback-item + .adminx-feedback-item {
    border-top: 1px solid var(--border);
}

.adminx-row.is-banned {
    opacity: 0.7;
}

.adminx-row-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.adminx-row-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.adminx-row-title strong {
    font-size: 14px;
}

.adminx-row-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.adminx-row-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
}

.adminx-ban-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.adminx-ban-form input[type='text'] {
    width: 160px;
    font-size: 12.5px;
}

.adminx-danger-button {
    color: #e5484d;
    border-color: rgba(229, 72, 77, 0.4);
}

.adminx-danger-button:hover {
    background: rgba(229, 72, 77, 0.1);
}

.adminx-mini-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.adminx-mini-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    min-width: 0;
}

.adminx-mini-item + .adminx-mini-item {
    border-top: 1px solid var(--border);
}

.adminx-mini-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.adminx-mini-copy strong {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.adminx-mini-copy span {
    font-size: 11.5px;
    color: var(--text-muted);
}

.adminx-mini-empty {
    padding: 16px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    list-style: none;
}

.adminx-log-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    min-width: 0;
}

.adminx-log-row strong {
    font-size: 13px;
}

.adminx-log-action {
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-mono, monospace);
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.adminx-log-time {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.adminx-faq-item {
    flex-direction: column;
    align-items: stretch;
}

.adminx-faq-item details {
    width: 100%;
}

.adminx-faq-summary {
    cursor: pointer;
    list-style: none;
}

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

.adminx-faq-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 14px;
}

.adminx-faq-form label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
}

.adminx-faq-form-row {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
}

.adminx-faq-form-row label:first-child {
    flex: 1;
    min-width: 160px;
}

.adminx-faq-publish {
    flex-direction: row !important;
    align-items: center;
    gap: 8px !important;
    padding-bottom: 10px;
}

.adminx-faq-item form[data-confirm] {
    margin-top: 10px;
}

.adminx-feedback-item {
    align-items: flex-start;
}

.adminx-feedback-content {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 2px 0;
    line-height: 1.5;
}

.adminx-feedback-status-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

@media (max-width: 720px) {
    .adminx-row,
    .adminx-feedback-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .adminx-row-actions {
        width: 100%;
    }

    .adminx-log-time {
        margin-left: 0;
    }
}

/* ========================================
   Discord-Bot-Seite
   ======================================== */
.botx {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.botx-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 20px;
    align-items: start;
}

.botx-main,
.botx-side {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.botx-token-alert {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.botx-token {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 13px;
    word-break: break-all;
    user-select: all;
    color: var(--text);
}

.botx-wait-list,
.botx-history {
    display: flex;
    flex-direction: column;
    list-style: none;
    margin: 0;
    padding: 0;
}

.botx-wait-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 2px;
}

.botx-wait-item + .botx-wait-item {
    border-top: 1px solid var(--border);
}

.botx-wait-dot {
    width: 9px;
    height: 9px;
    flex-shrink: 0;
    border-radius: 999px;
    background: #30a46c;
    animation: botx-pulse 1.6s ease-in-out infinite;
}

@keyframes botx-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.botx-wait-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.botx-wait-copy strong {
    font-size: 13.5px;
}

.botx-wait-copy span {
    font-size: 12px;
    color: var(--text-secondary);
}

.botx-history-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 2px;
}

.botx-history-item + .botx-history-item {
    border-top: 1px solid var(--border);
}

.botx-history-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.botx-history-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.botx-history-title strong {
    font-size: 13.5px;
}

.botx-history-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.botx-history-time {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.botx-hours {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 120px;
    margin-top: 6px;
}

.botx-hour {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    height: 100%;
    min-width: 0;
}

.botx-hour-track {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    border-radius: 5px;
    background: var(--bg-secondary);
    overflow: hidden;
}

.botx-hour-fill {
    display: block;
    width: 100%;
    border-radius: 5px 5px 0 0;
    background: var(--border);
    min-height: 2px;
    transition: background 0.2s ease;
}

.botx-hour-fill.has-data {
    background: #30a46c;
}

.botx-hour-track:hover .botx-hour-fill.has-data {
    background: #3cbf7f;
}

.botx-hour-label {
    font-size: 9.5px;
    color: var(--text-muted);
}

.botx-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.botx-form label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
}

.botx-form .button {
    align-self: flex-start;
}

/* Toggle-Switch fuer "Bot aktiv" (statt riesiger Standard-Checkbox) */
.botx-toggle {
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.botx-toggle:hover {
    border-color: var(--text-muted);
}

.botx-toggle input[type='checkbox'] {
    position: absolute;
    width: 1px;
    height: 1px;
    min-height: 0;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.botx-toggle-track {
    position: relative;
    flex-shrink: 0;
    width: 40px;
    height: 22px;
    border-radius: 999px;
    background: var(--border);
    transition: background 0.2s ease;
}

.botx-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.botx-toggle input:checked ~ .botx-toggle-track {
    background: #30a46c;
}

.botx-toggle input:checked ~ .botx-toggle-track .botx-toggle-thumb {
    transform: translateX(18px);
}

.botx-toggle input:focus-visible ~ .botx-toggle-track {
    outline: 2px solid var(--text);
    outline-offset: 2px;
}

.botx-toggle-copy {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.botx-toggle-copy strong {
    font-size: 13px;
    color: var(--text);
}

.botx-toggle-copy span {
    font-size: 11.5px;
    font-weight: 400;
    color: var(--text-muted);
}

/* Live-Badge im Warteraum-Header */
.botx-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.botx-live-badge .botx-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--text-muted);
}

.botx-live-badge.is-active {
    border-color: rgba(48, 164, 108, 0.4);
    background: rgba(48, 164, 108, 0.1);
    color: #30a46c;
}

.botx-live-badge.is-active .botx-live-dot {
    background: #30a46c;
    animation: botx-pulse 1.6s ease-in-out infinite;
}

/* Leere Zustaende mit Icon */
.botx-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 28px 16px;
    text-align: center;
}

.botx-empty svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: var(--text-muted);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.botx-empty p {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

/* Icon je Ausgang im Verlauf */
.botx-history-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
}

.botx-history-icon svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: var(--text-secondary);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.botx-history-icon.botx-outcome-moved {
    border-color: rgba(48, 164, 108, 0.35);
    background: rgba(48, 164, 108, 0.1);
}

.botx-history-icon.botx-outcome-moved svg {
    stroke: #30a46c;
}

.botx-history-icon.botx-outcome-kicked {
    border-color: rgba(229, 72, 77, 0.35);
    background: rgba(229, 72, 77, 0.1);
}

.botx-history-icon.botx-outcome-kicked svg {
    stroke: #e5484d;
}

.botx-history-copy {
    flex: 1;
}

.botx-placeholder-list {
    display: flex;
    flex-direction: column;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.botx-placeholder-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.botx-placeholder-list li + li {
    border-top: 1px solid var(--border);
}

.botx-placeholder-list code {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--text);
}

.botx-placeholder-list span {
    font-size: 12.5px;
    color: var(--text-muted);
}

@media (max-width: 1100px) {
    .botx-grid {
        grid-template-columns: 1fr;
    }

    .botx-hour-label {
        display: none;
    }
}
