:root {
  --bg: #f4efe7;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-strong: #ffffff;
  --text: #14213d;
  --muted: #526071;
  --accent: #1f8ac0;
  --accent-strong: #13668f;
  --success-bg: #e7f6ef;
  --success-text: #146c43;
  --line: rgba(20, 33, 61, 0.12);
  --shadow: 0 20px 40px rgba(20, 33, 61, 0.12);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(31, 138, 192, 0.18), transparent 30%),
    radial-gradient(circle at top right, rgba(19, 102, 143, 0.18), transparent 28%),
    linear-gradient(180deg, #f6f1ea 0%, #efe7db 100%);
}

.app-shell {
  width: min(100%, 1280px);
  margin: 0 auto;
  padding: 20px 16px 36px;
}

.dashboard-layout {
  display: grid;
  gap: 16px;
}

.dashboard-main,
.dashboard-side {
  display: grid;
  gap: 16px;
}

.hero-card,
.panel {
  backdrop-filter: blur(14px);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 24px;
  margin-bottom: 16px;
}

.week-trend-card {
  margin-bottom: 16px;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hero-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.hero-brand img {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.hero-card h1,
.panel h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  line-height: 1.05;
}

.hero-card h1 {
  font-size: 2rem;
  margin-top: 6px;
}

.hero-copy,
.empty-state,
.field-help {
  color: var(--muted);
}

.identity-banner {
  background: rgba(20, 33, 61, 0.07);
  border: 1px solid rgba(20, 33, 61, 0.08);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.82rem;
}

.identity-banner {
  display: inline-flex;
  margin-top: 18px;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.identity-banner strong {
  font-weight: 700;
}

.connection-loader {
  margin-top: 16px;
}

.connection-loader-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(31, 138, 192, 0.14) 0%, rgba(19, 102, 143, 0.2) 100%);
  color: var(--accent-strong);
  font: inherit;
  font-weight: 700;
  box-shadow: 0 14px 30px rgba(8, 76, 97, 0.12);
}

.connection-loader-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(19, 102, 143, 0.22);
  border-top-color: var(--accent-strong);
  animation: connection-loader-spin 0.8s linear infinite;
}

.hero-return-button {
  flex: 0 0 auto;
  margin-left: auto;
  white-space: nowrap;
}

.panel {
  padding: 18px;
  margin-bottom: 16px;
}

.panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-strong);
}

.stack {
  display: grid;
  gap: 14px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field-wide {
  grid-column: 1 / -1;
}

.field span {
  font-size: 0.92rem;
  font-weight: 700;
}

.field-help {
  margin: 4px 0 0;
  font-size: 0.9rem;
}

.field select,
.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-strong);
  padding: 14px 15px;
  font: inherit;
  color: var(--text);
}

.field textarea {
  resize: vertical;
}

.quick-hours {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

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

.quick-hours button,
.primary-button,
.secondary-button {
  border: 0;
  border-radius: 16px;
  font: inherit;
  cursor: pointer;
}

.quick-hours button {
  padding: 12px 10px;
  background: rgba(31, 138, 192, 0.08);
  color: var(--accent);
  font-weight: 700;
}

.primary-button {
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 14px 30px rgba(8, 76, 97, 0.28);
}

.secondary-button {
  padding: 10px 14px;
  background: rgba(31, 138, 192, 0.08);
  color: var(--accent-strong);
  font-weight: 700;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}

.info-card,
.feedback-card,
.entry-card,
.summary-tile,
.warning-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.info-card,
.feedback-card {
  padding: 14px;
}

.warning-card {
  padding: 14px;
  background: rgba(255, 244, 214, 0.95);
  border-color: rgba(160, 120, 20, 0.22);
  color: #6c4c00;
}

.success-card {
  padding: 14px;
  border-radius: 18px;
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid rgba(20, 108, 67, 0.18);
  font-weight: 600;
}

.is-hidden {
  display: none;
}

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

.week-chart-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 12px;
}

.week-chart-head span {
  color: var(--muted);
  font-size: 0.86rem;
}

.week-chart-head strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
}

.week-chart {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  min-height: 210px;
}

.week-chart-bar {
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: end;
  gap: 8px;
  min-height: 210px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-align: inherit;
}

.week-chart-value {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-strong);
}

.week-chart-track {
  position: relative;
  height: 150px;
  border-radius: 18px 18px 10px 10px;
  background: linear-gradient(180deg, rgba(20, 33, 61, 0.02) 0%, rgba(20, 33, 61, 0.08) 100%);
  border: 1px solid rgba(20, 33, 61, 0.06);
  overflow: hidden;
  display: flex;
  align-items: end;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.week-chart-fill {
  width: 100%;
  align-self: flex-end;
  border-radius: 14px 14px 8px 8px;
  background: linear-gradient(180deg, #66b9e3 0%, #1f8ac0 100%);
  box-shadow: 0 10px 20px rgba(31, 138, 192, 0.2);
  transition: height 0.18s ease, background 0.18s ease;
}

.week-chart-overtime {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #ffc36b 0%, #f08b1d 100%);
  box-shadow: 0 8px 16px rgba(240, 139, 29, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.45);
}

.week-chart-bar.is-selected .week-chart-fill {
  background: linear-gradient(180deg, #1782b6 0%, #13668f 100%);
}

.week-chart-bar.is-complete .week-chart-fill {
  background: linear-gradient(180deg, #73d89c 0%, #1f9d55 100%);
  box-shadow: 0 10px 20px rgba(31, 157, 85, 0.2);
}

.week-chart-bar.is-selected .week-chart-track {
  border-color: rgba(31, 138, 192, 0.35);
  box-shadow: 0 0 0 3px rgba(31, 138, 192, 0.12);
}

.week-chart-bar.is-complete.is-selected .week-chart-track {
  border-color: rgba(31, 157, 85, 0.28);
  box-shadow: 0 0 0 3px rgba(31, 157, 85, 0.12);
}

.week-chart-bar:hover .week-chart-track,
.week-chart-bar:focus-visible .week-chart-track {
  border-color: rgba(31, 138, 192, 0.28);
  box-shadow: 0 0 0 3px rgba(31, 138, 192, 0.1);
  transform: translateY(-2px);
}

.week-chart-bar.is-overtime .week-chart-value {
  color: #c96a00;
}

.week-chart-bar.is-overtime .week-chart-track {
  border-color: rgba(240, 139, 29, 0.28);
}

.week-chart-bar.is-overtime.is-selected .week-chart-track {
  box-shadow: 0 0 0 3px rgba(240, 139, 29, 0.14);
}

.week-chart-label {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.week-chart-range {
  display: block;
  margin-top: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.2;
}

.week-days-head {
  margin-bottom: 10px;
}

.week-nav {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.week-nav strong {
  text-align: center;
  font-family: "Space Grotesk", sans-serif;
}

.week-nav-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: stretch;
}

.week-nav-button {
  width: 100%;
}

.ghost-button {
  border: 1px solid rgba(31, 138, 192, 0.18);
  background: rgba(31, 138, 192, 0.06);
  color: var(--accent-strong);
  padding: 10px 16px;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.ghost-button:hover,
.ghost-button:focus-visible {
  background: rgba(31, 138, 192, 0.12);
  border-color: rgba(31, 138, 192, 0.26);
}

.summary-tile {
  padding: 14px;
}

.summary-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.summary-tile strong {
  display: block;
  margin-top: 6px;
  font-size: 1.35rem;
  font-family: "Space Grotesk", sans-serif;
}

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

.day-tile {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  text-align: left;
}

.day-tile.is-selected {
  border-color: rgba(31, 138, 192, 0.4);
  background: rgba(31, 138, 192, 0.12);
}

.day-tile.is-calendar-red {
  border-color: rgba(205, 55, 55, 0.28);
}

.day-tile.is-calendar-blue {
  border-color: rgba(31, 138, 192, 0.28);
}

.day-tile.is-calendar-green {
  border-color: rgba(31, 157, 85, 0.28);
}

.day-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.calendar-chip {
  display: inline-flex;
  margin-top: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(180, 61, 61, 0.08);
  color: #b43d3d;
  font-size: 0.72rem;
  font-weight: 700;
}

.calendar-subnote {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
}

.day-tile strong {
  display: block;
  margin-top: 4px;
  font-size: 1.05rem;
  color: var(--text);
}

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

.panel-sticky {
  position: sticky;
  top: 20px;
}

.entry-card {
  padding: 14px;
}

.entry-card header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
  margin-bottom: 6px;
}

.entry-card h3 {
  margin: 0;
  font-size: 1rem;
}

.entry-card p {
  margin: 0;
  color: var(--muted);
}

.entry-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.calendar-notice {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(20, 33, 61, 0.05);
  border: 1px solid rgba(20, 33, 61, 0.08);
  font-size: 0.84rem;
  font-weight: 700;
}

.calendar-notice.is-calendar-red {
  color: #b43d3d;
}

.calendar-notice.is-calendar-blue {
  color: var(--accent-strong);
}

.calendar-notice.is-calendar-green {
  color: #1f9d55;
}

.delete-button {
  border: 1px solid rgba(180, 54, 54, 0.2);
  background: rgba(180, 54, 54, 0.08);
  color: #9c2f2f;
  padding: 9px 12px;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.edit-button {
  border: 1px solid rgba(31, 138, 192, 0.22);
  background: rgba(31, 138, 192, 0.08);
  color: var(--accent-strong);
  padding: 9px 12px;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.feedback-card pre,
.success-card pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Consolas, monospace;
  font-size: 0.82rem;
}

@keyframes connection-loader-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media (min-width: 860px) {
  .app-shell {
    padding: 28px 24px 40px;
  }

  .hero-card {
    padding: 28px 30px;
  }

  .dashboard-layout {
    grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
    align-items: start;
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

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

  .week-nav-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .entries-list {
    max-height: 720px;
    overflow: auto;
    padding-right: 4px;
  }
}

@media (max-width: 680px) {
  .hero-head {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-return-button {
    margin-left: 0;
    width: fit-content;
  }
}

@media (max-width: 380px) {
  .quick-hours {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .week-days {
    grid-template-columns: 1fr;
  }

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