.admin-body {
    min-height: 100vh;
    background: #eef2f5;
}

.admin-header {
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
}

.admin-layout {
    width: min(1260px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 18px;
    padding: 18px;
}

.admin-nav {
    align-self: start;
    display: grid;
    gap: 4px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.admin-nav a {
    height: 40px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    border-radius: 6px;
    color: #4c5968;
}

.admin-nav a.active {
    background: #eaf3ff;
    color: var(--brand-blue);
    font-weight: 700;
}

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

.admin-page-heading {
    min-height: 64px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.admin-page-heading h1 {
    margin: 0 0 6px;
    font-size: 24px;
}

.admin-page-heading p,
.section-note {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}

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

.stat-item,
.admin-section {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.stat-item {
    min-height: 112px;
    padding: 18px;
}

.stat-item strong {
    display: block;
    margin-bottom: 9px;
    color: #1e232b;
    font-size: 28px;
}

.stat-item span {
    color: var(--muted);
    font-size: 13px;
}

.admin-section {
    padding: 16px;
    margin-bottom: 14px;
}

.admin-section h2 {
    margin: 0 0 14px;
    font-size: 17px;
}

.compact-section {
    max-width: 760px;
}

.admin-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table th,
.admin-table td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

.admin-table th {
    color: #4c5968;
    background: #f7f9fb;
    font-weight: 700;
}

.admin-table tr:last-child td {
    border-bottom: 0;
}

.admin-table td code {
    display: inline-block;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.status-dot {
    width: 7px;
    height: 7px;
    display: inline-block;
    margin-right: 6px;
    border-radius: 50%;
}

.status-dot.on {
    background: var(--success);
}

.status-dot.off {
    background: #a3acb8;
}

.inline-form,
.filter-bar,
.row-actions,
.report-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.inline-form input,
.filter-bar select {
    height: 40px;
    min-width: 220px;
    padding: 0 10px;
    border: 1px solid #cfd7e2;
    border-radius: 6px;
    background: #fff;
}

.project-editor-list {
    display: grid;
    gap: 12px;
}

.project-editor {
    padding: 0;
    margin: 0;
}

.project-editor > summary {
    position: relative;
    min-height: 60px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    list-style: none;
}

.project-editor > summary::-webkit-details-marker {
    display: none;
}

.project-editor > summary::after {
    content: "+";
    margin-left: auto;
    color: var(--muted);
    font-size: 22px;
}

.project-editor[open] > summary::after {
    content: "−";
}

.project-editor > summary span:last-of-type {
    color: var(--muted);
    font-size: 12px;
}

.project-editor > summary .project-status {
    padding: 3px 7px;
    border-radius: 999px;
    font-weight: 700;
}

.project-editor > summary .project-status.on {
    background: #e8f8f1;
    color: #087f5b;
}

.project-editor > summary .project-status.off {
    background: #eef1f4;
    color: #7b8794;
}

.project-color {
    width: 12px;
    height: 32px;
    border-radius: 3px;
}

.new-project > summary {
    color: var(--brand-blue);
}

.admin-form {
    border-top: 1px solid var(--line);
    padding: 18px 16px;
}

.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px;
    margin-bottom: 16px;
}

.admin-form label > span,
.admin-login-panel label > span {
    display: block;
    margin-bottom: 6px;
    color: #4c5968;
    font-size: 12px;
    font-weight: 700;
}

.admin-form input,
.admin-form select {
    height: 40px;
    padding: 0 10px;
}

.admin-form textarea {
    padding: 10px;
    resize: vertical;
}

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

.project-form-actions,
.project-secondary-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.project-secondary-actions {
    padding: 0 16px 18px;
}

.project-secondary-actions form {
    margin: 0;
}

.button.danger-outline {
    border-color: #ffc9c9;
    background: #fff;
    color: var(--danger);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
}

.toggle-label input {
    width: 18px;
    height: 18px;
}

.toggle-label > span {
    margin: 0 !important;
}

.color-input {
    height: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-input input {
    width: 52px;
    padding: 3px;
}

.filter-bar {
    margin-bottom: 12px;
}

.entry-admin-table .row-actions {
    min-width: 130px;
}

.table-empty {
    padding: 32px !important;
    color: var(--muted);
    text-align: center !important;
}

.report-table td:nth-child(2) {
    min-width: 220px;
    max-width: 420px;
    white-space: normal;
    line-height: 1.6;
}

.report-table td:first-child {
    display: grid;
    gap: 5px;
}

.report-actions label {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--muted);
    font-size: 12px;
}

.cleanup-form {
    padding: 0;
    border: 0;
}

.cleanup-form > label {
    max-width: 360px;
    margin-bottom: 12px;
}

.code-block {
    margin: 12px 0;
    padding: 12px;
    overflow-x: auto;
    border-radius: 6px;
    background: #1e232b;
    color: #e9eef3;
    font-family: Consolas, monospace;
    font-size: 12px;
    white-space: nowrap;
}

.form-alert.success {
    border: 1px solid #b7ebd6;
    background: #f0fbf7;
    color: #087f5b;
}

.admin-login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 16px;
}

.admin-login-shell {
    width: min(420px, 100%);
}

.admin-login-brand {
    justify-content: center;
    margin-bottom: 16px;
}

.admin-login-panel {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.admin-login-panel h1 {
    margin: 0 0 8px;
    font-size: 22px;
}

.admin-login-panel > p {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 13px;
}

.admin-login-panel label {
    display: block;
    margin-bottom: 13px;
}

.admin-login-panel input {
    width: 100%;
    height: 42px;
    padding: 0 10px;
    border: 1px solid #cfd7e2;
    border-radius: 6px;
}

.admin-login-panel .button {
    width: 100%;
    margin-top: 4px;
}

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

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

    .admin-form-grid .full {
        grid-column: auto;
    }
}

@media (max-width: 680px) {
    .admin-header {
        padding: 0 12px;
    }

    .admin-user span {
        display: none;
    }

    .admin-layout {
        display: block;
        padding: 10px 8px;
    }

    .admin-nav {
        display: flex;
        overflow-x: auto;
        margin-bottom: 12px;
    }

    .admin-nav a {
        flex: 0 0 auto;
    }

    .admin-page-heading {
        min-height: auto;
    }

    .admin-page-heading .button {
        flex: 0 0 auto;
    }

    .admin-page-heading h1 {
        font-size: 21px;
    }

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

    .stat-item {
        min-height: 96px;
        padding: 14px;
    }

    .stat-item strong {
        font-size: 24px;
    }

    .inline-form {
        align-items: stretch;
        flex-direction: column;
    }

    .inline-form input {
        min-width: 0;
        width: 100%;
    }

    .project-editor > summary {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .project-editor > summary::after {
        position: absolute;
        right: 14px;
    }

    .project-editor > summary strong {
        max-width: calc(100% - 72px);
    }

    .project-secondary-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .project-secondary-actions form,
    .project-secondary-actions .button {
        width: 100%;
    }
}
