:root {
  --red: #e4032e;
  --dark: #1e1f1d;
  --light: #f5f5f5;
  --white: #ffffff;
  --border: #e0e0e0;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 8px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--light); color: var(--dark); }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navbar */
.navbar { background: var(--dark); color: white; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; height: 60px; position: sticky; top: 0; z-index: 100; }
.navbar .logo { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 600; }
.navbar .logo span { color: var(--red); }
.navbar .user-menu { display: flex; align-items: center; gap: 16px; }
.navbar .user-name { font-size: 14px; opacity: 0.8; }
.btn-logout { background: transparent; border: 1px solid rgba(255,255,255,0.3); color: white; padding: 6px 16px; border-radius: var(--radius); cursor: pointer; font-size: 13px; }
.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* Login Page */
.login-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg, var(--dark) 0%, #2a2b29 100%); }
.login-box { background: white; padding: 48px 40px; border-radius: 12px; width: 400px; max-width: 90vw; box-shadow: 0 20px 40px rgba(0,0,0,0.3); }
.login-box h1 { text-align: center; margin-bottom: 8px; color: var(--dark); }
.login-box .subtitle { text-align: center; color: #888; margin-bottom: 32px; font-size: 14px; }
.login-box .logo-header { text-align: center; margin-bottom: 24px; }
.login-box .logo-header .brand { font-size: 24px; font-weight: 700; color: var(--dark); }
.login-box .logo-header .brand span { color: var(--red); }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; color: #555; }
.form-group input { width: 100%; padding: 12px 16px; border: 2px solid var(--border); border-radius: var(--radius); font-size: 15px; transition: border-color 0.2s; }
.form-group input:focus { outline: none; border-color: var(--red); }
.btn-primary { width: 100%; padding: 14px; background: var(--red); color: white; border: none; border-radius: var(--radius); font-size: 16px; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.btn-primary:hover { background: #c7022a; }
.btn-primary:disabled { background: #ccc; cursor: not-allowed; }
.error-msg { color: var(--red); text-align: center; margin-top: 12px; font-size: 14px; display: none; }

/* Dashboard */
.container { max-width: 1400px; margin: 0 auto; padding: 24px; }
.page-title { font-size: 24px; font-weight: 700; margin-bottom: 24px; }

/* Stat Cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card { background: white; padding: 24px; border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-card .stat-value { font-size: 32px; font-weight: 700; color: var(--dark); }
.stat-card .stat-label { font-size: 13px; color: #888; margin-top: 4px; }
.stat-card.red .stat-value { color: var(--red); }

/* Filters */
.filters { background: white; padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 24px; display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.filters .form-group { margin-bottom: 0; flex: 1; min-width: 150px; }
.filters input { padding: 10px 12px; font-size: 14px; }
.btn-filter { padding: 10px 20px; background: var(--dark); color: white; border: none; border-radius: var(--radius); cursor: pointer; font-size: 14px; height: 42px; }
.btn-filter:hover { background: #333; }
.btn-reset { padding: 10px 20px; background: transparent; color: var(--dark); border: 2px solid var(--border); border-radius: var(--radius); cursor: pointer; font-size: 14px; height: 42px; }

/* Table */
.table-container { background: white; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--dark); color: white; }
th { padding: 14px 16px; text-align: left; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
tbody tr { cursor: pointer; transition: background 0.15s; }
tbody tr:hover { background: #f9f9f9; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge-green { background: #e8f5e9; color: #2e7d32; }
.badge-orange { background: #fff3e0; color: #ef6c00; }
.badge-red { background: #ffebee; color: #c62828; }

/* Pagination */
.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 20px; }
.pagination button { padding: 8px 16px; border: 1px solid var(--border); background: white; border-radius: var(--radius); cursor: pointer; font-size: 14px; }
.pagination button:hover:not(:disabled) { border-color: var(--red); color: var(--red); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination .current { background: var(--red); color: white; border-color: var(--red); }

/* Detail Page */
.detail-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 16px; }
.detail-header h1 { font-size: 28px; }
.btn-back { display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px; background: var(--dark); color: white; border: none; border-radius: var(--radius); cursor: pointer; font-size: 14px; text-decoration: none; }
.btn-back:hover { background: #333; text-decoration: none; }
.btn-pdf { padding: 10px 20px; background: var(--red); color: white; border: none; border-radius: var(--radius); cursor: pointer; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 24px; }
.info-card { background: white; padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); }
.info-card h3 { font-size: 14px; color: #888; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--red); }
.info-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.info-row:last-child { border-bottom: none; }
.info-label { font-weight: 600; color: #555; }
.info-value { text-align: right; }

/* Photo Gallery */
.photo-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.photo-card { background: white; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; cursor: pointer; transition: transform 0.2s; }
.photo-card:hover { transform: translateY(-2px); }
.photo-card img { width: 100%; height: 160px; object-fit: cover; }
.photo-card .photo-title { padding: 10px 12px; font-size: 13px; font-weight: 600; }

/* Lightbox */
.lightbox { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); z-index: 1000; justify-content: center; align-items: center; }
.lightbox.active { display: flex; }
.lightbox img { max-width: 90%; max-height: 90%; object-fit: contain; }
.lightbox-close { position: absolute; top: 20px; right: 20px; color: white; font-size: 32px; cursor: pointer; background: none; border: none; }

/* Signature */
.signature-box { background: white; padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); }
.signature-box h3 { margin-bottom: 12px; }
.signature-box img { width: 100%; max-width: 400px; height: auto; border: 1px solid var(--border); border-radius: 4px; background: #ffffff; padding: 8px; display: block; }
.signature-box canvas { display: none; }

/* Empty State */
.empty-state { text-align: center; padding: 60px 20px; color: #888; }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state p { font-size: 16px; }

/* Loading */
.loading { text-align: center; padding: 40px; color: #888; }
.spinner { display: inline-block; width: 24px; height: 24px; border: 3px solid var(--border); border-top-color: var(--red); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 768px) {
  .container { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .filters { flex-direction: column; }
  th, td { padding: 10px 12px; font-size: 13px; }
  .detail-header { flex-direction: column; align-items: flex-start; }
  .photo-gallery { grid-template-columns: repeat(2, 1fr); }
}
