:root {
    --bg: #f3f5f7;
    --card: #ffffff;
    --text: #17212b;
    --muted: #5d6975;
    --line: #dce3ea;
    --primary: #0d7a5f;
    --primary-dark: #0a5a47;
    --error-bg: #fde8e8;
    --error-text: #7f1d1d;
    --success-bg: #eafaf1;
    --success-text: #14532d;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(180deg, #edf2f6 0%, #f7f9fb 100%);
    color: var(--text);
}

.topbar {
    background: #0f1720;
    color: #fff;
    border-bottom: 3px solid var(--primary);
}

.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
}

.brand-wrap {
    display: grid;
    gap: 0.25rem;
}

.brand {
    font-weight: 700;
}

.tenant-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: #dbe5f0;
}

.nav {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.nav a {
    color: #dbe5f0;
    text-decoration: none;
    padding: 0.35rem 0.55rem;
    border-radius: 0.4rem;
}

.nav a:hover {
    background: #1f2a36;
}

.container {
    max-width: 1200px;
    margin: 1.25rem auto;
    padding: 0 1rem 2rem;
    display: grid;
    gap: 1rem;
}

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    padding: 1rem;
    box-shadow: 0 6px 14px rgba(15, 23, 32, 0.04);
}

.panel.narrow {
    max-width: 460px;
    margin: 2rem auto;
}

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

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

.stat-card {
    background: #f8fbfd;
    border: 1px solid #e0ebf2;
    border-radius: 0.65rem;
    padding: 0.8rem;
}

.stat-card h2 {
    margin: 0;
    color: var(--primary-dark);
}

.stat-card p {
    margin: 0.3rem 0 0;
    color: var(--muted);
}

.form-grid,
.form-inline {
    display: grid;
    gap: 0.75rem;
}

.form-inline {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    align-items: end;
}

label {
    display: grid;
    gap: 0.35rem;
    font-weight: 600;
    color: #24313d;
}

input,
textarea,
select,
button {
    font: inherit;
    padding: 0.55rem 0.65rem;
    border-radius: 0.45rem;
    border: 1px solid #cbd5df;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 122, 95, 0.18);
}

textarea {
    resize: vertical;
}

button,
.button-link,
.link-button {
    background: var(--primary);
    color: #fff;
    border: 1px solid var(--primary);
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

button:hover,
.button-link:hover,
.link-button:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

button:disabled {
    background: #8da3b4;
    border-color: #8da3b4;
    cursor: not-allowed;
}

.link-button {
    padding: 0.45rem 0.75rem;
}

.secondary {
    background: #415a70;
    border-color: #415a70;
}

.danger {
    background: #b42318;
    border-color: #b42318;
}

.danger:hover {
    background: #8f1c14;
    border-color: #8f1c14;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.93rem;
}

th,
td {
    text-align: left;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid #e3e9ef;
    vertical-align: top;
}

th {
    color: #354657;
    font-weight: 700;
}

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

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.compact-form {
    display: grid;
    gap: 0.4rem;
    margin-bottom: 0.45rem;
}

.mono {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.8rem;
    word-break: break-all;
}

.alert {
    border-radius: 0.6rem;
    padding: 0.75rem 0.85rem;
    margin-bottom: 0.8rem;
    border: 1px solid transparent;
}

.alert.error {
    background: var(--error-bg);
    color: var(--error-text);
    border-color: #fecaca;
}

.alert.success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: #bbf7d0;
}

.result-card {
    margin-top: 1rem;
    border: 1px solid #dae5ef;
    border-radius: 0.6rem;
    padding: 0.85rem;
    background: #f7fafc;
}

.result-card pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.82rem;
}

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

    .nav {
        width: 100%;
    }
}
