/* slowmonster web — minimal stylesheet */

:root {
  --color-bg: #121212;
  --color-surface: #1e1e1e;
  --color-text: #e0e0e0;
  --color-muted: #9a9a9a;
  --color-border: #333;
  --color-primary: #5b9bf5;
  --color-primary-hover: #4a8ae6;
  --color-danger: #ef5350;
  --color-danger-hover: #e53935;
  --color-badge: #2a2a2a;
  --color-badge-due: #3d2e00;
  --color-badge-priority: #1a2744;
  --color-running: #0f2e1a;
  --radius: 6px;
  --max-width: 720px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  margin: 0;
  line-height: 1.5;
}

/* Nav */
header nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem;
}

.logo {
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--color-text);
}

.nav-links {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.nav-links a {
  color: var(--color-muted);
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--color-text);
}

.inline { display: inline; }

.link-button {
  background: none;
  border: none;
  color: var(--color-muted);
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.link-button:hover { color: var(--color-text); }

/* Main */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

/* Page header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.page-header h1 {
  font-size: 1.5rem;
  margin: 0;
}

/* Buttons */
.button {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  text-decoration: none;
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.button:hover { background: var(--color-primary-hover); }
.button.secondary { background: var(--color-border); color: var(--color-text); }
.button.secondary:hover { background: #444; }
.button.danger { background: var(--color-danger); }
.button.danger:hover { background: var(--color-danger-hover); }
.button.small { padding: 0.3rem 0.7rem; font-size: 0.8rem; }

/* Ticket list */
.ticket-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ticket-list li {
  border-bottom: 1px solid var(--color-border);
}

.ticket-list li:first-child {
  border-top: 1px solid var(--color-border);
}

.ticket-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.5rem;
}

/* Drag handle */
.drag-handle {
  cursor: grab;
  color: var(--color-muted);
  user-select: none;
  touch-action: none;
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0.4;
  transition: opacity 0.15s;
}

.drag-handle:active { cursor: grabbing; }

.ticket-list li:hover .drag-handle { opacity: 1; }

.drag-ghost {
  opacity: 0.3;
}

.ticket-list input[type="checkbox"] {
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  cursor: pointer;
  accent-color: var(--color-primary);
}

.ticket-list a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0;
  text-decoration: none;
  color: var(--color-text);
  flex: 1;
  min-width: 0;
}

.ticket-list a:hover {
  background: var(--color-badge);
}

.ticket-description {
  flex: 1;
}

.ticket-description.completed {
  text-decoration: line-through;
  color: var(--color-muted);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  background: var(--color-badge);
  color: var(--color-muted);
  white-space: nowrap;
}

.badge.priority { background: var(--color-badge-priority); color: #93bbfc; }
.badge.due { background: var(--color-badge-due); color: #fbbf24; }

/* Ticket detail */
.ticket-detail h1 {
  font-size: 1.5rem;
  margin: 0 0 0.5rem;
}

.ticket-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.ticket-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.ticket-notes {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.ticket-notes h2 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
  color: var(--color-muted);
}

.ticket-notes pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: inherit;
}

/* Timer */
.timer-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  margin-bottom: 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.timer-running {
  color: #4ade80;
  font-size: 0.875rem;
  flex: 1;
}

/* Children section */
.children {
  margin-top: 1.5rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.section-header h2 {
  font-size: 1.1rem;
  margin: 0;
}

/* Breadcrumbs */
.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: var(--color-muted);
}

.breadcrumbs li + li::before {
  content: "/";
  margin: 0 0.4rem;
}

.breadcrumbs a {
  color: var(--color-primary);
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

.breadcrumbs [aria-current] {
  color: var(--color-text);
}

/* Forms */
.ticket-form {
  max-width: 500px;
}

.ticket-form label {
  display: block;
  margin-top: 1rem;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-muted);
}

.ticket-form input[type="text"],
.ticket-form input[type="number"],
.ticket-form textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.95rem;
  background: var(--color-surface);
  color: var(--color-text);
}

.ticket-form textarea {
  resize: vertical;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* Login */
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.login-card {
  width: 100%;
  max-width: 360px;
  padding: 2rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.login-card h1 {
  margin: 0 0 1.5rem;
  font-size: 1.5rem;
  text-align: center;
}

.login-card label {
  display: block;
  margin-top: 1rem;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.login-card input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font: inherit;
  background: var(--color-surface);
  color: var(--color-text);
}

.login-card button {
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.6rem;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font: inherit;
  cursor: pointer;
}

.login-card button:hover { background: var(--color-primary-hover); }

/* Error */
.error {
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  background: #2d1515;
  border: 1px solid #5c2020;
  border-radius: var(--radius);
  color: var(--color-danger);
  font-size: 0.875rem;
}

/* Empty state */
.empty {
  color: var(--color-muted);
  font-style: italic;
}

/* Times and Amounts sections on edit ticket */
.row-section {
  margin-top: 2rem;
}

.row-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.row-list {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.row input[type="datetime-local"],
.row input[type="number"] {
  padding: 0.35rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.9rem;
  background: var(--color-bg, var(--color-surface));
  color: var(--color-text);
}

.row-empty {
  color: var(--color-muted);
  font-size: 0.875rem;
  margin: 0.5rem 0 0;
}

footer {
  margin-top: 2rem;
  padding: 1rem 0;
  border-top: 1px solid var(--color-border);
  text-align: center;
  color: var(--color-muted);
  font-size: 0.875rem;
}

footer .link-button {
  color: inherit;
}

dialog {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 1.5rem;
  min-width: 320px;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

dialog form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

dialog .dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Running timers banner — top of every authenticated full page */
.running-banner {
  margin: 0 0 1rem;
  padding: 0.5rem 0.75rem;
  background: var(--color-running);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.running-banner-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.running-banner-link {
  flex: 1;
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.running-banner-link:hover {
  text-decoration: underline;
}

.running-banner-since {
  color: var(--color-muted);
  font-size: 0.9rem;
  white-space: nowrap;
}
