:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Apple SD Gothic Neo",
    "Noto Sans KR", sans-serif;
  --blue: #1368e8;
  --blue-dark: #0754c8;
  --blue-soft: #eaf2ff;
  --green: #16885f;
  --green-soft: #e7f8f1;
  --orange: #b45d00;
  --orange-soft: #fff1dc;
  --red: #c53535;
  --red-soft: #fdeaea;
  --purple: #7440c8;
  --purple-soft: #f2eaff;
  --ink: #172033;
  --muted: #687386;
  --line: #dce3ed;
  --surface: #ffffff;
  --background: #f4f7fb;
  --shadow: 0 12px 34px rgba(32, 54, 86, 0.09);
  background: var(--background);
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

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

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background: var(--background);
}

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

button {
  cursor: pointer;
}

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

.boot-screen,
.page-loading {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  color: var(--muted);
}

.boot-screen strong {
  color: var(--ink);
  font-size: 1.4rem;
}

.brand-mark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  color: white;
  font-size: 2.4rem;
  font-weight: 900;
  background: linear-gradient(145deg, #2c83f5, #0754c8);
  box-shadow: 0 14px 28px rgba(19, 104, 232, 0.25);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #c8d5e8;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

.auth-page {
  min-height: 100dvh;
  display: grid;
  align-items: center;
  justify-items: center;
  padding: max(28px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 15% 15%, rgba(39, 125, 244, 0.14), transparent 34%),
    radial-gradient(circle at 90% 80%, rgba(33, 181, 115, 0.1), transparent 30%),
    var(--background);
}

.auth-wrap {
  width: min(100%, 430px);
}

.auth-brand {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin-bottom: 22px;
  text-align: center;
}

.auth-brand h1 {
  margin: 0;
  font-size: 2.15rem;
  letter-spacing: -0.04em;
}

.auth-brand p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.auth-card,
.card {
  background: var(--surface);
  border: 1px solid rgba(220, 227, 237, 0.9);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.auth-card {
  padding: 20px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  border-radius: 12px;
  background: #edf1f6;
}

.segmented button {
  min-height: 40px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
}

.segmented button.active {
  color: var(--ink);
  background: white;
  box-shadow: 0 2px 8px rgba(32, 54, 86, 0.12);
}

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

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

.field label,
.field-label {
  color: #465165;
  font-size: 0.9rem;
  font-weight: 700;
}

.input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid #cfd8e6;
  border-radius: 12px;
  color: var(--ink);
  background: white;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea.input {
  min-height: 100px;
  resize: vertical;
  line-height: 1.55;
}

.input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(19, 104, 232, 0.12);
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button {
  min-height: 46px;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 800;
  border: 1px solid transparent;
}

.primary-button {
  color: white;
  background: var(--blue);
}

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

.secondary-button {
  color: var(--blue-dark);
  border-color: #bcd1f3;
  background: var(--blue-soft);
}

.danger-button {
  color: var(--red);
  border-color: #efbcbc;
  background: var(--red-soft);
}

.ghost-button {
  color: var(--muted);
  border-color: var(--line);
  background: white;
}

.text-button {
  justify-self: end;
  min-height: auto;
  padding: 0;
  border: 0;
  color: var(--blue-dark);
  background: transparent;
  font-size: 0.88rem;
  font-weight: 800;
}

.auth-message {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 0.9rem;
  line-height: 1.4;
}

.helper-text {
  margin: 14px 6px 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
  text-align: center;
}

.credits {
  padding: 22px 0 2px;
  color: #8a94a5;
  font-size: 0.74rem;
  text-align: center;
}

.app-shell {
  min-height: 100dvh;
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: calc(62px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 18px 0;
  border-bottom: 1px solid rgba(220, 227, 237, 0.9);
  background: rgba(250, 252, 255, 0.92);
  backdrop-filter: blur(16px);
}

.topbar-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.topbar-title strong {
  font-size: 1.16rem;
}

.topbar-title span {
  color: var(--muted);
  font-size: 0.76rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
}

.sync-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 11px;
  border: 1px solid #bcd1f3;
  border-radius: 999px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-size: 0.78rem;
  font-weight: 900;
}

.sync-button > span:first-child {
  display: inline-block;
  font-size: 1rem;
  line-height: 1;
}

.sync-button.syncing > span:first-child {
  animation: spin 0.8s linear infinite;
}

.avatar-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: white;
  background: var(--blue);
  font-weight: 900;
}

.content {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 20px 16px 30px;
}

.page-title {
  margin: 2px 0 18px;
  font-size: 1.65rem;
  letter-spacing: -0.035em;
}

.balance-card {
  padding: 22px;
  border: 1px solid #cfe0f7;
  border-radius: 22px;
  background: linear-gradient(135deg, #e5f0ff, #f4fbff);
}

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

.balance-value {
  display: block;
  margin: 8px 0 5px;
  font-size: clamp(2rem, 10vw, 2.7rem);
  letter-spacing: -0.05em;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.summary-card {
  padding: 17px;
}

.summary-card span {
  color: var(--muted);
  font-size: 0.88rem;
}

.summary-card strong {
  display: block;
  margin-top: 7px;
  font-size: 1.55rem;
}

.section-card {
  margin-top: 18px;
  overflow: hidden;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 17px 18px 13px;
  border-bottom: 1px solid var(--line);
}

.section-heading h2 {
  margin: 0;
  font-size: 1.05rem;
}

.section-body {
  padding: 0 18px;
}

.empty {
  padding: 42px 18px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

.request-row {
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
}

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

.row-top,
.row-main,
.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.row-top strong {
  font-size: 1rem;
}

.request-person,
.request-meta,
.reviewer {
  color: var(--muted);
  font-size: 0.82rem;
}

.request-person {
  display: block;
  margin-bottom: 3px;
}

.row-main {
  align-items: baseline;
  margin-top: 10px;
}

.request-time {
  font-size: 1.18rem;
  font-weight: 900;
}

.request-time.earn {
  color: var(--blue);
}

.request-time.use {
  color: var(--purple);
}

.reason {
  margin: 10px 0 0;
  line-height: 1.45;
}

.reviewer {
  margin: 8px 0 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 900;
  white-space: nowrap;
}

.badge.pending {
  color: var(--orange);
  background: var(--orange-soft);
}

.badge.approved {
  color: var(--green);
  background: var(--green-soft);
}

.badge.rejected {
  color: var(--red);
  background: var(--red-soft);
}

.badge.cancelled {
  color: #606b7a;
  background: #edf0f4;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 13px;
}

.inline-actions button {
  min-height: 36px;
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 800;
}

.form-card {
  padding: 18px;
}

.form-section + .form-section {
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.form-section h2 {
  margin: 0 0 14px;
  font-size: 1rem;
}

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

.two-columns > .field {
  min-width: 0;
}

.request-datetime-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
}

.request-datetime-grid input[type="date"],
.request-datetime-grid select {
  min-height: 44px;
  height: 44px;
  padding: 8px 10px;
  font-size: 0.9rem;
}

.request-datetime-grid input[type="date"] {
  appearance: none;
  -webkit-appearance: none;
}

.form-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.full-button {
  width: 100%;
  margin-top: 18px;
}

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: -4px -16px 14px;
  padding: 4px 16px;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  min-height: 36px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: white;
  font-weight: 800;
  white-space: nowrap;
}

.filter-chip.active {
  color: white;
  border-color: var(--blue);
  background: var(--blue);
}

.member-list {
  overflow: hidden;
}

.member-row {
  width: 100%;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.member-row-button {
  border-top: 0;
  border-right: 0;
  border-left: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.member-row-button:hover,
.member-row-button:focus-visible {
  background: #f7faff;
}

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

.member-info {
  min-width: 0;
}

.member-info strong,
.member-info span {
  display: block;
}

.member-info span {
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  text-align: right;
}

.member-side strong {
  display: block;
}

.member-chevron {
  color: #98a3b4;
  font-size: 1.7rem;
  font-weight: 400;
  line-height: 1;
}

.role-label {
  display: inline-block;
  margin-top: 4px;
  color: var(--blue-dark);
  font-size: 0.73rem;
  font-weight: 900;
}

.detail-title-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
}

.detail-title-row .page-title {
  margin: 0 0 3px;
}

.back-button {
  width: 38px;
  height: 38px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: white;
  font-size: 2rem;
  line-height: 1;
}

.role-change-button {
  width: 100%;
  margin-top: 12px;
}

.member-history-card {
  margin-top: 16px;
}

.section-heading > span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.detail-line {
  margin: 8px 0 0;
}

.request-detail-list {
  display: grid;
  gap: 8px;
  padding: 12px;
  margin: 12px 0 0;
  border-radius: 12px;
  background: #f7f9fc;
}

.request-detail-list div {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
}

.request-detail-list dt,
.request-detail-list dd {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
}

.request-detail-list dt {
  color: var(--muted);
  font-weight: 700;
}

.request-detail-list dd {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.install-card {
  padding: 16px 18px;
  margin-top: 18px;
  border: 1px dashed #9db9df;
  border-radius: 18px;
  color: #40516c;
  background: #f7fbff;
  line-height: 1.55;
}

.install-card strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
}

.bottom-nav {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  padding: 7px 6px max(7px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(210, 219, 232, 0.95);
  background: rgba(252, 253, 255, 0.94);
  backdrop-filter: blur(18px);
}

.nav-button {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 0;
  padding: 5px 2px;
  border: 0;
  color: #788397;
  background: transparent;
  font-size: 0.68rem;
  font-weight: 800;
}

.nav-button .nav-icon {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  line-height: 1;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-button.active {
  color: var(--blue);
}

.profile-popover {
  position: fixed;
  z-index: 40;
  top: calc(58px + env(safe-area-inset-top));
  right: 14px;
  width: min(310px, calc(100vw - 28px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  box-shadow: 0 18px 48px rgba(27, 42, 68, 0.18);
}

.profile-popover strong,
.profile-popover span {
  display: block;
}

.profile-popover span {
  margin: 5px 0 13px;
  color: var(--muted);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.profile-popover button {
  width: 100%;
}

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  max-width: min(90vw, 420px);
  padding: 12px 16px;
  border-radius: 13px;
  color: white;
  background: rgba(23, 32, 51, 0.94);
  box-shadow: 0 12px 32px rgba(23, 32, 51, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s, transform 0.2s;
}

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

.app-dialog {
  width: min(92vw, 460px);
  padding: 0;
  border: 0;
  border-radius: 20px;
  color: var(--ink);
  background: white;
  box-shadow: 0 24px 80px rgba(23, 32, 51, 0.26);
}

.app-dialog::backdrop {
  background: rgba(15, 24, 39, 0.42);
  backdrop-filter: blur(3px);
}

.dialog-content {
  padding: 22px;
}

.dialog-content h2 {
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.dialog-content p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
}

@media (min-width: 820px) {
  .app-shell {
    padding-bottom: 0;
    padding-left: 190px;
  }

  .topbar {
    padding-left: 24px;
    padding-right: 24px;
  }

  .bottom-nav {
    top: 0;
    right: auto;
    width: 190px;
    height: 100dvh;
    align-content: start;
    grid-template-columns: 1fr;
    grid-auto-flow: row;
    grid-auto-columns: auto;
    gap: 6px;
    padding: 84px 12px 20px;
    border-top: 0;
    border-right: 1px solid var(--line);
  }

  .nav-button {
    grid-template-columns: 28px 1fr;
    justify-items: start;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 0.9rem;
  }

  .nav-button.active {
    background: var(--blue-soft);
  }

  .content {
    padding-top: 28px;
  }
}

@media (max-width: 430px) {
  .sync-button {
    width: 38px;
    padding-inline: 0;
  }

  .sync-label {
    display: none;
  }

  .summary-card {
    padding: 15px;
  }

  .request-datetime-grid {
    gap: 8px;
  }

  .request-datetime-grid input[type="date"],
  .request-datetime-grid select {
    padding-inline: 8px;
    font-size: 0.82rem;
  }
}
