/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 14px; color: #111827; background: #f9fafb; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; font-size: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* Layout */
.layout { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
.sidebar { width: 256px; background: #111827; color: #fff; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-brand { padding: 24px; border-bottom: 1px solid #1f2937; }
.sidebar-brand h1 { font-size: 18px; font-weight: 700; }
.sidebar-brand p { font-size: 12px; color: #9ca3af; margin-top: 4px; }
.sidebar-nav { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; color: #9ca3af; font-size: 14px; transition: background 0.15s, color 0.15s; }
.sidebar-nav a:hover { background: #1f2937; color: #fff; }
.sidebar-nav a.active { background: #374151; color: #fff; }
.sidebar-nav svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-footer { padding: 16px; border-top: 1px solid #1f2937; }
.sidebar-footer button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border-radius: 8px; color: #9ca3af; background: none; border: none; font-size: 14px; transition: background 0.15s, color 0.15s; }
.sidebar-footer button:hover { background: #1f2937; color: #fff; }
.sidebar-footer svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Main */
.main { flex: 1; overflow: auto; background: #f9fafb; }
.main-inner { padding: 32px; }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 700; }
.header-left { display: flex; align-items: center; gap: 12px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; border: none; transition: background 0.15s, opacity 0.15s; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1d4ed8; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-outline { background: #fff; color: #374151; border: 1px solid #d1d5db; }
.btn-outline:hover:not(:disabled) { background: #f9fafb; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-link-danger { background: none; border: none; color: #dc2626; font-size: 13px; font-weight: 500; padding: 4px 10px; border-radius: 6px; }
.btn-link-danger:hover:not(:disabled) { background: #fef2f2; }
.btn-link-success { background: none; border: none; color: #16a34a; font-size: 13px; font-weight: 500; padding: 4px 10px; border-radius: 6px; }
.btn-link-success:hover:not(:disabled) { background: #f0fdf4; }

/* Card */
.card { background: #fff; border-radius: 12px; border: 1px solid #e5e7eb; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }

/* Filters */
.filters { display: flex; gap: 12px; margin-bottom: 16px; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead { background: #f9fafb; border-bottom: 1px solid #e5e7eb; }
th { text-align: left; padding: 11px 16px; font-weight: 500; color: #6b7280; white-space: nowrap; font-size: 13px; }
td { padding: 11px 16px; border-bottom: 1px solid #f3f4f6; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafafa; }
.mono { font-family: 'Courier New', monospace; font-size: 12px; }
.truncate { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.muted { color: #9ca3af; font-style: italic; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-gray { background: #f3f4f6; color: #374151; }

/* Dot */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot-green { background: #22c55e; }
.dot-gray { background: #d1d5db; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid #e5e7eb; background: #f9fafb; border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }
.pagination p { font-size: 13px; color: #6b7280; }
.pagination-btns { display: flex; gap: 6px; }

/* Forms */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 14px; font-weight: 500; color: #374151; }
.form-input, .form-select, .form-textarea { width: 100%; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; color: #111827; background: #fff; outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-textarea { resize: vertical; min-height: 88px; }
.form-error { font-size: 12px; color: #dc2626; min-height: 16px; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: #fff; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); width: 100%; max-width: 480px; margin: 16px; }
.modal-lg { max-width: 560px; }
.modal-sm { max-width: 380px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid #e5e7eb; }
.modal-header h2 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; color: #9ca3af; line-height: 1; padding: 4px; border-radius: 4px; }
.modal-close:hover { color: #374151; }
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid #e5e7eb; }

/* Toast */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 100; pointer-events: none; }
.toast { padding: 12px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; box-shadow: 0 4px 16px rgba(0,0,0,0.12); animation: toastIn 0.2s ease; max-width: 360px; pointer-events: auto; }
.toast-success { background: #f0fdf4; color: #166534; border: 1px solid #86efac; }
.toast-error { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Login */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #f3f4f6; }
.login-card { background: #fff; padding: 40px; border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,0.08); width: 100%; max-width: 400px; }
.login-title { text-align: center; margin-bottom: 32px; }
.login-title h1 { font-size: 24px; font-weight: 700; }
.login-title p { color: #6b7280; font-size: 14px; margin-top: 4px; }
.login-form { display: flex; flex-direction: column; gap: 20px; }

/* Loading / Empty */
.empty { padding: 40px 16px; text-align: center; color: #9ca3af; }
.loading-cell { padding: 40px 16px; text-align: center; color: #6b7280; }

/* Info grid (license detail) */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 600px) { .info-grid { grid-template-columns: 1fr; } }
.info-item dt { font-size: 11px; font-weight: 600; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.05em; }
.info-item dd { font-size: 14px; color: #111827; margin-top: 4px; }

/* Action log colors */
.action-green { color: #16a34a; font-weight: 500; }
.action-red { color: #dc2626; font-weight: 500; }
.action-blue { color: #2563eb; font-weight: 500; }
.action-indigo { color: #4f46e5; font-weight: 500; }
.action-default { color: #374151; font-weight: 500; }

/* Back button */
.back-btn { background: none; border: none; color: #9ca3af; padding: 0; display: inline-flex; align-items: center; border-radius: 6px; }
.back-btn:hover { color: #374151; }

/* Section header inside card */
.card-header { padding: 16px 24px; border-bottom: 1px solid #e5e7eb; }
.card-header h2 { font-size: 15px; font-weight: 600; }
.card-body { padding: 24px; }
