:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-muted: #f3f6f8;
  --ink: #1f2933;
  --muted: #667085;
  --line: #d8dee8;
  --accent: #0f8b8d;
  --accent-strong: #0b6d70;
  --accent-soft: #e6f6f5;
  --danger: #c24132;
  --danger-soft: #fff1ee;
  --shadow: 0 18px 48px rgba(31, 41, 51, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 28px;
  align-items: end;
  padding: 12px 0 30px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.4rem, 6vw, 5.4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.1rem;
}

.hero-copy {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.storage-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}

.storage-status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin: 0;
  border: 1px solid #c8e7e5;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 5px 12px;
  font-size: 0.84rem;
  font-weight: 800;
}

.storage-status.is-local {
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
}

.storage-status.is-error {
  border-color: rgba(194, 65, 50, 0.28);
  background: var(--danger-soft);
  color: var(--danger);
}

.account-panel {
  display: grid;
  gap: 12px;
  align-self: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  padding: 16px;
}

.account-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.account-panel strong {
  display: block;
  overflow-wrap: anywhere;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.account-message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.account-message.is-error {
  color: var(--danger);
}

.language-switcher {
  width: fit-content;
  min-width: 190px;
  margin-top: 18px;
  grid-column: 2;
  justify-self: end;
  align-self: start;
}

.language-switcher select {
  min-height: 40px;
  background: #fff;
}

.summary-grid {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.summary-card,
.entry-panel,
.log-panel {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.summary-card {
  min-height: 112px;
  border-radius: 8px;
  padding: 18px;
  border-top: 4px solid var(--accent);
}

.summary-card span {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.summary-card strong {
  font-size: clamp(1.2rem, 2vw, 1.8rem);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 420px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.side-stack {
  display: grid;
  gap: 20px;
}

.entry-panel,
.log-panel {
  border-radius: 8px;
  padding: 22px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 44px;
  padding: 10px 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field-row label:first-child {
  grid-column: 1 / -1;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.checkbox-row input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.duration-preview {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 16px 0 8px;
  border-radius: 8px;
  background: var(--accent-soft);
  padding: 14px 16px;
  color: var(--muted);
}

.duration-preview strong {
  color: var(--ink);
}

.form-error {
  min-height: 22px;
  margin-bottom: 14px;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 700;
}

.guide-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(31, 41, 51, 0.38);
  padding: 20px;
}

.guide-overlay[hidden] {
  display: none;
}

.guide-modal {
  width: min(620px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 22px;
}

.guide-steps {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.guide-language {
  margin-bottom: 16px;
}

.guide-steps article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 14px;
}

.guide-steps strong {
  display: block;
  margin-bottom: 6px;
}

.guide-steps p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.timer-state {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.timer-state.is-running {
  border-color: #c8e7e5;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.timer-display {
  display: grid;
  place-items: center;
  min-height: 92px;
  margin: 4px 0 8px;
  border: 1px solid #c8e7e5;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.timer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.timer-actions .primary-button {
  grid-column: 1 / -1;
}

.timer-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary-button,
.ghost-button,
.danger-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 9px 14px;
  font-weight: 800;
}

.primary-button {
  width: 100%;
  border: 0;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 22px rgba(15, 139, 141, 0.2);
}

.primary-button:hover {
  background: var(--accent-strong);
}

.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.ghost-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.danger-button {
  border: 1px solid rgba(194, 65, 50, 0.28);
  background: var(--danger-soft);
  color: var(--danger);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.actions button {
  min-width: 108px;
}

.compact-heading {
  margin-bottom: 12px;
}

.compact-heading span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.heading-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.small-button {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 0.82rem;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px 190px;
  gap: 12px;
  margin-bottom: 12px;
}

.category-panel,
.goals-panel,
.reports-panel {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 14px;
}

.report-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.report-kpis article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.report-kpis span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.report-kpis strong {
  font-size: 1.15rem;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.report-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.report-card-wide {
  grid-column: 1 / -1;
}

.report-card h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.report-bars {
  display: grid;
  gap: 12px;
}

.report-bar {
  display: grid;
  gap: 8px;
}

.report-bar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.86rem;
}

.report-bar-head strong,
.report-bar-head span {
  overflow-wrap: anywhere;
}

.report-bar-head span {
  color: var(--muted);
  font-weight: 800;
  text-align: right;
}

.report-bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted);
}

.report-bar-track span {
  display: block;
  width: var(--progress);
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.daily-bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  min-height: 160px;
}

.daily-bar {
  display: grid;
  grid-template-rows: minmax(100px, 1fr) auto auto;
  gap: 6px;
  min-width: 0;
  text-align: center;
}

.daily-bar-track {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-muted);
}

.daily-bar-track span {
  width: 100%;
  height: var(--height);
  min-height: 0;
  border-radius: 8px 8px 0 0;
  background: var(--accent);
}

.daily-bar strong,
.daily-bar small {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.category-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.category-total {
  display: grid;
  gap: 8px;
  min-height: 78px;
  border: 1px solid #c8e7e5;
  border-radius: 8px;
  background: linear-gradient(180deg, #f5fbfb, #edf8f7);
  padding: 12px;
}

.category-total span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.category-total strong {
  font-size: 1.2rem;
}

.goal-list {
  display: grid;
  gap: 12px;
}

.subsection-title {
  margin: 14px 0 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.goal-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.goal-card[role="button"] {
  cursor: pointer;
}

.goal-card[role="button"]:hover {
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(31, 41, 51, 0.08);
}

.goal-card[role="button"]:focus {
  outline: 3px solid rgba(15, 139, 141, 0.18);
  outline-offset: 2px;
}

.goal-card.is-done {
  border-color: #a7d8d5;
  background: #f6fcfb;
}

.goal-head,
.goal-stats {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.goal-title {
  display: grid;
  gap: 4px;
}

.goal-title strong {
  color: var(--ink);
}

.goal-title span,
.goal-stats {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.goal-progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted);
}

.goal-progress span {
  display: block;
  width: var(--progress);
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.goal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.goal-actions label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.goal-actions input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.link-button {
  min-height: 32px;
  border: 0;
  background: transparent;
  color: var(--danger);
  padding: 4px 0;
  font-weight: 800;
}

.created-categories {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

#createdCategoryList {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  border: 1px solid #c8e7e5;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 6px 10px;
  font-size: 0.84rem;
  font-weight: 800;
}

.category-chip span {
  overflow-wrap: anywhere;
}

.category-chip button {
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  padding: 0;
  font-weight: 900;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  background: #f8fafc;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #f9fcfc;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.event-title {
  display: grid;
  gap: 4px;
}

.event-title strong {
  color: var(--ink);
}

.event-title span {
  color: var(--muted);
  font-size: 0.86rem;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.row-actions button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.86rem;
  font-weight: 800;
}

.row-actions .delete {
  color: var(--danger);
}

.empty-state {
  margin: 16px 0 0;
  color: var(--muted);
  text-align: center;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.pagination button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 6px 10px;
  font-weight: 900;
}

.pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

@media (max-width: 980px) {
  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .language-switcher,
  .summary-grid {
    grid-column: auto;
  }

  .summary-grid,
  .filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 22px, 1180px);
    padding-top: 24px;
  }

  .summary-grid,
  .report-kpis,
  .report-grid,
  .field-row,
  .filters {
    grid-template-columns: 1fr;
  }

  .entry-panel,
  .log-panel {
    padding: 16px;
  }

  .controls-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions {
    width: 100%;
    justify-content: flex-start;
  }

  .actions button {
    flex: 0 1 auto;
  }
}
