:root {
  --shadow-grey: #231f20ff;
  --tomato-jam: #bb4430ff;
  --tropical-teal: #7ebdc2ff;
  --vanilla-custard: #f3dfa2ff;
  --linen: #efe6ddff;

  --bg: #ffffff;
  --surface: #ffffff;
  --border: #d6d6d6;
  --text: var(--shadow-grey);
  --muted: #666666;
  --accent: var(--tropical-teal);
  --accent-dim: #4499ff;
  --danger: var(--tomato-jam);
  --radius: 10px;
  --app-header-height: 3.25rem;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--shadow-grey);
    --surface: var(--shadow-grey);
    --border: #6d6d6d;
    --text: var(--linen);
    --muted: #8b9cb3;
    --accent: var(--vanilla-custard);
    --accent-dim: #2b7bc4;
  }
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
main {
  flex: 1;
  min-width: 0;
  max-width: 520px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

main > div {
  margin-bottom: 2rem;
}

.header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}
h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}
.btn-create {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #0a0e14;
  font-size: 1.75rem;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    background 0.15s ease,
    transform 0.1s ease;
}
.btn-create:hover:not(:disabled) {
  background: #5aadff;
}
.btn-create:active:not(:disabled) {
  transform: scale(0.96);
}
.btn-create:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.message {
  display: block;
}
label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 1rem;
  cursor: pointer;
}
select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input:not([type="checkbox"]):not([type="radio"]) {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 1rem;
  cursor: text;
}
input:not([type="checkbox"]):not([type="radio"]):disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
input:not([type="checkbox"]):not([type="radio"]):focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input:not([type="checkbox"]):not([type="radio"]):invalid {
  border-color: var(--danger);
}
input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
label.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-left: 0.25rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}
textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 1rem;
  cursor: text;
}
textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
textarea:invalid {
  border-color: var(--danger);
}
button {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    transform 0.1s ease;
}
button:active:not(:disabled) {
  transform: scale(0.98);
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-start {
  background: var(--accent);
  color: #0a0e14;
}
.btn-start:hover:not(:disabled) {
  background: #5aadff;
}
.btn-stop {
  background: var(--danger);
  color: #fff;
}
.btn-stop:hover:not(:disabled) {
  background: #ff7a7b;
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--muted);
}
.btn-edit {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: transparent;
  border: none;
}
.btn-edit:hover:not(:disabled) {
  background: #212c38;
}
.btn-delete {
  background: transparent;
  color: var(--danger);
  border: none;
}
.btn-delete:hover:not(:disabled) {
  background: rgba(240, 93, 94, 0.1);
}
.msg {
  font-size: 0.875rem;
  color: var(--muted);
  min-height: 1.25rem;
  margin-top: 1rem;
}
.msg.error {
  color: #ff9d9e;
}
dialog.modal {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0;
  max-width: min(420px, calc(100vw - 2rem));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
dialog.modal::backdrop {
  background: rgba(8, 12, 18, 0.72);
}
.modal-inner {
  padding: 1.5rem;
  width: 22rem;
}
.modal-inner h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  font-weight: 600;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.25rem;
}
.modal-actions button {
  margin: 0;
}
header {
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 2;
  gap: 1rem;
  width: 100%;
  min-height: var(--app-header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

header > h1 {
  line-height: 2;
  padding-left: 1rem;
}
