:root {
    --bg: #f5f6f8;
    --panel: #ffffff;
    --border: #d8dee8;
    --border-soft: #eef2f7;
    --text: #1f2937;
    --muted: #4b5563;
    --link: #0b4f9c;
    --danger: #a40000;
    --button-bg: #efefef;
    --button-border: #8f8f9d;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

button,
input {
    font: inherit;
}

button,
.button-link,
.nav-link {
    border: 1px solid var(--button-border);
    border-radius: 3px;
    background: var(--button-bg);
    color: #000;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.2;
    padding: 4px 8px;
    text-decoration: none;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.page-container {
    max-width: 1400px;
    margin: 16px auto 0;
    padding: 0 12px;
}

.app-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
}

.app-nav-links,
.button-group,
.history-toolbar,
.actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logout-form {
    margin: 0;
}

.toolbar {
    margin-top: 10px;
}

.grid-panel,
.history-table-wrapper,
.history-toolbar,
.empty-state,
.login-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.grid-panel {
    margin-top: 10px;
    padding: 12px;
}

.grid {
    width: 100%;
    height: 400px;
}

.message {
    margin-top: 12px;
}

.message-error {
    margin-top: 8px;
    color: var(--danger);
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 999;
}

.modal-panel {
    max-width: 680px;
    margin: 8vh auto;
    background: var(--panel);
    padding: 18px 20px;
    border-radius: 8px;
    line-height: 1.45;
    max-height: 84vh;
    overflow: auto;
}

.modal-title {
    margin-top: 0;
}

.model-list {
    font-size: 14px;
    background: #f7f7f7;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 6px;
    word-break: break-word;
}

.align-end {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}

.page-title {
    margin: 14px 2px 0;
    font-size: 22px;
}

.history-toolbar {
    margin-top: 10px;
    padding: 10px 12px;
}

.history-link {
    color: var(--link);
    font-weight: 600;
    text-decoration: none;
}

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

.history-table-wrapper {
    margin-top: 14px;
    overflow: auto;
}

.history-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 1360px;
    font-size: 14px;
}

.history-table thead tr {
    background: #f2f6fc;
}

.history-table th,
.history-table td {
    text-align: left;
    border-bottom: 1px solid var(--border-soft);
    padding: 10px;
}

.history-table th {
    border-bottom-color: var(--border);
}

.empty-state {
    margin-top: 14px;
    padding: 14px;
}

.login-panel {
    max-width: 380px;
    margin: 80px auto;
    padding: 18px;
}

.login-panel h1 {
    font-size: 24px;
    margin: 0 0 16px;
}

.form-row {
    margin-bottom: 12px;
}

.form-row input {
    width: 100%;
    padding: 8px;
}

@media (max-width: 640px) {
    .app-nav,
    .history-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .modal-panel {
        margin: 4vh 12px;
    }
}
