/* ── Wireshark-inspired palette ── */
:root {
  --bg-primary:    #ffffff;
  --bg-secondary:  #f5f6f7;
  --bg-card:       #ffffff;
  --bg-input:      #ffffff;
  --bg-header:     #2c3e3a;
  --bg-sidebar:    #34534b;
  --text-primary:  #1a1a1a;
  --text-secondary:#5a6268;
  --text-muted:    #8c939a;
  --text-on-dark:  #e8ece4;
  --accent:        #5b9a4b;
  --accent-hover:  #4a8340;
  --accent-light:  #e6f2e2;
  --border:        #d5d9dd;
  --danger:        #c0392b;
  --danger-hover:  #a93226;
  --warning:       #d4a017;
  --info:          #2980b9;
  --success:       #27ae60;
  --shadow:        0 1px 3px rgba(0,0,0,0.08);
}

[data-theme="dark"] {
  --bg-primary:    #1a1f1e;
  --bg-secondary:  #232928;
  --bg-card:       #2a302f;
  --bg-input:      #323938;
  --bg-header:     #1a2320;
  --bg-sidebar:    #1e2b27;
  --text-primary:  #d8ddd6;
  --text-secondary:#9aa39e;
  --text-muted:    #6b756f;
  --text-on-dark:  #d8ddd6;
  --accent:        #6aad58;
  --accent-hover:  #7dbf6b;
  --accent-light:  #2a3d28;
  --border:        #3a4240;
  --shadow:        0 1px 3px rgba(0,0,0,0.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.app-header {
  background: var(--bg-header);
  color: var(--text-on-dark);
  padding: 0 1.5rem;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.app-header h1 { font-size: 1.1rem; font-weight: 600; letter-spacing: 0.5px; }
.app-header nav { display: flex; gap: 1rem; align-items: center; }
.app-header nav a { color: var(--text-on-dark); opacity: 0.85; font-size: 0.85rem; }
.app-header nav a:hover { opacity: 1; text-decoration: none; }
.app-header nav a.active { opacity: 1; border-bottom: 2px solid var(--accent); }

.app-body { max-width: 1280px; margin: 0 auto; padding: 1.5rem; }
.app-body.wide { max-width: 100%; }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

/* ── Forms ── */
.form-group { margin-bottom: 0.75rem; }
.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="search"],
textarea,
select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
}
textarea { resize: vertical; min-height: 80px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover  { background: var(--danger-hover); }
.btn-secondary { background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.78rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); }
th { background: var(--bg-secondary); font-weight: 600; color: var(--text-secondary); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.3px; }
tr:hover td { background: var(--accent-light); }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-critical { background: var(--danger); color: #fff; }
.badge-high     { background: var(--warning); color: #1a1a1a; }
.badge-low      { background: var(--info); color: #fff; }
.badge-info     { background: var(--bg-secondary); color: var(--text-secondary); border: 1px solid var(--border); }

.badge-open     { background: var(--info); color: #fff; }
.badge-active   { background: var(--success); color: #fff; }
.badge-closed   { background: var(--text-muted); color: #fff; }

.badge-reported            { background: var(--info); color: #fff; }
.badge-under-investigation { background: var(--warning); color: #1a1a1a; }
.badge-under-repair        { background: #e67e22; color: #fff; }
.badge-resolved            { background: var(--success); color: #fff; }

/* ── Map container ── */
.map-container { width: 100%; height: 500px; border-radius: 6px; border: 1px solid var(--border); }

/* ── Utilities ── */
.text-muted { color: var(--text-muted); }
.text-sm    { font-size: 0.8rem; }
.text-xs    { font-size: 0.72rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.hidden { display: none; }
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #fff;
  z-index: 999;
  animation: fadeIn 0.2s;
}
.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; }
  .app-header nav { gap: 0.5rem; }
  .app-body { padding: 1rem; }
}
