/* Dark Stopwatch-style layout (inspired by ActivityWatch UI). */
:root {
  --bg: #1a1b1e;
  --surface: #25262b;
  --text: #f1f3f5;
  --muted: #868e96;
  --accent-green: #2f9e44;
  --accent-teal: #0c5460;
  --banner-info-bg: #0f3d44;
  --danger: #c92a2a;
  --save: #1971c2;
  --border: #373a40;
}

* {
  box-sizing: border-box;
}

body.theme-dark {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.page.narrow {
  max-width: 420px;
}

.title {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.875rem;
}

.user-line {
  margin: 0.25rem 0 0;
}

.h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}

.banner {
  padding: 0.65rem 1rem;
  border-radius: 4px;
  margin: 1rem 0;
  font-size: 0.9rem;
}

.banner-info {
  background: var(--banner-info-bg);
  color: #e3fafc;
}

.banner-error {
  background: #5c2b29;
  color: #ffc9c9;
}

.section {
  margin-top: 1.75rem;
}

.row-input {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  padding: 0.6rem 0.75rem;
  font-size: 1rem;
  width: 100%;
}

.input.flex {
  flex: 1;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
}

.btn:hover {
  filter: brightness(1.08);
}

.btn-start {
  background: var(--accent-green);
  border-color: #2b8a3e;
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
}

.btn-google {
  background: #fff;
  color: #333;
  border-color: #ccc;
}

.btn-primary {
  background: var(--save);
  border-color: #1864ab;
  color: #fff;
}

.btn-muted {
  background: #343a40;
}

.btn-danger {
  background: var(--danger);
  border-color: #a61e1e;
  color: #fff;
}

.btn-save {
  background: var(--save);
  border-color: #1864ab;
  color: #fff;
}

.btn-icon {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.running-area,
.history-block {
  background: transparent;
}

.history-date {
  font-weight: 600;
  margin: 1rem 0 0.5rem;
  color: var(--text);
}

.history-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.history-row-main {
  flex: 1;
  min-width: 0;
}

.history-label {
  font-weight: 600;
}

.history-meta {
  color: var(--muted);
  font-size: 0.875rem;
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex-shrink: 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin-top: 1rem;
}

.label {
  display: block;
  margin: 0.75rem 0 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.mono {
  font-family: ui-monospace, monospace;
  word-break: break-all;
  background: var(--bg);
  padding: 0.5rem;
  border-radius: 4px;
}

.msg {
  margin-top: 0.75rem;
}

.msg-error {
  color: #ff8787;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-body {
  padding: 1rem;
}

.modal-foot {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  gap: 0.5rem;
}

.spacer {
  flex: 1;
}

.meta-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.meta-table th,
.meta-table td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.5rem;
  vertical-align: middle;
}

.meta-table th {
  background: var(--bg);
  text-align: left;
}
