:root {
  color-scheme: light;
  --ink: #1f2a44;
  --muted: #64728c;
  --canvas: #f4f7fb;
  --surface: #ffffff;
  --line: #e1e7f0;
  --primary: #6657d7;
  --primary-dark: #5143bd;
  --primary-soft: #f0edff;
  --success-soft: #e8f8ef;
  --success-ink: #197247;
  --danger-soft: #fff0f1;
  --danger-ink: #b42336;
  --shadow: 0 18px 50px rgba(36, 52, 82, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--canvas);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(195, 183, 255, 0.42), transparent 27rem),
    radial-gradient(circle at 95% 8%, rgba(170, 226, 212, 0.42), transparent 25rem),
    var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.skip-link {
  position: fixed;
  z-index: 5;
  top: 12px;
  left: 12px;
  padding: 8px 12px;
  color: #fff;
  background: var(--primary-dark);
  border-radius: 8px;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  border-bottom: 1px solid rgba(225, 231, 240, 0.85);
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(16px);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #8978ec, #5d4dcc);
  border-radius: 10px;
  box-shadow: 0 7px 16px rgba(91, 75, 201, 0.28);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.main-nav a {
  padding: 8px 11px;
  color: var(--muted);
  border-radius: 8px;
  font-size: 0.94rem;
  font-weight: 650;
  text-decoration: none;
}

.main-nav a:hover,
.main-nav a:focus-visible,
.main-nav a.is-current {
  color: var(--primary-dark);
  background: var(--primary-soft);
}

#app {
  padding-top: 56px;
  padding-bottom: 80px;
  outline: none;
}

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

.eyebrow {
  margin: 0 0 7px;
  color: var(--primary-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

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

h1,
h2 {
  color: var(--ink);
  letter-spacing: -0.035em;
}

h1 {
  max-width: 700px;
  margin-bottom: 8px;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.08;
}

h2 {
  margin-bottom: 5px;
  font-size: 1.26rem;
}

.page-intro,
.list-header p,
.field-help,
.metric-detail {
  color: var(--muted);
}

.page-intro {
  max-width: 650px;
  margin-bottom: 0;
  font-size: 1.04rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 750;
  text-decoration: none;
  transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:focus-visible,
.text-link:focus-visible,
.main-nav a:focus-visible,
.brand:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(102, 87, 215, 0.28);
  outline-offset: 2px;
}

.button-primary {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(89, 73, 197, 0.22);
}

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

.button-primary:disabled {
  cursor: wait;
  opacity: 0.68;
  transform: none;
}

.button-secondary {
  color: var(--primary-dark);
  background: var(--surface);
  border-color: #d9d2ff;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card,
.list-section,
.form-panel,
.empty-state,
.loading-state {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(225, 231, 240, 0.94);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 130px;
  padding: 23px 25px;
}

.metric-label {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.metric-value {
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 1.55rem;
  font-weight: 830;
  letter-spacing: -0.035em;
}

.metric-detail {
  margin-bottom: 0;
  font-size: 0.92rem;
}

.list-section {
  overflow: hidden;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 25px 25px 19px;
  border-bottom: 1px solid var(--line);
}

.list-header h2,
.list-header p {
  margin-bottom: 0;
}

.list-header p {
  font-size: 0.92rem;
}

.search-field {
  min-width: min(100%, 265px);
}

.search-field input,
.form-field input,
.form-field select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #ccd5e3;
  border-radius: 9px;
}

.search-field input::placeholder {
  color: #8792a6;
}

.table-wrapper {
  overflow-x: auto;
}

.people-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  text-align: left;
}

.people-table th {
  padding: 13px 25px;
  color: var(--muted);
  background: #fbfcfe;
  border-bottom: 1px solid var(--line);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.people-table td {
  padding: 17px 25px;
  border-bottom: 1px solid var(--line);
  color: #43506a;
  font-size: 0.94rem;
}

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

.people-table tbody tr:hover td {
  background: #fcfbff;
}

.people-table tr.is-birthday td {
  background: #f4f1ff;
}

.name-cell,
.next-birthday {
  display: grid;
  gap: 4px;
}

.name-cell strong,
.next-birthday strong,
.people-table td > strong {
  color: var(--ink);
}

.birthday-badge {
  width: fit-content;
  padding: 2px 7px;
  color: var(--success-ink);
  background: var(--success-soft);
  border-radius: 99px;
  font-size: 0.73rem;
  font-weight: 800;
}

.next-birthday span {
  color: var(--muted);
  font-size: 0.83rem;
}

.empty-state,
.loading-state {
  display: grid;
  justify-items: center;
  max-width: 650px;
  margin: 28px auto 0;
  padding: 46px 28px;
  text-align: center;
}

.empty-state h2 {
  margin: 12px 0 8px;
}

.empty-state p {
  max-width: 490px;
  margin-bottom: 22px;
  color: var(--muted);
}

.empty-icon {
  display: grid;
  width: 45px;
  height: 45px;
  place-items: center;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-radius: 14px;
  font-size: 1.2rem;
}

.loading-state {
  color: var(--muted);
}

.form-panel {
  max-width: 640px;
  padding: 29px;
}

.form-panel h2 {
  margin-bottom: 24px;
}

.person-form {
  display: grid;
  gap: 20px;
}

.form-field {
  display: grid;
  gap: 8px;
}

.form-field label {
  font-weight: 750;
}

.field-help {
  margin-bottom: 0;
  font-size: 0.86rem;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 5px;
}

.text-link {
  color: var(--primary-dark);
  font-weight: 700;
}

.form-error {
  margin: 0;
  padding: 11px 13px;
  color: var(--danger-ink);
  background: var(--danger-soft);
  border-radius: 9px;
  font-size: 0.92rem;
}

.toast {
  position: fixed;
  z-index: 4;
  right: 20px;
  bottom: 20px;
  max-width: min(390px, calc(100% - 40px));
  padding: 12px 15px;
  color: #fff;
  background: #26314a;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(31, 42, 68, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 680px) {
  .shell {
    width: min(100% - 28px, 1120px);
  }

  .header-content {
    min-height: 64px;
    gap: 10px;
  }

  .brand {
    font-size: 1rem;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
  }

  .main-nav a {
    padding: 7px 8px;
    font-size: 0.84rem;
  }

  #app {
    padding-top: 37px;
  }

  .page-heading,
  .list-header {
    display: grid;
    align-items: start;
  }

  .page-heading {
    margin-bottom: 24px;
  }

  .page-heading .button {
    width: 100%;
  }

  .metrics {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 20px;
  }

  .metric-card {
    min-height: auto;
    padding: 19px;
  }

  .list-header {
    gap: 16px;
    padding: 20px 18px 17px;
  }

  .search-field {
    width: 100%;
  }

  .table-wrapper {
    overflow: visible;
  }

  .people-table,
  .people-table tbody,
  .people-table tr,
  .people-table td {
    display: block;
    min-width: 0;
    width: 100%;
  }

  .people-table thead {
    display: none;
  }

  .people-table tr {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
  }

  .people-table tbody tr:last-child {
    border-bottom: 0;
  }

  .people-table td {
    display: grid;
    grid-template-columns: minmax(108px, 0.8fr) minmax(0, 1.2fr);
    gap: 10px;
    padding: 6px 0;
    border: 0;
  }

  .people-table td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .name-cell,
  .next-birthday {
    justify-items: start;
  }

  .form-panel {
    padding: 23px 18px;
  }
}

@media (max-width: 390px) {
  .header-content {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding: 11px 0;
  }

  .main-nav {
    width: 100%;
    justify-content: space-between;
  }
}

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

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

.dashboard-panel {
  overflow: hidden;
  min-width: 0;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(225, 231, 240, 0.94);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 24px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2,
.panel-header p {
  margin-bottom: 0;
}

.panel-header p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.9rem;
}

.panel-header .text-link {
  flex: 0 0 auto;
  font-size: 0.9rem;
  text-decoration: none;
}

.panel-content {
  padding: 4px 24px;
}

.event-list,
.routine-list,
.metric-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.event-item,
.routine-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.event-item:last-child,
.routine-item:last-child {
  border-bottom: 0;
}

.event-copy,
.routine-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.event-copy strong,
.routine-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.96rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-copy span,
.routine-meta {
  color: var(--muted);
  font-size: 0.84rem;
}

.event-when {
  flex: 0 0 auto;
  color: var(--primary-dark);
  font-size: 0.82rem;
  font-weight: 780;
  text-align: right;
}

.event-item.is-today .event-when {
  color: var(--success-ink);
}

.routine-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.routine-status {
  width: fit-content;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 800;
}

.status-overdue {
  color: var(--danger-ink);
  background: var(--danger-soft);
}

.status-today {
  color: var(--success-ink);
  background: var(--success-soft);
}

.status-upcoming {
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.list-empty {
  padding: 25px 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.button-ghost {
  min-height: 36px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-color: #ddd6ff;
  box-shadow: none;
}

.button-ghost:hover {
  color: #fff;
  background: var(--primary-dark);
}

.button-small {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.84rem;
}

.metric-upcoming {
  min-height: 130px;
}

.metric-list {
  display: grid;
  gap: 7px;
}

.metric-list li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 0.86rem;
}

.metric-list strong {
  overflow: hidden;
  min-width: 0;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-list span {
  flex: 0 0 auto;
  text-align: right;
}

@media (max-width: 680px) {
  .quick-actions {
    justify-content: stretch;
  }

  .page-heading .quick-actions .button {
    width: auto;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .panel-header {
    padding: 20px 18px 16px;
  }

  .panel-content {
    padding: 4px 18px;
  }

  .routine-item,
  .event-item {
    align-items: flex-start;
  }

  .routine-item .button {
    flex: 0 0 auto;
  }

  .people-table td[data-label="Ações"] {
    align-items: center;
  }

  .people-table td[data-label="Ações"] .button {
    width: fit-content;
  }
}

@media (max-width: 430px) {
  .quick-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .page-heading .quick-actions .button {
    width: 100%;
  }

  .metric-list li {
    display: grid;
    gap: 2px;
  }

  .metric-list span {
    text-align: left;
  }
}
