/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --bg:      #1a1a1a;
  --surface: #2a2a2a;
  --border:  #3a3a3a;
  --accent:  #FF8C00;
  --text:    #e0e0e0;
  --dim:     #888;
  --ok:      #8fc98f;
  --danger:  #e08080;
  --info:    #80b0e0;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Login screen ──────────────────────────────────────────────────────────── */
#login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  gap: 12px;
  max-width: 360px;
  margin: auto;
}

#login-screen h1 { font-size: 22px; font-weight: 700; color: var(--accent); }
.login-subtitle   { font-size: 12px; color: var(--dim); margin-bottom: 4px; }
.login-error      { font-size: 11px; color: var(--danger); }

#login-screen input {
  width: 100%;
  padding: 9px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
#login-screen input:focus { border-color: var(--accent); }

/* ── App shell ─────────────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 520px;
  margin: auto;
}

header {
  padding: 16px 16px 0;
}

header h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 12px;
}

main {
  flex: 1;
  padding: 16px;
}

/* ── Tabs ──────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  flex-shrink: 0;
  padding: 7px 10px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--dim);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.tab-btn:hover  { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
/* ── Form elements ─────────────────────────────────────────────────────────── */
label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  margin-top: 12px;
}
label:first-of-type { margin-top: 0; }

select,
input[type="text"],
input[type="number"],
input[type="date"],
textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
select:focus,
input:focus,
textarea:focus    { border-color: var(--accent); }
select option     { background: var(--surface); }
textarea          { resize: vertical; min-height: 56px; }

/* ── Quick-hour buttons ────────────────────────────────────────────────────── */
.quick-hours {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.qh-btn {
  flex: 1;
  min-width: 40px;
  padding: 7px 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: #ccc;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}
.qh-btn:hover    { border-color: var(--accent); color: var(--accent); }
.qh-btn.selected { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Primary submit button ─────────────────────────────────────────────────── */
.btn-submit {
  width: 100%;
  padding: 10px;
  margin-top: 16px;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  letter-spacing: 0.3px;
}
.btn-submit:hover    { background: #e07800; }
.btn-submit:disabled { background: #555; cursor: not-allowed; }

/* ── Secondary / danger buttons ────────────────────────────────────────────── */
.btn-secondary {
  padding: 7px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
  padding: 7px 12px;
  background: #3a1a1a;
  border: 1px solid #6a3a3a;
  border-radius: 5px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-danger:hover { background: #5a1a1a; }

/* ── Info box ──────────────────────────────────────────────────────────────── */
.info-box {
  background: #252525;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 11px;
  color: var(--dim);
  margin-top: 8px;
  line-height: 1.5;
}

/* ── Toast ─────────────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 240px;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  display: none;
  z-index: 999;
  pointer-events: none;
}
#toast.success { background: #2a5a2a; border: 1px solid #4a8a4a; color: var(--ok); }
#toast.error   { background: #5a1a1a; border: 1px solid #8a3a3a; color: var(--danger); }
#toast.info    { background: #1a3a5a; border: 1px solid #3a6a8a; color: var(--info); }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.card-meta {
  font-size: 10px;
  color: var(--dim);
}

/* ── Stats grid ────────────────────────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.stat-label {
  font-size: 9px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--dim);
  margin-bottom: 2px;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
}

.stat-value.ok     { color: var(--ok); }
.stat-value.danger { color: var(--danger); }

/* ── Progress bar ──────────────────────────────────────────────────────────── */
.progress-track {
  height: 4px;
  background: rgba(255,255,255,0.07);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 4px;
}

.progress-bar {
  height: 100%;
  background: #10b981;
  border-radius: 99px;
  transition: width 0.4s;
}
.progress-bar.warn   { background: var(--accent); }
.progress-bar.danger { background: #ef4444; }

/* ── List rows ─────────────────────────────────────────────────────────────── */
.list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.list-row:last-child { border-bottom: none; }

.list-row-info { flex: 1; min-width: 0; }

.list-row-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-row-meta {
  display: flex;
  gap: 6px;
  font-size: 10px;
  color: var(--dim);
  margin-top: 2px;
  flex-wrap: wrap;
}

/* ── Badges ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(255,255,255,0.07);
  color: var(--dim);
  white-space: nowrap;
}
.badge.active   { background: rgba(59,130,246,.15); color: #60a5fa; }
.badge.ready    { background: rgba(255,140,0,.15);  color: var(--accent); }
.badge.archived { background: rgba(0,0,0,.3);       color: #555; }

/* ── Section headings ──────────────────────────────────────────────────────── */
.section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--dim);
  margin: 20px 0 10px;
}

/* ── Divider ───────────────────────────────────────────────────────────────── */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  color: var(--dim);
  font-size: 12px;
  padding: 24px 0;
}

/* ── Loading spinner ───────────────────────────────────────────────────────── */
.loading {
  text-align: center;
  color: var(--dim);
  font-size: 12px;
  padding: 32px 0;
}

/* ── Status select inline ──────────────────────────────────────────────────── */
.status-select {
  font-size: 10px;
  padding: 4px 24px 4px 6px;
  width: auto;
  cursor: pointer;
}

/* ── Modal overlay ─────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal h2 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.modal-actions .btn-secondary,
.modal-actions .btn-submit {
  flex: 1;
  margin-top: 0;
}

/* ── Timer bar ─────────────────────────────────────────────────────────────── */
#timer-bar {
  padding: 5px 16px 6px;
  background: var(--bg);
}

.timer-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.timer-bar select {
  flex: 1;
  min-width: 0;
  padding: 4px 28px 4px 8px;
  font-size: 12px;
  height: 28px;
  border-radius: 4px;
}

.timer-btn {
  flex-shrink: 0;
  padding: 0 12px;
  height: 28px;
  border: none;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.3px;
  transition: background 0.15s;
}

.timer-btn.start {
  background: var(--accent);
  color: #000;
}

.timer-btn.start:hover {
  background: #e07800;
}

.timer-btn.stop {
  background: #ef4444;
  color: #fff;
}

.timer-btn.stop:hover {
  background: #dc2626;
}

.timer-running .timer-project-name {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--dim);
}

.timer-elapsed {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}
