/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --bg:           #0e0f11;
  --surface:      #16181c;
  --surface-2:    #1e2026;
  --border:       #2a2d35;
  --text:         #e2e4ea;
  --text-muted:   #6b7180;
  --accent:       #4f8ef7;
  --accent-dim:   rgba(79,142,247,0.15);
  --green:        #3ecf8e;
  --amber:        #f5a623;
  --red:          #e05252;
  --radius:       10px;
  --font-mono:    'Space Mono', monospace;
  --font-body:    'DM Sans', sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ────────────────────────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.clock-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  padding: 0 28px;
}

.clock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 9px 24px;
  border-right: 1px solid var(--border);
  min-width: 110px;
}
.clock-item:first-child { padding-left: 0; }
.clock-item:last-child  { border-right: none; }

.clock-label {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.clock-time {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
}

.layout {
  display: grid;
  grid-template-columns: 300px 1fr 220px;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sidebar   { padding: 28px 20px; border-right: 1px solid var(--border); overflow-y: auto; }
.centre    { padding: 28px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; }
.right-panel { padding: 28px 20px; border-left: 1px solid var(--border); overflow-y: auto; display: flex; flex-direction: column; gap: 20px; }

/* ── Brand ─────────────────────────────────────────────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
}
.brand-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.brand-name {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--accent);
}

/* ── Date & Streak ─────────────────────────────────────────────────────────── */
.date-block { margin-bottom: 28px; }
.date-text  { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.streak-row { display: flex; align-items: center; gap: 5px; }
.streak-count { font-family: var(--font-mono); font-size: 18px; color: var(--amber); }
.streak-label { font-size: 12px; color: var(--text-muted); }

/* ── Section label ─────────────────────────────────────────────────────────── */
.section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ── Projects list ─────────────────────────────────────────────────────────── */
.projects-list { display: flex; flex-direction: column; gap: 14px; }
.project-item  { display: flex; flex-direction: column; gap: 5px; }
.project-header { display: flex; justify-content: space-between; align-items: baseline; }
.project-name  { font-size: 13px; font-weight: 500; }
.project-pct   { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.progress-track {
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

/* ── Panels ────────────────────────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.panel-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--text-muted);
}

/* ── Next task ─────────────────────────────────────────────────────────────── */
.next-task-content {
  min-height: 48px;
  margin-bottom: 14px;
}
.task-title {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 4px;
}
.task-project {
  font-size: 12px;
  color: var(--text-muted);
}
.next-task-actions { display: flex; gap: 8px; }

/* ── Timer ─────────────────────────────────────────────────────────────────── */
.timer-panel { display: flex; flex-direction: column; align-items: center; }
.timer-panel .panel-header { width: 100%; }

.timer-display {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 8px auto 20px;
}
.timer-ring  { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg     { fill: none; stroke: var(--surface-2); stroke-width: 6; }
.ring-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 553;  /* 2π × 88 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.5s;
}
.ring-progress.break-mode { stroke: var(--green); }

.timer-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.timer-mode {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.timer-time {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text);
}
.active-task-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  min-height: 60px;
  width: 100%;
  padding: 0 12px;
}
.timer-task {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  max-width: 100%;
  line-height: 1.35;
  transition: color 0.3s;
}
.timer-task.active { color: var(--text); }
.timer-task-empty  { font-size: 13px; font-weight: 400; font-style: italic; opacity: 0.4; }

.timer-controls { display: flex; gap: 10px; }
.pomodoro-counter {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn:not(:disabled):active { transform: scale(0.97); }

.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:not(:disabled):hover { opacity: 0.85; }
.btn-accent    { background: rgba(79,142,247,0.18); color: var(--accent); border: 1px solid var(--accent); }
.btn-accent:not(:disabled):hover  { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:not(:disabled):hover { border-color: var(--accent); }
.btn-ghost     { background: transparent; color: var(--text-muted); }
.btn-ghost:not(:disabled):hover { color: var(--text); }
.btn-complete  { background: var(--green); color: #0e0f11; }
.btn-complete:hover { opacity: 0.85; }

.icon-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 5px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  line-height: 1;
}
.icon-btn:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface-2);
}

/* ── Stats grid ────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.stat-item { text-align: center; }
.stat-value {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Task panel header actions ─────────────────────────────────────────────── */
.task-header-actions { display: flex; align-items: center; gap: 4px; }

/* ── Task list ─────────────────────────────────────────────────────────────── */
.task-list {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 300px; overflow-y: auto; padding-right: 4px;
}
.task-item {
  padding: 10px 12px; background: var(--surface-2);
  border-radius: 6px; border-left: 3px solid var(--border);
  transition: border-left-color 0.15s, background 0.15s;
}
.task-item--active { border-left-color: var(--accent) !important; background: rgba(79,142,247,0.08); }
.task-item-top     { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.task-item-title   { font-size: 13px; font-weight: 500; line-height: 1.35; margin-bottom: 3px; }
.task-item-meta    { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }
.task-item-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.task-active-badge {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.1em;
  color: var(--accent); padding: 2px 6px;
  border: 1px solid var(--accent); border-radius: 4px;
}

/* ── Task create form ──────────────────────────────────────────────────────── */
.task-create-form {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px; margin-bottom: 12px; display: none;
}
.task-create-form--open { display: block; }
.task-create-row { display: flex; gap: 6px; margin-top: 8px; align-items: center; flex-wrap: wrap; }
.task-input {
  background: var(--surface); border: 1px solid var(--border); border-radius: 5px;
  color: var(--text); font-family: var(--font-body); font-size: 13px;
  padding: 6px 10px; outline: none; transition: border-color 0.15s;
}
.task-input:focus { border-color: var(--accent); }
.task-input--name   { flex: 1; width: 100%; }
.task-input--select { padding: 5px 8px; background: var(--surface); }
option { background: var(--surface-2); }

/* ── Shared small button size ──────────────────────────────────────────────── */
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 4px; }

/* ── Overdue stat ──────────────────────────────────────────────────────────── */
.stat-value-overdue { color: var(--red); }

/* ── Priority chip ─────────────────────────────────────────────────────────── */
.priority-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: 4px;
  margin-bottom: 6px;
  font-weight: 700;
}
.priority-urgent { background: rgba(224,82,82,0.18);   color: var(--red); }
.priority-high   { background: rgba(245,166,35,0.18);  color: var(--amber); }
.priority-normal { background: rgba(79,142,247,0.18);  color: var(--accent); }
.priority-low    { background: rgba(107,113,128,0.18); color: var(--text-muted); }
.priority-none   { background: rgba(107,113,128,0.12); color: var(--text-muted); }

/* ── Overdue text on task card ─────────────────────────────────────────────── */
.task-overdue { font-size: 11px; color: var(--red); margin-top: 4px; }
.task-due     { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── History ───────────────────────────────────────────────────────────────── */
.history-list  { display: flex; flex-direction: column; gap: 10px; max-height: 340px; overflow-y: auto; }
.history-item  {
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 6px;
  border-left: 3px solid var(--border);
}
.history-item.accent-border { border-left-color: var(--accent); }
.history-task  { font-size: 13px; font-weight: 500; margin-bottom: 3px; }
.history-meta  { font-size: 11px; color: var(--text-muted); }

/* ── Utilities ─────────────────────────────────────────────────────────────── */
.placeholder-text { color: var(--text-muted); font-size: 13px; font-style: italic; }

/* ── News feed ─────────────────────────────────────────────────────────────── */
.news-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 380px);
  overflow-y: auto;
  padding-right: 4px;
}

.news-item {
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 6px;
  border-left: 3px solid var(--border);
  transition: border-left-color 0.15s;
}
.news-item:hover { border-left-color: var(--accent); }

.news-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  padding: 1px 5px;
  border-radius: 3px;
  margin-bottom: 5px;
  font-weight: 700;
}
.news-tag-ai        { background: rgba(79,142,247,0.15);  color: var(--accent); }
.news-tag-social    { background: rgba(62,207,142,0.15);  color: var(--green); }
.news-tag-marketing { background: rgba(245,166,35,0.15);  color: var(--amber); }

.news-headline a {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  line-height: 1.35;
  display: block;
}
.news-headline a:hover { color: var(--accent); }
.news-summary { font-size: 12px; color: var(--text-muted); margin-top: 4px; line-height: 1.45; }
.news-meta    { font-size: 10px; color: var(--text-muted); margin-top: 5px; opacity: 0.7; }

/* ── Tab nav ───────────────────────────────────────────────────────────────── */
.tab-nav {
  display: flex;
  gap: 2px;
  padding: 10px 28px 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.tab-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
  cursor: pointer;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.view { flex: 1; overflow: auto; }

/* ── Coaching ──────────────────────────────────────────────────────────────── */
.coaching-layout {
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  gap: 16px;
  padding: 20px 28px;
  height: calc(100vh - 96px);
}
.coaching-config-row { display: flex; gap: 8px; margin-bottom: 10px; }
.coaching-status { font-size: 12px; color: var(--text-muted); }
.coaching-status.live { color: var(--green); }

.coaching-main-panel { display: flex; flex-direction: column; }
.coaching-reply-text {
  flex: 1;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.6;
  padding: 4px 2px 12px;
  white-space: pre-wrap;
}
.coaching-tool-status {
  font-size: 12px;
  color: var(--amber);
  font-style: italic;
  margin-bottom: 10px;
}
.coaching-controls { display: flex; gap: 10px; margin-top: 12px; }
.coaching-controls .btn { flex: 1; padding: 14px; }
.coaching-controls .btn.recording {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.coaching-notes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 100%;
  overflow-y: auto;
}
.coaching-note-item {
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 6px;
  border-left: 3px solid var(--amber);
  font-size: 12px;
}
.coaching-note-time { color: var(--text-muted); font-size: 10px; margin-bottom: 3px; }

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Mobile / narrow viewport ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .app-wrapper { height: auto; min-height: 100vh; overflow: visible; }

  .clock-bar {
    overflow-x: auto;
    justify-content: flex-start;
    padding: 0 12px;
    -webkit-overflow-scrolling: touch;
  }
  .clock-item { min-width: 88px; padding: 8px 14px; }

  .tab-nav { padding: 8px 12px 0; }

  .layout {
    display: flex;
    flex-direction: column;
    overflow: visible;
    height: auto;
  }
  .sidebar, .centre, .right-panel {
    overflow-y: visible;
    padding: 18px 16px;
    border-right: none;
    border-left: none;
    border-bottom: 1px solid var(--border);
  }
  /* Show the timer/task first, sidebar (projects/news) and stats after */
  .sidebar { order: 2; }
  .centre  { order: 1; }
  .right-panel { order: 3; border-bottom: none; }

  .view { overflow: visible; }

  .timer-display { width: 160px; height: 160px; }
  .timer-time { font-size: 28px; }

  .news-list { max-height: none; }
  .task-list { max-height: none; }
  .history-list { max-height: none; }

  .coaching-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    padding: 16px;
    gap: 12px;
  }
  .coaching-main-panel { order: 1; }
  .coaching-config-panel { order: 2; }
  .coaching-notes-panel { order: 3; }
  .coaching-reply-text { max-height: 40vh; }
  .coaching-notes-list { max-height: 240px; }

  .coaching-controls .btn { padding: 16px 10px; font-size: 14px; }
}

@media (max-width: 480px) {
  .clock-item { min-width: 76px; padding: 6px 10px; }
  .clock-time { font-size: 14px; }
  .task-create-row { flex-direction: column; align-items: stretch; }
  .task-input--select { width: 100%; }
}
