:root {
  --bg-top: #f3f8f9;
  --bg-bottom: #dce9ec;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #f6fbfc;
  --text-main: #1d2b2f;
  --text-muted: #5c7077;
  --border: #d6e3e7;
  --border-soft: #dee9ec;
  --accent: #0a7d83;
  --accent-2: #0c9399;
  --danger: #b42318;
  --danger-bg: #fff1ef;
  --success: #0f7a3b;
  --success-bg: #e9f8ef;
  --shadow: 0 16px 40px rgba(31, 78, 89, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-main);
  font-family: "Avenir Next", "Segoe UI", Arial, sans-serif;
}

.app-bg {
  background:
    radial-gradient(circle at 8% 7%, rgba(10, 125, 131, 0.16), transparent 34%),
    radial-gradient(circle at 95% 0%, rgba(247, 203, 89, 0.2), transparent 30%),
    linear-gradient(155deg, var(--bg-top), var(--bg-bottom));
}

.page-shell {
  width: min(1040px, calc(100% - 32px));
  margin: 44px auto 56px;
}

.home-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  padding-bottom: 30px;
}

.home-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  justify-content: center;
  min-height: calc(100vh - 30px);
  margin: 0 auto;
  width: min(1040px, calc(100% - 32px));
}

.home-main .hero,
.home-main .search-panel,
.home-main .result-panel {
  width: min(1008px, 100%);
  margin: 0;
}

.home-footer {
  position: absolute;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.2;
  white-space: nowrap;
}

.home-footer a {
  color: inherit;
}

.auth-page {
  position: relative;
  min-height: 100vh;
  padding-bottom: 30px;
  overflow: hidden;
}

.auth-main {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 312px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-figure {
  width: 156px;
  height: 156px;
  margin-bottom: 10px;
}

.auth-form {
  width: 312px;
  height: 40px;
  display: flex;
}

.auth-form input {
  width: 266px;
  height: 40px;
  border: 0;
  border-radius: 13px 0 0 13px;
  padding: 0 16px;
  background: #dee1eb;
  color: #000;
  font-family: "Avenir Next", "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  outline: none;
}

.auth-form input::placeholder {
  color: #000;
  opacity: 1;
}

.auth-form button {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 0 13px 13px 0;
  background: #0b898f;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.auth-form button img {
  width: 24px;
  height: 24px;
}

.auth-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-bottom {
  position: absolute;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.auth-home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 40px;
  border-radius: 13px 0 0 13px;
  background: #dee1eb;
  color: #000;
  text-decoration: none;
  font-size: 15px;
}

.auth-code-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 0 13px 13px 0;
  background: #0b898f;
}

.auth-code-link img {
  width: 24px;
  height: 24px;
}

.auth-footer {
  position: static;
  transform: none;
  margin: 0;
}

.admin-page {
  position: relative;
  min-height: 100vh;
  padding-bottom: 30px;
  overflow: hidden;
}

.admin-main {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: min(1040px, calc(100% - 32px));
  margin: 0;
}

.admin-main .hero {
  margin-bottom: 0;
  width: min(1008px, 100%);
}

.admin-stats {
  width: min(1016px, 100%);
  padding: 19px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.admin-stat-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 15px;
  background: linear-gradient(145deg, #f8fbfc 0%, #ffffff 100%);
}

.admin-stat-label {
  display: block;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 6px;
}

.admin-stat-value {
  display: block;
  color: var(--text-main);
  font-size: 36px;
  line-height: 1;
}

.hero {
  margin-bottom: 22px;
}

.hero-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1.15;
}

.subtitle {
  margin: 8px 0 0;
  max-width: 880px;
  color: var(--text-muted);
  font-size: 16px;
}

.subtitle a {
  color: inherit;
}

.ghost-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.panel {
  border: 1px solid var(--border-soft);
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(2px);
}

.search-panel {
  padding: 18px;
}

.panel-hint {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 14px;
}

.inn-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.inn-cell {
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: center;
  font-size: 23px;
  font-weight: 700;
  color: var(--text-main);
  background: #fff;
  outline: none;
}

.inn-cell::placeholder {
  color: rgba(29, 43, 47, 0.3);
  opacity: 1;
  font-weight: 700;
}

.inn-cell:focus {
  border-color: #84babf;
  box-shadow: 0 0 0 3px rgba(10, 125, 131, 0.13);
}

.primary-button,
.primary-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  border: 0;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 13.3px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(165deg, var(--accent), var(--accent-2));
}

.primary-button:hover,
.primary-link-button:hover {
  filter: brightness(0.97);
}

.result-panel {
  margin-top: 18px;
  padding: 18px;
}

h2 {
  margin: 0 0 10px;
  font-size: 22px;
}

h3 {
  margin: 16px 0 8px;
  font-size: 18.7px;
}

.result-current {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(150deg, #f8fbfc 0%, #fff 100%);
  padding: 14px;
}

.result-current p {
  margin: 7px 0;
  font-size: 16px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 840px;
  font-size: 14px;
}

thead th {
  position: sticky;
  top: 0;
  background: #edf6f8;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: left;
  padding: 12px;
}

thead th:last-child {
  border-right: 0;
}

tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  vertical-align: top;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody td:last-child {
  border-right: 0;
  overflow-wrap: anywhere;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  width: min(1016px, 100%);
}

.admin-panel {
  min-height: 343px;
  padding: 18px;
}

.admin-upload-panel {
  display: flex;
  flex-direction: column;
}

.admin-panel h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.admin-upload-panel .panel-hint {
  margin-bottom: 14px;
}

.admin-upload-panel .drop-zone {
  min-height: 165px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.admin-upload-panel .drop-zone strong {
  margin-bottom: 7px;
  font-size: 16px;
  line-height: 1.1;
}

.admin-upload-panel .drop-zone span {
  font-size: 14px;
}

.admin-upload-panel .drop-zone span:last-child {
  margin-top: 7px;
  color: #1d2b2f;
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-upload-panel .upload-form {
  flex: 1;
}

.admin-upload-panel .primary-button {
  margin-top: auto;
  align-self: flex-start;
}

label {
  font-size: 16px;
  font-weight: 700;
}

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

.drop-zone {
  display: block;
  padding: 14px;
  border-radius: 12px;
  border: 1px dashed #84babf;
  background: #f9fcfd;
  cursor: pointer;
}

.drop-zone strong {
  display: block;
  font-size: 16px;
  margin-bottom: 4px;
}

.drop-zone span {
  display: block;
  color: var(--text-muted);
  font-size: 14px;
}

.drop-zone span:last-child {
  margin-top: 8px;
  color: var(--text-main);
}

.drop-zone.drag-over {
  background: #e9f5f7;
}

.jobs-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.job-card {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
}

.job-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.job-file {
  font-size: 14px;
  overflow-wrap: anywhere;
}

.job-status {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-queued {
  background: #edf6f8;
  color: #34555c;
}

.status-processing {
  background: #e8f5f6;
  color: #0c7076;
}

.status-stopping,
.status-canceling {
  background: #fff7e8;
  color: #946200;
}

.job-meta {
  margin: 5px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.job-progress {
  width: 100%;
  height: 8px;
  margin: 8px 0 6px;
  border-radius: 999px;
  background: #e7eef0;
  overflow: hidden;
}

.job-progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #1298a0;
  transition: width 0.25s ease;
}

.job-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.secondary-button,
.danger-button {
  border: 0;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.secondary-button {
  background: #edf6f8;
  color: #1d2b2f;
}

.danger-button {
  background: #fee4e2;
  color: #912018;
}

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

.upload-message {
  margin: 2px 0 0;
  min-height: 20px;
  font-size: 14px;
}

.admin-upload-panel .upload-message {
  min-height: 0;
}

.admin-upload-panel .upload-message:empty {
  display: none;
}

.upload-message.error {
  color: var(--danger);
}

.upload-message.success {
  color: var(--success);
}

.admin-back {
  margin-top: 18px;
  text-align: center;
}

.admin-bottom {
  position: absolute;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.messages {
  margin-bottom: 14px;
}

.message {
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid transparent;
}

.message.error {
  background: var(--danger-bg);
  border-color: #ffcfc8;
}

.message.success {
  background: var(--success-bg);
  border-color: #b9e4c8;
}

.error {
  color: var(--danger);
  font-weight: 700;
}

.muted {
  color: var(--text-muted);
  margin: 4px 0 0;
}

@media (max-width: 1024px) {
  .inn-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-stats {
    grid-template-columns: 1fr;
  }

  .admin-page {
    overflow: auto;
  }

  .admin-main {
    position: static;
    transform: none;
    margin: 20px auto 120px;
  }

  .admin-bottom {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: calc(100% - 20px);
    margin-top: 24px;
  }

  .home-main {
    width: calc(100% - 20px);
    min-height: calc(100vh - 30px);
  }

  h1 {
    font-size: 35px;
  }

  h2 {
    font-size: 28px;
  }

  h3 {
    font-size: 24px;
  }

  .hero-topline {
    flex-direction: column;
    align-items: flex-start;
  }
}
