* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", "Hiragino Kaku Gothic ProN", sans-serif; background: #f4f6f8; color: #222; }
.hidden { display: none !important; }

.login-screen { display: flex; align-items: center; justify-content: center; height: 100vh; }
.login-box { background: #fff; padding: 40px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.1); width: 320px; text-align: center; }
.login-box h1 { font-size: 18px; margin-bottom: 20px; }
.login-box input { width: 100%; padding: 10px; margin-bottom: 10px; border: 1px solid #ccc; border-radius: 4px; }
.login-box button { width: 100%; padding: 10px; background: #2c5282; color: #fff; border: none; border-radius: 4px; cursor: pointer; }
.error { color: #c53030; font-size: 13px; min-height: 18px; }

.app { display: flex; height: 100vh; }
.sidebar { width: 220px; background: #1a2332; color: #fff; display: flex; flex-direction: column; padding: 16px 0; flex-shrink: 0; }
.sidebar h2 { font-size: 16px; padding: 0 16px 12px; margin: 0; border-bottom: 1px solid #2d3a4f; }
.sidebar nav { flex: 1; display: flex; flex-direction: column; margin-top: 8px; overflow-y: auto; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; color: #cbd5e0; text-decoration: none; padding: 10px 16px; font-size: 14px; }
.sidebar nav a:hover, .sidebar nav a.active { background: #2c5282; color: #fff; }
.sidebar nav a svg { width: 18px; height: 18px; flex-shrink: 0; fill: currentColor; }
.logout { margin: 12px 16px 0; padding: 8px; background: #4a5568; color: #fff; border: none; border-radius: 4px; cursor: pointer; }

.main-content { flex: 1; padding: 24px; overflow-y: auto; }
h3 { margin-top: 0; }

table { width: 100%; border-collapse: collapse; background: #fff; margin-top: 12px; font-size: 13px; }
th, td { border: 1px solid #e2e8f0; padding: 6px 8px; text-align: left; }
th { background: #edf2f7; }
tr:hover { background: #f9fafb; }

.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input, .toolbar select { padding: 6px; border: 1px solid #ccc; border-radius: 4px; }
button { padding: 6px 14px; background: #2c5282; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 13px; }
button.secondary { background: #718096; }
button.danger { background: #c53030; }
button:hover { opacity: .9; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; padding: 24px; border-radius: 8px; width: 640px; max-height: 85vh; overflow-y: auto; }
.modal h3 { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.form-grid label { display: flex; flex-direction: column; font-size: 12px; color: #4a5568; gap: 4px; }
.form-grid input, .form-grid select, .form-grid textarea { padding: 6px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; }
.modal-actions { margin-top: 16px; display: flex; gap: 8px; justify-content: flex-end; }
.doc-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.doc-buttons button { font-size: 11px; padding: 4px 8px; }

.dashboard-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.dash-card { background: #fff; border-radius: 8px; padding: 16px 20px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.dash-label { font-size: 12px; color: #718096; margin-bottom: 6px; }
.dash-value { font-size: 26px; font-weight: bold; }
.dash-value.blue { color: #2c5282; }
.dash-value.red { color: #c53030; }
.dash-value.green { color: #2f855a; }
.dash-value.orange { color: #dd6b20; }

.dashboard-charts { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 24px; }
.chart-box { background: #fff; border-radius: 8px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.chart-box h4 { margin: 0 0 12px; font-size: 14px; color: #4a5568; }
.chart-box.wide canvas { max-height: 320px; }
.chart-box:not(.wide) canvas { max-height: 320px; }
