:root {
  --bg: #14161c;
  --panel: #1d2029;
  --line: #2c3040;
  --text: #e8e6df;
  --mute: #8b90a0;
  --gold: #e0a93b;
  --red: #d9534f;
  --green: #4caf7d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, sans-serif;
}

h1,
h2,
h3,
button.tab {
  font-family: "Chakra Petch", sans-serif;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}

.header .logo {
  margin: 0;
  font-size: 22px;
  color: var(--gold);
}

.header .nav {
  display: flex;
  gap: 8px;
}

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 6px;
}

button:hover {
  border-color: var(--gold);
}

button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

button.tab {
  font-weight: 700;
}

button.tab.on,
button.pri {
  background: var(--gold);
  color: #14161c;
  border-color: var(--gold);
}

button.del {
  color: var(--red);
}

/* Layout utilities */
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.row h2 {
  margin: 0;
}

.item {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1.2fr auto;
  gap: 12px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 8px;
}

small {
  color: var(--mute);
  display: block;
}

.count {
  font-family: "Chakra Petch", sans-serif;
  font-size: 20px;
}

.soon {
  color: var(--gold);
}
.now {
  color: var(--green);
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--mute);
  margin-right: 6px;
}

.dot.on {
  background: var(--green);
}

.dot.off {
  background: var(--red);
}

.acts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.empty {
  color: var(--mute);
  padding: 24px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 6px;
}

.err {
  color: var(--red);
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  width: min(480px, 94vw);
  max-height: 92vh;
  overflow: auto;
}

.modal-header {
  margin-top: 0;
  font-size: 18px;
}

.form-control {
  width: 100%;
  padding: 9px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

.form-control[type="color"] {
  padding: 2px;
  height: 36px;
}

.form-check {
  display: flex;
  gap: 8px;
  align-items: center;
}

.days-container {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.days-container label {
  margin: 0;
  display: flex;
  gap: 4px;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 6px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gold);
  color: #14161c;
  padding: 10px 18px;
  border-radius: 6px;
  display: none;
  z-index: 2000;
}

.toast.show {
  display: block;
}

/* Responsive */
@media (max-width: 700px) {
  .item {
    grid-template-columns: 1fr;
  }
}

/* Utils */
.hidden {
  display: none !important;
}
