@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+JP:wght@400;500;700&display=swap');

:root {
  /* Colors */
  --miu-brand-teal: #3ebdb8;
  --miu-brand-ink: #1a1a1a;
  --bg-color: #F8FAFC;
  --surface-color: #FFFFFF;
  --text-primary: #1E293B;
  --text-secondary: #64748B;
  --primary-color: #3ebdb8;
  --primary-hover: #32a39f;
  --danger-color: #EF4444;
  --danger-hover: #DC2626;
  --border-color: #E2E8F0;
  --success-color: #10B981;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', 'Noto Sans JP', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

/* Layout */
.container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Cards */
.card {
  background-color: var(--surface-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

/* Typography Utilities */
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-muted { color: var(--text-secondary); }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }

/* Buttons */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: white;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-color);
  border-color: #cbd5e1;
}

.btn-danger {
  background-color: white;
  color: var(--danger-color);
  border: 1px solid var(--danger-color);
}

.btn-danger:hover {
  background-color: var(--danger-color);
  color: white;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
}

.btn-with-icon {
  gap: 0.2rem;
  font-weight: 400;
}

.miu-btn-icon.material-symbols-outlined {
  font-family: "Material Symbols Outlined", sans-serif;
  font-size: 1.05em;
  line-height: 1;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20;
}

.miu-btn-label {
  line-height: 1.2;
}

button:disabled, .btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--surface-color);
  color: var(--text-primary);
  transition: var(--transition);
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control:read-only {
  background-color: #f1f5f9;
  color: var(--text-secondary);
}

/* Modals & Glassmorphism */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--surface-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 90%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-backdrop.active .modal-content {
  transform: translateY(0) scale(1);
}

/* Flex Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }

/* Margins */
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }

/* Header/Logo Placeholder */
.site-header {
  text-align: center;
  padding: 2rem 0 1rem;
}

.site-logo {
  max-width: 150px;
  height: auto;
  margin-bottom: 0.5rem;
}

.site-title {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

/* Status Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
}

.badge-success { background-color: #d1fae5; color: #065f46; }
.badge-secondary { background-color: #f1f5f9; color: #475569; }
.badge-primary { background-color: #dbeafe; color: #1e40af; }

/* ST-042 表の行アクション */
.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  justify-content: flex-end;
}

.action-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

.action-stack .action-bar {
  flex-wrap: nowrap;
}

.miu-menu {
  position: relative;
  display: inline-block;
}

.miu-menu-trigger::after {
  content: "▾";
  margin-left: 0.2em;
  font-size: 0.75em;
  opacity: 0.75;
}

.miu-menu-panel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 50;
  min-width: 10.5rem;
  padding: 0.35rem 0;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.miu-menu.open .miu-menu-panel {
  display: block;
}

.miu-menu-item {
  display: block;
  width: 100%;
  padding: 0.5rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 500;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  font-family: inherit;
  border-radius: 0;
}

.miu-menu-item:hover {
  background: var(--bg-color);
}

.miu-menu-item--danger {
  color: var(--danger-color);
}

.miu-menu-item--danger:hover {
  background: #fef2f2;
}

/* ST-020 ページャ共通 */
.miu-pager-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-color);
  background: var(--surface-color);
}

/* オペレーション手順（miu-guides.js） */
.miu-guide {
  margin-bottom: 1.25rem;
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary-color);
  border-radius: var(--radius-md);
  background: #f8fafc;
  overflow: hidden;
}

.miu-guide-title {
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.miu-guide-title::-webkit-details-marker {
  display: none;
}

.miu-guide-title::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.15s ease;
  color: var(--primary-color);
}

.miu-guide[open] .miu-guide-title::before {
  transform: rotate(90deg);
}

.miu-guide-body {
  padding: 0 1rem 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.miu-guide-steps {
  margin: 0 0 0.75rem 1.15rem;
  padding: 0;
}

.miu-guide-steps li {
  margin-bottom: 0.35rem;
}

.miu-guide-note {
  margin: 0;
  padding: 0.65rem 0.75rem;
  background: var(--surface-color);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  border: 1px solid var(--border-color);
}

/* ST-043: トースト・確認ダイアログ */
#miu-toast-root {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: min(92vw, 24rem);
  pointer-events: none;
}

.miu-toast {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  line-height: 1.45;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: auto;
  white-space: pre-wrap;
  text-align: center;
}

.miu-toast--visible {
  opacity: 1;
  transform: translateY(0);
}

.miu-toast--info {
  background: #1e293b;
  color: #f8fafc;
}

.miu-toast--success {
  background: #065f46;
  color: #ecfdf5;
}

.miu-toast--error {
  background: #991b1b;
  color: #fef2f2;
}

.miu-toast--warning {
  background: #92400e;
  color: #fffbeb;
}

.miu-feedback-modal {
  z-index: 1050;
}

.miu-feedback-panel {
  max-width: 420px;
  padding: 1.5rem;
}

.miu-feedback-title {
  margin: 0 0 0.75rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.miu-feedback-body {
  margin: 0 0 1.25rem;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

.miu-feedback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.miu-form-feedback {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  line-height: 1.45;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.miu-form-feedback[hidden] {
  display: none !important;
}

.miu-form-feedback--success {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}