:root {
  color-scheme: light;
  --bg: #f5f2ea;
  --ink: #1f252d;
  --muted: #68717d;
  --panel: #fffdfa;
  --line: #ddd6c8;
  --green: #28765b;
  --gold: #d89b2b;
  --coral: #d75f49;
  --blue: #315c9b;
  --soft-green: #dceee5;
  --soft-blue: #dfe9f7;
  --soft-coral: #f7ded8;
  --shadow: 0 18px 50px rgba(31, 37, 45, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(49, 92, 155, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(215, 95, 73, 0.12), transparent 30%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

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

h1,
h2,
h3,
p {
  margin: 0;
  letter-spacing: 0;
}

.eyebrow,
.muted,
.small-note {
  color: var(--muted);
}

.eyebrow {
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.tablet-shell {
  min-height: 100vh;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.cog-button {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 5;
  width: 48px;
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 1.25rem;
  box-shadow: var(--shadow);
}

.kiosk-screen {
  display: none;
}

.kiosk-screen.active {
  display: block;
}

.tablet-heading {
  min-height: 132px;
  display: grid;
  align-content: center;
}

.tablet-heading h1 {
  font-size: clamp(2.5rem, 5vw, 5rem);
  line-height: 0.95;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  height: calc(100vh - 184px);
  min-height: 430px;
}

.person-card {
  border: 1px solid rgba(221, 214, 200, 0.95);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.92);
  box-shadow: var(--shadow);
  padding: 18px;
  color: var(--ink);
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 14px;
  align-items: center;
  justify-items: center;
  text-align: center;
}

.person-avatar,
.big-avatar,
.mini-avatar {
  background:
    radial-gradient(circle at 50% 36%, rgba(255, 255, 255, 0.34), transparent 28%),
    var(--avatar-color);
  background-size: cover;
  background-position: center;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 950;
}

.person-avatar.has-photo,
.big-avatar.has-photo,
.mini-avatar.has-photo {
  background-image: var(--avatar-image);
}

.person-avatar {
  width: min(19vw, 190px);
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: clamp(2.7rem, 6vw, 5.4rem);
}

.person-card h2 {
  font-size: clamp(1.6rem, 3vw, 2.7rem);
  overflow-wrap: anywhere;
}

.metric-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #f7f3ea;
  border-radius: 8px;
  overflow: hidden;
}

.metric-table th,
.metric-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e6dece;
  font-size: clamp(0.9rem, 1.4vw, 1.1rem);
}

.metric-table th {
  color: var(--muted);
  text-align: left;
}

.metric-table td {
  text-align: right;
  font-weight: 950;
}

.back-button {
  border: 0;
  border-radius: 8px;
  min-height: 44px;
  padding: 0 18px;
  background: var(--soft-blue);
  color: var(--blue);
  font-weight: 950;
}

.child-focus {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 18px 0;
}

.big-avatar {
  width: min(22vw, 170px);
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: clamp(2.5rem, 6vw, 5rem);
}

.child-focus h2 {
  font-size: clamp(2.2rem, 5vw, 5rem);
  line-height: 0.95;
}

.focus-metrics,
.task-meta,
.item-meta,
.item-actions,
.button-row,
.xml-actions,
.two-col {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--blue);
  background: var(--soft-blue);
  font-size: 0.82rem;
  font-weight: 950;
}

.task-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

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

.task-item,
.manager-item,
.parent-summary article,
.parent-panel,
.settings-dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.94);
  box-shadow: var(--shadow);
}

.task-item {
  min-height: 110px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.task-title,
.item-title {
  font-weight: 950;
  overflow-wrap: anywhere;
}

.task-title {
  font-size: clamp(1.25rem, 2vw, 1.8rem);
}

.task-meta,
.item-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.complete-button,
.primary-button,
.secondary-button,
.danger-button,
.small-button,
.link-button,
.file-button,
.icon-button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 14px;
  font-weight: 950;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.complete-button,
.primary-button {
  color: #fff;
  background: var(--green);
}

.complete-button {
  min-width: 126px;
}

.secondary-button,
.link-button,
.file-button,
.small-button {
  color: var(--blue);
  background: var(--soft-blue);
}

.danger-button,
.small-button.warn {
  color: var(--coral);
  background: var(--soft-coral);
}

.file-button input {
  display: none;
}

.empty-state {
  display: none;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
}

.settings-dialog {
  width: min(540px, calc(100% - 28px));
  padding: 18px;
}

.settings-dialog::backdrop {
  background: rgba(31, 37, 45, 0.45);
}

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

.icon-button {
  width: 42px;
  padding: 0;
  color: var(--coral);
  background: var(--soft-coral);
}

.settings-form,
.mobile-form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 950;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: 20px;
  min-height: 20px;
}

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

select[multiple] {
  padding: 8px;
}

.xml-actions {
  margin-top: 12px;
}

.parent-shell {
  width: min(760px, calc(100% - 24px));
  margin: 0 auto;
  padding: 16px 0 38px;
}

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

.parent-header h1 {
  font-size: clamp(2rem, 9vw, 4rem);
  line-height: 0.95;
}

.parent-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.parent-summary article {
  min-height: 82px;
  padding: 12px;
}

.parent-summary strong {
  display: block;
  font-size: 1.8rem;
}

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

.parent-tabs {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  padding: 8px 0;
  background: var(--bg);
}

.parent-tab {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: #eee8dc;
  font-size: 0.78rem;
  font-weight: 950;
}

.child-lock .cog-button,
.child-lock .back-button,
.child-lock #homeScreen {
  display: none;
}

.child-lock #taskScreen {
  display: block;
}

.approval-heading {
  margin-top: 4px;
}

.approval-heading + .manager-list {
  margin-top: 10px;
}

.inline-link {
  color: var(--blue);
  font-weight: 950;
}

.parent-tab.active {
  color: #fff;
  background: var(--ink);
}

.locked-parent .parent-shell {
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
}

.parent-panel {
  display: none;
  padding: 14px;
}

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

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

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

.manager-item {
  padding: 12px;
}

.kid-manager {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
}

.mini-avatar {
  width: 56px;
  aspect-ratio: 1;
  border-radius: 50%;
}

.xml-preview {
  max-height: 240px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: #1f252d;
  color: #f5f2ea;
  font-size: 0.78rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  max-width: min(520px, calc(100% - 32px));
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  translate: -50% 18px;
  transition: opacity 180ms ease, translate 180ms ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  translate: -50% 0;
}

@media (max-width: 920px) and (orientation: landscape) {
  .tablet-shell {
    padding: 14px;
  }

  .tablet-heading {
    min-height: 86px;
  }

  .avatar-grid {
    height: calc(100vh - 114px);
    min-height: 300px;
    gap: 10px;
  }

  .person-card {
    padding: 10px;
  }

  .person-avatar {
    width: min(16vw, 130px);
  }
}

@media (max-width: 760px) {
  .avatar-grid,
  .tablet-tasks,
  .parent-summary {
    grid-template-columns: 1fr;
    height: auto;
  }

  .person-avatar {
    width: min(48vw, 180px);
  }

  .task-item,
  .parent-header {
    flex-direction: column;
    align-items: stretch;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .button-row {
    display: grid;
  }
}
