:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --panel: #ffffff;
  --panel-soft: #f8faf9;
  --text: #151b1f;
  --muted: #667277;
  --line: #dbe2df;
  --primary: #0f766e;
  --primary-hover: #0b5e58;
  --ink: #17202a;
  --accent: #2f6fed;
  --danger: #b42318;
  --success: #137333;
  --warning: #946200;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.09) 0%, rgba(15, 118, 110, 0) 32%),
    linear-gradient(315deg, rgba(47, 111, 237, 0.08) 0%, rgba(47, 111, 237, 0) 36%),
    var(--bg);
  color: var(--text);
}

h1,
h2,
p {
  margin: 0;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

button,
input {
  font: inherit;
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel,
.tool-panel {
  width: min(100%, 480px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px;
  box-shadow: 0 22px 70px rgba(21, 27, 31, 0.11);
}

.auth-panel {
  position: relative;
  overflow: hidden;
}

.auth-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  background: linear-gradient(90deg, var(--primary), var(--accent), #d98a2b);
}

.brand-lockup,
.topbar-title {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.topbar-title {
  flex: 1;
}

.topbar-title > div {
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--ink), #284044);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(21, 27, 31, 0.18);
}

.brand-mark.small {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 13px;
}

.auth-panel h1,
.topbar h1 {
  font-size: 30px;
  font-weight: 780;
  line-height: 1.15;
}

.panel-heading {
  display: grid;
  gap: 6px;
}

.panel-heading h2 {
  font-size: 24px;
  font-weight: 760;
}

.stack {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}

label {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

input[type="password"] {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 1px 0 rgba(21, 27, 31, 0.03);
}

input[type="password"]:focus,
.native-file:focus + .file-frame {
  outline: 3px solid rgba(15, 118, 110, 0.15);
  border-color: var(--primary);
}

input[type="password"] {
  padding: 0 16px;
}

.primary-button,
.ghost-button {
  min-height: 50px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.primary-button {
  display: inline-grid;
  place-items: center;
  padding: 0 18px;
  background: linear-gradient(135deg, var(--primary), #146f97);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 14px 28px rgba(15, 118, 110, 0.2);
}

.primary-button:hover {
  background: linear-gradient(135deg, var(--primary-hover), #115f82);
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: not-allowed;
  background: #89b8b3;
  transform: none;
  box-shadow: none;
}

.ghost-button {
  padding: 0 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
}

.ghost-button:hover {
  border-color: #a9b3c4;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px clamp(18px, 5vw, 58px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(21, 27, 31, 0.05);
}

.eyebrow,
.back-link {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}

.menu-layout {
  padding: 34px clamp(18px, 5vw, 58px);
}

.menu-panel {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  max-width: 920px;
}

.app-tile {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 118px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 16px 48px rgba(21, 27, 31, 0.08);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.app-tile:hover {
  border-color: rgba(15, 118, 110, 0.35);
  box-shadow: 0 20px 56px rgba(21, 27, 31, 0.12);
  transform: translateY(-2px);
}

.app-icon {
  display: grid;
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  place-items: center;
  border-radius: 20px;
  background: linear-gradient(145deg, #0f766e, #2f6fed);
  color: #ffffff;
  font-size: 18px;
  font-weight: 850;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 14px 30px rgba(15, 118, 110, 0.22);
}

.app-copy {
  display: grid;
  gap: 6px;
}

.app-name {
  color: var(--text);
  font-size: 20px;
  font-weight: 760;
}

.app-meta {
  color: var(--muted);
  font-size: 13px;
}

.workspace {
  display: grid;
  place-items: start center;
  padding: 42px 18px;
}

.file-field {
  color: var(--text);
  font-weight: 650;
}

.upload-card {
  cursor: pointer;
}

.native-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-frame {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #fbfcfc);
  box-shadow: 0 1px 0 rgba(21, 27, 31, 0.03);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.upload-card:hover .file-frame {
  border-color: rgba(15, 118, 110, 0.38);
  box-shadow: 0 12px 26px rgba(21, 27, 31, 0.07);
  transform: translateY(-1px);
}

.file-action {
  display: inline-grid;
  flex: 0 0 auto;
  min-height: 36px;
  place-items: center;
  padding: 0 14px;
  border-radius: 10px;
  background: #eaf4f2;
  color: var(--primary);
  font-size: 13px;
  font-weight: 760;
}

.file-name {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.field-label::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--primary);
}

.result-panel {
  display: grid;
  gap: 12px;
  margin-top: 22px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
}

.download-button {
  width: 100%;
}

.status-text,
.error-text {
  min-height: 20px;
  font-size: 14px;
}

.error-text {
  margin-top: 14px;
  color: var(--danger);
}

.success-text {
  color: var(--success);
}

.warning-text {
  color: var(--warning);
}

@media (max-width: 560px) {
  .auth-page {
    align-items: start;
    padding-top: 58px;
  }

  .auth-panel,
  .tool-panel {
    padding: 22px;
    border-radius: 16px;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar h1 {
    font-size: 23px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .menu-panel {
    grid-template-columns: 1fr;
  }

  .app-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    font-size: 16px;
  }

  .app-tile {
    min-height: 104px;
  }
}
