/* ===================== BASE ===================== */
*, *::before, *::after { box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; margin: 0; background: #f4f6f9; color: #2c3e50; font-size: 14px; }
a { color: #2980b9; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===================== NAVBAR ===================== */
.navbar { display: flex; align-items: center; background: #2c3e50; color: white; padding: 0 20px; height: 52px; gap: 8px; }
.nav-brand { font-weight: 700; font-size: 1rem; margin-right: 16px; white-space: nowrap; }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a { color: rgba(255,255,255,0.75); padding: 6px 12px; border-radius: 6px; font-size: 0.875rem; transition: background 0.15s; }
.nav-links a:hover { background: rgba(255,255,255,0.1); text-decoration: none; color: white; }
.nav-links a.active { background: rgba(255,255,255,0.15); color: white; font-weight: 600; }
.btn-logout { margin-left: auto; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); color: white; padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: 0.8rem; }
.btn-logout:hover { background: rgba(255,255,255,0.2); }

/* ===================== PAGE ===================== */
.page { padding: 24px; max-width: 1200px; margin: 0 auto; }
.page-title { font-size: 1.4rem; font-weight: 700; margin: 0 0 20px; color: #2c3e50; }
.page-header { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-header .page-title { margin-bottom: 0; }

/* ===================== CARDS ===================== */
.cards { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.card { background: white; border-radius: 12px; padding: 16px 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.07); flex: 1; min-width: 160px; }
.card-label { font-size: 0.78rem; color: #888; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.03em; }
.card-value { font-size: 1.5rem; font-weight: 700; color: #2c3e50; }
.card-value.positive { color: #27ae60; }
.card-value.negative { color: #e74c3c; }

/* ===================== TABLE ===================== */
.table-wrap { background: white; border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.07); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th { background: #f8f9fa; padding: 10px 14px; text-align: left; font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: #666; border-bottom: 1px solid #e9ecef; white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid #f0f0f0; font-size: 0.875rem; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }
.td-actions { white-space: nowrap; text-align: right; }

/* ===================== BUTTONS ===================== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: none; border-radius: 8px; font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: opacity 0.15s; line-height: 1; }
.btn:hover { opacity: 0.85; }
.btn:active { opacity: 0.7; }
.btn-primary { background: #2980b9; color: white; }
.btn-danger { background: #e74c3c; color: white; }
.btn-secondary { background: #ecf0f1; color: #2c3e50; border: 1px solid #dce1e7; }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }

/* ===================== FORMS ===================== */
.form-group { margin-bottom: 14px; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
label { display: block; font-size: 0.8rem; font-weight: 600; color: #555; margin-bottom: 5px; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid #dce1e7; border-radius: 8px; font-size: 0.875rem; outline: none; transition: border-color 0.15s; background: white; }
input:focus, select:focus, textarea:focus { border-color: #2980b9; }
input[type="checkbox"] { width: auto; }
input:disabled, select:disabled { background: #f8f9fa; color: #999; }

/* ===================== MODAL ===================== */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000; align-items: center; justify-content: center; padding: 16px; }
.modal-overlay.open { display: flex; }
.modal { background: white; border-radius: 14px; padding: 24px; width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto; box-shadow: 0 8px 32px rgba(0,0,0,0.18); }
.modal-title { font-size: 1.1rem; font-weight: 700; margin: 0 0 18px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* ===================== ALERTS ===================== */
.alert { padding: 10px 14px; border-radius: 8px; font-size: 0.875rem; margin-bottom: 14px; display: none; }
.alert-error { background: #fdf0f0; color: #c0392b; border: 1px solid #f5c6c6; }
.alert-success { background: #f0fdf4; color: #1a7a3a; border: 1px solid #b7e4c4; }

/* ===================== FILTERS ===================== */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: flex-end; }
.filters .form-group { margin-bottom: 0; min-width: 140px; }

/* ===================== LOGIN ===================== */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: white; border-radius: 16px; padding: 36px 32px; width: 100%; max-width: 360px; box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
.login-title { text-align: center; font-size: 1.4rem; font-weight: 700; margin: 0 0 24px; }
.login-title span { font-size: 2.5rem; display: block; margin-bottom: 8px; }

/* ===================== WARNINGS ===================== */
.warnings { margin-bottom: 16px; }
.warning-item { background: #fff9e6; border: 1px solid #f6d860; border-radius: 8px; padding: 8px 12px; font-size: 0.85rem; color: #7a5c00; margin-bottom: 6px; }

/* ===================== TABS ===================== */
.tabs { display: flex; gap: 0; border-bottom: 2px solid #e9ecef; margin-bottom: 20px; }
.tab-btn { padding: 9px 18px; cursor: pointer; font-size: 0.875rem; color: #666; background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; font-weight: 500; }
.tab-btn.active { color: #2980b9; border-bottom-color: #2980b9; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===================== BADGE ===================== */
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.badge-green { background: #e6f7ee; color: #1a7a3a; }
.badge-yellow { background: #fff9e6; color: #7a5c00; }
.badge-red { background: #fdf0f0; color: #c0392b; }
.badge-gray { background: #f0f0f0; color: #666; }
.badge-blue { background: #e8f4fb; color: #1a5c80; }

/* ===================== EMPTY STATE ===================== */
.empty-state { text-align: center; padding: 48px 16px; color: #999; }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.95rem; }

/* ===================== PERIOD SELECT ===================== */
.period-select { padding: 7px 10px; border: 1px solid #dce1e7; border-radius: 8px; font-size: 0.875rem; }

/* ===================== RESULT COLORS ===================== */
.positive { color: #27ae60; }
.negative { color: #e74c3c; }
