:root {
    --bg: #f8f9fa;
    --panel: #ffffff;
    --text: #212529;
    --muted: #6c757d;
    --border: #dee2e6;
    --primary: #0d6efd;
    --success: #198754;
    --danger: #dc3545;
    --warning: #ffc107;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial; background: var(--bg); color: var(--text); }

#app { display: flex; height: 100vh; }
aside { width: 260px; background: var(--panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
main { flex: 1; overflow-y: auto; padding: 1rem; }
header { padding: 1rem; border-bottom: 1px solid var(--border); }
header h1 { font-size: 1.1rem; margin: 0; }
nav a { display: block; padding: 0.6rem 1rem; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--border); }
nav a:hover { background: var(--bg); }
nav a.active { background: var(--primary); color: #fff; }

.sidebar-footer { margin-top: auto; padding: 1rem; border-top: 1px solid var(--border); font-size: 0.875rem; }
.sidebar-footer .user { color: var(--muted); margin-bottom: 0.5rem; word-break: break-word; }
.sidebar-footer button { width: 100%; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; }

button { cursor: pointer; padding: 0.5rem 1rem; border: none; border-radius: 4px; background: var(--primary); color: #fff; font-size: 0.875rem; }
button:hover { opacity: 0.92; }
button.danger { background: var(--danger); }
button.success { background: var(--success); }
button.secondary { background: #6c757d; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
button.ghost:hover { background: var(--bg); }

input, select, textarea { font-family: inherit; font-size: inherit; padding: 0.35rem 0.5rem; border: 1px solid var(--border); border-radius: 4px; width: 100%; }
input[type="number"] { width: 5rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--border); }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--bg); }

img { display: block; max-width: 100%; height: auto; object-fit: cover; }

/* Toast notifications */
#toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 200; display: flex; flex-direction: column; gap: 0.5rem; pointer-events: none; }
.toast { padding: 0.75rem 1rem; border-radius: 6px; color: #fff; font-size: 0.875rem; box-shadow: 0 4px 12px rgba(0,0,0,0.15); animation: toastIn 200ms ease; min-width: 240px; pointer-events: auto; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Confirm dialog */
#confirm-dialog { position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center; }
#confirm-dialog[hidden] { display: none; }
.confirm-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); }
.confirm-panel { position: relative; background: var(--panel); border-radius: 12px; width: min(400px, calc(100% - 2rem)); padding: 1.5rem; box-shadow: 0 20px 60px rgba(0,0,0,0.18); }
.confirm-panel p { margin: 0 0 1.25rem; font-size: 1rem; line-height: 1.4; }
.confirm-actions { display: flex; gap: 0.75rem; justify-content: flex-end; }
.confirm-actions button { padding: 0.5rem 1rem; font-size: 0.875rem; }

/* Modal dialog */
.modal { position: fixed; inset: 0; z-index: 160; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); }
.modal-panel { position: relative; background: var(--panel); border-radius: 12px; width: min(500px, calc(100% - 2rem)); padding: 1.5rem; box-shadow: 0 20px 60px rgba(0,0,0,0.18); }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1rem; }
    aside { width: 200px; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
