@import './tokens.css';

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.page-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 16px 80px;
  background: var(--paper);
  min-height: 100vh;
}

h1 {
  font-size: 22px;
  margin: 0 0 4px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.subtitle {
  color: var(--muted);
  margin-bottom: 18px;
  font-size: 13px;
}

button,
a[role="button"],
[data-action] {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  padding: 0 14px;
}

button:focus-visible,
a[role="button"]:focus-visible,
[data-action]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.fab {
  position: fixed;
  bottom: 24px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  border: none;
  font-size: 28px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 100;
}

.day-row {
  border-bottom: 1px solid var(--line);
  padding: 6px 0;
}

.day-row.weekend {
  background: var(--weekend-bg);
}

.daymax {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  display: inline-block;
}
.daymax.sev-low  { background: var(--sev-low-bg);  color: var(--sev-low-fg); }
.daymax.sev-mid  { background: var(--sev-mid-bg);  color: var(--sev-mid-fg); }
.daymax.sev-high { background: var(--sev-high-bg); color: var(--sev-high-fg); }
.daymax.sev-none { background: var(--sev-none-bg); color: var(--sev-none-fg); }

.chip {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  line-height: 1.4;
  white-space: nowrap;
}
.chip-state { background: #efe7d6; color: #5a4a18; }
.chip-do    { background: #e0e8ed; color: #2a4a5a; }
.chip-event { background: #ead6e5; color: #5a1a4a; font-weight: 500; }
.chip-bp    { background: #f0e0c0; color: #5a3a00; font-variant-numeric: tabular-nums; }
.chip-med   { color: #ffffff; font-weight: 500; }
.chip-med.med-naratriptan { background: var(--med-naratriptan); }
.chip-med.med-sumatriptan { background: var(--med-sumatriptan); }
.chip-med.med-ibu         { background: var(--med-ibu); }
.chip-med.med-ass         { background: var(--med-ass); }
.chip-med.med-other       { background: var(--med-other); }

.unsynced-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e53e3e;
  color: #ffffff;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  min-width: 24px;
}
.unsynced-badge[hidden] {
  display: none;
}

.summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 16px;
  background: #fcfbf7;
}
@media (min-width: 600px) {
  .summary { grid-template-columns: repeat(4, 1fr); }
}
.sumbox h3 {
  margin: 0 0 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
}
.bignum {
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
}
.bignum small {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  margin-left: 4px;
}

.time-axis-wrap {
  display: grid;
  grid-template-columns: 48px 1fr 160px;
  gap: 6px;
  padding: 6px 0 4px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 5;
}

.day-chart {
  position: relative;
  min-height: 56px;
  padding: 2px 0;
}
.day-chart svg {
  width: 100%;
  height: 56px;
  display: block;
  overflow: visible;
}

.gridminor   { stroke: #ececec; stroke-width: 1; }
.gridmajor   { stroke: #d9d6cd; stroke-width: 1; }
.threshold   { stroke: var(--threshold); stroke-width: 1; stroke-dasharray: 3 3; }
.line        { stroke: #b03030; stroke-width: 1.5; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.dot         { stroke: #ffffff; stroke-width: 1.5; }
.dot.sev-low  { fill: var(--sev-low); }
.dot.sev-mid  { fill: var(--sev-mid); }
.dot.sev-high { fill: var(--sev-high); }
.ptlbl       { font-size: 11px; font-weight: 600; fill: #333; font-family: inherit; }

.day-notes {
  padding: 4px 4px 4px 10px;
  border-left: 1px solid var(--line);
  font-size: 11.5px;
}
.noteline {
  margin-bottom: 3px;
  display: flex;
  gap: 6px;
  align-items: flex-start;
}
.ntime {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  min-width: 34px;
  padding-top: 2px;
}
