:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #677181;
  --line: #dfe4ea;
  --accent: #166b5b;
  --accent-strong: #0d4f43;
  --amber: #b76e00;
  --blue: #265c9f;
  --shadow: 0 18px 45px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: #b8c2cc;
}

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

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

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

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

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

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1;
  letter-spacing: 0;
}

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

.subtitle {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.today-card,
.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.today-card {
  min-width: 188px;
  padding: 18px;
}

.today-card span,
.metric span,
.insights-grid span,
.entry-panel label,
.section-title span {
  color: var(--muted);
  font-size: 0.85rem;
}

.today-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.15rem;
}

.dashboard-grid,
.insights-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric {
  padding: 18px;
}

.metric strong,
.insights-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 1.45rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 390px) 1fr;
  gap: 18px;
  margin: 18px 0;
  align-items: start;
}

.panel {
  padding: 18px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.entry-panel {
  display: grid;
  gap: 14px;
}

.entry-panel label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.cloud-panel {
  margin-top: 18px;
}

.cloud-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.cloud-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

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

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(22, 107, 91, 0.16);
}

input[type="range"] {
  padding: 0;
  accent-color: var(--accent);
}

.range-value {
  color: var(--ink);
  font-weight: 800;
}

.actions,
.export-actions,
.view-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 150px 140px 140px;
  gap: 10px;
  margin-bottom: 14px;
}

.view-tabs {
  margin-bottom: 12px;
}

.view-tabs button {
  min-height: 34px;
}

.view-tabs .active {
  border-color: #bed9d3;
  background: #e9f4f1;
  color: var(--accent-strong);
  font-weight: 800;
}

.records-list {
  display: grid;
  gap: 10px;
}

.record,
.group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 14px;
}

.record-header,
.group-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.record-date,
.group-title {
  font-weight: 800;
}

.record-day,
.record-meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.record p {
  margin: 10px 0;
  white-space: pre-wrap;
  line-height: 1.45;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  border-radius: 999px;
  background: #eef3f6;
  color: #334155;
  padding: 4px 9px;
  font-size: 0.8rem;
  font-weight: 700;
}

.record-actions {
  display: flex;
  gap: 6px;
}

.record-actions button {
  min-height: 32px;
  padding: 0 10px;
}

.danger {
  color: #9b1c1c;
}

.insights-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.insights-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.chart {
  display: grid;
  gap: 8px;
}

.bar-row {
  display: grid;
  grid-template-columns: 132px 1fr 42px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: #e7ebef;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--blue), var(--amber));
}

.empty {
  border: 1px dashed #c8d0d8;
  border-radius: 8px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

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

  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters {
    grid-template-columns: 1fr 1fr;
  }

  .cloud-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding: 18px 0;
  }

  .dashboard-grid,
  .insights-grid,
  .filters,
  .cloud-grid {
    grid-template-columns: 1fr;
  }

  .section-title,
  .record-header,
  .group-header {
    align-items: stretch;
    flex-direction: column;
  }

  .bar-row {
    grid-template-columns: 88px 1fr 34px;
  }
}

@media print {
  body {
    background: #fff;
  }

  button,
  .entry-panel,
  .filters,
  .view-tabs {
    display: none !important;
  }

  .shell {
    width: 100%;
    padding: 0;
  }

  .panel,
  .metric,
  .today-card {
    box-shadow: none;
  }
}
