:root {
    --bg: #f4f6f5;
    --panel: #ffffff;
    --text: #1f2a2a;
    --muted: #667372;
    --line: #dce3e1;
    --accent: #176b5b;
    --accent-dark: #0f4c41;
    --warn: #9b5d11;
    --error: #b3261e;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 15px;
}

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

a:hover {
    text-decoration: underline;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 82px;
    padding: 14px 32px;
    border-bottom: 1px solid var(--line);
    background: #ffffff;
}

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

.brand-logo {
    width: 58px;
    height: 58px;
    flex: 0 0 auto;
    object-fit: contain;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-title {
    font-size: 20px;
    font-weight: 700;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 13px;
}

.main-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px 16px;
}

.user-box {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    padding: 0 10px;
    border-left: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.user-box a {
    font-weight: 700;
}

.main-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text);
    font-weight: 600;
}

.main-nav a:hover {
    border-color: var(--line);
    background: #f7faf9;
    text-decoration: none;
}

.page {
    width: min(1280px, calc(100% - 40px));
    margin: 24px auto 48px;
}

.page-title {
    margin: 0 0 18px;
    font-size: 28px;
    line-height: 1.2;
}

.section-title {
    margin: 28px 0 12px;
    font-size: 19px;
}

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

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

.metric {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.metric-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.metric-value {
    display: block;
    margin-top: 10px;
    font-size: 28px;
    font-weight: 700;
}

.quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.button,
input[type="submit"],
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    background: var(--accent);
    color: #ffffff;
    cursor: pointer;
    font-weight: 700;
}

.button.secondary,
input.secondary {
    border-color: var(--line);
    background: #ffffff;
    color: var(--text);
}

.button:hover,
input[type="submit"]:hover,
button:hover {
    background: var(--accent-dark);
    text-decoration: none;
}

.text-command {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    color: var(--accent-dark);
    font-weight: 700;
}

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

.filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 16px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

input[type="text"],
select {
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    color: var(--text);
}

.data-grid {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--line);
    background: var(--panel);
}

.data-grid th,
.data-grid td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.data-grid th {
    background: #edf3f1;
    color: #1b3f39;
    font-size: 13px;
    text-transform: uppercase;
}

.data-grid tr:nth-child(even) td {
    background: #fafcfc;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.detail-item {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.detail-label {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.detail-value {
    display: block;
    margin-top: 6px;
    overflow-wrap: anywhere;
    font-weight: 600;
}

.message {
    margin: 12px 0;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.message.ok {
    border-color: #8fc7b7;
    background: #edf8f5;
}

.message.error {
    border-color: #e2aaa6;
    background: #fff3f2;
    color: var(--error);
}

.login-body {
    min-height: 100vh;
    background: #eef3f2;
}

.login-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 28px;
}

.login-panel {
    width: min(420px, 100%);
    padding: 32px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 18px 48px rgba(24, 45, 43, 0.12);
}

.login-logo {
    display: block;
    width: 118px;
    height: 118px;
    margin: 0 auto 18px;
    object-fit: contain;
}

.login-panel h1 {
    margin: 0;
    text-align: center;
    font-size: 25px;
}

.login-panel p {
    margin: 8px 0 22px;
    color: var(--muted);
    text-align: center;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.login-field label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.login-field input {
    width: 100%;
}

.login-options {
    margin: 4px 0 16px;
    color: var(--muted);
    font-size: 14px;
}

.login-button {
    width: 100%;
}

.raw-json {
    max-width: 100%;
    margin: 12px 0 0;
    padding: 12px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #17201f;
    color: #e8f4f1;
    white-space: pre-wrap;
}

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

    .header-actions {
        justify-content: flex-start;
    }

    .main-nav {
        justify-content: flex-start;
    }

    .user-box {
        padding-left: 0;
        border-left: 0;
    }

    .dashboard-grid,
    .details-grid {
        grid-template-columns: 1fr;
    }
}
