/* ファイルパス: public/css/style.css */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --surface-blue: #f5f7ff;
  --border: #e5e7eb;
  --border-strong: #d9def0;
  --text: #111827;
  --text-muted: #667085;
  --text-soft: #98a2b3;
  --primary: #4f46e5;
  --primary-2: #2563eb;
  --primary-soft: #eef2ff;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --blue-soft: #dbeafe;
  --green-soft: #dcfce7;
  --red-soft: #fee2e2;
  --yellow-soft: #fef3c7;
  --purple-soft: #ede9fe;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 18px 50px rgba(15, 23, 42, 0.10);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --header-h: 72px;
  --tab-h: 58px;
  --sidebar-w: 260px;
  --right-panel-w: 320px;
  --toolbar-w: 88px;
  --font: Inter, "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body {
  overflow-x: hidden;
}

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

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

button {
  cursor: pointer;
}

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

.app-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(79, 70, 229, 0.05), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.app-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.header-left,
.header-center,
.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-center {
  flex: 1;
  min-width: 0;
}

.header-right {
  margin-left: auto;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.logo img {
  width: 164px;
  height: 40px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 650;
  font-size: 14px;
}

.project-title {
  font-weight: 750;
  font-size: 18px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.save-status,
.meta-text {
  color: var(--text-muted);
  font-size: 13px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--success);
  display: inline-block;
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.btn {
  height: 42px;
  padding: 0 18px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  border-color: var(--border-strong);
  background: #fbfcff;
}

.btn-primary {
  border-color: var(--primary);
  background: linear-gradient(135deg, #4f46e5 0%, #5b35f5 100%);
  color: #fff;
  box-shadow: 0 10px 22px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4338ca 0%, #4f2ddd 100%);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.btn-soft {
  background: var(--primary-soft);
  border-color: #d9ddff;
  color: var(--primary);
}

.btn-danger {
  background: #fff;
  border-color: #fecaca;
  color: #dc2626;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--header-h));
}

.sidebar {
  background: rgba(255, 255, 255, 0.74);
  border-right: 1px solid var(--border);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidebar-card,
.panel-card,
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.sidebar-card {
  padding: 18px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  height: 48px;
  border-radius: 12px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #475467;
  font-weight: 650;
  font-size: 14px;
}

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

.main {
  padding: 28px 32px 40px;
  min-width: 0;
}

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

.page-title {
  margin: 0;
  font-size: 34px;
  letter-spacing: -0.05em;
  line-height: 1.1;
}

.page-subtitle {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 15px;
}

.search-box {
  height: 44px;
  min-width: 320px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--text);
  background: transparent;
}

.tabs {
  height: var(--tab-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 20px;
  padding: 0 20px;
}

.tab {
  border: none;
  background: transparent;
  padding: 0 14px;
  color: #475467;
  font-weight: 750;
  font-size: 14px;
  position: relative;
}

.tab.active {
  color: var(--primary);
}

.tab.active::after {
  content: "";
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: var(--primary);
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
}

.sub-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  padding: 0 28px;
  height: 62px;
}

.sub-tab {
  height: 48px;
  padding: 0 18px;
  border: none;
  border-radius: 12px 12px 0 0;
  background: transparent;
  color: #475467;
  font-weight: 750;
}

.sub-tab.active {
  color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 -3px 0 var(--primary);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.project-card {
  padding: 24px;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.project-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.project-icon {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 26px;
  color: var(--primary);
  background: var(--primary-soft);
}

.project-card h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.project-card p {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

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

.tag {
  display: inline-flex;
  height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 750;
}

.tag.green {
  background: var(--green-soft);
  color: #15803d;
}

.tag.red {
  background: var(--red-soft);
  color: #dc2626;
}

.tag.yellow {
  background: var(--yellow-soft);
  color: #b45309;
}

.tag.blue {
  background: var(--blue-soft);
  color: #2563eb;
}

.table-card {
  overflow: hidden;
}

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

.table th {
  background: #fbfcff;
  color: #475467;
  font-size: 12px;
  letter-spacing: 0.02em;
  text-align: left;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  vertical-align: middle;
}

.table tr:last-child td {
  border-bottom: none;
}

.form-control,
.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.input,
.select {
  height: 44px;
  padding: 0 14px;
}

.textarea {
  min-height: 110px;
  resize: vertical;
  padding: 12px 14px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 750;
  color: #475467;
  margin-bottom: 8px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.workspace-shell {
  display: grid;
  grid-template-columns: var(--toolbar-w) 1fr var(--right-panel-w);
  height: calc(100vh - var(--header-h) - var(--tab-h));
  background: #fff;
}

.canvas-toolbar {
  border-right: 1px solid var(--border);
  background: #fff;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tool-btn {
  min-height: 66px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  color: #475467;
  display: grid;
  place-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 650;
}

.tool-btn.active,
.tool-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: #dfe3ff;
}

.canvas-area {
  position: relative;
  overflow: hidden;
  background-color: #fff;
  background-image: radial-gradient(#d6d9e6 1px, transparent 1px);
  background-size: 22px 22px;
}

.canvas-board {
  position: relative;
  width: 1800px;
  height: 1100px;
  transform-origin: top left;
}

.frame {
  position: absolute;
  border: 1.5px dashed rgba(79, 70, 229, 0.22);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.36);
  padding: 28px;
}

.frame-title {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 140px;
  height: 38px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 800;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: var(--shadow-sm);
}

.sticky {
  position: absolute;
  width: 148px;
  min-height: 116px;
  padding: 18px 16px;
  border-radius: 4px;
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.12);
  color: #111827;
  font-weight: 700;
  line-height: 1.55;
  font-size: 14px;
}

.sticky.pink {
  background: #ffd9d9;
}

.sticky.blue {
  background: #dcecff;
}

.sticky.green {
  background: #dcf8d8;
}

.sticky.yellow {
  background: #ffedb6;
}

.sticky.orange {
  background: #ffe0ad;
}

.connector {
  position: absolute;
  height: 2px;
  background: #111827;
  transform-origin: left center;
}

.connector::after {
  content: "";
  position: absolute;
  right: -2px;
  top: -5px;
  border-left: 9px solid #111827;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.right-panel {
  border-left: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  padding: 22px;
  overflow: auto;
}

.panel-title {
  font-size: 18px;
  font-weight: 850;
  letter-spacing: -0.03em;
  margin: 0 0 18px;
}

.panel-section {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.panel-section:last-child {
  border-bottom: none;
}

.color-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.color-dot {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--border);
}

.color-dot.active {
  box-shadow: 0 0 0 2px var(--primary);
}

.zoom-controls,
.toast,
.mini-map {
  position: absolute;
  z-index: 10;
}

.zoom-controls {
  right: 24px;
  bottom: 24px;
  display: flex;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px;
  box-shadow: var(--shadow-md);
}

.zoom-controls button,
.zoom-controls span {
  height: 34px;
  min-width: 42px;
  border: none;
  border-radius: 9px;
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 750;
}

.mini-map {
  right: 24px;
  bottom: 86px;
  width: 168px;
  height: 112px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
}

.toast {
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  min-width: 340px;
  min-height: 58px;
  padding: 0 18px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-weight: 750;
}

.toast::before {
  content: "✓";
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #5dbb55;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.revenue-layout {
  display: grid;
  grid-template-columns: 260px 1fr 330px;
  gap: 24px;
  padding: 24px;
}

.stepper {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
}

.step.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.step-no {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 850;
  background: #fff;
}

.revenue-main {
  min-width: 0;
}

.revenue-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.revenue-table-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1.1fr 1.8fr 100px;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.revenue-table-row.header {
  background: #fbfcff;
  color: #475467;
  font-size: 13px;
  font-weight: 800;
}

.result-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.metric-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.metric-label {
  color: var(--primary);
  font-size: 14px;
  font-weight: 850;
  margin-bottom: 10px;
}

.metric-value {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -0.06em;
}

.metric-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 6px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 480px;
  background:
    radial-gradient(circle at 30% 20%, rgba(79, 70, 229, 0.14), transparent 35%),
    linear-gradient(135deg, #ffffff 0%, #f4f7ff 100%);
}

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

.auth-card {
  margin: auto 56px auto 0;
  padding: 34px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
}

.auth-card h1 {
  margin: 0;
  font-size: 32px;
  letter-spacing: -0.05em;
}

.auth-card p {
  color: var(--text-muted);
  line-height: 1.7;
}

.admin-layout {
  display: grid;
  grid-template-columns: 240px 1fr 300px;
  gap: 24px;
  padding: 24px;
}

.kpi-card {
  padding: 24px;
}

.kpi-value {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: -0.06em;
  margin-top: 8px;
}

.kpi-label {
  color: #475467;
  font-weight: 750;
}

.ai-layout {
  display: grid;
  grid-template-columns: 260px 1fr 320px;
  gap: 24px;
  padding: 28px;
}

.chat-message {
  max-width: 820px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}

.chat-message.user {
  margin-left: auto;
  background: var(--primary-soft);
  border-color: #dfe3ff;
}

.chat-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  position: sticky;
  bottom: 0;
  padding-top: 14px;
  background: linear-gradient(180deg, transparent 0%, #f8fafc 30%);
}

.export-layout {
  display: grid;
  grid-template-columns: 300px 1fr 330px;
  gap: 24px;
  padding: 24px;
}

.export-preview {
  height: 230px;
  border-radius: 14px;
  background:
    linear-gradient(135deg, #ffffff 0%, #eef2ff 100%);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--primary);
  font-weight: 850;
}

@media (max-width: 1180px) {
  .layout,
  .admin-layout,
  .ai-layout,
  .export-layout,
  .revenue-layout {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .right-panel {
    display: none;
  }

  .workspace-shell {
    grid-template-columns: 72px 1fr;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}
