:root {
    --bg: #edf1eb;
    --panel: #ffffff;
    --panel-alt: #f7f5ef;
    --line: #d8ddd4;
    --text: #1e2b24;
    --muted: #65746a;
    --brand: #1f7a5a;
    --brand-strong: #155f45;
    --danger: #c94f4f;
    --shadow: 0 18px 40px rgba(30, 43, 36, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(31, 122, 90, 0.16), transparent 30%),
        linear-gradient(180deg, #f6f8f2 0%, var(--bg) 100%);
    font-family: "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-panel {
    width: min(920px, 100%);
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    background: var(--panel);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.login-brand {
    padding: 56px 48px;
    background:
        linear-gradient(135deg, rgba(31, 122, 90, 0.95), rgba(19, 66, 49, 0.92)),
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent);
    color: #fff;
}

.eyebrow {
    margin: 0 0 12px;
    font-size: 12px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    opacity: 0.85;
}

.login-brand h1,
.brand-block h1 {
    margin: 0 0 12px;
    font-size: 36px;
    font-weight: 700;
}

.subtitle,
.brand-block p,
.login-brand p {
    margin: 0;
    color: rgba(255, 255, 255, 0.84);
    line-height: 1.7;
}

.login-form {
    padding: 48px;
    align-self: center;
}

.login-hint {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--muted);
    font-size: 14px;
}

.btn-brand {
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-strong));
    border-color: var(--brand);
}

.btn-brand:hover,
.btn-brand:focus {
    color: #fff;
    background: linear-gradient(135deg, var(--brand-strong), #124f3a);
    border-color: var(--brand-strong);
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.sidebar-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 28px 22px;
    background: linear-gradient(180deg, #113627 0%, #1a4a37 100%);
    color: #fff;
}

.brand-block {
    padding: 10px 8px 26px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-nav {
    margin-top: 24px;
    display: grid;
    gap: 10px;
}

.sidebar-nav .nav-link {
    width: 100%;
    border: 0;
    border-radius: 16px;
    padding: 14px 16px;
    text-align: left;
    background: rgba(255, 255, 255, 0.08);
    color: #f4fbf8;
    transition: background 0.2s ease, transform 0.2s ease;
}

.sidebar-nav .nav-link.active,
.sidebar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateX(2px);
}

.api-tip {
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 14px;
}

.api-tip code {
    display: block;
    margin-top: 8px;
    color: #dcf7ea;
}

.main-panel {
    padding: 28px;
}

.topbar {
    margin-bottom: 22px;
    padding: 22px 24px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(216, 221, 212, 0.9);
    border-radius: 24px;
    box-shadow: 0 10px 24px rgba(30, 43, 36, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
}

.topbar-label {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 13px;
}

.topbar h2 {
    margin: 0;
    font-size: 28px;
}

.content-view {
    display: none;
}

.content-view.active {
    display: block;
}

.content-card {
    padding: 24px;
    border-radius: 24px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

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

.section-heading h3 {
    margin: 0 0 6px;
    font-size: 28px;
}

.section-heading p {
    margin: 0;
    color: var(--muted);
}

.filter-bar,
.task-filter-grid {
    margin-bottom: 18px;
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-select {
    width: 140px;
}

.task-filter-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
}

.filter-actions {
    display: flex;
    gap: 10px;
}

.app-table thead th {
    white-space: nowrap;
    background: var(--panel-alt);
    color: #304338;
    border-bottom: 1px solid var(--line);
}

.app-table td {
    vertical-align: middle;
}

.task-row {
    height: 76px;
}

.task-row > td {
    height: 76px;
}

.task-row.task-row-expanded,
.task-row.task-row-expanded > td {
    height: auto;
    vertical-align: top;
}

.task-detail-cell {
    width: 360px;
    max-width: 360px;
}

.task-detail-wrap {
    display: grid;
    gap: 4px;
    align-items: start;
}

.task-detail-text {
    max-height: 42px;
    overflow: hidden;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.5;
}

.task-detail-text.expanded {
    max-height: none;
}

.task-detail-toggle {
    width: fit-content;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--brand);
    font-size: 13px;
    line-height: 1.4;
}

.task-detail-toggle:hover,
.task-detail-toggle:focus {
    color: var(--brand-strong);
    text-decoration: underline;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
}

.status-enabled {
    color: #176f50;
    background: rgba(31, 122, 90, 0.14);
}

.status-disabled {
    color: #8b4f20;
    background: rgba(201, 137, 54, 0.16);
}

.pagination-wrap {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.pagination-meta {
    color: var(--muted);
    font-size: 14px;
}

.alert-stack {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
}

.modal-content {
    border: 0;
    border-radius: 24px;
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, rgba(31, 122, 90, 0.95), rgba(19, 66, 49, 0.92));
    color: #fff;
    border-bottom: 0;
}

.modal-header .btn-close {
    filter: invert(1);
}

.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

@media (max-width: 1200px) {
    .task-filter-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .login-panel {
        grid-template-columns: 1fr;
    }

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

    .sidebar-panel {
        gap: 24px;
    }
}

@media (max-width: 768px) {
    .main-panel {
        padding: 16px;
    }

    .topbar,
    .content-card {
        padding: 18px;
    }

    .section-heading,
    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .task-filter-grid {
        grid-template-columns: 1fr;
    }
}

.portal-shell {
    min-height: 100vh;
    padding: 42px;
}

.portal-header {
    margin: 0 auto 24px;
    max-width: 1120px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.portal-header h1 {
    margin: 0 0 8px;
    font-size: 34px;
}

.portal-header p {
    margin: 0;
    color: var(--muted);
}

.portal-grid {
    max-width: 1120px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.portal-card {
    min-height: 260px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: var(--text);
    text-decoration: none;
    background: var(--panel);
    border: 1px solid rgba(216, 221, 212, 0.95);
    border-radius: 24px;
    box-shadow: var(--shadow);
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.portal-card:hover,
.portal-card:focus {
    color: var(--text);
    border-color: var(--brand);
    transform: translateY(-2px);
}

.portal-card h2 {
    margin: 12px 0 10px;
    font-size: 28px;
}

.portal-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

.portal-card span {
    color: var(--brand-strong);
    font-weight: 700;
}

.portal-card-kicker {
    color: var(--brand-strong);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.portal-card-accent {
    background: linear-gradient(135deg, #ffffff 0%, #f3faf5 100%);
}

.rhd-shell .sidebar-nav .nav-link {
    display: block;
    text-decoration: none;
}

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

.metric-card {
    min-height: 98px;
    padding: 18px;
    border-radius: 20px;
    background: var(--panel);
    border: 1px solid rgba(216, 221, 212, 0.95);
    box-shadow: 0 10px 24px rgba(30, 43, 36, 0.06);
}

.metric-card span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 13px;
}

.metric-card strong {
    font-size: 28px;
}

.metric-card code {
    color: var(--brand-strong);
    word-break: break-all;
}

.rhd-grid {
    display: grid;
    grid-template-columns: minmax(360px, 0.88fr) minmax(0, 1.12fr);
    gap: 18px;
    align-items: start;
    margin-bottom: 18px;
}

.rhd-grid .content-card {
    margin-bottom: 18px;
}

.rhd-form {
    display: grid;
    gap: 16px;
}

.rhd-form h4 {
    margin: 4px 0 0;
    font-size: 18px;
}

.rhd-json {
    min-height: 150px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
}

.rhd-logbox {
    max-height: 360px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
}

.rhd-logitem {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}

.rhd-logitem:last-child {
    border-bottom: 0;
}

.rhd-logitem code {
    display: block;
    white-space: normal;
    word-break: break-all;
}

@media (max-width: 1100px) {
    .portal-grid,
    .rhd-grid,
    .rhd-metrics {
        grid-template-columns: 1fr;
    }

    .portal-shell {
        padding: 24px;
    }
}
