:root {
    color-scheme: dark;
    --bg: #07111f;
    --panel: rgba(12, 24, 38, 0.92);
    --panel-strong: rgba(16, 33, 50, 0.98);
    --line: rgba(76, 212, 255, 0.22);
    --text: #e7f5ff;
    --muted: #8eabc0;
    --accent: #38d5ff;
    --online: #2ce6a6;
    --warn: #f7b955;
    --offline: #ff6b7a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at 18% 12%, rgba(56, 213, 255, 0.16), transparent 28%), var(--bg);
    color: var(--text);
    font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

.login-shell {
    display: grid;
    min-height: 100dvh;
    place-items: center;
    padding: 24px;
}

.login-shell[hidden] {
    display: none;
}

.login-panel {
    display: grid;
    gap: 14px;
    width: min(420px, 100%);
    border: 1px solid rgba(76, 212, 255, 0.28);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(56, 213, 255, 0.13), transparent 44%),
        var(--panel-strong);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
    padding: 26px;
}

.login-panel h1 {
    font-size: 28px;
}

.login-subtitle {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.login-form,
.login-panel label {
    display: grid;
    gap: 8px;
}

.login-panel label span {
    color: var(--muted);
    font-size: 13px;
}

.login-panel input {
    min-height: 46px;
    font-size: 16px;
}

.login-panel button {
    min-height: 46px;
    margin-top: 4px;
}

.login-error {
    border: 1px solid rgba(255, 107, 122, 0.45);
    border-radius: 6px;
    background: rgba(255, 107, 122, 0.11);
    color: #ffd8dd;
    padding: 10px 12px;
}

.login-error[hidden],
.portal-shell[hidden] {
    display: none;
}

.portal-shell {
    width: min(1180px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 28px 0;
}

.portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.user-chip {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(76, 212, 255, 0.22);
    border-radius: 6px;
    background: rgba(4, 13, 23, 0.58);
    color: var(--accent);
    padding: 8px 11px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--accent);
    font-size: 12px;
    letter-spacing: 0;
}

h1,
h2 {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    font-size: 28px;
}

button,
.entry-link,
.customer-entry-button {
    border: 1px solid rgba(56, 213, 255, 0.45);
    border-radius: 6px;
    background: rgba(56, 213, 255, 0.12);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    padding: 9px 14px;
    text-decoration: none;
}

button:hover,
.entry-link:hover,
.customer-entry-button:hover {
    border-color: var(--accent);
    box-shadow: 0 0 18px rgba(56, 213, 255, 0.24);
}

input {
    min-width: 0;
    border: 1px solid rgba(76, 212, 255, 0.2);
    border-radius: 6px;
    background: rgba(4, 13, 23, 0.76);
    color: var(--text);
    font: inherit;
    padding: 10px 11px;
}

select {
    min-width: 0;
    border: 1px solid rgba(76, 212, 255, 0.2);
    border-radius: 6px;
    background: rgba(4, 13, 23, 0.76);
    color: var(--text);
    font: inherit;
    padding: 10px 11px;
}

input:focus {
    border-color: var(--accent);
    outline: none;
}

.summary-grid,
.project-grid {
    display: grid;
    gap: 12px;
}

.summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 14px;
}

.summary-card,
.project-card,
.audit-panel,
.management-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.summary-card {
    padding: 14px;
}

.summary-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.summary-card strong {
    display: block;
    margin-top: 6px;
    font-size: 26px;
}

.project-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.summary-grid[hidden] {
    display: none;
}

.customer-project-center {
    position: relative;
    grid-column: 1 / -1;
    overflow: hidden;
    border: 1px solid rgba(76, 212, 255, 0.24);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(56, 213, 255, 0.12), transparent 36%),
        linear-gradient(180deg, rgba(12, 30, 48, 0.96), rgba(5, 13, 24, 0.98));
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
    padding: 28px;
}

.customer-project-heading,
.customer-project-grid {
    position: relative;
    z-index: 1;
}

.customer-project-heading {
    display: grid;
    gap: 8px;
    margin-bottom: 24px;
}

.customer-project-heading span,
.customer-tile-topline {
    color: var(--accent);
    font-size: 13px;
}

.customer-project-heading h2 {
    margin: 0;
    font-size: 30px;
}

.customer-project-heading p {
    margin: 0;
    color: var(--muted);
}

.customer-project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.customer-project-tile {
    position: relative;
    display: grid;
    min-height: 210px;
    overflow: hidden;
    border: 1px solid rgba(76, 212, 255, 0.24);
    border-radius: 8px;
    background: rgba(4, 14, 27, 0.78);
    padding: 18px;
}

.customer-project-tile:hover {
    border-color: rgba(56, 213, 255, 0.62);
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.28), 0 0 24px rgba(56, 213, 255, 0.12);
}

.customer-tile-topline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.customer-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--online);
    box-shadow: 0 0 14px rgba(44, 230, 166, 0.68);
}

.customer-tile-body {
    align-self: center;
}

.customer-tile-body p {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.55;
}

.customer-entry-button {
    align-self: end;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-width: 118px;
    min-height: 40px;
}

.customer-entry-button::after {
    content: ">";
    margin-left: 8px;
}

.customer-empty-state {
    grid-column: 1 / -1;
}

.customer-portal-shell {
    width: min(1280px, calc(100vw - 32px));
    padding: 20px 0 40px;
}

.customer-portal-shell .portal-header {
    min-height: 56px;
    margin-bottom: 26px;
    border: 0;
    border-bottom: 1px solid rgba(76, 212, 255, 0.22);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: 0 2px 14px;
}

.customer-portal-shell .portal-header h1 {
    font-size: 20px;
}

.customer-portal-shell .portal-header .eyebrow {
    display: none;
    margin: 0;
    font-size: 13px;
}

.customer-portal-shell #refreshBtn {
    display: none;
}

.customer-portal-shell .user-chip {
    border: 0;
    background: transparent;
    color: var(--text);
}

.customer-portal-shell .project-grid {
    display: block;
}

.customer-portal-shell .customer-project-center {
    border: 0;
    border-radius: 0;
    background:
        linear-gradient(rgba(76, 212, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(76, 212, 255, 0.06) 1px, transparent 1px);
    background-size: 46px 46px;
    box-shadow: none;
    padding: 4px 0 0;
}

.customer-portal-shell .customer-project-heading {
    margin-bottom: 18px;
}

.customer-portal-shell .customer-project-heading span {
    color: var(--online);
}

.customer-portal-shell .customer-project-heading h2 {
    font-size: 34px;
    line-height: 1.15;
}

.customer-portal-shell .customer-project-heading p {
    font-size: 16px;
}




.customer-portal-shell .customer-project-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.customer-portal-shell .customer-project-tile {
    min-height: 208px;
    border-color: rgba(76, 212, 255, 0.28);
    background:
        linear-gradient(145deg, rgba(30, 104, 150, 0.32), rgba(3, 12, 24, 0.86) 50%),
        rgba(5, 15, 29, 0.92);
    box-shadow: inset 0 1px 0 rgba(231, 245, 255, 0.06);
    padding: 20px;
}

.customer-tile-corner {
    position: absolute;
    width: 42px;
    height: 42px;
    border-color: rgba(56, 213, 255, 0.66);
    pointer-events: none;
}

.customer-tile-corner-top {
    inset: 0 0 auto auto;
    border-top: 1px solid;
    border-right: 1px solid;
}

.customer-tile-corner-bottom {
    inset: auto auto 0 0;
    border-bottom: 1px solid;
    border-left: 1px solid;
}

.customer-project-status {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    min-height: 32px;
    border: 1px solid rgba(76, 212, 255, 0.28);
    border-radius: 999px;
    background: rgba(56, 213, 255, 0.08);
    color: var(--text);
    font-size: 13px;
    padding: 5px 11px;
}

.customer-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--offline);
    box-shadow: 0 0 12px rgba(255, 107, 122, 0.5);
}

.customer-status-online {
    border-color: rgba(44, 230, 166, 0.36);
    background: rgba(44, 230, 166, 0.1);
    color: var(--online);
}

.customer-status-online .customer-status-dot {
    background: var(--online);
    box-shadow: 0 0 14px rgba(44, 230, 166, 0.7);
}

.customer-status-stale {
    border-color: rgba(247, 185, 85, 0.38);
    background: rgba(247, 185, 85, 0.1);
    color: var(--warn);
}

.customer-status-stale .customer-status-dot {
    background: var(--warn);
    box-shadow: 0 0 14px rgba(247, 185, 85, 0.62);
}

.customer-status-offline,
.customer-status-disabled,
.customer-status-archived {
    border-color: rgba(255, 107, 122, 0.34);
    background: rgba(255, 107, 122, 0.1);
    color: var(--offline);
}


.customer-portal-shell .customer-tile-body {
    align-self: end;
}

.customer-tile-body h3 {
    margin: 0;
    font-size: 25px;
    line-height: 1.2;
}

.customer-card-footer {
    display: flex;
    justify-content: flex-end;
    align-items: end;
}

.customer-portal-shell .customer-entry-button {
    min-width: 124px;
    border-color: rgba(56, 213, 255, 0.52);
    background: rgba(56, 213, 255, 0.16);
}

.customer-loading-state {
    position: relative;
    z-index: 1;
    display: grid;
    min-height: 160px;
    place-items: center;
    border: 1px dashed rgba(76, 212, 255, 0.28);
    border-radius: 8px;
    color: var(--muted);
}

.project-card {
    position: relative;
    overflow: hidden;
    padding: 16px;
}

.project-entry-card {
    display: grid;
    gap: 14px;
    min-height: 260px;
    border-color: rgba(76, 212, 255, 0.28);
    background:
        linear-gradient(135deg, rgba(56, 213, 255, 0.1), transparent 42%),
        var(--panel);
}

.project-entry-card:hover {
    border-color: rgba(56, 213, 255, 0.58);
    box-shadow: 0 16px 44px rgba(2, 12, 22, 0.34), 0 0 24px rgba(56, 213, 255, 0.14);
}

.project-signal-strip {
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--offline);
}

.status-card-online .project-signal-strip {
    background: var(--online);
    box-shadow: 0 0 18px rgba(44, 230, 166, 0.55);
}

.status-card-stale .project-signal-strip {
    background: var(--warn);
    box-shadow: 0 0 18px rgba(247, 185, 85, 0.5);
}

.card-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.project-code {
    color: var(--accent);
    font-size: 13px;
}

.project-title-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 14px;
}

.project-title-row h2 {
    font-size: 22px;
}

.project-title-row p,
.project-actions span,
.project-entry-url span {
    color: var(--muted);
}

.project-title-row p {
    margin: 6px 0 0;
}

.project-title-row strong {
    color: var(--accent);
    font-size: 16px;
}

.status-badge {
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 12px;
}

.status-online {
    background: rgba(44, 230, 166, 0.13);
    color: var(--online);
}

.status-stale {
    background: rgba(247, 185, 85, 0.13);
    color: var(--warn);
}

.status-offline,
.status-disabled,
.status-archived {
    background: rgba(255, 107, 122, 0.13);
    color: var(--offline);
}

.project-entry-url {
    display: grid;
    gap: 6px;
    border: 1px solid rgba(76, 212, 255, 0.16);
    border-radius: 8px;
    background: rgba(4, 13, 23, 0.55);
    padding: 10px 12px;
}

.project-entry-url code {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--text);
    font-family: "Consolas", "Segoe UI", monospace;
}

dl {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 14px 0;
}

.project-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
}

dl div {
    display: grid;
    gap: 5px;
}

dt {
    color: var(--muted);
}

dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: left;
}

.entry-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
}

.entry-link-disabled,
.entry-link-disabled:hover,
.customer-entry-disabled,
.customer-entry-disabled:hover {
    cursor: not-allowed;
    opacity: 0.58;
    box-shadow: none;
}

.project-actions {
    display: grid;
    grid-template-columns: minmax(128px, max-content) 1fr;
    align-items: center;
    gap: 12px;
}

.admin-console {
    margin-top: 18px;
}

.admin-console-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-top: 1px solid rgba(76, 212, 255, 0.22);
    border-bottom: 1px solid rgba(76, 212, 255, 0.12);
    padding: 14px 0;
}

.admin-console-header h2 {
    font-size: 22px;
}

.admin-console-header span,
.section-kicker {
    color: var(--muted);
}

.section-kicker {
    margin: 0 0 5px;
    color: var(--accent);
    font-size: 12px;
    letter-spacing: 0;
}

.admin-toggle {
    min-width: 116px;
}

.admin-console.is-open .admin-toggle {
    background: rgba(56, 213, 255, 0.18);
}

.admin-content {
    display: grid;
    gap: 14px;
}

.admin-content[hidden] {
    display: none;
}

.management-panel,
.audit-panel {
    margin-top: 14px;
    padding: 16px;
}

.management-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.management-form button {
    min-height: 40px;
}

.form-mode-hint {
    margin-top: 10px;
    color: var(--muted);
    font-size: 13px;
}

.management-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.user-role-grid,
.user-project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.user-access-label {
    color: var(--muted);
    font-size: 13px;
    margin-top: 14px;
}

.role-option {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 8px;
    align-items: center;
    border: 1px solid rgba(76, 212, 255, 0.16);
    border-radius: 8px;
    background: rgba(4, 13, 23, 0.4);
    padding: 10px;
}

.role-option small {
    grid-column: 2;
    color: var(--muted);
}

.management-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 10px;
}

.management-row strong,
.management-row span {
    display: block;
}

.management-row span {
    color: var(--muted);
    margin-top: 4px;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.secret-panel {
    display: grid;
    gap: 8px;
    margin-top: 12px;
    border: 1px solid rgba(247, 185, 85, 0.4);
    border-radius: 8px;
    background: rgba(247, 185, 85, 0.1);
    color: var(--text);
    padding: 12px;
}

.secret-panel[hidden] {
    display: none;
}

.secret-panel code {
    overflow-wrap: anywhere;
    color: var(--warn);
}

.audit-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.audit-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 8px;
    color: var(--muted);
}

.audit-item span {
    color: var(--text);
}

.empty-state {
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 18px;
    color: var(--muted);
}

@media (max-width: 980px) {
    .customer-portal-shell .customer-project-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .portal-shell {
        width: min(100vw - 20px, 1180px);
        padding: 18px 0;
    }

    .portal-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .header-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .customer-project-center {
        padding: 20px;
    }

    .customer-portal-shell .customer-project-center {
        padding: 0;
    }


    .customer-project-heading h2 {
        font-size: 26px;
    }

    .customer-portal-shell .customer-project-heading h2 {
        font-size: 34px;
    }


    .summary-grid,
    .management-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    dl {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .audit-item,
    .management-row {
        grid-template-columns: 1fr;
    }

    .project-title-row,
    .project-actions,
    .admin-console-header {
        grid-template-columns: 1fr;
    }

    .admin-console-header {
        display: grid;
        align-items: stretch;
    }

    .admin-toggle {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .customer-project-grid,
    .customer-portal-shell .customer-project-grid {
        grid-template-columns: 1fr;
    }

    .customer-project-tile {
        min-height: 190px;
    }

    dl,
    .project-meta-grid,
    .summary-grid,
    .management-form {
        grid-template-columns: 1fr;
    }
}
