:root {
  --bg: #f2f4f6;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --text: #191f28;
  --muted: #6b7684;
  --faint: #8b95a1;
  --line: #e5e8eb;
  --blue: #3182f6;
  --blue-dark: #1b64da;
  --blue-soft: #e8f3ff;
  --green: #00a661;
  --green-soft: #e6f7ef;
  --yellow: #f9ab00;
  --yellow-soft: #fff6d8;
  --red: #f04452;
  --red-soft: #fff1f3;
  --shadow: 0 10px 30px rgba(25, 31, 40, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

#appRoot {
  min-height: 100vh;
}

.auth-shell,
.app-shell {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 18px 108px;
}

.auth-shell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  padding-bottom: 24px;
}

.brand-row,
.topbar,
.section-title-row,
.state-row,
.account-row,
.history-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-row {
  justify-content: flex-start;
}

.brand-mark,
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  color: #ffffff;
  background: var(--blue);
  font-size: 20px;
  font-weight: 900;
  flex: 0 0 auto;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 14px;
  font-weight: 800;
}

.auth-title,
.page-title,
.hero-percent {
  margin: 0;
  color: var(--text);
  font-weight: 900;
}

.auth-title {
  font-size: 34px;
  line-height: 1.16;
}

.auth-subtitle,
.page-subtitle,
.section-desc,
.empty-text,
.help-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.auth-panel,
.panel,
.metric,
.history-item,
.info-row,
.modal-sheet {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-panel,
.panel {
  padding: 20px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  margin-bottom: 18px;
  border-radius: 12px;
  background: var(--surface-soft);
}

.segmented button,
.nav button {
  border: 0;
  background: transparent;
}

.segmented button {
  min-height: 44px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 800;
}

.segmented button.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(25, 31, 40, 0.08);
}

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

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

.field span,
.form-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 15px;
  color: var(--text);
  background: var(--surface-soft);
  outline: none;
}

input:focus {
  border-color: var(--blue);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(49, 130, 246, 0.14);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border-radius: 12px;
  padding: 0 16px;
  border: 1px solid transparent;
  font-size: 16px;
  font-weight: 850;
  text-align: center;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.primary-btn {
  color: #ffffff;
  background: var(--blue);
}

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

.secondary-btn {
  color: var(--blue);
  background: var(--blue-soft);
}

.ghost-btn {
  color: var(--text);
  background: var(--surface-soft);
  border-color: var(--line);
}

.danger-btn {
  color: var(--red);
  background: var(--red-soft);
}

.primary-btn:active,
.secondary-btn:active,
.ghost-btn:active,
.danger-btn:active,
.nav button:active {
  transform: translateY(1px);
}

.auth-note,
.help-text {
  color: var(--faint);
  font-size: 13px;
}

.topbar {
  margin-bottom: 22px;
}

.account-row {
  justify-content: flex-start;
  min-width: 0;
}

.account-name {
  display: block;
  max-width: 230px;
  overflow: hidden;
  color: var(--text);
  font-size: 19px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-email {
  display: block;
  max-width: 230px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view {
  display: grid;
  gap: 14px;
}

.hero-panel {
  padding: 24px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.status-pill,
.status-soft {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 850;
}

.status-pill {
  color: var(--blue);
  background: var(--blue-soft);
}

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

.status-soft.yellow {
  color: #8a5a00;
  background: var(--yellow-soft);
}

.hero-percent {
  margin-top: 18px;
  color: var(--blue);
  font-size: 72px;
  line-height: 1;
}

.hero-copy {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

.progress {
  overflow: hidden;
  height: 12px;
  margin-top: 22px;
  border-radius: 999px;
  background: #edf1f5;
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 0.35s ease;
}

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

.metric {
  min-height: 108px;
  padding: 16px;
}

.metric small,
.schedule-list span,
.history-meta span,
.info-row span {
  display: block;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.metric b {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 25px;
  line-height: 1.16;
  word-break: keep-all;
}

.metric.primary b {
  color: var(--blue);
}

.section-title-row {
  margin-bottom: 14px;
}

.section-title-row h2,
.page-title {
  margin: 0;
  color: var(--text);
  font-size: 22px;
  line-height: 1.28;
}

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

.schedule-list p,
.info-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  align-items: center;
  margin: 0;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.schedule-list p:first-child,
.info-row:first-child {
  border-top: 0;
}

.schedule-list b,
.info-row b {
  min-width: 0;
  color: var(--text);
  font-size: 15px;
  text-align: right;
  word-break: keep-all;
}

.action-row,
.form-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

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

.page-head {
  display: grid;
  gap: 8px;
  margin-bottom: 4px;
}

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

.history-item {
  padding: 16px;
  box-shadow: none;
}

.history-meta {
  align-items: flex-start;
}

.history-state {
  color: var(--blue);
  font-size: 14px;
  font-weight: 850;
}

.history-item strong {
  display: block;
  margin-top: 10px;
  color: var(--text);
  font-size: 18px;
}

.history-item p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.empty-state {
  padding: 28px 20px;
  border: 1px dashed #d1d6db;
  border-radius: 8px;
  background: var(--surface-soft);
  text-align: center;
}

.settings-form {
  display: grid;
  gap: 16px;
}

.form-section {
  display: grid;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.form-section:last-of-type {
  padding-bottom: 0;
  border-bottom: 0;
}

.info-stack {
  display: grid;
  gap: 10px;
}

.info-note {
  margin: 0;
  padding: 14px;
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 14px;
  line-height: 1.55;
}

.nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 480px);
  min-height: 76px;
  transform: translateX(-50%);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
}

.nav button {
  position: relative;
  min-width: 0;
  min-height: 76px;
  color: var(--faint);
  font-size: 13px;
  font-weight: 850;
}

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

.nav button.active::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 10px;
  width: 5px;
  height: 5px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: var(--blue);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 18px;
  background: rgba(25, 31, 40, 0.36);
}

.modal-sheet {
  width: min(100%, 444px);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 20px;
}

.modal-sheet h2 {
  margin: 0 0 16px;
  font-size: 22px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  z-index: 50;
  max-width: calc(100% - 36px);
  transform: translate(-50%, 14px);
  border-radius: 999px;
  padding: 12px 16px;
  color: #ffffff;
  background: rgba(25, 31, 40, 0.92);
  font-size: 14px;
  font-weight: 750;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

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

@media (min-width: 720px) {
  .auth-shell,
  .app-shell {
    padding-top: 36px;
  }

  .app-shell {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    background: #f7f8fa;
  }

  .nav {
    bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
  }
}

@media (max-width: 380px) {
  .hero-percent {
    font-size: 60px;
  }

  .metric-grid,
  .action-row,
  .form-actions {
    grid-template-columns: 1fr;
  }

  .schedule-list p,
  .info-row {
    grid-template-columns: 1fr;
  }

  .schedule-list b,
  .info-row b {
    text-align: left;
  }
}
