:root {
    color-scheme: dark;

    --bg: #0d0f14;
    --sidebar: #11141b;
    --panel: #171b24;
    --panel-2: #1c212c;
    --panel-3: #222834;

    --border: #292f3c;
    --border-soft: #232936;

    --text: #f2f4f8;
    --muted: #929aac;
    --muted-2: #697184;

    --accent: #6e7cf7;
    --accent-hover: #7d89ff;
    --accent-soft: rgba(110, 124, 247, .13);

    --green: #4fd19c;
    --green-soft: rgba(79, 209, 156, .12);

    --red: #f26b7a;
    --red-soft: rgba(242, 107, 122, .12);

    --yellow: #e9bd62;
    --yellow-soft: rgba(233, 189, 98, .12);

    --radius: 12px;
    --radius-sm: 8px;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-height: 100%;
    margin: 0;
}

body {
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background: var(--bg);
    color: var(--text);
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}


/* LOGIN */

.login-screen {
    min-height: 100vh;

    display: grid;
    place-items: center;

    padding: 24px;

    background:
        radial-gradient(
            circle at 25% 20%,
            rgba(110, 124, 247, .16),
            transparent 35%
        ),
        radial-gradient(
            circle at 80% 80%,
            rgba(79, 209, 156, .07),
            transparent 35%
        ),
        var(--bg);
}

.login-card {
    width: min(430px, 100%);

    padding: 34px;

    background:
        rgba(23, 27, 36, .95);

    border: 1px solid var(--border);

    border-radius: 18px;

    box-shadow:
        0 30px 80px rgba(0, 0, 0, .38);
}

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

.brand-login {
    margin-bottom: 34px;
}

.brand-icon {
    width: 48px;
    height: 48px;

    display: grid;
    place-items: center;

    border-radius: 14px;

    background:
        linear-gradient(
            135deg,
            #6e7cf7,
            #4958d7
        );

    color: white;

    font-size: 15px;
    font-weight: 800;
    letter-spacing: .5px;

    box-shadow:
        0 8px 30px rgba(110, 124, 247, .25);
}

.brand-icon.small {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    font-size: 12px;
}

.brand-name {
    font-weight: 750;
    font-size: 16px;
}

.brand-subtitle {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.login-heading h1 {
    margin: 0 0 8px;
    font-size: 26px;
}

.login-heading p {
    margin: 0 0 26px;
    color: var(--muted);
    line-height: 1.5;
}

label {
    display: block;

    margin-bottom: 17px;

    color: #c3c8d3;

    font-size: 13px;
    font-weight: 650;
}

input,
select {
    width: 100%;

    margin-top: 7px;
    padding: 11px 12px;

    background: #10131a;
    color: var(--text);

    border: 1px solid var(--border);
    border-radius: var(--radius-sm);

    outline: none;
}

input:focus,
select:focus {
    border-color: var(--accent);

    box-shadow:
        0 0 0 3px var(--accent-soft);
}

.primary-button,
.ghost-button,
.danger-button,
.icon-button,
.small-button {
    border: 0;
    border-radius: var(--radius-sm);

    color: white;

    transition:
        background .15s ease,
        border-color .15s ease,
        opacity .15s ease;
}

.primary-button {
    padding: 10px 15px;
    background: var(--accent);
    font-weight: 680;
}

.primary-button:hover {
    background: var(--accent-hover);
}

.login-button {
    width: 100%;
    min-height: 44px;
    margin-top: 4px;
}

.ghost-button {
    padding: 9px 13px;

    background: transparent;
    border: 1px solid var(--border);

    color: #c8cdd8;
}

.ghost-button:hover {
    background: var(--panel-3);
}

.danger-button {
    padding: 8px 11px;

    background: var(--red-soft);
    border: 1px solid rgba(242, 107, 122, .2);

    color: #ff9aa4;
}

.icon-button {
    width: 38px;
    height: 38px;

    background: var(--panel);
    border: 1px solid var(--border);

    color: var(--muted);
}

.small-button {
    padding: 7px 10px;

    background: var(--panel-3);
    border: 1px solid var(--border);

    color: #d7dbe4;
}

.form-error {
    margin: 0 0 14px;
    padding: 10px 12px;

    border-radius: var(--radius-sm);

    background: var(--red-soft);

    color: #ff9aa4;

    font-size: 13px;
}

.security-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    margin-top: 22px;

    color: var(--muted-2);
    font-size: 11px;
}


/* APP SHELL */

.app-shell {
    min-height: 100vh;

    display: grid;

    grid-template-columns:
        250px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;

    height: 100vh;

    display: flex;
    flex-direction: column;

    padding: 18px 13px;

    background: var(--sidebar);

    border-right:
        1px solid var(--border-soft);
}

.sidebar-brand {
    padding: 3px 8px 20px;
}

.navigation {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    width: 100%;

    display: flex;
    align-items: center;
    gap: 11px;

    padding: 10px 11px;

    background: transparent;
    color: #aeb5c3;

    border: 0;
    border-radius: 8px;

    text-align: left;
}

.nav-item:hover {
    background: #181c25;
    color: white;
}

.nav-item.active {
    background: var(--accent-soft);
    color: #dce0ff;
}

.nav-icon {
    width: 20px;

    color: #788196;

    text-align: center;
}

.nav-item.active .nav-icon {
    color: #98a3ff;
}

.nav-section {
    margin:
        21px 11px 7px;

    color: #60697c;

    font-size: 10px;
    font-weight: 750;

    letter-spacing: .11em;
}

.sidebar-footer {
    margin-top: auto;

    padding:
        14px 8px 4px;

    border-top:
        1px solid var(--border-soft);
}

.server-status {
    display: flex;
    align-items: center;
    gap: 9px;
}

.status-dot {
    width: 8px;
    height: 8px;

    display: inline-block;

    flex: 0 0 auto;

    border-radius: 50%;

    background: var(--green);

    box-shadow:
        0 0 0 3px var(--green-soft);
}

.server-status strong {
    display: block;
    font-size: 12px;
}

.server-status small {
    display: block;
    margin-top: 2px;
    color: var(--muted-2);
    font-size: 10px;
}

.workspace {
    min-width: 0;
}

.topbar {
    height: 78px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 28px;

    border-bottom:
        1px solid var(--border-soft);

    background:
        rgba(13, 15, 20, .9);

    backdrop-filter: blur(10px);

    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar h1 {
    margin: 0;

    font-size: 18px;
    font-weight: 700;
}

#page-description {
    margin-top: 4px;

    color: var(--muted);
    font-size: 12px;
}

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

.account {
    display: flex;
    align-items: center;
    gap: 9px;

    margin:
        0 5px 0 4px;
}

.avatar {
    width: 36px;
    height: 36px;

    display: grid;
    place-items: center;

    border-radius: 50%;

    background:
        linear-gradient(
            135deg,
            #30374a,
            #242a38
        );

    border: 1px solid var(--border);

    font-size: 12px;
    font-weight: 700;
}

.account-text strong {
    display: block;
    font-size: 12px;
}

.account-text small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
}

.content {
    padding: 26px;
}


/* GENERAL */

.page-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 15px;

    margin-bottom: 18px;
}

.page-toolbar h2 {
    margin: 0 0 5px;
    font-size: 18px;
}

.page-toolbar p {
    margin: 0;

    color: var(--muted);
    font-size: 12px;
}

.metrics {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 14px;

    margin-bottom: 22px;
}

.metric-card,
.card {
    background: var(--panel);

    border: 1px solid var(--border-soft);

    border-radius: var(--radius);
}

.metric-card {
    padding: 17px;
}

.metric-label {
    color: var(--muted);
    font-size: 11px;
}

.metric-value {
    margin-top: 9px;

    font-size: 27px;
    font-weight: 760;
}

.metric-note {
    margin-top: 6px;

    color: var(--muted-2);
    font-size: 10px;
}

.card {
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 15px 17px;

    border-bottom:
        1px solid var(--border-soft);
}

.card-header h3 {
    margin: 0;
    font-size: 13px;
}

.card-body {
    padding: 17px;
}

.two-column {
    display: grid;
    grid-template-columns:
        minmax(280px, 360px)
        minmax(0, 1fr);

    gap: 16px;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 12px;
}

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

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

    margin-top: 4px;
}

.inline-form {
    display: flex;
    gap: 8px;
    align-items: end;
}

.inline-form > * {
    flex: 1;
}

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

.empty-state {
    padding: 36px 18px;

    color: var(--muted);

    text-align: center;
}


/* TABLE */

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;

    border-collapse: collapse;

    font-size: 12px;
}

th {
    padding: 10px 12px;

    color: #6f788b;

    border-bottom:
        1px solid var(--border);

    font-size: 10px;
    font-weight: 700;

    letter-spacing: .05em;

    text-align: left;

    text-transform: uppercase;
}

td {
    padding: 11px 12px;

    border-bottom:
        1px solid var(--border-soft);

    vertical-align: middle;
}

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

tbody tr:hover {
    background: rgba(255,255,255,.015);
}

.code {
    font-family:
        "SFMono-Regular",
        Consolas,
        monospace;

    color: #b7bdca;

    font-size: 11px;
}


/* BADGES */

.badge {
    display: inline-flex;
    align-items: center;

    padding: 4px 7px;

    border-radius: 999px;

    background: var(--panel-3);

    color: #b8bfcd;

    font-size: 10px;
}

.badge.green {
    background: var(--green-soft);
    color: #79dfb6;
}

.badge.red {
    background: var(--red-soft);
    color: #ff939e;
}

.badge.yellow {
    background: var(--yellow-soft);
    color: #eac97f;
}

.badge.purple {
    background: var(--accent-soft);
    color: #a9b1ff;
}

.badge + .badge {
    margin-left: 4px;
}


/* GROUP LIST */

.entity-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.entity-item {
    padding: 11px 12px;

    border: 1px solid var(--border-soft);
    border-radius: 9px;

    background: var(--panel-2);
}

.entity-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.entity-item strong {
    font-size: 12px;
}

.entity-item small {
    display: block;

    margin-top: 4px;

    color: var(--muted);

    font-size: 10px;
}


/* PERMISSIONS */

.permission-group {
    margin-bottom: 18px;
}

.permission-group:last-child {
    margin-bottom: 0;
}

.permission-category {
    margin-bottom: 8px;

    color: #8b94a8;

    font-size: 10px;
    font-weight: 750;

    letter-spacing: .07em;
    text-transform: uppercase;
}

.permission-row {
    display: grid;

    grid-template-columns:
        minmax(180px, 1fr)
        minmax(120px, 160px);

    align-items: center;
    gap: 12px;

    padding: 9px 0;

    border-bottom:
        1px solid var(--border-soft);
}

.permission-row:last-child {
    border-bottom: 0;
}

.permission-code {
    font-size: 11px;
}

.permission-description {
    margin-top: 3px;

    color: var(--muted-2);
    font-size: 10px;
}

.permission-select {
    margin: 0;
    padding: 7px 9px;

    font-size: 11px;
}

.permission-select.allow {
    border-color:
        rgba(79, 209, 156, .35);

    color: #79dfb6;
}

.permission-select.deny {
    border-color:
        rgba(242, 107, 122, .35);

    color: #ff939e;
}


/* TOAST */

.toast-container {
    position: fixed;
    right: 20px;
    bottom: 20px;

    z-index: 9999;

    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    min-width: 260px;
    max-width: 420px;

    padding: 11px 13px;

    background: #1d222d;

    border:
        1px solid var(--border);

    border-radius: 9px;

    box-shadow:
        0 14px 40px rgba(0,0,0,.3);

    color: #dce0e9;

    font-size: 12px;
}

.toast.error {
    border-color:
        rgba(242, 107, 122, .35);
}

.toast.success {
    border-color:
        rgba(79, 209, 156, .35);
}


/* RESPONSIVE */

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

    .two-column {
        grid-template-columns: 1fr;
    }
}

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

    .sidebar {
        padding-left: 8px;
        padding-right: 8px;
    }

    .sidebar .brand-name,
    .sidebar .brand-subtitle,
    .nav-item:not(.active) {
    }

    .sidebar-brand > div:last-child,
    .nav-section,
    .nav-item {
        font-size: 0;
    }

    .nav-item {
        justify-content: center;
    }

    .nav-icon {
        font-size: 16px;
    }

    .server-status > div {
        display: none;
    }

    .topbar {
        padding: 0 16px;
    }

    .account-text {
        display: none;
    }

    .content {
        padding: 16px;
    }

    .metrics {
        grid-template-columns: 1fr;
    }

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

/* ==================================================
   SecureVoice Admin Web 0.2.0
   ================================================== */

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
}

.detail-grid {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 16px;
}

.detail-sidebar {
    min-width: 0;
}

.detail-main {
    min-width: 0;
}

.click-row {
    cursor: pointer;
}

.click-row:hover {
    background: rgba(110, 124, 247, .06);
}

.selected-row {
    background: rgba(110, 124, 247, .10) !important;
}

.section-title {
    margin: 4px 0 10px;
    color: #8f98aa;
    font-size: 10px;
    font-weight: 750;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.matrix {
    overflow-x: auto;
}

.matrix table {
    min-width: 760px;
}

.matrix-select {
    min-width: 104px;
    margin: 0;
    padding: 6px 8px;
    font-size: 11px;
}

.matrix-select.allow {
    color: #79dfb6;
    border-color: rgba(79, 209, 156, .35);
}

.matrix-select.deny {
    color: #ff939e;
    border-color: rgba(242, 107, 122, .35);
}

.permission-effective {
    font-weight: 700;
}

.permission-effective.allow {
    color: #79dfb6;
}

.permission-effective.deny {
    color: #ff939e;
}

.source-text {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.detail-header h2 {
    margin: 0;
    font-size: 18px;
}

.detail-header p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.toolbar-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
}

.toolbar-controls label {
    margin: 0;
}

.toolbar-controls select,
.toolbar-controls input {
    margin-top: 4px;
}

.compact-select {
    width: auto;
    min-width: 180px;
}

.filter-input {
    width: min(320px, 100%);
}

.info-list {
    display: grid;
    gap: 8px;
}

.info-line {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-soft);
}

.info-line:last-child {
    border-bottom: 0;
}

.info-line span:first-child {
    color: var(--muted);
}

.subcard {
    padding: 14px;
    background: var(--panel-2);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
}

.assignment-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 8px;
}

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

@media (max-width: 700px) {
    .assignment-grid {
        grid-template-columns: 1fr;
    }
}
