:root {
  --main: #008080;
  --main-dark: #0b5f5f;
  --accent: #dfe6e9;
  --accent-soft: #f4f8f8;
  --text: #2d3748;
  --muted: #607080;
  --line: #ccd7dc;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --warning: #946200;
  --warning-soft: #fff8e1;
  --ok: #116149;
  --ok-soft: #e8f7f1;
  --card: #ffffff;
  --shadow: 0 12px 28px rgba(21, 45, 54, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
  color: var(--text);
  line-height: 1.7;
  background: linear-gradient(180deg, #f8fbfc 0%, #eef4f4 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.page-shell {
  width: min(1280px, calc(100% - 28px));
  margin: 0 auto;
  padding: 20px 0 42px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 14px;
  color: var(--main);
  font-weight: 700;
  text-decoration: none;
}

.back-link:hover,
.back-link:focus-visible {
  text-decoration: underline;
}

.hero,
.panel,
.table-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.hero {
  padding: 24px;
}

.eyebrow {
  display: inline-flex;
  padding: 5px 11px;
  border-radius: 999px;
  background: #e8f6f6;
  color: var(--main);
  font-size: 0.82rem;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin-top: 12px;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  line-height: 1.25;
}

h2 {
  font-size: 1.05rem;
}

.hero p,
.hint,
.summary,
.status-detail,
.empty-state {
  color: var(--muted);
}

.app-layout {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.panel {
  padding: 18px;
}

.top-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(520px, 1.35fr);
  gap: 16px;
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 190px;
  padding: 24px;
  border: 2px dashed #92b9bb;
  border-radius: 8px;
  background: #f8fcfc;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone.is-dragging,
.dropzone:hover,
.dropzone:focus-within {
  border-color: var(--main);
  background: #eef8f8;
}

.dropzone input {
  display: none;
}

.drop-title {
  display: block;
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 700;
}

.drop-text {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.94rem;
}

.drop-button {
  display: inline-flex;
  margin-top: 14px;
  padding: 10px 16px;
  border-radius: 6px;
  background: var(--main);
  color: #fff;
  font-weight: 700;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field span {
  font-size: 0.9rem;
  font-weight: 700;
}

.inline-action {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.replace-action {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
}

input[type="text"] {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #bfccd2;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

input[type="text"]:focus {
  outline: 3px solid rgba(0, 128, 128, 0.14);
  border-color: var(--main);
}

.button,
.primary-button,
.danger-button,
.ghost-button {
  appearance: none;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 700;
  white-space: nowrap;
}

.primary-button {
  background: var(--main);
  color: #fff;
}

.button {
  background: #f5f9f9;
  border-color: #cbdada;
  color: var(--main-dark);
}

.ghost-button {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.danger-button {
  background: #fff;
  border-color: #f0bbb5;
  color: var(--danger);
}

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

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.summary {
  font-size: 0.94rem;
}

.alert {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 6px;
  font-weight: 700;
}

.alert-warning {
  border: 1px solid #e9c46a;
  background: var(--warning-soft);
  color: var(--warning);
}

.alert-error {
  border: 1px solid #f0bbb5;
  background: var(--danger-soft);
  color: var(--danger);
}

.table-card {
  overflow: hidden;
}

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

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

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

th {
  background: var(--accent);
  color: var(--text);
  font-size: 0.9rem;
  white-space: nowrap;
}

td.no-cell {
  width: 64px;
  color: var(--muted);
  font-weight: 700;
}

.original-name {
  max-width: 320px;
  overflow-wrap: anywhere;
}

.rename-cell {
  min-width: 300px;
}

.extension {
  margin-left: 6px;
  color: var(--muted);
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.status-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-error {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-detail {
  margin-top: 6px;
  max-width: 360px;
  font-size: 0.84rem;
}

.empty-state {
  padding: 28px;
  text-align: center;
}

.rules {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 1.2em;
  color: var(--muted);
  font-size: 0.92rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 31, 41, 0.58);
}

.preview-modal {
  display: grid;
  gap: 14px;
  width: min(980px, 100%);
  max-height: min(92vh, 900px);
  padding: 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.preview-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.preview-name-field {
  max-width: 620px;
}

.preview-name-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}

.preview-canvas-wrap {
  position: relative;
  min-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2f4;
  text-align: center;
}

.preview-canvas-wrap canvas {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 8px 24px rgba(45, 55, 72, 0.16);
}

.preview-loading {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.78);
  color: var(--main-dark);
  font-weight: 700;
}

@media (max-width: 980px) {
  .top-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 14px, 1280px);
    padding-top: 14px;
  }

  .hero,
  .panel {
    padding: 16px;
  }

  .bulk-grid,
  .inline-action,
  .replace-action {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar-actions,
  .row-actions,
  .toolbar-actions button {
    width: 100%;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .preview-modal {
    max-height: 96vh;
    padding: 14px;
  }

  .preview-modal-head {
    flex-direction: column;
  }
}
