:root {
    --bg: #07120c;
    --panel: #0b1b12;
    --panel-2: #102318;
    --text: #d7fbe2;
    --muted: #8fb39b;
    --line: #1d3a28;
    --accent: #39ff88;
    --accent-2: #19c563;
    --danger: #ff6b6b;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --radius: 14px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: radial-gradient(circle at top, #0b1a12 0%, #07120c 45%, #050c08 100%);
    color: var(--text);
    font-family: var(--font);
    min-height: 100%;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button,
input {
    font: inherit;
}

button {
    background: linear-gradient(180deg, var(--accent), var(--accent-2));
    color: #041109;
    border: 0;
    border-radius: 10px;
    padding: 0.7rem 1rem;
    font-weight: 700;
    cursor: pointer;
}

button:hover {
    filter: brightness(1.05);
}

input {
    width: 100%;
    background: #08140d;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.75rem 0.85rem;
    outline: none;
}

input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(57, 255, 136, 0.14);
}

label {
    font-size: 0.95rem;
    color: var(--muted);
    margin-bottom: 0.3rem;
    display: inline-block;
}

.topbar {
    width: 100%;
    padding: 1rem 1.4rem;
    border-bottom: 1px solid var(--line);
    background: rgba(6, 14, 9, 0.88);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar__brand a {
    color: var(--accent);
    font-weight: 800;
    letter-spacing: 0.03em;
}

.topbar__meta {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.topbar__user {
    color: var(--muted);
    font-size: 0.95rem;
}

.inline-form {
    margin: 0;
}

.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.2rem;
}

.page-header {
    margin-bottom: 1rem;
}

.page-header h1 {
    margin: 0 0 0.3rem 0;
    font-size: 1.9rem;
    line-height: 1.15;
}

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

.card,
.login-card {
    background: linear-gradient(180deg, rgba(12, 28, 19, 0.96), rgba(8, 18, 13, 0.96));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card {
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
}

.card h2 {
    margin-top: 0;
}

.kv-list {
    display: grid;
    gap: 0.55rem;
}

.login-shell {
    min-height: calc(100vh - 90px);
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
}

.login-card {
    width: 100%;
    max-width: 430px;
    padding: 1.4rem;
}

.login-card h1 {
    margin-top: 0;
    margin-bottom: 0.35rem;
}

.form-stack {
    display: grid;
    gap: 0.8rem;
    margin-top: 1rem;
}

.alert {
    border-radius: 10px;
    padding: 0.8rem 0.9rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.alert-error {
    background: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.25);
    color: #ffd7d7;
}

@media (max-width: 700px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .page {
        padding: 1rem 0.8rem;
    }

    .page-header h1 {
        font-size: 1.6rem;
    }
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    align-items: end;
}

.filters-actions {
    display: flex;
    gap: 0.7rem;
    align-items: center;
    flex-wrap: wrap;
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #0a1610;
    color: var(--text);
    text-decoration: none;
}

.button-link:hover {
    border-color: var(--accent);
    text-decoration: none;
}

.table-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.9rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
    background: rgba(7, 18, 12, 0.55);
}

.data-table th,
.data-table td {
    padding: 0.8rem 0.9rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.data-table thead th {
    background: rgba(16, 35, 24, 0.95);
    color: var(--accent);
    font-size: 0.92rem;
    letter-spacing: 0.02em;
}

.data-table tbody tr:hover {
    background: rgba(57, 255, 136, 0.05);
}

.mono {
    font-family: Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.92rem;
}

.empty-state {
    padding: 1rem;
    border: 1px dashed var(--line);
    border-radius: 12px;
    color: var(--muted);
    background: rgba(8, 18, 13, 0.45);
}

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.pager-center {
    text-align: center;
}

button[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.break-all {
    word-break: break-all;
    overflow-wrap: anywhere;
}

.timeline-list {
    display: grid;
    gap: 0.9rem;
}

.timeline-item {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.9rem 1rem;
    background: rgba(8, 18, 13, 0.55);
}

.timeline-item strong {
    color: var(--accent);
}

.card .button-link {
    min-height: auto;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 28px;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.badge-success {
    background: rgba(57, 255, 136, 0.12);
    border-color: rgba(57, 255, 136, 0.28);
    color: #8dffc0;
}

.badge-danger {
    background: rgba(255, 107, 107, 0.12);
    border-color: rgba(255, 107, 107, 0.28);
    color: #ffb3b3;
}

.badge-warning {
    background: rgba(255, 214, 102, 0.12);
    border-color: rgba(255, 214, 102, 0.28);
    color: #ffe7a0;
}

.badge-info {
    background: rgba(102, 204, 255, 0.12);
    border-color: rgba(102, 204, 255, 0.28);
    color: #a9e3ff;
}

.badge-neutral {
    background: rgba(180, 200, 190, 0.10);
    border-color: rgba(180, 200, 190, 0.22);
    color: #d9e8de;
}

.json-details {
    margin-top: 0.75rem;
}

.json-details summary {
    cursor: pointer;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 0.6rem;
}

.json-block {
    margin: 0.75rem 0 0 0;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(5, 12, 8, 0.88);
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    font-family: Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.88rem;
}

.field-actions {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
}

.copy-btn {
    min-height: 32px;
    padding: 0.35rem 0.7rem;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: #0a1610;
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 700;
}

.copy-btn:hover {
    border-color: var(--accent);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.summary-card {
    background: linear-gradient(180deg, rgba(12, 28, 19, 0.96), rgba(8, 18, 13, 0.96));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.1rem;
}

.summary-label {
    color: var(--muted);
    font-size: 0.92rem;
    margin-bottom: 0.45rem;
}

.summary-value {
    color: var(--accent);
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.1;
}

.sort-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
}

.sort-link:hover {
    text-decoration: underline;
}

.sort-link-active {
    color: #ffffff;
}

.badge-telemetry {
    background: rgba(115, 78, 168, 0.22);
    color: #e1d2ff;
    border: 1px solid rgba(152, 109, 214, 0.55);
}

.app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 1rem;
    padding: 1rem 1rem 1.5rem;
}

.app-sidebar {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1rem;
    align-self: start;
    position: sticky;
    top: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
}

.app-sidebar__title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.85rem;
    color: var(--fg);
    letter-spacing: 0.02em;
}

.app-nav {
    display: grid;
    gap: 0.8rem;
}

.app-nav__group {
    display: grid;
    gap: 0.4rem;
}

.app-nav__item,
.app-nav__child {
    display: block;
    text-decoration: none;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel-2);
    color: var(--fg);
}

.app-nav__item {
    padding: 0.8rem 0.9rem;
    font-weight: 700;
}

.app-nav__child {
    padding: 0.65rem 0.8rem;
    margin-left: 0.55rem;
    font-size: 0.95rem;
}

.app-nav__item:hover,
.app-nav__child:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.app-nav__item.is-active,
.app-nav__child.is-active {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px rgba(49, 196, 141, 0.28);
}

.app-nav__item.is-disabled,
.app-nav__child.is-disabled {
    opacity: 0.7;
    cursor: default;
}

.app-nav__soon {
    display: inline-block;
    margin-left: 0.5rem;
    font-size: 0.74rem;
    color: var(--muted);
}

.app-nav__children {
    display: grid;
    gap: 0.35rem;
}

.app-content {
    min-width: 0;
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        position: static;
    }
}

.app-sidebar { max-height: calc(100vh - 92px); overflow-y: auto; }


.preview-box {
    margin: 0.35rem 0 0;
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(8, 18, 12, 0.88);
    color: var(--fg);
}

.preview-box--mono {
    font-family: Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}


/* amber textarea test */
textarea {
    width: 100%;
    border: 1px solid #7a5b1e;
    border-radius: 10px;
    background: #1a1408;
    color: #f6d79a;
    padding: 0.75rem 0.9rem;
    font: inherit;
    resize: vertical;
    caret-color: #ffd27a;
}

textarea:focus {
    outline: 2px solid rgba(255, 191, 73, 0.22);
    border-color: #d39b2b;
}

textarea::placeholder {
    color: #c7a66a;
}



/* history action buttons */
.history-actions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    align-items: stretch;
    min-width: 8.5rem;
}

.history-actions > * {
    width: 100%;
}

.history-action-form {
    width: 100%;
    margin: 0;
}

.history-action-button,





/* history buttons equal width */
.history-actions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    align-items: stretch;
    min-width: 10rem;
}

.history-action-form,
.history-actions > * {
    width: 100%;
    margin: 0;
}

.history-action-button,
.history-action-form .history-action-button,
.history-actions .history-action-button {
    display: block;
    width: 100%;
    min-width: 100%;
    box-sizing: border-box;
    text-align: center;
}


/* amber editable panels */
.card-amber-panel {
    border: 1px solid #7a5b1e;
    background: linear-gradient(180deg, rgba(38, 28, 11, 0.96), rgba(24, 18, 8, 0.98));
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
}

.card-amber-panel h2,
.card-amber-panel strong {
    color: #f6d79a;
}

.card-amber-panel .muted,
.card-amber-panel label {
    color: #d8b984;
}

.card-amber-panel .mono {
    color: #ffe2a8;
}

.card-amber-panel input[type="number"] {
    width: 100%;
    border: 1px solid #7a5b1e;
    border-radius: 10px;
    background: #1a1408;
    color: #f6d79a;
    padding: 0.75rem 0.9rem;
    font: inherit;
    box-sizing: border-box;
    caret-color: #ffd27a;
}

.card-amber-panel input[type="number"]:focus {
    outline: 2px solid rgba(255, 191, 73, 0.22);
    border-color: #d39b2b;
}

.card-amber-subpanel {
    border: 1px solid rgba(211, 155, 43, 0.42);
    background: rgba(36, 27, 11, 0.88);
}

.card-amber-subpanel .muted {
    color: #d8b984;
}



/* amber input field */
.input-amber {
    width: 100%;
    border: 1px solid #7a5b1e;
    border-radius: 10px;
    background: #1a1408;
    color: #f6d79a;
    padding: 0.75rem 0.9rem;
    font: inherit;
    box-sizing: border-box;
    caret-color: #ffd27a;
}

.input-amber:focus {
    outline: 2px solid rgba(255, 191, 73, 0.22);
    border-color: #d39b2b;
}

.input-amber::placeholder {
    color: #c7a66a;
}

