:root {
  --bg: #0c1118;
  --panel: #151d28;
  --panel-2: #1b2533;
  --text: #eef3f8;
  --muted: #93a1b3;
  --line: #2a3647;
  --accent: #4ea8de;
  --accent-2: #76c893;
  --warn: #f4a261;
  --danger: #e76f51;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: linear-gradient(180deg, #0a0f15 0%, #0e1621 100%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(980px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

h1, h2, h3, p { margin: 0; }
.subtitle { color: var(--muted); margin-top: 4px; }
.main-grid { display: grid; gap: 16px; }
.card {
  background: rgba(21, 29, 40, 0.95);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.summary-head, .actions-row, .sound-row, .section-head, .progress-meta, .modal-head, .modal-actions, .alert-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.summary-head { align-items: flex-start; }
.label {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 6px;
}
.big-number {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
}
.progress-block { margin-top: 18px; }
.progress-bar {
  margin-top: 8px;
  width: 100%;
  height: 16px;
  border-radius: 999px;
  background: #0d141d;
  overflow: hidden;
  border: 1px solid var(--line);
}
.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
  transition: width 0.25s ease;
}
.next-reminder-block { margin-top: 18px; }
.next-reminder { font-size: 1.15rem; font-weight: 600; }

.btn {
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 11px 14px;
  color: white;
  transition: transform 0.12s ease, opacity 0.12s ease, border-color 0.12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--accent); }
.btn-secondary { background: var(--panel-2); border-color: var(--line); }
.btn-warning { background: var(--warn); color: #1d1104; font-weight: 700; }
.btn-danger { background: var(--danger); }
.btn-large { flex: 1; min-height: 54px; font-weight: 700; }
.icon-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 12px;
}
.muted { color: var(--muted); }
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #101823;
  border: 1px solid var(--line);
  font-size: 0.92rem;
}
.status-badge.status-active {
  color: var(--accent-2);
  border-color: rgba(118, 200, 147, 0.55);
}
.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #101823;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}
.entries-list { display: grid; gap: 10px; }
.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 20px 10px;
  border: 1px dashed var(--line);
  border-radius: 14px;
}
.entry-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: #111924;
  border: 1px solid var(--line);
}
.entry-main { display: grid; gap: 4px; }
.entry-time { color: var(--muted); font-size: 0.9rem; }
.entry-amount { font-size: 1.1rem; font-weight: 700; }
.entry-actions { display: flex; gap: 8px; }
.entry-actions .btn { padding: 8px 10px; border-radius: 10px; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 13, 0.72);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  z-index: 50;
}
.hidden { display: none !important; }
.overlay-card {
  width: min(720px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 18px;
}
.alert-card { width: min(380px, 100%); text-align: center; }
.modal-card { max-height: 92vh; overflow: auto; }
.settings-modal-card { width: min(840px, 100%); }
.form-grid { display: grid; gap: 14px; }
.form-grid label { display: grid; gap: 7px; }
.form-grid input, .form-grid select {
  width: 100%;
  background: #0e1520;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 13px;
}
.two-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.schedule-section {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.weekday-grid { display: grid; gap: 10px; margin-top: 10px; }
.weekday-row {
  display: grid;
  grid-template-columns: 110px 1fr 1fr;
  gap: 10px;
  align-items: center;
}
.profile-id {
  display: inline-block;
  margin-top: 6px;
  background: #0d141d;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  word-break: break-all;
}
.toast-container {
  position: fixed;
  right: 12px;
  bottom: 12px;
  display: grid;
  gap: 10px;
  z-index: 100;
}
.toast {
  background: #101823;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  min-width: 220px;
  box-shadow: var(--shadow);
}
.toast.error { border-color: rgba(231,111,81,0.65); }
.toast.success { border-color: rgba(118,200,147,0.65); }

@media (max-width: 720px) {
  .app-shell { width: min(100%, calc(100% - 16px)); padding-top: 12px; }
  .topbar, .summary-head, .actions-row, .section-head, .modal-actions { flex-direction: column; align-items: stretch; }
  .topbar-actions { justify-content: stretch; }
  .topbar-actions > * { width: 100%; }
  .two-cols, .weekday-row { grid-template-columns: 1fr; }
  .weekday-row { padding: 10px; background: #111924; border: 1px solid var(--line); border-radius: 14px; }
  .overlay-card { padding: 16px; }
}
