/* ============================================================
   FormLogic Pomodoro — styles (matches FormLogic Studio brand)
   ============================================================ */
:root {
  --bg:            #0F1117;
  --surface:       #1A1F2E;
  --surface-2:     #222838;
  --accent:        #00C853;
  --accent-dim:    #00A843;
  --accent-soft:   rgba(0,200,83,0.12);
  --accent-border: rgba(0,200,83,0.35);
  --fg-1:          #FFFFFF;
  --fg-2:          #CCCCCC;
  --fg-3:          #8892A6;
  --border:        rgba(255,255,255,0.08);
  --danger:        #ff5a5a;
  --radius:        14px;
  --font-display:  'Syne', system-ui, sans-serif;
  --font-body:     'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ease:          cubic-bezier(0.16,1,0.3,1);
}

* , *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--fg-1);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.02em; line-height: 1.15; }

/* ---- Buttons ---- */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #0F1117;
  font-weight: 700; font-size: 15px;
  border: none; border-radius: 10px; padding: 13px 24px;
  transition: background .2s, transform .2s, box-shadow .2s;
}
.btn-primary:hover { background: var(--accent-dim); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,200,83,0.28); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary.small { padding: 10px 16px; font-size: 14px; border-radius: 9px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--surface-2); color: var(--fg-2);
  border: 1px solid var(--border);
  transition: color .2s, border-color .2s, background .2s, transform .15s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent-border); }
.icon-btn:active { transform: scale(0.94); }
.text-btn {
  background: none; border: none; color: var(--fg-3); font-size: 14px; font-weight: 500;
  padding: 8px 10px; border-radius: 8px; transition: color .2s;
}
.text-btn:hover { color: var(--accent); }

/* ---- Fields ---- */
.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-size: 13px; color: var(--fg-2); margin-bottom: 6px; font-weight: 500; }
.field-input {
  width: 100%; background: var(--bg); color: var(--fg-1);
  border: 1px solid #333a4d; border-radius: 10px; padding: 12px 14px;
  font-family: inherit; font-size: 15px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field-input::placeholder { color: #5b6479; }
.field-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,200,83,0.12); }

/* ============================================================
   AUTH SCREENS
   ============================================================ */
.auth-body {
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(0,200,83,0.10) 0%, transparent 55%),
    var(--bg);
}
.auth-wrap { width: 100%; max-width: 420px; }
.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 36px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.auth-brand {
  font-family: var(--font-display); font-weight: 800; font-size: 20px;
  color: var(--fg-1); letter-spacing: -0.03em; text-decoration: none;
}
.auth-brand span { color: var(--accent); }
.auth-brand:hover { text-decoration: none; }
.auth-title { font-size: 26px; font-weight: 700; margin: 22px 0 6px; }
.auth-sub { color: var(--fg-3); font-size: 15px; margin-bottom: 26px; }
.auth-card .btn-primary { width: 100%; margin-top: 6px; }
.auth-switch { text-align: center; color: var(--fg-3); font-size: 14px; margin-top: 20px; }
.auth-errors {
  background: rgba(255,90,90,0.08); border: 1px solid rgba(255,90,90,0.3);
  color: #ffb3b3; border-radius: 10px; padding: 12px 14px; margin-bottom: 20px; font-size: 14px;
}
.auth-errors p + p { margin-top: 4px; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: rgba(15,17,23,0.85);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 20;
}
.brand {
  font-family: var(--font-display); font-weight: 800; font-size: 19px;
  color: var(--fg-1); letter-spacing: -0.03em;
}
.brand span { color: var(--accent); }
.brand:hover { text-decoration: none; }
.header-right { display: flex; align-items: center; gap: 10px; }
.hello { color: var(--fg-3); font-size: 14px; }
.logout-form { display: inline; }

.app-main {
  max-width: 1040px; margin: 0 auto; padding: 32px 24px 64px;
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 24px; align-items: start;
}

/* ---- Timer card ---- */
.timer-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 24px 24px;
  display: flex; flex-direction: column; align-items: center;
}
.mode-tabs {
  display: inline-flex; gap: 4px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 100px; padding: 4px; margin-bottom: 28px;
}
.mode-tab {
  background: none; border: none; color: var(--fg-3);
  font-size: 13px; font-weight: 600; padding: 8px 16px; border-radius: 100px;
  transition: color .2s, background .2s; white-space: nowrap;
}
.mode-tab:hover { color: var(--fg-1); }
.mode-tab.active { background: var(--accent-soft); color: var(--accent); }

.timer-ring-wrap { position: relative; width: 260px; height: 260px; margin-bottom: 14px; }
.timer-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 12; }
.ring-progress {
  fill: none; stroke: var(--accent); stroke-width: 12; stroke-linecap: round;
  transition: stroke-dashoffset .3s linear, stroke .3s;
}
.timer-display {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
}
.time {
  font-family: var(--font-display); font-weight: 800; font-size: 60px;
  letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--fg-1);
}
.timer-status { color: var(--fg-3); font-size: 13px; margin-top: 4px; }

.active-task {
  margin: 10px 0 18px; font-size: 14px; color: var(--fg-2);
  max-width: 100%; text-align: center;
}
.active-task strong { color: var(--accent); font-weight: 600; }

.timer-controls { display: flex; align-items: center; gap: 12px; }
.btn-start { min-width: 150px; font-size: 16px; padding: 14px 28px; }
.round-count { margin-top: 16px; color: var(--fg-3); font-size: 13px; }

/* ---- Side column ---- */
.side-col { display: flex; flex-direction: column; gap: 24px; }
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.panel-head h2 { font-size: 17px; }

/* ---- Tasks ---- */
.task-add { display: grid; grid-template-columns: 1fr 64px auto; gap: 8px; margin-bottom: 16px; }
.task-add .est { text-align: center; padding-left: 8px; padding-right: 8px; }
.task-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.task-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; transition: border-color .2s;
}
.task-item.active { border-color: var(--accent-border); background: rgba(0,200,83,0.05); }
.task-item.done .task-title { text-decoration: line-through; color: var(--fg-3); }
.task-check {
  width: 20px; height: 20px; border-radius: 6px; flex-shrink: 0;
  border: 2px solid #3a4255; background: transparent; display: inline-flex;
  align-items: center; justify-content: center; color: #0F1117; transition: background .2s, border-color .2s;
}
.task-check.on { background: var(--accent); border-color: var(--accent); }
.task-main { flex: 1; min-width: 0; cursor: pointer; }
.task-title { font-size: 14px; color: var(--fg-1); word-break: break-word; }
.task-meta { font-size: 12px; color: var(--fg-3); margin-top: 2px; }
.task-del {
  background: none; border: none; color: var(--fg-3); font-size: 18px; line-height: 1;
  padding: 4px 6px; border-radius: 6px; transition: color .2s;
}
.task-del:hover { color: var(--danger); }
.task-empty { color: var(--fg-3); font-size: 14px; text-align: center; padding: 14px 0; }

/* ---- Stats ---- */
.stat-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 20px; }
.stat { text-align: center; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 14px 8px; }
.stat-num { font-family: var(--font-display); font-weight: 800; font-size: 26px; color: var(--accent); line-height: 1; }
.stat-cap { font-size: 12px; color: var(--fg-3); margin-top: 6px; }
.chart { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; height: 120px; padding-top: 8px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bar-wrap { width: 100%; flex: 1; display: flex; align-items: flex-end; }
.chart-bar {
  width: 100%; background: var(--accent-soft); border: 1px solid var(--accent-border);
  border-radius: 6px 6px 0 0; min-height: 4px; transition: height .4s var(--ease);
  position: relative;
}
.chart-bar.has-value { background: var(--accent); border-color: var(--accent); }
.chart-day { font-size: 11px; color: var(--fg-3); }
.stat-foot { margin-top: 16px; color: var(--fg-3); font-size: 13px; text-align: center; }

/* ---- Modal ---- */
.modal {
  position: fixed; inset: 0; background: rgba(5,7,12,0.7);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 28px; width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto;
}
.modal-card h2 { font-size: 20px; margin-bottom: 20px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 8px; }
.toggle { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 14px; color: var(--fg-2); cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* ---- Toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--surface-2); color: var(--fg-1); border: 1px solid var(--border);
  padding: 12px 18px; border-radius: 10px; font-size: 14px; opacity: 0;
  transition: opacity .25s, transform .25s; z-index: 60; pointer-events: none; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: rgba(255,90,90,0.4); color: #ffb3b3; }

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .app-main { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .app-header { padding: 14px 16px; }
  .hello { display: none; }
  .app-main { padding: 20px 16px 48px; }
  .timer-ring-wrap { width: 220px; height: 220px; }
  .time { font-size: 50px; }
  .settings-grid { grid-template-columns: 1fr; }
  .task-add { grid-template-columns: 1fr 56px auto; }
}
