:root {
  --bg: #ffffff;
  --surface: #f7f9fb;
  --panel: #ffffff;
  --text: #18202b;
  --muted: #667085;
  --border: #d8dee8;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --success-bg: #e8f7ef;
  --success-text: #166534;
  --error-bg: #fcebea;
  --error-text: #b42318;
  --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: Arial, "Noto Sans KR", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

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

code {
  overflow-wrap: anywhere;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 68px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.nav a {
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  padding: 9px 12px;
}

.nav a.active,
.nav a:hover {
  background: #eef7f6;
  color: var(--accent-dark);
}

.logout-form {
  margin: 0;
}

.page {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

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

.page-heading h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.1;
}

.page-heading p,
.tool-card p,
.summary-panel p,
.muted {
  color: var(--muted);
  margin: 0;
}

.summary-grid,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-settings dl {
  display: grid;
  gap: 12px;
  margin: 0;
}

.compact-settings div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
}

.compact-settings dt {
  color: var(--muted);
  font-weight: 700;
}

.compact-settings dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.summary-panel,
.tool-card,
.work-panel,
.result-panel,
.section-block,
.login-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.summary-panel {
  padding: 20px;
}

.summary-panel h2,
.section-block h2,
.result-panel h2,
.form-section h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.section-block {
  padding: 22px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

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

.tool-card {
  display: flex;
  align-items: center;
  min-height: 118px;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
}

.tool-card h2 {
  margin: 0 0 8px;
  font-size: 19px;
}

.primary-button,
.secondary-button,
.ghost-button,
.download-button,
.small-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  min-height: 42px;
  padding: 0 16px;
  white-space: nowrap;
}

.primary-button,
.download-button {
  background: var(--accent);
  color: white;
}

.primary-button:hover,
.download-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  background: #e7f4f2;
  color: var(--accent-dark);
}

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

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

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

.work-panel,
.result-panel {
  padding: 20px;
}

.form-section {
  margin-bottom: 16px;
}

.stack-form,
.work-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  min-height: 44px;
  padding: 10px 12px;
}

.file-drop {
  justify-content: center;
  min-height: 118px;
  border: 1px dashed #9ca3af;
  border-radius: 8px;
  background: var(--surface);
  padding: 20px;
}

.file-drop span {
  font-size: 16px;
}

.file-drop small {
  color: var(--muted);
  font-weight: 400;
}

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

.option-grid h2 {
  grid-column: 1 / -1;
}

.alert {
  border-radius: 8px;
  font-weight: 700;
  margin-bottom: 18px;
  padding: 13px 16px;
}

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

.alert.error {
  background: var(--error-bg);
  color: var(--error-text);
}

.result-list {
  display: grid;
  gap: 12px;
  margin: 0 0 18px;
}

.result-list div {
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.result-list dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.result-list dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.table-wrap {
  overflow-x: auto;
}

.jobs-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}

.jobs-table th,
.jobs-table td {
  border-bottom: 1px solid var(--border);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

.jobs-table th {
  background: var(--surface);
  color: #344054;
  font-size: 13px;
}

.file-name {
  display: block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status {
  display: inline-flex;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 9px;
}

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

.status.failed {
  background: var(--error-bg);
  color: var(--error-text);
}

.status.running {
  background: #fff7e6;
  color: #92400e;
}

.small-download {
  min-height: 32px;
  padding: 0 10px;
  background: var(--accent);
  color: white;
}

.download-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.file-count {
  display: inline-block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-right: 6px;
}

.error-cell {
  color: var(--error-text);
  max-width: 260px;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background: var(--surface);
}

.login-panel {
  width: min(430px, calc(100% - 32px));
  padding: 28px;
}

.login-panel h1 {
  margin: 0 0 8px;
}

@media (max-width: 900px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 14px 18px;
  }

  .nav {
    flex-wrap: wrap;
  }

  .page-heading,
  .work-layout {
    grid-template-columns: 1fr;
  }

  .page-heading {
    flex-direction: column;
  }

  .summary-grid,
  .settings-grid,
  .tool-grid {
    grid-template-columns: 1fr;
  }

  .work-layout {
    display: block;
  }

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

@media (max-width: 560px) {
  .page {
    width: min(100% - 24px, 1160px);
    padding-top: 24px;
  }

  .brand {
    white-space: normal;
  }

  .nav a {
    padding: 8px 9px;
  }

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