:root {
  --bg: #080711;
  --panel: #0f0d1b;
  --panel-soft: #141122;
  --panel-strong: #1a152d;
  --line: rgba(136, 90, 255, 0.18);
  --line-strong: rgba(136, 90, 255, 0.34);
  --ink: #f5f3ff;
  --muted: #aaa5c5;
  --accent: #8f3dff;
  --accent-strong: #a85dff;
  --success: #18c57a;
  --danger: #ff6b81;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.46);
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  overflow-x: hidden;
  background:
    radial-gradient(circle at top right, rgba(143, 61, 255, 0.12), transparent 28%),
    radial-gradient(circle at bottom left, rgba(52, 27, 92, 0.28), transparent 25%),
    linear-gradient(180deg, #06050c 0%, #0a0713 100%);
}

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

img {
  display: block;
  width: 100%;
}

.hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #b794ff;
  font-weight: 700;
}

.hint,
.section-copy,
.auth-copy,
.simple-list,
.placeholder-card p {
  color: var(--muted);
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  padding: 24px;
}

.auth-hero,
.auth-card,
.sidebar,
.panel-card,
.section-panel,
.modal-card,
.topbar,
.placeholder-card {
  background: rgba(15, 13, 27, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.auth-hero,
.auth-card {
  border-radius: 28px;
  padding: 36px;
}

.auth-hero {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auth-hero h1,
.section-heading h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.04;
}

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

.auth-points article,
.stat-card,
.operator-chip,
.operator-card,
.variant-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(143, 61, 255, 0.14);
  border-radius: 20px;
  padding: 18px;
}

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

label {
  display: grid;
  gap: 8px;
  font-weight: 700;
  color: #f6f2ff;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(143, 61, 255, 0.18);
  border-radius: 14px;
  background: #0a0d18;
  color: var(--ink);
  padding: 12px 14px;
}

input::placeholder,
textarea::placeholder {
  color: #8d87ab;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(143, 61, 255, 0.18);
  border-color: var(--accent);
}

input:disabled,
textarea:disabled {
  opacity: 0.7;
}

.primary-btn,
.secondary-btn,
.icon-btn {
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.primary-btn,
.secondary-btn {
  padding: 12px 16px;
  font-weight: 700;
}

.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
}

.secondary-btn,
.icon-btn {
  color: #f7f4ff;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(143, 61, 255, 0.14);
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  font-size: 1.3rem;
}

.square-btn {
  border-radius: 12px;
}

.primary-btn:hover,
.secondary-btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
  opacity: 0.96;
}

.error-message {
  min-height: 1.2rem;
  color: var(--danger);
}

.app-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 40px;
}

.topbar {
  border-radius: 22px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.brand-lockup,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2e174a 0%, var(--accent) 100%);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.brand-name {
  margin: 0;
  letter-spacing: 0.24em;
  font-size: 0.82rem;
}

.workspace {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 18px;
  min-width: 0;
}

.sidebar,
.section-panel,
.panel-card,
.placeholder-card {
  border-radius: 24px;
  padding: 18px;
  min-width: 0;
}

.content {
  min-width: 0;
}

.sidebar-label {
  color: var(--muted);
  margin: 0 0 16px;
}

.menu-list {
  display: grid;
  gap: 8px;
}

.menu-item {
  text-align: left;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.menu-item.active {
  color: white;
  background: rgba(143, 61, 255, 0.16);
  border-color: rgba(143, 61, 255, 0.28);
}

.content {
  display: grid;
  gap: 18px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
  min-width: 0;
}

.section-heading h1,
.panel-card h2,
.modal-card h2,
.product-body h2 {
  margin: 0;
}

.stats-grid,
.dashboard-grid,
.analytics-grid,
.stock-grid,
.users-layout {
  display: grid;
  gap: 16px;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 16px;
}

.stat-card strong {
  display: block;
  font-size: 1.9rem;
  margin-bottom: 6px;
}

.dashboard-grid,
.analytics-grid,
.stock-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.users-layout {
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  align-items: start;
}

.user-create-card,
.user-list-card {
  min-width: 0;
}

.quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.simple-list {
  margin: 0;
  padding-left: 18px;
}

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

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.product-card {
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: #0d0b18;
}

.product-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: linear-gradient(135deg, #171128 0%, #22103a 100%);
}

.product-thumb img,
.thumb-fallback {
  width: 100%;
  height: 100%;
}

.thumb-fallback {
  display: grid;
  place-items: center;
  font-size: 3rem;
  font-weight: 800;
  color: #f6edff;
}

.badge-pill {
  position: absolute;
  top: 14px;
  right: 14px;
  background: #17c56f;
  color: white;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.85rem;
  font-weight: 800;
}

.product-body {
  padding: 18px;
}

.product-actions,
.table-actions,
.modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.product-actions {
  margin-top: 14px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid rgba(143, 61, 255, 0.12);
  border-radius: 18px;
  max-width: 100%;
}

.compact-table table {
  min-width: 100%;
  table-layout: fixed;
}

.compact-table th,
.compact-table td {
  white-space: normal;
  word-break: break-word;
}

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

th,
td {
  padding: 14px 14px;
  border-bottom: 1px solid rgba(143, 61, 255, 0.12);
  text-align: left;
}

th {
  color: #c9abff;
  background: rgba(255, 255, 255, 0.02);
}

td {
  color: #f3efff;
}

code {
  font-family: Consolas, monospace;
  word-break: break-all;
  color: #f8f5ff;
}

dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(5px);
}

.modal-card {
  width: min(760px, calc(100vw - 24px));
  border-radius: 24px;
  padding: 22px;
}

.wide-modal {
  width: min(920px, calc(100vw - 24px));
}

.modal-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

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

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

.plan-editor,
.preview-card,
.operator-chip,
.operator-card,
.placeholder-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 20px;
}

.plan-editor,
.preview-card,
.operator-card,
.placeholder-card {
  padding: 16px;
}

.plan-head,
.plan-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 0.8fr;
  gap: 10px;
  align-items: center;
}

.plan-head {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.plan-row {
  margin-top: 10px;
}

.toggle-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-visual {
  border-radius: 20px;
  overflow: hidden;
  min-height: 260px;
  background: #120f21;
}

.detail-side {
  display: grid;
  gap: 16px;
}

.variant-list {
  display: grid;
  gap: 10px;
}

.variant-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.variant-card span,
.detail-copy,
.preview-card p,
.preview-card strong,
.plan-head span,
.plan-row,
.section-heading h1,
.section-heading p {
  color: #f4efff;
}

.preview-card .eyebrow {
  color: #c8a4ff;
}

.muted-card {
  opacity: 0.56;
}

.license-modal-card {
  width: min(580px, calc(100vw - 24px));
}

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

.license-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  background: #0b0e18;
  border: 1px solid var(--line);
}

.license-row code {
  flex: 1;
}

.product-body h2,
.panel-card h2,
.modal-card h2,
.variant-card strong,
.stat-card strong,
.operator-chip strong,
.placeholder-card strong {
  color: #fff;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 14px 18px;
  border-radius: 16px;
  background: rgba(10, 67, 38, 0.96);
  border: 1px solid rgba(24, 197, 122, 0.28);
  color: white;
  box-shadow: var(--shadow);
}

.empty-card {
  padding: 28px;
  border-radius: 20px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
}

.tool-frame-card {
  padding: 0;
  overflow: hidden;
}

.tool-frame-embed {
  display: block;
  width: 100%;
  min-height: 980px;
  border: 0;
  background: #090711;
}

@media (max-width: 1100px) {
  .auth-screen,
  .workspace,
  .product-grid,
  .stats-grid,
  .dashboard-grid,
  .analytics-grid,
  .stock-grid,
  .users-layout,
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .auth-screen,
  .app-shell {
    width: auto;
    padding: 12px;
  }

  .auth-screen {
    gap: 14px;
  }

  .auth-hero,
  .auth-card,
  .sidebar,
  .section-panel,
  .panel-card,
  .placeholder-card,
  .modal-card {
    padding: 16px;
    border-radius: 20px;
  }

  .topbar,
  .section-heading,
  .topbar-actions,
  .toolbar,
  .modal-top,
  .modal-actions,
  .variant-card {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-points,
  .modal-grid,
  .plan-head,
  .plan-row {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 620px;
  }

  .tool-frame-embed {
    min-height: 760px;
  }
}
