* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --nav-height: 33px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #e0e2e6;
    color: #333;
}

/* global input styling — tinted background so inputs stand out on white panels */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select,
textarea {
    background: #f7f8fa !important;
    border-color: #bbb !important;
}

/* nav */
.topnav {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: #fff;
    border-bottom: 2px solid #ddd;
}

.nav-brand {
    font-weight: 700;
    font-size: 15px;
    margin-right: 4px;
}

.nav-links { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; }
.nav-links a {
    text-decoration: none;
    color: #555;
    font-size: 13px;
    padding: 2px 6px;
    border-radius: 4px;
}
.nav-links a:hover { background: #f0f0f0; color: #111; }
.nav-links a.active { color: #111; font-weight: 600; background: #eee; }

@media (max-width: 768px) {
    .topnav { padding: 6px 10px; gap: 6px; }
    .nav-links { gap: 4px; }
    .nav-links a { font-size: 12px; padding: 2px 4px; }
    .dashboard { margin: 4px !important; padding: 4px 8px 8px !important; }
    .card { padding: 10px; margin-bottom: 8px; }
}

@media (max-width: 480px) {
    .topnav {
        flex-wrap: wrap;
        padding: 6px 10px;
        gap: 6px;
    }
    .nav-brand { width: 100%; display: flex; justify-content: space-between; align-items: center; }
    .nav-brand::after { content: ''; }
    .nav-links { flex: none; width: 100%; gap: 4px; }
    .nav-links a { font-size: 12px; }
    .topnav > .btn { position: absolute; top: 8px; right: 10px; }
}

.login-container {
    max-width: 360px;
    margin: 120px auto;
    padding: 32px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.login-container h1 {
    font-size: 20px;
    margin-bottom: 24px;
    text-align: center;
}

.login-container input {
    display: block;
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid #bbb;
    border-radius: 4px;
    font-size: 14px;
    background: #f7f8fa;
}

.login-container button {
    display: block;
    width: 100%;
    padding: 10px;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

.login-container button:hover { background: #555; }

.error {
    color: #c00;
    font-size: 13px;
    margin-bottom: 12px;
    text-align: center;
}

/* dashboard */
.dashboard {
    max-width: 800px;
    margin: 6px auto 0;
    padding: 6px 12px 12px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ddd;
}

.dashboard-header h1 { font-size: 20px; }

.dashboard-header button {
    padding: 6px 16px;
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.dashboard-header button:hover { background: #eee; }

.card {
    background: #fff;
    border-radius: 6px;
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    border-top: 3px solid #666;
}

.card h2 {
    font-size: 16px;
    margin-bottom: 6px;
}

.card p {
    font-size: 14px;
    color: #666;
}

/* tables */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
}

th { font-weight: 600; color: #666; font-size: 12px; text-transform: uppercase; }

/* buttons */
.btn {
    padding: 5px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s, border-color 0.15s;
}

.btn:hover { background: #f0f0f0; }
.btn-primary { background: #333; color: #fff; border-color: #333; }
.btn-primary:hover { background: #555; }
.btn-danger { color: #c00; border-color: #c00; }
.btn-danger:hover { background: #fdd; }
.btn-sm { padding: 3px 8px; font-size: 12px; }

.actions { display: flex; gap: 6px; }

/* forms in cards */
.form-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.form-row input, .form-row select {
    padding: 7px 10px;
    border: 1px solid #bbb;
    border-radius: 4px;
    font-size: 13px;
    flex: 1;
    background: #f7f8fa;
}

/* modal overlay */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: #fff;
    border-radius: 6px;
    padding: 16px;
    width: 480px;
    max-width: 90vw;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.modal h2 {
    font-size: 16px;
    margin-bottom: 12px;
}

.modal input, .modal select {
    display: block;
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 10px;
    border: 1px solid #bbb;
    border-radius: 4px;
    font-size: 13px;
    background: #f7f8fa;
}
.modal input[type="checkbox"] {
    display: inline;
    width: auto;
    margin-bottom: 0;
    padding: 0;
}

.modal-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

.success {
    color: #080;
    font-size: 13px;
    margin-bottom: 8px;
}

/* combobox */
.combobox {
    position: relative;
}

.combobox input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #bbb;
    border-radius: 4px;
    font-size: 16px;
    background: #f7f8fa;
}

.combobox input:focus { outline: none; border-color: #999; }

.combobox-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 240px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    z-index: 100;
}

.combobox-item {
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
}

.combobox-item:hover { background: #f5f5f5; }
.combobox-item.highlighted { background: #eef2ff; }
.combobox-empty { color: #999; cursor: default; }
.combobox-empty:hover { background: none; }
.combobox-hint { padding: 4px 12px; font-size: 11px; color: #aaa; border-top: 1px solid #f0f0f0; }

/* process picker */
.pp-wrap {
    position: relative;
    display: inline-block;
    width: 100%;
}

.pp-summary {
    padding: 3px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    min-height: 24px;
    line-height: 1.4;
    background: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pp-summary:hover { border-color: #999; }

.pp-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 260px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 500;
    padding: 6px 0;
}

.pp-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 13px;
    cursor: pointer;
}

.pp-row:hover { background: #f5f5f5; }

.pp-row input[type="checkbox"] {
    flex-shrink: 0;
    margin: 0;
    width: auto;
}

.pp-label {
    flex-shrink: 0;
    min-width: 70px;
}

.pp-detail {
    flex: 1;
    padding: 2px 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 12px;
    min-width: 80px;
}

.pp-detail:disabled {
    background: #f5f5f5;
    color: #aaa;
    border-color: #eee;
}
