:root {
    --bg: #f4efe8;
    --surface: #fffaf3;
    --surface-strong: #fff;
    --line: #d8c9b4;
    --text: #2f2419;
    --muted: #776553;
    --accent: #136f63;
    --accent-strong: #0d544b;
    --danger: #9d2b2b;
    --warning: #9a6700;
    --shadow: 0 18px 40px rgba(55, 35, 10, 0.08);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(19, 111, 99, 0.14), transparent 35%),
        radial-gradient(circle at bottom right, rgba(191, 140, 65, 0.2), transparent 30%),
        var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 28px;
    border-bottom: 1px solid rgba(47, 36, 25, 0.08);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    background: rgba(255, 250, 243, 0.86);
}

.brand {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.topnav {
    display: flex;
    gap: 12px;
    align-items: center;
}

.active-link {
    font-weight: 700;
    color: var(--accent-strong);
}

.logout-form {
    margin: 0;
}

.nav-button {
    appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 28px auto;
}

.panel {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(47, 36, 25, 0.08);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

.panel.narrow {
    max-width: 760px;
    margin-inline: auto;
}

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

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

.flash {
    margin-bottom: 18px;
    background: #eef9f7;
    border: 1px solid #bddfd9;
    border-radius: 14px;
    padding: 14px 16px;
}

.flash.warning {
    background: #fff8e8;
    border-color: #efd18f;
}

.table-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(19, 111, 99, 0.1);
    color: var(--accent-strong);
    font-size: 0.92rem;
}

.muted-pill {
    background: rgba(119, 101, 83, 0.12);
    color: var(--muted);
}

.bulk-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.search-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.search-bar select {
    width: auto;
    min-width: 110px;
}

.search-bar input[type="text"] {
    flex: 1 1 260px;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface-strong);
    border-radius: 16px;
    overflow: hidden;
}

th,
td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid rgba(47, 36, 25, 0.08);
    vertical-align: top;
}

.checkbox-col {
    width: 46px;
    text-align: center;
}

.data-cell {
    min-width: 140px;
    max-width: 320px;
    white-space: pre-wrap;
    word-break: break-word;
}

th {
    background: rgba(19, 111, 99, 0.08);
    font-weight: 700;
}

.button,
button {
    appearance: none;
    border: 0;
    border-radius: 12px;
    background: var(--accent);
    color: white;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.button:hover,
button:hover {
    background: var(--accent-strong);
}

.button.secondary {
    background: #efe3d4;
    color: var(--text);
}

.button.secondary:hover {
    background: #e2d3bf;
}

.button.danger,
button.danger {
    background: var(--danger);
}

.button.danger.subtle {
    background: #be6b31;
}

.button.danger.ghost {
    background: transparent;
    color: var(--danger);
    border: 1px solid rgba(157, 43, 43, 0.35);
}

.button.danger.ghost:hover {
    background: rgba(157, 43, 43, 0.08);
}

.button.disabled {
    opacity: 0.45;
    pointer-events: none;
}

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

.action-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 170px;
}

.stack {
    display: grid;
    gap: 16px;
}

.compact-stack {
    gap: 12px;
}

.field,
label {
    display: grid;
    gap: 8px;
}

input[type="text"],
input[type="password"],
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 1rem;
    background: #fff;
}

textarea {
    resize: vertical;
    min-height: 160px;
    font-family: Consolas, "Courier New", monospace;
}

.checkbox-field {
    display: block;
}

.hint-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.92rem;
    color: var(--muted);
}

.disabled-field input {
    background: #f0ece7;
}

.null-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(119, 101, 83, 0.12);
    color: var(--muted);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
}

.code-block {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    background: rgba(47, 36, 25, 0.04);
    border-radius: 14px;
    padding: 14px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.92rem;
}

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

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-button {
    appearance: none;
    border: 1px solid rgba(19, 111, 99, 0.18);
    background: rgba(19, 111, 99, 0.08);
    color: var(--accent-strong);
    border-radius: 999px;
    padding: 8px 12px;
    cursor: pointer;
}

.pubsub-log-panel {
    margin-top: 18px;
}

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

.schema-panel {
    margin-top: 22px;
}

.schema-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 18px;
}

.panel.inset {
    background: rgba(255, 255, 255, 0.62);
    box-shadow: none;
}

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

.column-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid rgba(47, 36, 25, 0.08);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.7);
}

.stream-card {
    align-items: flex-start;
}

.small-code {
    margin-top: 10px;
    font-size: 0.84rem;
    max-width: 520px;
}

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

.login-card {
    width: min(460px, 100%);
    padding: 28px;
    background: rgba(255, 255, 255, 0.84);
    border-radius: 24px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(47, 36, 25, 0.08);
}

@media (max-width: 720px) {
    .topbar,
    .panel-header,
    .pagination,
    .column-card {
        flex-direction: column;
        align-items: stretch;
    }

    .container {
        width: min(100% - 20px, 100%);
        margin: 20px auto;
    }

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