:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --text: #17202a;
  --muted: #65717e;
  --line: #d8dee6;
  --accent: #0f766e;
  --accent-2: #1d4ed8;
  --danger: #b42318;
  --warning: #9a6700;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  min-height: 40px;
  padding: 0 14px;
  font-weight: 650;
}

button.secondary {
  background: #243447;
}

button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

button.danger {
  background: var(--danger);
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  min-height: 40px;
  padding: 9px 10px;
}

textarea {
  min-height: 140px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 68px;
  padding: 10px clamp(16px, 4vw, 38px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 210px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--text);
  color: #fff;
  font-weight: 800;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav a {
  border-radius: 6px;
  color: var(--muted);
  padding: 9px 11px;
  font-weight: 700;
}

.nav a.active,
.nav a:hover {
  background: var(--surface-2);
  color: var(--text);
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: clamp(16px, 3vw, 34px);
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.2fr);
  gap: 28px;
  align-items: start;
}

.auth-copy h1,
.page-head h1,
.state-panel h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.05;
}

.auth-copy p,
.state-panel p,
.page-head p {
  color: var(--muted);
  line-height: 1.55;
  max-width: 680px;
}

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

.panel,
.state-panel,
.loading-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel h2 {
  margin: 0 0 16px;
}

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

.notice {
  grid-column: 1 / -1;
  color: var(--muted);
  min-height: 24px;
}

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

.notice.ok {
  color: var(--accent);
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar input,
.toolbar select {
  width: min(320px, 100%);
}

.converter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.converter-card {
  display: grid;
  gap: 10px;
  min-height: 150px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color 120ms ease, transform 120ms ease;
}

.converter-card:hover {
  border-color: #95a3b5;
  transform: translateY(-1px);
}

.converter-card strong {
  font-size: 17px;
}

.meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  width: max-content;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  min-height: 26px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 750;
}

.layout-2 {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.account-grid,
.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  align-items: start;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-head h2 {
  margin: 0;
}

.result-panel {
  min-height: 380px;
}

.task-list,
.jobs-list,
.user-list,
.file-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.row-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.row-item header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.row-item p {
  color: var(--muted);
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}

.status {
  color: var(--muted);
}

.status.finished,
.status.approved {
  color: var(--accent);
}

.status.error,
.status.disabled {
  color: var(--danger);
}

.status.waiting,
.status.processing,
.status.pending {
  color: var(--warning);
}

.json-view {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #101820;
  color: #e7eef7;
  border-radius: 8px;
  padding: 14px;
  font-size: 12px;
  line-height: 1.5;
  max-height: 420px;
  overflow: auto;
}

.download-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 11px;
  color: var(--accent-2);
  font-weight: 700;
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.7);
}

@media (max-width: 920px) {
  .auth-layout,
  .auth-panels,
  .layout-2,
  .account-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .nav {
    justify-content: flex-start;
  }
}
