/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f4f6f8;
  color: #333;
  line-height: 1.5;
}

/* Navbar */
.navbar {
  background: #1a1a2e;
  color: #fff;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-link {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  transition: all 0.2s;
}

.nav-link:hover, .nav-link.active {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

/* Summary Cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border-left: 4px solid #ddd;
}

.card-green { border-left-color: #4caf50; }
.card-red { border-left-color: #f44336; }

.card-value {
  font-size: 32px;
  font-weight: 700;
  color: #1a1a2e;
}

.card-value-small {
  font-size: 16px;
}

.card-label {
  font-size: 13px;
  color: #666;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Search Bar */
.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.search-input, .search-select {
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
}

.search-input {
  flex: 1;
  min-width: 200px;
}

.search-select {
  min-width: 160px;
}

.search-input:focus, .search-select:focus {
  outline: none;
  border-color: #1976d2;
  box-shadow: 0 0 0 2px rgba(25,118,210,0.1);
}

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: flex-end;
}

/* Table */
.table-wrapper {
  overflow-x: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table colgroup .col-name { width: 15%; }
.data-table colgroup .col-group { width: 12%; }
.data-table colgroup .col-armed { width: 8%; }
.data-table colgroup .col-cameras { width: 7%; }
.data-table colgroup .col-health { width: 8%; }
.data-table colgroup .col-detail { width: 22%; }
.data-table colgroup .col-checked { width: 14%; }
.data-table colgroup .col-changed { width: 14%; }

.data-table th {
  background: #f8f9fa;
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
  border-bottom: 2px solid #eee;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.data-table th.sortable:hover {
  background: #e8eaed;
  color: #333;
}

.sort-arrow {
  font-size: 10px;
  color: #1976d2;
}

.data-table td {
  padding: 10px 16px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
}

.data-table tbody tr:hover {
  background: #f8f9fa;
}

.row-alert {
  background: #fff5f5 !important;
}

.row-alert:hover {
  background: #ffebee !important;
}

.row-ok {
  background: #fff;
}

.detail-cell {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #666;
  font-size: 13px;
}

.detail-cell-full {
  color: #666;
  font-size: 13px;
  white-space: normal;
  word-break: break-word;
  min-width: 200px;
}

.nowrap {
  white-space: nowrap;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-green {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-red {
  background: #ffebee;
  color: #c62828;
}

.badge-neutral {
  background: #e3f2fd;
  color: #1565c0;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: #1976d2;
  color: #fff;
}

.btn-primary:hover {
  background: #1565c0;
}

.btn-secondary {
  background: #e0e0e0;
  color: #333;
}

.btn-secondary:hover {
  background: #d0d0d0;
}

.btn-full {
  width: 100%;
  text-align: center;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

.page-info {
  font-size: 14px;
  color: #666;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 14px;
}

.alert-success {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

.alert-error {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ffcdd2;
}

/* Login Box */
.login-box {
  max-width: 400px;
  margin: 80px auto;
  background: #fff;
  border-radius: 8px;
  padding: 40px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.login-box h2 {
  margin-bottom: 8px;
}

.login-box p {
  color: #666;
  margin-bottom: 24px;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
  flex: 1;
}

.form-group-small {
  flex: 0 0 120px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 4px;
}

.form-input, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.form-input:focus, .form-textarea:focus {
  outline: none;
  border-color: #1976d2;
  box-shadow: 0 0 0 2px rgba(25,118,210,0.1);
}

.form-hint {
  display: block;
  font-size: 12px;
  color: #999;
  margin-top: 4px;
}

.form-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding-top: 24px;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

/* Settings Sections */
.settings-section {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.settings-section h3 {
  font-size: 16px;
  color: #1a1a2e;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}

/* Test Email */
.test-email-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed #ddd;
}

.test-result {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-top: 8px;
}

.test-success {
  background: #e8f5e9;
  color: #2e7d32;
}

.test-error {
  background: #ffebee;
  color: #c62828;
}

/* Subtitle */
.subtitle {
  color: #666;
  margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 768px) {
  .container { padding: 16px; }
  .summary-cards { grid-template-columns: repeat(3, 1fr); }
  .search-bar, .filter-bar { flex-direction: column; }
  .form-row { flex-direction: column; }
  .nav-links { gap: 0; }
  .nav-link { padding: 8px 10px; font-size: 13px; }
}
