:root {
  --bg: #f2f0e8;
  --bg-deep: #e9e6dc;
  --surface: #fffdf8;
  --surface-soft: #f8f6ef;
  --surface-tint: #f2f5ef;
  --ink: #1c2a22;
  --ink-soft: #34463b;
  --muted: #6d786f;
  --muted-2: #8e978f;
  --line: #e3dfd3;
  --line-strong: #d3cec0;
  --green: #226849;
  --green-deep: #154b35;
  --green-dark: #0e3927;
  --green-soft: #e3f1e7;
  --green-mid: #9ccdb0;
  --lime: #d8efdf;
  --gold: #b57f33;
  --gold-soft: #f6ecd9;
  --red: #b34b45;
  --red-soft: #f8e8e6;
  --blue: #3d6f8e;
  --shadow-sm: 0 1px 2px rgba(28, 42, 34, 0.04), 0 8px 24px rgba(28, 42, 34, 0.04);
  --shadow-md: 0 2px 4px rgba(28, 42, 34, 0.04), 0 18px 48px rgba(28, 42, 34, 0.08);
  --shadow-lg: 0 30px 80px rgba(20, 40, 30, 0.16);
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 26px;
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    sans-serif;
  --font-display: "Avenir Next", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", "Consolas", "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 6% 2%, rgba(216, 239, 223, 0.7), transparent 32rem),
    radial-gradient(circle at 96% 14%, rgba(246, 236, 217, 0.85), transparent 30rem),
    linear-gradient(180deg, #f7f5ef 0%, var(--bg) 38%, #efede4 100%);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: 0.32;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.13'/%3E%3C/svg%3E");
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: var(--green);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

::selection {
  color: var(--green-dark);
  background: var(--lime);
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px 32px 64px;
}

/* ------------------------------------------------------------------ */
/* Topbar                                                             */
/* ------------------------------------------------------------------ */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  color: #f5f3e9;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.16), transparent 55%),
    var(--green-deep);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 8px 18px rgba(21, 75, 53, 0.18);
  place-items: center;
}

.brand-mark span {
  margin-top: -2px;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: 24px;
  font-weight: 700;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 750;
  letter-spacing: 0.12em;
  line-height: 1.2;
}

.brand-sub {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.date-chip,
.sync-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid rgba(211, 206, 192, 0.75);
  border-radius: 999px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
  font-size: 12.5px;
  backdrop-filter: blur(12px);
  white-space: nowrap;
}

.sync-chip {
  color: var(--muted);
}

.sync-dot {
  width: 7px;
  height: 7px;
  background: #57a878;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(87, 168, 120, 0.12);
}

.sync-chip.is-loading .sync-dot {
  background: var(--gold);
  animation: blink 1.2s ease-in-out infinite;
}

.sync-chip.is-error .sync-dot {
  background: var(--red);
}

/* ------------------------------------------------------------------ */
/* Tabs                                                               */
/* ------------------------------------------------------------------ */

.tabbar {
  display: flex;
  width: fit-content;
  max-width: 100%;
  gap: 4px;
  padding: 5px;
  margin-bottom: 24px;
  overflow-x: auto;
  background: rgba(255, 253, 248, 0.66);
  border: 1px solid rgba(211, 206, 192, 0.7);
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(28, 42, 34, 0.035);
  backdrop-filter: blur(14px);
  scrollbar-width: none;
}

.tabbar::-webkit-scrollbar {
  display: none;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 17px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.tab svg {
  width: 17px;
  height: 17px;
  opacity: 0.8;
}

.tab:hover {
  color: var(--green-deep);
  background: rgba(227, 241, 231, 0.62);
}

.tab.is-active {
  color: #f8f7f1;
  background: var(--green-deep);
  box-shadow: 0 5px 16px rgba(21, 75, 53, 0.18);
}

.tab.is-active svg {
  opacity: 1;
}

/* ------------------------------------------------------------------ */
/* Views and common                                                   */
/* ------------------------------------------------------------------ */

.view {
  display: none;
  animation: view-in 0.38s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.view.is-active {
  display: block;
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid rgba(216, 211, 199, 0.82);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.section-head h2,
.section-head h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.012em;
}

.section-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12.5px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
  color: var(--green);
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.eyebrow::before {
  width: 16px;
  height: 1.5px;
  content: "";
  background: currentColor;
  border-radius: 999px;
}

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

.tiny {
  color: var(--muted);
  font-size: 11.5px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.4;
  white-space: nowrap;
}

.pill.green {
  color: var(--green-deep);
  background: var(--green-soft);
  border-color: #cbe3d3;
}

.pill.amber {
  color: #7f571c;
  background: var(--gold-soft);
  border-color: #ead8b7;
}

.pill.red {
  color: #8b3530;
  background: var(--red-soft);
  border-color: #efd0cd;
}

.pill.gray {
  color: var(--muted);
  background: #f2f0e9;
}

.pill.blue {
  color: #2c5b77;
  background: #e8f1f6;
  border-color: #cfe1ea;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

/* ------------------------------------------------------------------ */
/* Hero                                                               */
/* ------------------------------------------------------------------ */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.26fr) minmax(360px, 0.74fr);
  gap: 30px;
  min-height: 284px;
  padding: 34px 38px;
  overflow: hidden;
  color: #f7f5ed;
  background:
    radial-gradient(circle at 86% 8%, rgba(177, 220, 190, 0.28), transparent 18rem),
    radial-gradient(circle at 8% 110%, rgba(164, 196, 167, 0.18), transparent 24rem),
    linear-gradient(135deg, #174d36 0%, #123f2c 50%, #0d3323 100%);
  border: 0;
  border-radius: 30px;
  box-shadow: 0 26px 70px rgba(16, 54, 37, 0.22);
}

.hero::before {
  position: absolute;
  top: -120px;
  right: -90px;
  width: 390px;
  height: 390px;
  content: "";
  border: 1px solid rgba(220, 241, 226, 0.13);
  border-radius: 50%;
  box-shadow:
    0 0 0 52px rgba(220, 241, 226, 0.035),
    0 0 0 108px rgba(220, 241, 226, 0.025),
    0 0 0 172px rgba(220, 241, 226, 0.018);
}

.hero::after {
  position: absolute;
  right: 31%;
  bottom: -70px;
  width: 210px;
  height: 210px;
  content: "";
  background: rgba(205, 232, 212, 0.05);
  border-radius: 50%;
  filter: blur(2px);
}

.hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero .eyebrow {
  color: #b9d8c3;
}

.hero-date {
  color: #d4e4d7;
  font-size: 12.5px;
  letter-spacing: 0.05em;
}

.hero h1 {
  max-width: 640px;
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: clamp(34px, 3.8vw, 54px);
  font-weight: 650;
  letter-spacing: -0.052em;
  line-height: 1.05;
}

.hero h1 em {
  position: relative;
  color: #d5efdc;
  font-style: normal;
}

.hero h1 em::after {
  position: absolute;
  right: 0;
  bottom: 2px;
  left: 0;
  height: 7px;
  content: "";
  background: rgba(180, 220, 189, 0.2);
  border-radius: 99px;
}

.hero-note {
  max-width: 500px;
  margin-top: 14px;
  color: #b8cbbd;
  font-size: 12.5px;
  line-height: 1.65;
}

.hero-clock-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 26px;
}

.hero-clock {
  font-family: var(--mono);
  font-size: clamp(26px, 3vw, 40px);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
}

.hero-clock-zone {
  padding-bottom: 4px;
  color: #a8c0ae;
  font-size: 10.5px;
  letter-spacing: 0.12em;
}

.hero-side {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-content: center;
}

.hero-stat {
  min-height: 108px;
  padding: 16px 17px;
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(221, 240, 226, 0.13);
  border-radius: 17px;
  backdrop-filter: blur(8px);
}

.hero-stat-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #a9c2af;
  font-size: 10.5px;
  letter-spacing: 0.05em;
}

.hero-stat-value {
  display: flex;
  align-items: baseline;
  gap: 3px;
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1;
}

.hero-stat-value small {
  color: #b8cebd;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
}

.hero-stat-sub {
  margin-top: 8px;
  color: #91aa97;
  font-size: 10px;
}

.hero-stat.is-accent {
  background: rgba(205, 235, 214, 0.14);
  border-color: rgba(205, 235, 214, 0.26);
}

.target-line {
  position: relative;
  height: 4px;
  margin-top: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
}

.target-line span {
  display: block;
  height: 100%;
  background: #c7e8d0;
  border-radius: inherit;
  transition: width 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ------------------------------------------------------------------ */
/* Dashboard / check-in                                               */
/* ------------------------------------------------------------------ */

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.48fr) minmax(320px, 0.52fr);
  gap: 18px;
  margin-top: 18px;
}

.checkin-card {
  padding: 26px 28px 28px;
}

.today-panel {
  display: flex;
  flex-direction: column;
  padding: 26px 24px;
}

.setup-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 18px;
  margin-bottom: 18px;
  color: #6f4f1d;
  background: linear-gradient(90deg, #fbf3e2, #f8eed9);
  border: 1px solid #ead7b4;
  border-radius: 16px;
  font-size: 12.5px;
}

.setup-banner strong {
  font-weight: 750;
}

.setup-banner a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #6f4f1d;
  font-weight: 700;
  white-space: nowrap;
}

.person-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 22px;
}

.person-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 9px 10px;
  text-align: left;
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 13px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.person-chip:hover {
  background: #f4f2ea;
  border-color: var(--line);
  transform: translateY(-1px);
}

.person-chip.is-active {
  background: var(--green-soft);
  border-color: #b9d9c5;
  box-shadow: inset 0 0 0 1px rgba(34, 104, 73, 0.04);
}

.person-chip.is-active::after {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 5px;
  height: 5px;
  content: "";
  background: var(--green);
  border-radius: 50%;
}

.person-chip .avatar {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.person-chip-copy {
  flex: 1;
  min-width: 0;
}

.person-chip-name,
.person-chip-status {
  display: block;
}

.person-chip-name {
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-chip-status {
  overflow: hidden;
  color: var(--muted);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  display: inline-grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  color: #fff;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  place-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.avatar.lg {
  width: 58px;
  height: 58px;
  font-size: 21px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 9px 20px rgba(28, 42, 34, 0.14);
}

.selected-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: linear-gradient(100deg, #f7f5ed, #fbfaf5 55%, #f1f6f1);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.selected-person {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.selected-person h3 {
  font-size: 16px;
  font-weight: 750;
  line-height: 1.3;
}

.selected-person p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.selected-state {
  flex: 0 0 auto;
  text-align: right;
}

.selected-state strong {
  display: block;
  color: var(--green-deep);
  font-family: var(--mono);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.selected-state span {
  color: var(--muted);
  font-size: 10px;
}

.checkin-stage {
  display: grid;
  grid-template-columns: 142px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  padding: 18px;
  background: #fcfbf6;
  border: 1px solid var(--line);
  border-radius: 20px;
}

.radar {
  position: relative;
  display: grid;
  width: 126px;
  height: 126px;
  margin: 0 auto;
  overflow: hidden;
  color: var(--muted);
  background:
    radial-gradient(circle, rgba(34, 104, 73, 0.06) 0 1px, transparent 1.5px) 0 0 / 11px 11px,
    radial-gradient(circle at 50% 50%, #f4f8f3, #eef2eb 68%, #e8ece5);
  border: 1px solid #dfe5dc;
  border-radius: 50%;
  place-items: center;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.radar::before,
.radar::after {
  position: absolute;
  content: "";
  border: 1px solid rgba(34, 104, 73, 0.12);
  border-radius: 50%;
}

.radar::before {
  inset: 16px;
}

.radar::after {
  inset: 34px;
}

.radar-sweep {
  position: absolute;
  inset: 0;
  background: conic-gradient(from 0deg, transparent 0 74%, rgba(34, 104, 73, 0.15) 92%, transparent 100%);
  border-radius: 50%;
  animation: radar-spin 7s linear infinite;
  opacity: 0.7;
}

.radar-pin {
  position: relative;
  z-index: 1;
  display: grid;
  width: 40px;
  height: 40px;
  color: #fff;
  background: var(--muted-2);
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 8px;
  box-shadow: 0 6px 16px rgba(28, 42, 34, 0.2);
  place-items: center;
  transform: rotate(-45deg);
  transition: background 0.3s ease;
}

.radar-pin svg {
  width: 16px;
  height: 16px;
  transform: rotate(45deg);
}

.radar.is-in .radar-pin {
  background: var(--green);
}

.radar.is-out .radar-pin {
  background: var(--red);
}

.radar.is-in {
  border-color: #b9d9c5;
  background:
    radial-gradient(circle, rgba(34, 104, 73, 0.09) 0 1px, transparent 1.5px) 0 0 / 11px 11px,
    radial-gradient(circle at 50% 50%, #f0f9f2, #e6f3e9 68%, #dcece0);
}

.radar.is-out {
  border-color: #ebc9c6;
  background:
    radial-gradient(circle, rgba(179, 75, 69, 0.08) 0 1px, transparent 1.5px) 0 0 / 11px 11px,
    radial-gradient(circle at 50% 50%, #fdf5f4, #f8e9e7 68%, #f1deda);
}

.radar.is-in .radar-sweep {
  opacity: 0.9;
}

.radar.is-out .radar-sweep {
  animation-duration: 14s;
  opacity: 0.35;
}

.radar.is-off .radar-sweep {
  display: none;
}

.location-copy {
  min-width: 0;
}

.location-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 5px;
}

.location-title h4 {
  font-size: 14px;
  font-weight: 750;
}

.location-distance {
  margin-top: 9px;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.location-distance small {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0;
}

.location-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10.5px;
}

.location-message {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.location-message.warn {
  color: #8b5b1e;
}

.location-message.error {
  color: #a23f39;
}

.location-refresh {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  margin-top: 8px;
  color: var(--green);
  background: none;
  border: 0;
  font-size: 10.5px;
  font-weight: 650;
  cursor: pointer;
}

.location-refresh:hover {
  text-decoration: underline;
}

.location-refresh svg {
  width: 12px;
  height: 12px;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 45px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease,
    border-color 0.18s ease;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:focus-visible,
.tab:focus-visible,
.person-chip:focus-visible,
.day-cell:focus-visible,
.icon-btn:focus-visible,
input:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #2b7553, #1d5b40);
  border-color: #1b553c;
  box-shadow: 0 8px 18px rgba(34, 104, 73, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #31815b, #216346);
  box-shadow: 0 10px 24px rgba(34, 104, 73, 0.26);
}

.btn-secondary {
  color: var(--green-deep);
  background: #fbfaf4;
  border-color: #cdd8cf;
}

.btn-secondary:hover:not(:disabled) {
  background: #f2f7f2;
  border-color: #b7cbbb;
}

.btn-ghost {
  min-height: 38px;
  padding: 0 13px;
  color: var(--ink-soft);
  background: transparent;
  border-color: var(--line);
  font-size: 12px;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-soft);
}

.btn-danger {
  color: #8f3b35;
  background: #fff8f7;
  border-color: #e7c9c6;
}

.btn-sm {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 11px;
}

.action-hint {
  min-height: 18px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
  text-align: center;
}

/* Today list */

.today-count {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  margin-bottom: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.progress-ring {
  --pct: 0;
  position: relative;
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  background: conic-gradient(var(--green) calc(var(--pct) * 1%), #e6e4db 0);
  border-radius: 50%;
  place-items: center;
}

.progress-ring::before {
  position: absolute;
  inset: 4px;
  content: "";
  background: var(--surface-soft);
  border-radius: 50%;
}

.progress-ring strong {
  position: relative;
  z-index: 1;
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.today-count-copy strong {
  display: block;
  font-size: 13px;
  font-weight: 750;
}

.today-count-copy span {
  color: var(--muted);
  font-size: 10px;
}

.today-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
}

.today-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid #efede6;
}

.today-row:last-child {
  border-bottom: 0;
}

.today-row .avatar {
  width: 32px;
  height: 32px;
  font-size: 11px;
}

.today-row-main {
  min-width: 0;
  flex: 1;
}

.today-row-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
}

.today-row-time {
  margin-top: 1px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
}

.today-row-state {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 9.5px;
  text-align: right;
}

.today-row-state.green {
  color: var(--green);
}

.today-row-state.amber {
  color: #9a6a22;
}

.today-row-state.red {
  color: var(--red);
}

.today-foot {
  padding-top: 12px;
  margin-top: 8px;
  color: var(--muted);
  border-top: 1px dashed var(--line);
  font-size: 10px;
  line-height: 1.55;
}

/* ------------------------------------------------------------------ */
/* Page heading / month                                               */
/* ------------------------------------------------------------------ */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 6px 2px 20px;
}

.page-head h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.3vw, 42px);
  font-weight: 680;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.page-head .eyebrow {
  margin-bottom: 8px;
}

.page-head-sub {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.page-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.month-switcher {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: rgba(255, 253, 248, 0.8);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 1px 0 #fff inset;
}

.month-switcher strong {
  min-width: 116px;
  padding: 0 8px;
  font-family: var(--font-display);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.icon-btn {
  display: inline-grid;
  width: 34px;
  height: 34px;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  place-items: center;
}

.icon-btn:hover {
  background: var(--surface-soft);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

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

.summary-card {
  position: relative;
  padding: 17px 18px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.summary-card::after {
  position: absolute;
  top: -24px;
  right: -24px;
  width: 78px;
  height: 78px;
  content: "";
  background: var(--green-soft);
  border-radius: 50%;
  opacity: 0.55;
}

.summary-label {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.04em;
}

.summary-value {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 7px;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 720;
  letter-spacing: -0.05em;
  line-height: 1;
}

.summary-value small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
}

.summary-sub {
  position: relative;
  z-index: 1;
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
}

.summary-card.is-dark {
  color: #f5f3e9;
  background:
    radial-gradient(circle at 100% 0, rgba(173, 215, 187, 0.22), transparent 8rem),
    var(--green-deep);
  border-color: var(--green-deep);
}

.summary-card.is-dark .summary-label,
.summary-card.is-dark .summary-sub,
.summary-card.is-dark .summary-value small {
  color: #b1c8b7;
}

.summary-card.is-dark::after {
  background: rgba(214, 238, 220, 0.12);
}

.table-card {
  padding: 18px 18px 10px;
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0 4px 13px;
}

.legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 10px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 3px;
}

.legend-dot.green {
  background: #cce6d5;
}

.legend-dot.red {
  background: #f2d6d2;
}

.legend-dot.gray {
  background: #e9e6de;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 15px;
  scrollbar-color: #c9c5b8 transparent;
  scrollbar-width: thin;
}

.table-scroll::-webkit-scrollbar {
  height: 7px;
}

.table-scroll::-webkit-scrollbar-thumb {
  background: #cdc9bd;
  border-radius: 99px;
}

.month-table {
  width: max-content;
  min-width: 100%;
  border-spacing: 0;
  border-collapse: separate;
  font-size: 10px;
}

.month-table th,
.month-table td {
  padding: 0;
  border-right: 1px solid #ece9df;
  border-bottom: 1px solid #ece9df;
}

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

.month-table th:last-child,
.month-table td:last-child {
  border-right: 0;
}

.month-table thead th {
  background: #f8f6ef;
}

.week-row th {
  height: 26px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-align: center;
}

.week-row th.week-start {
  border-left: 2px solid #dedacd;
}

.week-row th.weekend-week {
  background: #f4f1e8;
}

.week-row .week-range {
  color: var(--muted-2);
  font-weight: 500;
}

.day-row th {
  height: 49px;
  min-width: 48px;
}

.day-head {
  display: grid;
  gap: 1px;
  padding: 6px 2px;
  text-align: center;
}

.day-head-weekday {
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 600;
}

.day-head-date {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.day-row th.is-weekend {
  background: #f4f1e8;
}

.day-row th.is-weekend .day-head-weekday,
.day-row th.is-weekend .day-head-date {
  color: #9a9281;
}

.day-row th.is-today {
  background: #e4f1e8;
  box-shadow: inset 0 -2px 0 var(--green);
}

.day-row th.is-today .day-head-date {
  color: var(--green-deep);
}

.day-row th.is-holiday .day-head-date {
  color: var(--muted-2);
  text-decoration: line-through;
}

.person-col {
  position: sticky;
  left: 0;
  z-index: 4;
  width: 142px;
  min-width: 142px;
  padding: 0 14px !important;
  text-align: left;
  background: #fbf9f3;
  box-shadow: 1px 0 0 #e4e0d5;
}

.person-col .person-label {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 52px;
}

.person-col .avatar {
  width: 30px;
  height: 30px;
  font-size: 11px;
}

.person-col .person-name {
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.person-col .person-index {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 500;
}

.week-row .person-col {
  z-index: 6;
  background: #f4f1e8;
  vertical-align: middle;
  font-size: 9.5px;
  letter-spacing: 0.05em;
}

.day-row .person-col {
  z-index: 6;
  background: #f8f6ef;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.day-cell {
  display: grid;
  width: 100%;
  min-width: 48px;
  height: 52px;
  padding: 4px 3px;
  background: transparent;
  border: 0;
  cursor: pointer;
  place-content: center;
  transition: background 0.15s ease;
}

.day-cell:hover {
  background: #f4f6f0;
}

.day-cell .cell-in {
  color: var(--green-deep);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}

.day-cell .cell-out {
  color: #6e8f79;
  font-family: var(--mono);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.day-cell .cell-out.missing {
  color: #a8792e;
  font-family: var(--font);
  font-size: 7.5px;
}

.day-cell .cell-missing {
  display: grid;
  width: 21px;
  height: 21px;
  margin: 0 auto;
  color: #a7443e;
  background: #f9e9e7;
  border: 1px solid #f0d2cf;
  border-radius: 7px;
  font-size: 9px;
  font-weight: 700;
  place-items: center;
}

.day-cell .cell-wait {
  color: #a9792d;
  font-size: 8.5px;
  font-weight: 600;
}

.day-cell .cell-future {
  color: #c3bdb0;
  font-size: 12px;
}

.day-cell .cell-rest {
  color: #b0a997;
  font-size: 8px;
}

.day-cell.is-weekend {
  background: #faf8f2;
}

.day-cell.is-weekend:hover {
  background: #f4f1e8;
}

.day-cell.is-today {
  background: #eff8f1;
}

.day-cell.is-today:hover {
  background: #e7f4ea;
}

.day-cell.has-record .cell-in::before {
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-right: 3px;
  content: "";
  vertical-align: 1px;
  background: #5fae7b;
  border-radius: 50%;
}

.month-col {
  position: sticky;
  right: 0;
  z-index: 4;
  width: 128px;
  min-width: 128px;
  padding: 0 12px !important;
  background: #fbf9f3;
  box-shadow: -1px 0 0 #e4e0d5;
}

.week-row .month-col {
  z-index: 6;
  background: #f4f1e8;
  font-size: 9px;
  letter-spacing: 0.03em;
}

.day-row .month-col {
  z-index: 6;
  background: #f8f6ef;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 650;
  text-align: center;
}

.rate-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: 52px;
}

.rate-copy {
  min-width: 0;
}

.rate-number {
  font-family: var(--display, var(--font-display));
  font-size: 18px;
  font-weight: 720;
  letter-spacing: -0.04em;
  line-height: 1;
}

.rate-number small {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0;
}

.rate-fraction {
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
}

.rate-badge {
  display: inline-grid;
  width: 19px;
  height: 19px;
  color: #fff;
  background: var(--green);
  border-radius: 50%;
  font-size: 9px;
  place-items: center;
}

.rate-badge.warn {
  background: var(--gold);
}

.rate-badge.low {
  background: var(--red);
}

.rate-badge.none {
  color: var(--muted-2);
  background: #ebe8df;
}

.month-table tbody tr:hover .person-col,
.month-table tbody tr:hover .month-col {
  background: #f4f6ef;
}

.week-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.week-card {
  padding: 14px 15px;
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.week-card.is-current {
  background: var(--green-soft);
  border-color: #bfdcc8;
}

.week-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 9.5px;
}

.week-card-top strong {
  color: var(--ink);
  font-size: 10.5px;
}

.week-card-rate {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.week-card-rate small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
}

.week-card-bar {
  height: 3px;
  margin-top: 8px;
  overflow: hidden;
  background: #e6e3d9;
  border-radius: 99px;
}

.week-card-bar span {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: inherit;
}

/* ------------------------------------------------------------------ */
/* Stats                                                              */
/* ------------------------------------------------------------------ */

.stats-stack {
  display: grid;
  gap: 18px;
}

.stats-card {
  padding: 24px 24px 18px;
}

.stats-card-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.stats-card-head h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 720;
  letter-spacing: -0.025em;
}

.stats-card-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.stats-table {
  width: 100%;
  min-width: 760px;
  border-spacing: 0;
  border-collapse: separate;
  font-size: 11px;
}

.stats-table th,
.stats-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #eeebe2;
  text-align: center;
  white-space: nowrap;
}

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

.stats-table thead th {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.03em;
}

.stats-table thead th:first-child,
.stats-table tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 132px;
  padding-left: 6px;
  text-align: left;
  background: var(--surface);
}

.stats-table tbody tr:hover td,
.stats-table tbody tr:hover td:first-child {
  background: #faf9f3;
}

.stats-person {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stats-person .avatar {
  width: 28px;
  height: 28px;
  font-size: 10px;
}

.stats-person-name {
  font-size: 11px;
  font-weight: 700;
}

.stats-person-meta {
  color: var(--muted-2);
  font-size: 8.5px;
}

.rate-inline {
  display: inline-grid;
  gap: 2px;
  min-width: 64px;
  padding: 5px 8px;
  border-radius: 9px;
  font-variant-numeric: tabular-nums;
}

.rate-inline strong {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.rate-inline span {
  font-size: 7.5px;
  opacity: 0.72;
}

.rate-inline.good {
  color: var(--green-deep);
  background: var(--green-soft);
}

.rate-inline.mid {
  color: #7b531c;
  background: var(--gold-soft);
}

.rate-inline.low {
  color: #8c3833;
  background: var(--red-soft);
}

.rate-inline.none {
  color: var(--muted-2);
  background: #f2f0e9;
}

.rate-inline.current-week {
  box-shadow: inset 0 0 0 1px rgba(34, 104, 73, 0.2);
}

.stats-footnote {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  margin-top: 14px;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 12px;
  font-size: 10px;
  line-height: 1.55;
}

.stats-footnote svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  margin-top: 1px;
  color: var(--green);
}

.year-table {
  min-width: 900px;
}

.year-table th:first-child,
.year-table td:first-child {
  width: 90px;
  min-width: 90px;
}

.year-table tbody tr {
  cursor: pointer;
}

.year-table tbody tr:hover td {
  background: #f6f8f2;
}

.year-table tbody tr.is-current td {
  background: #eff7f1;
}

.year-table tbody tr.is-current td:first-child {
  background: #eff7f1;
}

.year-months {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
}

.year-months .avatar-dot {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
}

.year-month-note {
  color: var(--muted-2);
  font-size: 8px;
  font-weight: 500;
}

.year-total-row td {
  padding-top: 13px;
  border-top: 1px solid var(--line-strong);
}

.year-total-row td:first-child {
  font-weight: 750;
}

/* ------------------------------------------------------------------ */
/* Settings                                                           */
/* ------------------------------------------------------------------ */

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.settings-card {
  padding: 24px;
}

.settings-card + .settings-card {
  margin-top: 18px;
}

.settings-card h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.settings-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.settings-card-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.admin-gate {
  display: grid;
  gap: 16px;
  max-width: 420px;
  padding: 10px 0 6px;
}

.pin-field {
  position: relative;
}

.pin-field input {
  width: 100%;
  height: 48px;
  padding: 0 110px 0 15px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 13px;
  font-family: var(--mono);
  font-size: 18px;
  letter-spacing: 0.3em;
}

.pin-field .btn {
  position: absolute;
  top: 5px;
  right: 5px;
  min-height: 38px;
}

.form-hint {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.form-error {
  min-height: 16px;
  color: var(--red);
  font-size: 10.5px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

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

.field label,
.field-label {
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 650;
}

.field input,
.field textarea {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  color: var(--ink);
  background: #fcfbf6;
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 12px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.field input:focus,
.field textarea:focus {
  background: #fff;
  border-color: #a9c9b4;
  outline: none;
  box-shadow: 0 0 0 3px rgba(34, 104, 73, 0.07);
}

.field input.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.field-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.field-row .btn {
  flex: 0 0 auto;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.range-row input[type="range"] {
  flex: 1;
  accent-color: var(--green);
}

.range-value {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  min-width: 78px;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.range-value small {
  color: var(--muted);
  font-family: var(--font);
  font-size: 9px;
  font-weight: 500;
}

.range-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 8.5px;
}

.area-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px;
  margin-bottom: 16px;
  background:
    radial-gradient(circle at 8% 20%, rgba(216, 239, 223, 0.8), transparent 8rem),
    var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.area-preview-icon {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  color: var(--green);
  background: #fff;
  border: 1px solid #d5e4d9;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(28, 42, 34, 0.06);
  place-items: center;
}

.area-preview-icon svg {
  width: 19px;
  height: 19px;
}

.area-preview-copy {
  min-width: 0;
}

.area-preview-copy strong {
  display: block;
  overflow: hidden;
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.area-preview-copy span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.settings-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid #efede5;
}

.settings-actions .btn-primary {
  min-width: 132px;
}

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

.rules-list li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.6;
}

.rules-list b {
  color: var(--ink-soft);
  font-weight: 700;
}

.rule-num {
  display: grid;
  width: 24px;
  height: 24px;
  color: var(--green-deep);
  background: var(--green-soft);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 9px;
  font-style: normal;
  place-items: center;
}

.data-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.data-meta div {
  padding: 11px 12px;
  background: var(--surface-soft);
  border-radius: 10px;
}

.data-meta span {
  display: block;
  color: var(--muted);
  font-size: 8.5px;
}

.data-meta strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--green);
  font-size: 10.5px;
  font-weight: 650;
}

.admin-status::before {
  width: 6px;
  height: 6px;
  content: "";
  background: currentColor;
  border-radius: 50%;
}

/* ------------------------------------------------------------------ */
/* Dialog / toast / empty                                             */
/* ------------------------------------------------------------------ */

dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
}

dialog::backdrop {
  background: rgba(15, 35, 25, 0.34);
  backdrop-filter: blur(3px);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 22px 0;
}

.dialog-head h3 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.dialog-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
}

.dialog-body {
  padding: 16px 22px 4px;
}

.dialog-close {
  display: grid;
  width: 30px;
  height: 30px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  place-items: center;
}

.dialog-close svg {
  width: 14px;
  height: 14px;
}

.detail-person {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  margin-bottom: 14px;
  background: var(--surface-soft);
  border-radius: 14px;
}

.detail-person h4 {
  font-size: 14px;
  font-weight: 750;
}

.detail-person p {
  margin-top: 1px;
  color: var(--muted);
  font-size: 10px;
}

.detail-grid {
  display: grid;
  gap: 8px;
}

.detail-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid #f0eee7;
  font-size: 11px;
}

.detail-row:last-child {
  border-bottom: 0;
}

.detail-row span {
  color: var(--muted);
}

.detail-row strong {
  font-weight: 650;
  text-align: right;
}

.detail-row strong.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.detail-note {
  padding: 11px 12px;
  margin-top: 8px;
  color: #8b5b1e;
  background: var(--gold-soft);
  border-radius: 10px;
  font-size: 10px;
  line-height: 1.55;
}

.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 22px 22px;
}

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  z-index: 50;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 18px;
  color: #f6f4ec;
  background: rgba(20, 48, 34, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(15, 35, 25, 0.28);
  font-size: 12px;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  background: rgba(122, 43, 38, 0.97);
}

.toast.warn {
  background: rgba(116, 78, 24, 0.97);
}

.empty {
  display: grid;
  gap: 6px;
  padding: 30px 20px;
  color: var(--muted);
  text-align: center;
}

.empty strong {
  color: var(--ink-soft);
  font-size: 13px;
}

.empty span {
  font-size: 10.5px;
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: #eeece4;
  border-radius: 8px;
}

.skeleton::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  animation: shimmer 1.4s infinite;
}

.app-loading {
  display: grid;
  min-height: 64vh;
  place-items: center;
}

.loading-mark {
  display: grid;
  gap: 12px;
  justify-items: center;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.loading-mark .brand-mark {
  animation: float 1.8s ease-in-out infinite;
}

/* ------------------------------------------------------------------ */
/* Footer                                                             */
/* ------------------------------------------------------------------ */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 4px 0;
  color: var(--muted-2);
  font-size: 9.5px;
}

.footer a {
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* Animations                                                         */
/* ------------------------------------------------------------------ */

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes radar-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes blink {
  50% {
    opacity: 0.35;
  }
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

@keyframes float {
  50% {
    transform: translateY(-4px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ------------------------------------------------------------------ */
/* Responsive                                                         */
/* ------------------------------------------------------------------ */

@media (max-width: 1180px) {
  .app-shell {
    padding: 22px 24px 56px;
  }

  .hero {
    grid-template-columns: minmax(0, 1.1fr) minmax(330px, 0.9fr);
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1.32fr) minmax(300px, 0.68fr);
  }
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 30px;
  }

  .hero-side {
    grid-template-columns: repeat(4, 1fr);
  }

  .hero-stat {
    min-height: 92px;
    padding: 13px;
  }

  .hero-stat-value {
    font-size: 24px;
  }

  .dashboard-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .month-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .today-panel {
    min-height: 0;
  }

  .person-picker {
    grid-template-columns: repeat(5, minmax(112px, 1fr));
    padding-bottom: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .person-picker::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 720px) {
  body {
    padding-bottom: 76px;
    font-size: 14px;
  }

  .app-shell {
    padding: 16px 14px 34px;
  }

  .topbar {
    margin-bottom: 12px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .brand-mark span {
    font-size: 21px;
  }

  .brand-name {
    font-size: 17px;
  }

  .brand-sub {
    display: none;
  }

  .date-chip {
    display: none;
  }

  .sync-chip {
    min-height: 34px;
    padding: 0 11px;
    font-size: 10.5px;
  }

  .tabbar {
    position: fixed;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 30;
    display: grid;
    width: auto;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    padding: 6px;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    margin: 0;
    background: rgba(255, 253, 248, 0.93);
    border-color: rgba(203, 198, 185, 0.95);
    border-radius: 18px;
    box-shadow: 0 16px 44px rgba(24, 46, 33, 0.18);
    backdrop-filter: blur(18px);
  }

  .tab {
    flex-direction: column;
    gap: 2px;
    min-height: 52px;
    padding: 5px 2px;
    border-radius: 13px;
    font-size: 9.5px;
  }

  .tab svg {
    width: 19px;
    height: 19px;
  }

  .tab.is-active {
    color: var(--green-deep);
    background: var(--green-soft);
    box-shadow: none;
  }

  .hero {
    gap: 20px;
    padding: 23px 20px;
    border-radius: 23px;
  }

  .hero::before {
    top: -150px;
    right: -150px;
  }

  .hero h1 {
    font-size: 35px;
  }

  .hero-note {
    font-size: 11.5px;
  }

  .hero-clock-row {
    margin-top: 20px;
  }

  .hero-clock {
    font-size: 28px;
  }

  .hero-side {
    grid-template-columns: 1fr 1fr;
  }

  .hero-stat {
    min-height: 84px;
    padding: 12px 13px;
  }

  .hero-stat-value {
    margin-top: 8px;
    font-size: 23px;
  }

  .hero-stat-sub {
    white-space: nowrap;
  }

  .dashboard-grid {
    gap: 12px;
    margin-top: 12px;
  }

  .checkin-card,
  .today-panel {
    padding: 18px 15px;
    border-radius: 20px;
  }

  .setup-banner {
    align-items: flex-start;
    padding: 12px 14px;
    margin-bottom: 12px;
    font-size: 11px;
  }

  .person-picker {
    gap: 7px;
    margin-bottom: 15px;
  }

  .person-chip {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    min-width: 76px;
    padding: 8px;
  }

  .person-chip .avatar {
    width: 27px;
    height: 27px;
    font-size: 10px;
  }

  .person-chip-name {
    font-size: 11px;
  }

  .person-chip-status {
    font-size: 8.5px;
  }

  .selected-strip {
    padding: 11px 12px;
    margin-bottom: 12px;
  }

  .selected-person h3 {
    font-size: 14px;
  }

  .selected-person .avatar.lg {
    width: 45px;
    height: 45px;
    font-size: 17px;
  }

  .selected-state strong {
    font-size: 13px;
  }

  .checkin-stage {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 15px;
  }

  .radar {
    width: 104px;
    height: 104px;
  }

  .radar-pin {
    width: 34px;
    height: 34px;
  }

  .location-copy {
    text-align: center;
  }

  .location-title {
    justify-content: center;
  }

  .location-distance {
    font-size: 22px;
  }

  .action-row {
    margin-top: 14px;
  }

  .btn {
    min-height: 44px;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    padding: 2px 2px 16px;
  }

  .page-head h1 {
    font-size: 30px;
  }

  .page-actions {
    width: 100%;
    justify-content: space-between;
  }

  .month-switcher {
    width: 100%;
    justify-content: space-between;
  }

  .month-switcher strong {
    min-width: 0;
  }

  .month-summary {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
  }

  .summary-card {
    padding: 14px;
    border-radius: 15px;
  }

  .summary-value {
    font-size: 24px;
  }

  .table-card {
    padding: 12px 10px 8px;
    border-radius: 19px;
  }

  .table-toolbar {
    gap: 8px;
  }

  .legend {
    gap: 8px;
    font-size: 9px;
  }

  .month-table {
    font-size: 9.5px;
  }

  .person-col {
    width: 120px;
    min-width: 120px;
    padding: 0 10px !important;
  }

  .person-col .person-name {
    font-size: 10.5px;
  }

  .day-cell,
  .day-row th {
    min-width: 44px;
  }

  .month-col {
    width: 104px;
    min-width: 104px;
    padding: 0 9px !important;
  }

  .rate-number {
    font-size: 16px;
  }

  .rate-badge {
    width: 17px;
    height: 17px;
    font-size: 8px;
  }

  .stats-card {
    padding: 18px 14px 12px;
    border-radius: 20px;
  }

  .stats-card-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .stats-card-head h2 {
    font-size: 18px;
  }

  .settings-card {
    padding: 19px 16px;
    border-radius: 20px;
  }

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

  .field.full {
    grid-column: auto;
  }

  .admin-gate {
    max-width: none;
  }

  .pin-field input {
    padding-right: 100px;
  }

  .footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    padding-top: 22px;
  }

  .toast {
    bottom: 88px;
  }

  dialog {
    border-radius: 19px;
  }

  .dialog-head,
  .dialog-body {
    padding-right: 18px;
    padding-left: 18px;
  }

  .dialog-foot {
    padding-right: 18px;
    padding-left: 18px;
  }
}

@page {
  size: A4 landscape;
  margin: 10mm;
}

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

  body::before,
  .topbar,
  .tabbar,
  .page-actions,
  .table-toolbar .legend,
  .footer,
  .toast,
  .setup-banner {
    display: none !important;
  }

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

  .view:not(.is-active) {
    display: none;
  }

  .month-table {
    font-size: 8px;
  }

  .month-table .person-col,
  .month-table .month-col {
    position: static;
    box-shadow: none;
  }

  .table-scroll {
    overflow: visible;
    border: 0;
  }

  .card {
    box-shadow: none;
  }

  .stats-card,
  .table-card {
    break-inside: avoid;
  }
}
