:root {
  --bg: #f4f6f8;
  --sidebar-bg: #1a2332;
  --sidebar-text: #cbd5e1;
  --accent: #2563eb;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --white: #ffffff;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.app { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; padding: 20px 0; flex-shrink: 0; }
.sidebar .brand { color: white; font-weight: 700; font-size: 1.2rem; padding: 0 20px 20px; }
.sidebar a { color: var(--sidebar-text); padding: 10px 20px; display: block; }
.sidebar a:hover { background: rgba(255,255,255,0.08); text-decoration: none; }
.logout-form { margin-top: auto; padding: 20px; border-top: 1px solid rgba(255,255,255,0.1); display: flex; flex-direction: column; gap: 8px; }
.logout-form .user-name { color: white; font-size: 0.9rem; }
.logout-form button { background: transparent; border: 1px solid var(--sidebar-text); color: var(--sidebar-text); padding: 6px; border-radius: 4px; cursor: pointer; }

.content { flex: 1; padding: 30px 40px; max-width: 1200px; }
h1 { margin-top: 0; }

.flash { padding: 12px 16px; border-radius: 6px; margin-bottom: 20px; }
.flash-success { background: #dcfce7; color: #166534; }
.flash-error { background: #fee2e2; color: #991b1b; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 30px; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: 8px; padding: 20px; }
.stat-card.stat-alert { border-color: var(--danger); background: #fef2f2; }
.stat-value { font-size: 2rem; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }

.data-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: 8px; overflow: hidden; }
.data-table th, .data-table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.data-table th { background: #f8fafc; font-size: 0.8rem; text-transform: uppercase; color: var(--muted); }

.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; text-transform: capitalize; }
.badge-open, .badge-urgent { background: #fee2e2; color: #991b1b; }
.badge-in_progress, .badge-high { background: #fef3c7; color: #92400e; }
.badge-waiting, .badge-medium { background: #dbeafe; color: #1e40af; }
.badge-resolved, .badge-low { background: #dcfce7; color: #166534; }
.badge-closed { background: #e2e8f0; color: #475569; }
.badge-draft { background: #e2e8f0; color: #475569; }
.badge-exported { background: #dbeafe; color: #1e40af; }
.badge-paid { background: #dcfce7; color: #166534; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.toolbar-filters { display: flex; gap: 10px; }

.btn { display: inline-block; background: var(--accent); color: white; border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 0.9rem; }
.btn:hover { opacity: 0.9; text-decoration: none; }
.btn-secondary { background: var(--white); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }

form.inline-form { display: inline; }

.card { background: var(--white); border: 1px solid var(--border); border-radius: 8px; padding: 24px; margin-bottom: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; margin-bottom: 14px; }
.form-group label { font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
.form-group input, .form-group select, .form-group textarea {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.95rem; font-family: inherit;
}
.form-actions { margin-top: 20px; display: flex; gap: 10px; }

.detail-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.detail-meta { color: var(--muted); font-size: 0.9rem; margin-bottom: 20px; }
.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }

.comment { border-bottom: 1px solid var(--border); padding: 12px 0; }
.comment.internal { background: #fffbeb; padding: 12px; border-radius: 6px; border-bottom: none; margin-bottom: 8px; }
.comment-meta { font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }

.auth-body { display: flex; align-items: center; justify-content: center; height: 100vh; background: var(--sidebar-bg); }
.auth-card { background: white; padding: 40px; border-radius: 10px; width: 320px; }
.auth-card h1 { font-size: 1.3rem; text-align: center; }
.auth-card form { display: flex; flex-direction: column; gap: 6px; }
.auth-card input { padding: 10px; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 10px; }
.auth-card button { background: var(--accent); color: white; border: none; padding: 10px; border-radius: 6px; cursor: pointer; margin-top: 10px; }

.empty-state { color: var(--muted); padding: 30px; text-align: center; }
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }
