:root {
  color-scheme: light;
  --bg: #f2f7f6;
  --panel: rgba(255, 255, 255, .92);
  --text: #172326;
  --muted: #657579;
  --line: #dbe6e4;
  --accent: #0f766e;
  --accent-strong: #0a5d57;
  --accent-deep: #073f3b;
  --accent-soft: #e7f4f1;
  --danger: #b42318;
  --shadow: 0 24px 70px rgb(16 73 67 / 10%);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 0%, rgb(184 225 216 / 45%), transparent 32rem),
    linear-gradient(145deg, #f7faf9, var(--bg));
  color: var(--text);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.modal-open { overflow: hidden; }

button, input { font: inherit; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  filter: blur(4px);
  opacity: .34;
  pointer-events: none;
  animation: drift 14s ease-in-out infinite alternate;
}

.ambient-one { top: -15rem; right: -8rem; background: #89cfc4; }
.ambient-two { bottom: -19rem; left: -8rem; background: #bfe0da; animation-delay: -7s; }

main {
  width: min(1180px, calc(100% - 40px));
  margin: 32px auto 56px;
}

.page-header {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
}

.brand-lockup { display: flex; align-items: center; gap: 13px; }

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--accent), var(--accent-deep));
  box-shadow: 0 10px 24px rgb(15 118 110 / 25%);
  color: #fff;
  font-size: 20px;
  font-weight: 850;
}

.brand-mark.large { width: 54px; height: 54px; border-radius: 17px; }

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .15em;
  text-transform: uppercase;
}

h1, h2 { letter-spacing: -.035em; }
h1 { margin: 0; font-size: clamp(27px, 3vw, 36px); line-height: 1.08; }
h2 { margin: 0; font-size: 20px; line-height: 1.2; }

.account {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 50%;
  padding: 6px 6px 6px 11px;
  border: 1px solid rgb(215 228 225 / 85%);
  border-radius: 999px;
  background: rgb(255 255 255 / 72%);
  box-shadow: 0 8px 26px rgb(34 80 74 / 7%);
  backdrop-filter: blur(12px);
}

.account-avatar {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22a693;
  box-shadow: 0 0 0 4px rgb(34 166 147 / 12%);
}

.account-identity {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.intro { max-width: 620px; margin: 27px 0 30px; }
.subhead { margin: 0; color: var(--muted); font-size: 16px; }

#update-form {
  display: grid;
  grid-template-columns: minmax(300px, .78fr) minmax(440px, 1.22fr);
  gap: 20px;
  align-items: start;
}

.panel, .login-card {
  border: 1px solid rgb(215 228 225 / 92%);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel {
  padding: 25px;
  animation: rise .55s cubic-bezier(.2, .8, .2, 1) both;
}

.metadata-panel { animation-delay: .08s; }

.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 21px;
}

.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.step { color: var(--accent); font-size: 11px; font-weight: 850; letter-spacing: .08em; padding-top: 4px; }

label {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
  color: #2d3b3e;
  font-size: 13px;
  font-weight: 700;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 12px;
  background: rgb(252 254 254 / 82%);
  color: var(--text);
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease, transform .2s ease;
}

input::placeholder { color: #9aa8aa; }
input:hover { border-color: #bfd1ce; background: #fff; }
input:focus-visible {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgb(15 118 110 / 10%);
}

.file-picker {
  position: relative;
  min-height: 172px;
  margin: 0 0 16px;
  padding: 26px 18px;
  place-items: center;
  align-content: center;
  gap: 7px;
  overflow: hidden;
  border: 1.5px dashed #9fc9c3;
  border-radius: 16px;
  background: linear-gradient(145deg, #f7fcfb, #edf7f5);
  text-align: center;
  cursor: pointer;
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.file-picker:hover {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgb(15 118 110 / 8%), 0 10px 28px rgb(15 118 110 / 8%);
  transform: translateY(-2px);
}

.file-picker input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; background: #fff; box-shadow: 0 8px 22px rgb(15 118 110 / 12%); color: var(--accent); font-size: 24px; line-height: 1; }
.file-title { font-size: 14px; font-weight: 800; }
.file-name { max-width: 100%; overflow: hidden; color: var(--muted); font-size: 12px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }

.batch-list {
  display: grid;
  gap: 9px;
  max-height: 310px;
  margin: 0 0 16px;
  padding-right: 3px;
  overflow-y: auto;
}

.batch-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbfdfd;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

.batch-item[data-state="uploading"],
.batch-item[data-state="processing"] { border-color: #a8d5cf; background: #f6fbfa; }
.batch-item[data-state="completed"] { border-color: #a8d5cf; background: #f1faf8; }
.batch-item[data-state="failed"] { border-color: #f2b8b5; background: #fff8f7; }
.batch-item-heading, .batch-item-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.batch-file-details { min-width: 0; }
.batch-file-name, .batch-file-size { display: block; }
.batch-file-name { overflow: hidden; color: var(--text); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.batch-file-size, .batch-detail { color: var(--muted); font-size: 11px; }
.batch-detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-state { flex: 0 0 auto; padding: 3px 8px; border-radius: 99px; background: #edf2f1; color: var(--muted); font-size: 10px; font-weight: 800; }
.batch-state.uploading, .batch-state.queued, .batch-state.processing { background: var(--accent-soft); color: var(--accent-strong); }
.batch-state.completed { background: #d9f3ed; color: var(--accent-strong); }
.batch-state.failed { background: #fde7e5; color: var(--danger); }
.batch-progress { width: 100%; height: 5px; overflow: hidden; border: 0; border-radius: 99px; accent-color: var(--accent); }
.batch-download { flex: 0 0 auto; color: var(--accent-strong); font-size: 11px; font-weight: 800; text-decoration: none; }
.batch-download:hover { text-decoration: underline; }

.option-card { margin-bottom: 18px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: #fafcfc; }
.checkbox-row { position: relative; display: flex; align-items: flex-start; gap: 11px; margin: 0; cursor: pointer; }
.checkbox-row input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.check-control { position: relative; flex: 0 0 auto; width: 38px; height: 22px; margin-top: 1px; border-radius: 999px; background: #cbd7d5; transition: background .2s ease; }
.check-control::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgb(0 0 0 / 18%); transition: transform .22s cubic-bezier(.2, .8, .2, 1); }
.checkbox-row input:checked + .check-control { background: var(--accent); }
.checkbox-row input:checked + .check-control::after { transform: translateX(16px); }
.checkbox-row input:focus-visible + .check-control { box-shadow: 0 0 0 4px rgb(15 118 110 / 13%); }
.checkbox-row strong, .checkbox-row small { display: block; }
.checkbox-row small { margin-top: 2px; color: var(--muted); font-weight: 500; line-height: 1.4; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.full { grid-column: 1 / -1; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 42px;
  border: 0;
  border-radius: 11px;
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 8px 20px rgb(15 118 110 / 18%);
  color: #fff;
  font-weight: 780;
  cursor: pointer;
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease, background .18s ease;
}

button:hover, .button:hover { box-shadow: 0 11px 25px rgb(15 118 110 / 25%); transform: translateY(-1px); }
button:active, .button:active { transform: translateY(0); }
button:focus-visible, .button:focus-visible { outline: 3px solid rgb(15 118 110 / 20%); outline-offset: 2px; }
button:disabled { opacity: .58; cursor: wait; transform: none; }
.button.secondary { background: var(--accent-soft); box-shadow: none; color: var(--accent-strong); }
.text-button { min-height: 31px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px; background: #fff; box-shadow: none; color: var(--accent-strong); font-size: 12px; }
.text-button:hover { background: var(--accent-soft); box-shadow: none; }

progress { width: 100%; height: 7px; overflow: hidden; border: 0; border-radius: 99px; accent-color: var(--accent); }

.status {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f9fbfb;
  color: var(--muted);
  font-size: 13px;
  white-space: pre-wrap;
}

.status-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #9aabaa; }
.status.error { color: var(--danger); border-color: #f2b8b5; background: #fff7f6; }
.status.error .status-dot { background: var(--danger); }
.status.success { color: var(--accent-strong); border-color: #a8d5cf; background: #f1faf8; }
.status.success .status-dot { background: #159684; box-shadow: 0 0 0 4px rgb(21 150 132 / 10%); }

.login-page { display: grid; place-items: center; }
.login-shell { width: min(930px, calc(100% - 40px)); margin: 36px auto; }
.login-card { display: grid; grid-template-columns: .9fr 1.1fr; min-height: 560px; overflow: hidden; animation: rise .6s cubic-bezier(.2, .8, .2, 1) both; }
.login-brand { display: flex; flex-direction: column; justify-content: space-between; padding: 42px; background: linear-gradient(145deg, var(--accent-deep), var(--accent)); color: #fff; }
.login-brand .eyebrow { margin-top: 22px; color: #bfece4; }
.login-brand h1 { max-width: 290px; margin-top: 8px; font-size: 39px; }
.login-brand p:not(.eyebrow) { max-width: 310px; margin: 18px 0 0; color: rgb(255 255 255 / 72%); }
.privacy-note { display: flex; align-items: center; gap: 9px; color: rgb(255 255 255 / 78%); font-size: 12px; }
.privacy-note span { display: grid; width: 24px; height: 24px; place-items: center; border: 1px solid rgb(255 255 255 / 22%); border-radius: 50%; }
.login-content { display: flex; flex-direction: column; justify-content: center; padding: clamp(35px, 6vw, 68px); }
.login-content h2 { font-size: 28px; }
.login-lead { margin: 9px 0 27px; color: var(--muted); }
.login-form { display: block; }
.login-form label { margin-bottom: 16px; }
.login-form input { min-height: 48px; }
.login-form button { width: 100%; min-height: 48px; margin-top: 5px; }
.login-status { margin-top: 15px; }

.modal-backdrop {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
  background: rgb(7 31 29 / 68%);
  backdrop-filter: blur(8px);
}

.terms-dialog {
  width: min(620px, 100%);
  max-height: min(780px, calc(100vh - 40px));
  overflow-y: auto;
  border: 1px solid rgb(215 228 225 / 92%);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 30px 90px rgb(0 24 22 / 30%);
  animation: rise .35s cubic-bezier(.2, .8, .2, 1) both;
}

.terms-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 25px 27px 20px;
  border-bottom: 1px solid var(--line);
}

.terms-icon {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 20px;
  font-weight: 900;
}

.terms-header h2 { font-size: 25px; }
.terms-content { padding: 21px 27px 8px; color: #374649; }
.terms-content > :first-child { margin-top: 0; }
.terms-content h3 { margin: 20px 0 7px; color: var(--text); font-size: 14px; }
.terms-content p { margin: 0 0 14px; }
.terms-content ul { margin: 0; padding-left: 21px; }
.terms-content li { margin-bottom: 8px; }

.terms-actions {
  position: sticky;
  bottom: 0;
  padding: 18px 27px 25px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.terms-consent {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin: 0 0 16px;
  cursor: pointer;
  line-height: 1.45;
}

.terms-consent input {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  margin-top: 1px;
  accent-color: var(--accent);
}

.terms-actions button { width: 100%; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(35px, -18px, 0) scale(1.08); }
}

@media (max-width: 840px) {
  main { width: min(100% - 24px, 650px); margin: 22px auto 36px; }
  #update-form, .grid { grid-template-columns: 1fr; }
  .full { grid-column: auto; }
  .account { max-width: 58%; }
  .login-shell { width: min(100% - 24px, 520px); }
  .login-card { grid-template-columns: 1fr; min-height: auto; }
  .login-brand { min-height: 250px; padding: 30px; }
  .login-brand h1 { font-size: 32px; }
  .login-content { padding: 34px 30px; }
}

@media (max-width: 540px) {
  .page-header { align-items: flex-start; }
  .account { max-width: none; padding-left: 8px; }
  .account-avatar, .account-identity { display: none; }
  .intro { margin-top: 22px; }
  .panel { padding: 20px; border-radius: 18px; }
  .login-brand { min-height: 220px; }
  .modal-backdrop { padding: 10px; }
  .terms-dialog { max-height: calc(100vh - 20px); border-radius: 17px; }
  .terms-header, .terms-content, .terms-actions { padding-left: 20px; padding-right: 20px; }
}

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