/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2e3250;
  --accent: #6c8ef7;
  --accent-hover: #8aabff;
  --danger: #e05c5c;
  --success: #52c97b;
  --warning: #e0a045;
  --text: #e4e6f0;
  --text-muted: #7c82a0;
  --radius: 8px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Login page ───────────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 3rem;
  text-align: center;
  max-width: 360px;
  width: 100%;
}

.login-card h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.login-card p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.login-card .error {
  color: var(--danger);
  margin-top: 1rem;
  font-size: 0.85rem;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s, opacity 0.15s;
}

.btn-github {
  background: var(--text);
  color: #0f1117;
  width: 100%;
  justify-content: center;
}
.btn-github:hover { background: #fff; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid transparent;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}
.btn-danger:hover { background: rgba(224,92,92,0.1); }

.btn-icon {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.4rem 0.7rem;
  font-size: 1rem;
  line-height: 1;
}
.btn-icon:hover { background: var(--surface2); color: var(--text); }

/* ── Layout ───────────────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1rem;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}

header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.date-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.date-label {
  font-size: 0.95rem;
  font-weight: 600;
  min-width: 140px;
  text-align: center;
  cursor: pointer;
}
.date-label:hover { color: var(--accent); }

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}
.user-info span { color: var(--text-muted); font-size: 0.85rem; }

main {
  flex: 1;
  padding: 1.5rem 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Add entry form ───────────────────────────────────────── */
.add-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.add-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.add-form label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.add-form input[type="text"],
.add-form input[type="time"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s;
}

.add-form input:focus { border-color: var(--accent); }

.add-form .field-desc { flex: 1; }
.add-form .field-time { width: 120px; }

/* ── Entry list ───────────────────────────────────────────── */
.entries-section { display: flex; flex-direction: column; gap: 0.5rem; }

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

.section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}

.entry-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: border-color 0.15s;
}
.entry-row:hover { border-color: var(--accent); }
.entry-row.editing { border-color: var(--accent); background: var(--surface2); }

.entry-time {
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  width: 52px;
  flex-shrink: 0;
}

.entry-desc {
  flex: 1;
  font-size: 0.95rem;
}

.entry-duration {
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  flex-shrink: 0;
  width: 100px;
}

.duration-value {
  font-weight: 600;
  color: var(--accent);
}
.duration-rounded {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.duration-open {
  color: var(--success);
  font-size: 0.8rem;
}

.entry-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.entry-row:hover .entry-actions,
.entry-row.editing .entry-actions { opacity: 1; }

/* Edit inline ─── */
.edit-inline {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex: 1;
}

.edit-inline input[type="text"],
.edit-inline input[type="time"] {
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--text);
  padding: 0.35rem 0.6rem;
  font-size: 0.9rem;
  font-family: var(--font);
  outline: none;
}
.edit-inline input[type="text"] { flex: 1; }
.edit-inline input[type="time"] { width: 110px; }

/* ── Summary panel ────────────────────────────────────────── */
.summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.summary h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}
.summary-row:last-child { border-bottom: none; }

.summary-desc {
  flex: 1;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-hours {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent);
  flex-shrink: 0;
}

.summary-total {
  display: flex;
  justify-content: space-between;
  padding-top: 0.75rem;
  font-weight: 700;
  font-size: 1rem;
  border-top: 2px solid var(--border);
  margin-top: 0.25rem;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 0;
  font-size: 0.95rem;
}

/* ── Date picker overlay ──────────────────────────────────── */
.date-input-wrap {
  position: relative;
}
.date-input-wrap input[type="date"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  top: 0; left: 0;
  width: 100%; height: 100%;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 600px) {
  .add-form { flex-wrap: wrap; }
  .add-form .field-time { width: 100%; }
  .entry-duration { display: none; }
  .summary-desc { font-size: 0.8rem; }
}
