:root {
  --bg: #0b0e14;
  --panel: #121826;
  --panel2: #0f1420;
  --text: #e6eaf2;
  --muted: #a7b0c3;
  --border: #263047;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --accent: #7c5cff;
  --accent2: #3ddc97;
  --danger: #ff4d6d;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: radial-gradient(1200px 800px at 20% -10%, #1a2440 0%, var(--bg) 55%);
  color: var(--text);
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 14, 22, 0.7);
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
}
.brand .title { font-weight: 700; font-size: 16px; }
.brand .subtitle { color: var(--muted); font-size: 12px; margin-top: 2px; }
main { padding: 16px; }

.panel {
  background: rgba(18, 24, 38, 0.88);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
  max-width: 100%;
  overflow: hidden;
}
.panelTitle { font-weight: 700; margin-bottom: 10px; }

.grid { display: grid; grid-template-columns: 1fr; gap: 12px; width: 100%; }
@media (min-width: 980px) { .grid { grid-template-columns: 1fr 1fr; } #adminPanel{ grid-column: 1 / span 2; } }

/* Prevent overflow on small screens */
.grid, .panel, .row2, .itemTop { min-width: 0; }
.row2 > div { min-width: 0; }

@media (max-width: 520px) {
  .row2 { grid-template-columns: 1fr; }
  .actions { flex-wrap: wrap; }
}

.row { display: grid; gap: 6px; margin-bottom: 10px; width: 100%; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; width: 100%; }
.rowInline { margin-bottom: 10px; }
label { color: var(--muted); font-size: 12px; }

/* Toggle switch */
.toggleRow{ display:flex; align-items:center; justify-content:space-between; gap:12px; }
.toggleLabel{ color: var(--muted); font-size: 12px; }
.switch{ position:relative; display:inline-block; width:46px; height:26px; }
.switch input{ opacity:0; width:0; height:0; }
.slider{ position:absolute; cursor:pointer; inset:0; background: var(--panel2); border:1px solid var(--border); transition:.2s; border-radius:999px; }
.slider:before{ position:absolute; content:""; height:20px; width:20px; left:3px; top:50%; transform:translateY(-50%); background: #cfd6e6; transition:.2s; border-radius:50%; box-shadow: 0 6px 16px rgba(0,0,0,.35); }
.switch input:checked + .slider{ background: rgba(124,92,255,.35); border-color: rgba(124,92,255,.55); }
.switch input:checked + .slider:before{ transform: translate(20px, -50%); background: #ffffff; }
input, textarea {
  width: 100%;
  max-width: 100%;
  display: block;
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  outline: none;
}

/* Normalize iOS date/time inputs (prevents intrinsic sizing/overflow) */
input[type="date"],
input[type="time"]{
  appearance: none;
  -webkit-appearance: none;
}
textarea { resize: vertical; }

.btn {
  background: #1d2a49;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.1); }
.btn.primary { background: linear-gradient(135deg, rgba(124,92,255,.9), rgba(61,220,151,.25)); border-color: rgba(124,92,255,.55); }
.btn.ghost { background: transparent; }

.tabs { display: flex; gap: 10px; margin-bottom: 12px; }
.tab { background: transparent; border: 1px solid var(--border); color: var(--muted); padding: 8px 10px; border-radius: 999px; cursor: pointer; }
.tab.active { color: var(--text); border-color: rgba(124,92,255,.6); }

.segmented{ width:100%; max-width:100%; display:flex; background: rgba(15,20,32,.6); border:1px solid var(--border); border-radius: 999px; padding:4px; gap:4px; margin-bottom: 12px; }
.segBtn{ flex:1; border:1px solid transparent; background: transparent; color: var(--muted); padding: 8px 10px; border-radius: 999px; cursor:pointer; }
.segBtn.active{ background: rgba(124,92,255,.25); border-color: rgba(124,92,255,.45); color: var(--text); }

.mutedBox{ width:100%; max-width:100%; background: rgba(15,20,32,.85); border: 1px solid var(--border); padding: 10px 12px; border-radius: 12px; color: var(--text); }

.msg { margin-top: 10px; color: var(--muted); font-size: 12px; white-space: pre-wrap; }
.hint { color: var(--muted); font-size: 12px; margin-top: 8px; }

.list { display: grid; gap: 8px; margin-top: 10px; }
.item {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}
.itemTop { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.itemTitle { font-weight: 650; }
.small { color: var(--muted); font-size: 11px; margin-top: 6px; }
.badge { font-size: 11px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); }
.badge.ok { color: var(--accent2); }
.badge.pending { color: var(--accent); }
.badge.danger { color: var(--danger); }

.actions { display:flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.actions button { padding: 8px 10px; border-radius: 10px; }
.editBox{ margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(38,48,71,.6); }

/* Modal */
.modal{ position: fixed; inset:0; background: rgba(0,0,0,.55); display:flex; align-items:center; justify-content:center; padding: 16px; z-index: 50; }
.modalCard{ width: 100%; max-width: 420px; background: rgba(18, 24, 38, 0.98); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 14px; }
.modalTitle{ font-weight: 750; margin-bottom: 6px; }
.modalText{ color: var(--text); margin-bottom: 12px; }
.modalActions{ display:flex; gap: 10px; justify-content:flex-end; }
.modalActions .btn{ min-width: 96px; }
