:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-muted: #f9fafb;
  --text: #17202a;
  --muted: #687385;
  --line: #dfe4ea;
  --line-strong: #cbd3dc;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eaf1ff;
  --success: #15803d;
  --success-soft: #dcfce7;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 64px;
  padding: 0 clamp(18px, 3vw, 32px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.brand,
.topnav,
.flow-strip,
.row-actions,
.url-box,
.ghost-button,
.primary-button {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

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

.topnav {
  gap: 6px;
}

.nav-link,
.ghost-button,
.primary-button,
.icon-button {
  border-radius: var(--radius);
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.nav-link {
  padding: 8px 12px;
  color: var(--muted);
  font-weight: 600;
}

.nav-link:hover,
.nav-link.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.ghost-button,
.primary-button {
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  font-weight: 700;
}

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

.ghost-button:hover,
.icon-button:hover {
  background: var(--surface-muted);
  border-color: var(--line-strong);
}

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

.primary-button:hover {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
}

.primary-button:disabled {
  opacity: 0.62;
  cursor: wait;
}

.large {
  width: 100%;
  min-height: 48px;
}

.full-width {
  width: 100%;
}

.upload-shell,
.dashboard-shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

.upload-hero,
.dashboard-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

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

h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.15;
  letter-spacing: 0;
}

.dashboard-head h1 {
  font-size: clamp(28px, 3vw, 40px);
}

.lead {
  max-width: 640px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.flow-strip {
  flex: 0 0 auto;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.flow-strip span {
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--surface-muted);
}

.upload-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 20px;
}

.drop-panel,
.result-panel,
.table-panel,
.metric-card,
.login-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.drop-panel {
  padding: 20px;
}

.drop-zone {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 220px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--text);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.drop-zone svg {
  width: 44px;
  height: 44px;
  margin-bottom: 12px;
  color: var(--primary);
}

.drop-zone strong {
  font-size: 20px;
}

.drop-zone span {
  margin-top: 6px;
  color: var(--muted);
}

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

.mode-card {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.mode-card:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.mode-card input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.mode-card strong,
.mode-card small {
  display: block;
}

.mode-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

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

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

.full-row {
  grid-column: 1 / -1;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  padding: 0 12px;
  color: var(--text);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.result-panel {
  min-height: 340px;
  padding: 20px;
}

.empty-result,
.status-page {
  display: grid;
  place-items: center;
  min-height: 280px;
  color: var(--muted);
  text-align: center;
}

.empty-result svg {
  color: var(--primary);
}

.result-success h2 {
  margin: 16px 0;
  font-size: 22px;
}

.url-box {
  gap: 8px;
  margin-bottom: 14px;
}

.url-box input {
  font-size: 13px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
}

.icon-button.danger:hover {
  border-color: var(--danger-soft);
  background: var(--danger-soft);
  color: var(--danger);
}

.embed-box {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.embed-box span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.embed-box code {
  display: block;
  overflow-x: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metric-card {
  padding: 18px;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin-top: 6px;
  font-size: 30px;
  line-height: 1.1;
}

.table-panel {
  overflow: hidden;
}

.table-tools {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.search-field {
  position: relative;
  flex: 1;
}

.search-field svg {
  position: absolute;
  left: 12px;
  bottom: 12px;
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.search-field input {
  padding-left: 40px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.project-title {
  display: grid;
  gap: 5px;
  min-width: 260px;
}

.project-title a {
  color: var(--muted);
  font-size: 12px;
}

td small {
  display: block;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--warning-soft);
  color: #92400e;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.active {
  background: var(--success-soft);
  color: var(--success);
}

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

.type-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.type-pill svg {
  width: 14px;
  height: 14px;
}

.type-pill.file {
  background: #fef3c7;
  color: #92400e;
}

.type-pill.page {
  background: #dbeafe;
  color: #1d4ed8;
}

.row-actions {
  gap: 6px;
}

.file-share-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: var(--surface-muted);
}

.file-share-card {
  display: grid;
  width: min(560px, 100%);
  gap: 20px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.file-icon {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary);
}

.file-icon svg {
  width: 30px;
  height: 30px;
}

.file-share-card h1 {
  font-size: clamp(26px, 4vw, 38px);
}

.file-meta {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.file-meta div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
}

.file-meta dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.file-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.file-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ghost-button.strong {
  min-height: 42px;
  justify-content: center;
  color: var(--text);
  font-weight: 800;
}

.login-body {
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-shell {
  width: min(420px, 100%);
}

.login-panel {
  display: grid;
  gap: 16px;
  padding: 24px;
}

.login-panel h1 {
  font-size: 32px;
}

.alert-message {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--danger-soft);
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 700;
}

@media (max-width: 880px) {
  .topbar,
  .upload-hero,
  .dashboard-head,
  .table-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    padding-block: 12px;
  }

  .topnav {
    flex-wrap: wrap;
  }

  .upload-grid,
  .metric-grid,
  .form-grid,
  .mode-selector,
  .file-actions {
    grid-template-columns: 1fr;
  }

  .flow-strip {
    width: 100%;
    justify-content: center;
  }

  h1 {
    font-size: 34px;
  }

  .row-actions {
    min-width: 258px;
  }
}
