:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #1f2937;
  --muted: #687386;
  --line: #dfe5ef;
  --accent: #1f8a70;
  --accent-dark: #146554;
  --accent-soft: #e5f5f1;
  --empty-fill: #eef2f7;
  --half-fill: #dceeff;
  --half-ink: #1d5fae;
  --full-fill: #eadfff;
  --full-ink: #6f42c1;
  --leave: #d95d5d;
  --leave-soft: #fff0f0;
  --shadow: 0 18px 50px rgba(34, 48, 74, 0.12);
}

* {
  box-sizing: border-box;
  min-width: 0;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  width: 100%;
  max-width: 100%;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(31, 138, 112, 0.08), transparent 32%),
    linear-gradient(315deg, rgba(64, 91, 173, 0.08), transparent 30%),
    var(--bg);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Noto Sans SC",
    system-ui,
    sans-serif;
}

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

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
}

.auth-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 22px;
}

.auth-card {
  position: relative;
  overflow: hidden;
  width: min(430px, 100%);
  padding: 26px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(223, 229, 239, 0.92);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.auth-card::before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(145deg, rgba(31, 138, 112, 0.13), transparent 34%),
    linear-gradient(330deg, rgba(49, 95, 189, 0.09), transparent 38%);
  pointer-events: none;
}

.auth-card > * {
  position: relative;
  z-index: 1;
}

.auth-brand {
  text-align: center;
  margin-bottom: 22px;
}

.auth-brand h1 {
  position: relative;
  display: inline-block;
  max-width: 100%;
  margin: 0 auto;
  color: #073f3a;
  font-family:
    "Georgia",
    "Palatino Linotype",
    "Times New Roman",
    "Microsoft YaHei",
    serif;
  font-size: clamp(2.35rem, 10vw, 3.6rem);
  font-weight: 900;
  line-height: 0.94;
  letter-spacing: 0.01em;
  text-wrap: balance;
  text-shadow:
    0 2px 0 rgba(255, 255, 255, 0.96),
    0 10px 24px rgba(20, 101, 84, 0.18),
    0 1px 1px rgba(7, 63, 58, 0.18);
  transform: rotate(-1deg);
  transform-origin: center bottom;
}

.auth-brand h1::before {
  position: absolute;
  z-index: -1;
  top: 0.2em;
  right: -0.22em;
  left: -0.22em;
  height: 0.58em;
  content: "";
  background: linear-gradient(90deg, rgba(214, 247, 239, 0.96), rgba(224, 232, 255, 0.7));
  border-radius: 999px;
  transform: rotate(1.5deg);
}

.auth-brand h1::after {
  position: absolute;
  right: 9%;
  bottom: -0.18em;
  left: 9%;
  height: 5px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(31, 138, 112, 0.8), transparent);
  border-radius: 999px;
}

.auth-brand p:last-child {
  max-width: 25rem;
  margin: 20px auto 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

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

.email-login-fields {
  display: grid;
  gap: 14px;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.auth-form.single-action .auth-actions {
  grid-template-columns: 1fr;
}

.is-signed-in .auth-screen {
  display: none;
}

.is-signed-out .app-shell {
  display: none;
}

.is-signed-out .assistant-fab,
.is-signed-out .assistant-panel {
  display: none;
}

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

.topbar {
  display: grid;
  align-items: start;
  justify-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.topbar > div:first-child {
  width: 100%;
  text-align: center;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
}

.topbar h1 {
  display: inline-block;
  color: #073f3a;
  font-family:
    "Georgia",
    "Palatino Linotype",
    "Times New Roman",
    "Microsoft YaHei",
    serif;
  font-size: clamp(2.5rem, 5vw, 4.1rem);
  font-weight: 900;
  letter-spacing: 0.01em;
  text-shadow:
    0 2px 0 rgba(255, 255, 255, 0.95),
    0 8px 18px rgba(15, 118, 110, 0.22),
    0 1px 1px rgba(7, 63, 58, 0.22);
  -webkit-text-stroke: 0.35px rgba(255, 255, 255, 0.72);
  -webkit-box-reflect: below -0.48em linear-gradient(transparent 66%, rgba(7, 63, 58, 0.12));
}

.auth-brand h1 .title-word,
.topbar h1 .title-word {
  display: inline-block;
  white-space: nowrap;
}

.auth-brand h1 .title-char,
.topbar h1 .title-char {
  display: inline-block;
  transform-origin: center bottom;
  animation: title-letter-wave 3.2s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.075s);
}

.auth-brand h1 .title-space,
.topbar h1 .title-space {
  display: inline-block;
  width: 0.28em;
}

@keyframes title-letter-wave {
  0%,
  30%,
  100% {
    transform: translateY(0) scale(1);
  }

  7% {
    transform: translateY(-12px) scale(1.04);
  }

  14% {
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-brand h1 .title-char,
  .topbar h1 .title-char {
    animation: none;
  }
}

.month-summary,
.month-picker,
.calendar-panel {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(223, 229, 239, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.month-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(124px, 0.48fr) auto;
  width: min(620px, 100%);
  gap: 8px;
  align-items: stretch;
  padding: 10px;
  border-radius: 12px;
}

.month-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
}

.month-button,
.work-days-button {
  display: grid;
  min-height: 52px;
  align-content: center;
  gap: 4px;
  padding: 8px 14px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.month-button:hover,
.work-days-button:hover {
  border-color: rgba(31, 138, 112, 0.38);
  box-shadow: 0 8px 22px rgba(31, 138, 112, 0.1);
}

.month-button span,
.work-days-button span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.month-button strong,
.work-days-button strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 1.28rem;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-days-button {
  text-align: center;
}

.work-days-button strong {
  color: var(--accent-dark);
  font-size: 1.6rem;
}

.topbar-actions {
  display: grid;
  width: 100%;
  gap: 10px;
  justify-items: center;
}

.secondary-button {
  min-height: 44px;
  padding: 0 16px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border: 1px solid rgba(31, 138, 112, 0.16);
  border-radius: 8px;
  font-weight: 900;
}

.secondary-button:hover {
  background: #d8eee8;
}

.sync-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: min(100%, 360px);
  padding: 10px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(223, 229, 239, 0.88);
  border-radius: 12px;
  box-shadow: 0 10px 26px rgba(34, 48, 74, 0.08);
}

.sync-user div {
  display: grid;
  gap: 4px;
  text-align: right;
}

.sync-user span {
  color: var(--ink);
  font-weight: 900;
}

.sync-user strong {
  color: var(--accent-dark);
  font-size: 0.82rem;
}

.select-wrap,
.money-input,
.field {
  display: grid;
  gap: 6px;
}

.select-wrap span,
.money-input span,
.field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

select,
input,
textarea {
  width: 100%;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

select,
input {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 86px;
  padding: 12px;
  resize: vertical;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(31, 138, 112, 0.14);
}

.icon-button {
  width: 42px;
  height: 42px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border: 0;
  border-radius: 8px;
  font-size: 1.7rem;
  line-height: 1;
}

.month-summary .icon-button {
  height: auto;
  min-height: 52px;
}

.mode-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-pill span {
  display: grid;
  min-height: 43px;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
  transition:
    color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.mode-pill input:checked + span {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 10px 22px rgba(31, 138, 112, 0.22);
}

.money-input.compact {
  max-width: 180px;
}

.hidden {
  display: none !important;
}

.calendar-panel {
  overflow: hidden;
  border-radius: 16px;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid var(--line);
}

.calendar-toolbar-title h2 {
  font-size: 1.2rem;
}

.fill-controls {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.fill-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  min-width: 250px;
  padding: 5px;
  background: #edf1f7;
  border-radius: 10px;
}

.quick-fill-field {
  width: 150px;
}

.calendar-panel.quick-mode .day-cell:not(.is-empty):hover {
  box-shadow:
    inset 0 0 0 2px rgba(31, 138, 112, 0.44),
    0 10px 24px rgba(31, 138, 112, 0.12);
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekday-row {
  color: #536073;
  background: #eef3f8;
  border-bottom: 1px solid var(--line);
  font-size: 0.86rem;
  font-weight: 800;
}

.weekday-row span {
  padding: 14px 10px;
  text-align: center;
}

.calendar-grid {
  background: var(--line);
  gap: 1px;
}

.day-cell {
  position: relative;
  min-height: 128px;
  padding: 12px;
  text-align: left;
  background: rgba(255, 255, 255, 0.94);
  border: 0;
  transition:
    background 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.day-cell:hover {
  z-index: 2;
  background: #fff;
  box-shadow: inset 0 0 0 2px rgba(31, 138, 112, 0.36);
}

.day-cell.is-readonly {
  cursor: default;
}

.day-cell.is-readonly:hover {
  background: inherit;
  box-shadow: none;
}

.day-cell:focus-visible {
  z-index: 3;
  outline: 3px solid rgba(31, 138, 112, 0.32);
  outline-offset: -3px;
}

.day-cell.is-empty {
  cursor: default;
  background: #f4f7fb;
}

.day-cell.status-empty {
  background: var(--empty-fill);
}

.day-cell.status-empty:hover {
  background: #f7f9fc;
}

.day-cell.status-empty .status-badge {
  display: none;
}

.day-number {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--ink);
  background: #f0f4f8;
  border-radius: 8px;
  font-weight: 900;
}

.day-cell.is-today .day-number {
  color: #fff;
  background: var(--accent);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-top: 12px;
  padding: 4px 9px;
  color: var(--muted);
  background: #f0f4f8;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
}

.day-cell.status-work .status-badge {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.day-cell.status-work-half {
  background: var(--half-fill);
}

.day-cell.status-work-half:hover {
  background: #eef7ff;
}

.day-cell.status-work-half .day-number {
  color: #fff;
  background: var(--half-ink);
}

.day-cell.status-work-half .status-badge {
  color: var(--half-ink);
  background: rgba(255, 255, 255, 0.72);
}

.day-cell.status-work-full {
  background: var(--full-fill);
}

.day-cell.status-work-full:hover {
  background: #f4edff;
}

.day-cell.status-work-full .day-number {
  color: #fff;
  background: var(--full-ink);
}

.day-cell.status-work-full .status-badge {
  color: var(--full-ink);
  background: rgba(255, 255, 255, 0.72);
}

.day-cell.is-today .day-number {
  color: #fff;
  background: var(--accent);
}

.day-cell.is-today .status-badge,
.day-cell.is-today.status-work-half .status-badge,
.day-cell.is-today.status-work-full .status-badge,
.day-cell.is-today.status-leave .status-badge {
  color: var(--accent-dark);
  background: rgba(255, 255, 255, 0.78);
}

.day-cell.status-leave .status-badge {
  color: #b64040;
  background: var(--leave-soft);
}

.day-note-preview {
  display: -webkit-box;
  margin-top: 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.day-dialog,
.picker-dialog,
.summary-dialog {
  width: min(440px, calc(100% - 28px));
  max-width: calc(100vw - 28px);
  padding: 0;
  border: 0;
  border-radius: 16px;
  box-shadow: 0 28px 90px rgba(20, 32, 54, 0.28);
}

.summary-dialog {
  width: min(520px, calc(100% - 28px));
}

.day-dialog::backdrop,
.picker-dialog::backdrop,
.summary-dialog::backdrop {
  background: rgba(19, 29, 43, 0.48);
  backdrop-filter: blur(3px);
}

.picker-form,
.summary-detail-form {
  display: grid;
  gap: 16px;
  max-width: 100%;
  padding: 22px;
  background: #fff;
}

.dialog-month-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  box-shadow: none;
}

.summary-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.detail-item {
  display: grid;
  gap: 7px;
  min-height: 84px;
  align-content: center;
  padding: 12px;
  background: #f7fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-item span,
.detail-list span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.2;
}

.detail-item strong {
  color: var(--ink);
  font-size: 1.45rem;
  line-height: 1;
}

.detail-list {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: #f8fbfa;
  border: 1px solid rgba(31, 138, 112, 0.12);
  border-radius: 8px;
}

.detail-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-list strong {
  text-align: right;
}

.detail-list p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.support-dialog {
  width: min(360px, calc(100% - 40px));
  padding: 0;
  border: 0;
  border-radius: 18px;
  box-shadow: 0 28px 90px rgba(20, 32, 54, 0.28);
}

.support-dialog::backdrop {
  background: rgba(19, 29, 43, 0.48);
  backdrop-filter: blur(3px);
}

.support-dialog-card {
  display: grid;
  gap: 16px;
  padding: 24px;
  text-align: center;
  background: #fff;
}

.support-dialog-card p {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.45;
}

.support-dialog-card strong {
  overflow-wrap: anywhere;
  color: var(--accent-dark);
  font-size: 1.08rem;
}

.support-dialog-card .primary-button {
  width: 100%;
}

.assistant-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  color: #fff;
  background: #ffffff;
  border: 0;
  border-radius: 17px;
  box-shadow: 0 18px 38px rgba(25, 60, 110, 0.2);
  will-change: transform;
  animation: assistant-fab-hop 2.8s ease-in-out infinite;
  transition:
    box-shadow 160ms ease,
    transform 180ms ease;
}

.assistant-fab:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 22px 46px rgba(25, 60, 110, 0.26);
}

.assistant-fab.is-paused {
  animation-play-state: paused;
  box-shadow:
    0 18px 38px rgba(25, 60, 110, 0.2),
    0 0 0 5px rgba(48, 112, 231, 0.12);
}

@keyframes assistant-fab-hop {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .assistant-fab {
    animation: none;
  }
}

.assistant-chat-icon {
  position: relative;
  display: block;
  width: 37px;
  height: 31px;
}

.assistant-chat-shadow {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 20px;
  height: 22px;
  background: #ff8a25;
  border-radius: 4px 6px 6px 4px;
}

.assistant-chat-bubble {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  width: 30px;
  height: 25px;
  place-items: center;
  background: #3478f6;
  border-radius: 4px 4px 4px 2px;
  box-shadow: 0 2px 0 rgba(31, 63, 140, 0.1);
}

.assistant-chat-bubble::after {
  position: absolute;
  bottom: -5px;
  left: 4px;
  width: 9px;
  height: 8px;
  content: "";
  background: #3478f6;
  clip-path: polygon(0 0, 100% 0, 0 100%);
}

.assistant-chat-smile {
  width: 12px;
  height: 6px;
  border-bottom: 2.5px solid #ffffff;
  border-radius: 0 0 12px 12px;
}

.assistant-panel {
  position: fixed;
  right: 22px;
  bottom: 92px;
  z-index: 21;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  width: min(420px, calc(100vw - 28px));
  max-height: min(720px, calc(100vh - 118px));
  overflow: hidden;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(223, 229, 239, 0.94);
  border-radius: 16px;
  box-shadow: 0 28px 90px rgba(20, 32, 54, 0.22);
  backdrop-filter: blur(16px);
}

.assistant-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.assistant-head h2 {
  font-size: 1.1rem;
}

.assistant-messages {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 250px;
  overflow-y: auto;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(245, 247, 251, 0.78), transparent 34%),
    #fff;
}

.assistant-message {
  display: grid;
  gap: 7px;
  width: fit-content;
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.assistant-message p {
  margin: 0;
}

.assistant-message ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.84rem;
}

.assistant-message.is-user {
  justify-self: end;
  color: #fff;
  background: var(--accent);
  border-bottom-right-radius: 4px;
}

.assistant-message.is-bot {
  justify-self: start;
  color: var(--ink);
  background: #eef3f8;
  border-bottom-left-radius: 4px;
}

.assistant-message.is-system {
  justify-self: center;
  max-width: 94%;
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--line);
  text-align: center;
}

.assistant-pending {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  background: #f8fbfa;
  border-top: 1px solid var(--line);
}

.assistant-pending strong {
  color: var(--accent-dark);
  font-size: 0.92rem;
}

.assistant-pending ul {
  display: grid;
  gap: 4px;
  max-height: 112px;
  overflow-y: auto;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.42;
}

.assistant-pending-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.assistant-form {
  display: grid;
  gap: 10px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
}

.assistant-input-label {
  display: grid;
  gap: 6px;
}

.assistant-input-label span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.assistant-input-label textarea {
  min-height: 58px;
  max-height: 140px;
  resize: vertical;
}

.assistant-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.assistant-actions .primary-button,
.assistant-actions .secondary-button {
  width: 100%;
}

.day-form {
  display: grid;
  gap: 16px;
  padding: 22px;
  max-width: 100%;
}

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

.close-button {
  width: 38px;
  height: 38px;
  color: var(--muted);
  background: #f1f4f8;
  border: 0;
  border-radius: 8px;
  font-size: 1.35rem;
  line-height: 1;
}

.dialog-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
}

.dialog-actions.single {
  display: grid;
  grid-template-columns: 1fr;
}

.primary-button,
.ghost-button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  font-weight: 900;
}

.primary-button {
  color: #fff;
  background: var(--accent);
  border: 0;
}

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

.primary-button:disabled {
  opacity: 0.62;
  background: #8aa49d;
  box-shadow: none;
}

.ghost-button {
  color: var(--leave);
  background: #fff;
  border: 1px solid #f0caca;
}

@media (max-width: 860px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    justify-items: stretch;
  }

  .month-summary,
  .month-picker {
    width: 100%;
  }

  .sync-user {
    min-width: 0;
  }

  .calendar-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .fill-controls {
    justify-content: stretch;
  }

  .fill-mode,
  .quick-fill-field {
    flex: 1 1 220px;
  }

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

  .day-cell {
    min-height: 106px;
    padding: 9px;
  }
}

@media (max-width: 620px) {
  .auth-screen {
    align-items: start;
    padding: 18px 14px;
  }

  .auth-card {
    margin-top: 8vh;
    padding: 22px;
    border-radius: 14px;
  }

  .auth-actions {
    grid-template-columns: 1fr;
  }

  .app-shell {
    display: flex;
    width: 100%;
    max-width: 100vw;
    flex-direction: column;
    margin: 0;
    overflow-x: hidden;
    padding: 10px 8px 14px;
  }

  .topbar {
    order: 1;
    gap: 8px;
    width: 100%;
    margin-bottom: 8px;
  }

  .topbar h1 {
    color: #073f3a;
    max-width: 100%;
    overflow: visible;
    font-size: clamp(1.55rem, 7.4vw, 2.18rem);
    letter-spacing: -0.01em;
    line-height: 1.05;
    white-space: nowrap;
  }

  .topbar h1 .title-space {
    width: 0.2em;
  }

  .topbar-actions {
    gap: 8px;
    width: 100%;
    justify-items: stretch;
  }

  .month-summary {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) minmax(76px, 0.46fr) 34px;
    width: 100%;
    max-width: 100%;
    gap: 6px;
    padding: 7px;
    border-radius: 10px;
  }

  .month-button,
  .work-days-button {
    min-height: 38px;
    gap: 3px;
    padding: 5px 8px;
  }

  .month-button span,
  .work-days-button span {
    font-size: 0.58rem;
  }

  .month-button strong {
    font-size: 0.9rem;
  }

  .work-days-button strong {
    font-size: 1.18rem;
  }

  .month-picker {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
    gap: 6px;
    padding: 7px;
    border-radius: 10px;
  }

  .month-picker .select-wrap {
    gap: 0;
  }

  .month-picker .select-wrap span {
    display: none;
  }

  .month-picker select {
    min-height: 38px;
    padding: 0 8px;
  }

  .icon-button {
    width: 34px;
    height: 38px;
    border-radius: 8px;
    font-size: 1.25rem;
  }

  .month-summary .icon-button {
    min-height: 38px;
  }

  .sync-user {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
    max-width: 100%;
    gap: 8px;
    min-width: 0;
    padding: 7px 8px;
    box-shadow: 0 6px 18px rgba(34, 48, 74, 0.07);
    border-radius: 10px;
  }

  .sync-user div {
    text-align: left;
  }

  .sync-user span {
    overflow: hidden;
    font-size: 0.84rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sync-user strong {
    font-size: 0.74rem;
  }

  .sync-user .secondary-button {
    min-height: 36px;
    padding: 0 12px;
  }

  .fill-mode,
  .quick-fill-field {
    width: 100%;
    min-width: 0;
  }

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

  .detail-item {
    min-height: 74px;
    padding: 10px;
  }

  .detail-item strong {
    font-size: 1.22rem;
  }

  .calendar-panel {
    order: 3;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    border-radius: 12px;
  }

  .calendar-toolbar {
    gap: 8px;
    width: 100%;
    max-width: 100%;
    padding: 8px;
  }

  .calendar-toolbar-title {
    display: none;
  }

  .fill-controls {
    width: 100%;
    max-width: 100%;
    gap: 8px;
  }

  .fill-mode {
    min-width: 0;
    max-width: 100%;
    padding: 4px;
  }

  .weekday-row,
  .calendar-grid {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .weekday-row span,
  .day-cell {
    min-width: 0;
  }

  .fill-mode .mode-pill span {
    min-height: 36px;
    font-size: 0.82rem;
  }

  .weekday-row span {
    padding: 9px 1px;
    font-size: 0.68rem;
  }

  .day-cell {
    display: grid;
    min-height: 60px;
    align-content: start;
    justify-items: center;
    overflow: hidden;
    padding: 5px 3px;
    text-align: center;
  }

  .day-number {
    width: 25px;
    height: 25px;
    border-radius: 7px;
    font-size: 0.78rem;
  }

  .status-badge {
    display: inline-grid;
    width: fit-content;
    max-width: 100%;
    min-height: 20px;
    margin-top: 7px;
    padding: 2px 4px;
    font-size: 0.62rem;
    letter-spacing: 0;
    line-height: 1.1;
    white-space: nowrap;
  }

  .day-note-preview {
    display: none;
  }

  .day-dialog,
  .picker-dialog,
  .summary-dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: min(86vh, 680px);
    margin: auto 0 0;
    border-radius: 18px 18px 0 0;
  }

  .day-dialog::backdrop,
  .picker-dialog::backdrop,
  .summary-dialog::backdrop {
    background: rgba(19, 29, 43, 0.58);
  }

  .day-form,
  .picker-form,
  .summary-detail-form {
    gap: 14px;
    max-height: min(86vh, 680px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 18px 16px 20px;
  }

  .dialog-head {
    align-items: center;
  }

  .close-button {
    flex: 0 0 auto;
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }

  .assistant-fab {
    right: 14px;
    bottom: 14px;
    width: 54px;
    height: 54px;
    border-radius: 14px;
  }

  .assistant-panel {
    right: 8px;
    bottom: 76px;
    width: calc(100vw - 16px);
    max-height: min(680px, calc(100vh - 92px));
    border-radius: 14px;
  }

  .assistant-messages {
    min-height: 210px;
    padding: 12px;
  }

  .assistant-message {
    max-width: 92%;
  }
}
