* { box-sizing: border-box; margin: 0; padding: 0; font-family: Arial, sans-serif; }

body { background: #f4f6f8; color: #333; }
.hidden { display: none !important; }
.center { display: flex; justify-content: center; align-items: center; height: 100vh; }

.card {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#login-form { width: 320px; display: flex; flex-direction: column; gap: 10px; }
#login-form h2 { text-align: center; margin-bottom: 10px; }
input, select, button {
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}
button { cursor: pointer; background: #2563eb; color: #fff; border: none; font-weight: bold; }
button:hover { opacity: 0.9; }
.error { color: #e74c3c; font-size: 13px; min-height: 18px; }

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1e293b;
  color: #fff;
  padding: 15px 20px;
}
header h1 { font-size: 20px; }
header nav { display: flex; gap: 10px; align-items: center; }
header a { color: #93c5fd; text-decoration: none; }
header button { background: #e74c3c; }

main { max-width: 1100px; margin: 20px auto; padding: 0 15px; display: flex; flex-direction: column; gap: 20px; }

.card h2 { margin-bottom: 15px; font-size: 18px; }
#add-sensor-btn { margin-bottom: 10px; background: #16a34a; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px; text-align: left; border-bottom: 1px solid #e5e7eb; }
th { background: #f1f5f9; }
td .btn-edit { background: #f59e0b; margin-right: 5px; }
td .btn-del { background: #e74c3c; }

#history-select { margin-bottom: 10px; width: 250px; }

.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
#sensor-form { width: 350px; display: flex; flex-direction: column; gap: 10px; }
.btn-group { display: flex; gap: 10px; }
.btn-group button:first-child { background: #6b7280; }

/* Simbologi & alur sungai */
.sym-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 15px; margin-bottom: 15px; }
fieldset { border: 1px solid #e5e7eb; border-radius: 6px; padding: 12px; }
legend { font-weight: bold; font-size: 13px; padding: 0 6px; }
fieldset label { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 8px; }
fieldset input[type=color] { width: 48px; height: 32px; padding: 2px; border: 1px solid #ccc; border-radius: 4px; background: #fff; cursor: pointer; }
fieldset input[type=number] { width: 72px; }
fieldset input[type=range] { flex: 1; }
fieldset input[type=checkbox] { transform: scale(1.4); cursor: pointer; }
.btn-gray { background: #6b7280; }
.btn-green { background: #16a34a; }
.hint { font-size: 13px; color: #666; margin-bottom: 10px; }
textarea { width: 100%; font-family: monospace; font-size: 12px; padding: 8px; margin: 10px 0; }
.form-msg { font-size: 13px; min-height: 18px; margin-top: 8px; }
.form-msg.ok { color: #16a34a; }
.form-msg.err { color: #e74c3c; }
#river-file { margin-bottom: 8px; }

/* Widget peta */
#widget-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.widget-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px; border: 1px solid #e5e7eb; border-radius: 6px; background: #fafbfc;
}
.widget-row .w-label { font-weight: bold; font-size: 13px; min-width: 110px; }
.widget-row .w-title { flex: 1; padding: 6px; }
.widget-row select { padding: 6px; }
.widget-row .w-enable { display: flex; align-items: center; gap: 4px; font-size: 13px; white-space: nowrap; }
.widget-row button { padding: 5px 8px; font-size: 13px; }
.widget-row .w-up { background: #2563eb; }
.widget-row .w-down { background: #7c3aed; }
.widget-row .w-del { background: #e74c3c; }
.add-row { display: flex; gap: 8px; margin-bottom: 10px; }
.add-row select { flex: 1; }
.widget-actions { margin-top: 4px; }

/* Badge status riwayat */
.status {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: bold;
  color: #fff;
}
.status.aman { background: #2ecc71; }
.status.siaga3 { background: #f1c40f; color: #333; }
.status.siaga2 { background: #e67e22; }
.status.siaga1 { background: #e74c3c; }
.status.siaga { background: #f1c40f; color: #333; }
.status.bahaya { background: #e74c3c; }
