/* ============================================================
   my amidasu — デザインシステム
   あみだすブランド: オレンジ #F3982D / #E63828 / Noto Sans JP
   モバイルファースト。767px以下=下部ナビ、768px以上=サイドバー
   ============================================================ */

:root {
  --primary: #F3982D;
  --primary-dark: #E63828;
  --primary-light: #F7B95E;
  --primary-pale: #FEF3E2;
  --text: #333333;
  --text-light: #666666;
  --text-muted: #999999;
  --white: #FFFFFF;
  --bg: #FAF7F2;
  --bg-warm: #FAFAF8;
  --border: #E8E2D8;
  --success: #4CAF50;
  --danger: #E63828;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 2px 10px rgba(60, 42, 20, 0.07);
  --shadow-hover: 0 6px 20px rgba(60, 42, 20, 0.13);
  --sidebar-w: 240px;
  --grad: linear-gradient(135deg, #F3982D 0%, #E63828 100%);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.7;
}

img { max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ============ アプリレイアウト ============ */
.app { min-height: 100vh; }

.main {
  padding: 16px 16px 84px; /* 下部ナビ分の余白 */
  max-width: 1200px;
  margin: 0 auto;
}

/* ============ モバイル トップバー ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
}
.topbar .logo img { height: 30px; display: block; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.topbar-user {
  font-size: 12px; color: var(--text-light);
  max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ============ サイドバー（デスクトップ） ============ */
.sidebar {
  display: none;
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  flex-direction: column;
  z-index: 60;
}
.sidebar .logo { padding: 4px 12px 20px; }
.sidebar .logo img { height: 34px; }
.side-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-light);
  font-size: 14px; font-weight: 600;
}
.side-nav a:hover { background: var(--primary-pale); color: var(--text); }
.side-nav a.active { background: var(--primary-pale); color: var(--primary-dark); }
.side-nav .icon { width: 20px; text-align: center; font-size: 16px; }
.side-nav hr { border: none; border-top: 1px solid var(--border); margin: 10px 8px; }
.sidebar-foot {
  padding: 12px; font-size: 12px; color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ============ 下部ナビ（モバイル） ============ */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex;
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10px; color: var(--text-muted); font-weight: 600;
  padding: 4px 0;
}
.bottom-nav a .icon { font-size: 20px; line-height: 1; }
.bottom-nav a.active { color: var(--primary-dark); }

/* ============ ページ見出し ============ */
.page-header { margin: 8px 0 16px; }
.page-header h1 { font-size: 20px; font-weight: 700; }
.page-header .sub { font-size: 13px; color: var(--text-light); margin-top: 2px; }

/* ============ カード ============ */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  border: 1px solid rgba(232, 226, 216, 0.6);
}
a.card { display: block; transition: box-shadow .2s, transform .2s; }
a.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.card .card-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--primary-pale);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin-bottom: 12px;
}
.card h2, .card h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.card p { font-size: 13px; color: var(--text-light); }
.card .card-foot { margin-top: 14px; text-align: right; }

/* ============ ボタン ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 14px; font-weight: 700;
  border: none;
  transition: opacity .15s, box-shadow .15s;
}
.btn:hover { opacity: .88; }
.btn-primary { background: var(--grad); color: var(--white); box-shadow: 0 3px 10px rgba(230, 56, 40, .25); }
.btn-outline { background: var(--white); color: var(--primary-dark); border: 1.5px solid var(--primary); }
.btn-ghost { background: transparent; color: var(--text-light); border: 1px solid var(--border); }
.btn-sm { padding: 6px 14px; font-size: 12.5px; }
.btn-block { width: 100%; }

/* ============ バッジ ============ */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; vertical-align: middle;
}
.badge-free { background: #E8F5E9; color: #2E7D32; }
.badge-paid { background: var(--primary-pale); color: var(--primary-dark); }
.badge-new { background: var(--primary-dark); color: var(--white); }
.badge-muted { background: #F0EDE6; color: var(--text-light); }
.badge-answered { background: #E8F5E9; color: #2E7D32; }
.badge-waiting { background: #FFF3E0; color: #E65100; }

/* ============ リスト行（お知らせ・資料一覧） ============ */
.list { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.list-item:last-child { border-bottom: none; }
a.list-item:hover { background: var(--primary-pale); }
.list-item .date { font-size: 12px; color: var(--text-muted); flex-shrink: 0; width: 86px; }
.list-item .title { font-size: 14px; font-weight: 600; flex: 1; min-width: 0; }
.list-item .title .desc { display: block; font-size: 12px; color: var(--text-light); font-weight: 400; }
.list-item .chev { color: var(--primary); flex-shrink: 0; }

/* ============ セクション ============ */
.section { margin-bottom: 28px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.section-head h2 { font-size: 17px; font-weight: 700; }
.section-head .more { font-size: 13px; color: var(--primary-dark); font-weight: 600; }

/* ============ フォーム ============ */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.field input[type="text"], .field input[type="email"], .field input[type="search"],
.field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px; /* iOSズーム防止 */
  font-family: inherit;
  background: var(--white);
  color: var(--text);
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(243, 152, 45, .15);
}
.field .hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* OTP 6桁入力 */
.otp-boxes { display: flex; gap: 8px; justify-content: center; }
.otp-boxes input {
  width: 44px; height: 54px;
  text-align: center; font-size: 24px; font-weight: 700;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--white); color: var(--text);
}
.otp-boxes input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(243,152,45,.15); }

/* ============ 動画プレースホルダ（Vimeo枠） ============ */
.video-embed {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #3A3532 0%, #191715 100%);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 10px;
}
.video-embed .play {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  color: var(--white); font-size: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.video-embed .vlabel { color: rgba(255,255,255,.85); font-size: 13px; font-weight: 600; }

/* ============ タブ ============ */
.tabs {
  display: flex; gap: 4px; overflow-x: auto;
  border-bottom: 2px solid var(--border);
  margin-bottom: 18px;
  -webkit-overflow-scrolling: touch;
}
.tabs button, .tabs a {
  padding: 10px 16px;
  background: none; border: none;
  font-size: 14px; font-weight: 700; color: var(--text-muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
}
.tabs .active { color: var(--primary-dark); border-bottom-color: var(--primary-dark); }

/* ============ テーブル（管理画面） ============ */
.table-scroll { overflow-x: auto; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); }
table.data { width: 100%; border-collapse: collapse; min-width: 640px; }
table.data th, table.data td { padding: 12px 14px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--border); }
table.data th { background: var(--bg-warm); font-weight: 700; color: var(--text-light); white-space: nowrap; }
table.data tr:last-child td { border-bottom: none; }

/* ============ 質問箱 ============ */
.qa-item { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px; }
.qa-item .qa-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--text-muted); margin-bottom: 8px; flex-wrap: wrap; }
.qa-q { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.qa-a {
  background: var(--primary-pale);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 14px;
  font-size: 13.5px;
}
.qa-a .qa-a-label { font-size: 11px; font-weight: 700; color: var(--primary-dark); display: block; margin-bottom: 4px; }

/* ============ アラート・通知 ============ */
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--primary-pale);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 13.5px;
  margin-bottom: 18px;
}

/* ============ ヒーロー（ホーム上部） ============ */
.hero {
  background: var(--grad);
  border-radius: var(--radius);
  color: var(--white);
  padding: 22px 20px;
  margin-bottom: 20px;
}
.hero h1 { font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.hero p { font-size: 13px; opacity: .92; }

/* ============ ログイン画面 ============ */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(1000px 500px at 90% -10%, rgba(243,152,45,.14), transparent),
    radial-gradient(800px 400px at -10% 110%, rgba(230,56,40,.10), transparent),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--white);
  border-radius: 20px;
  box-shadow: var(--shadow-hover);
  padding: 32px 26px;
}
.auth-card .logo { text-align: center; margin-bottom: 8px; }
.auth-card .logo img { height: 40px; }
.auth-card h1 { font-size: 17px; text-align: center; margin-bottom: 6px; }
.auth-card .lead { font-size: 13px; color: var(--text-light); text-align: center; margin-bottom: 22px; }
.auth-steps { display: flex; justify-content: center; gap: 6px; margin-bottom: 20px; }
.auth-steps .step {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border);
}
.auth-steps .step.active { background: var(--primary); width: 24px; border-radius: 999px; }

/* ============ フッター ============ */
.page-foot { text-align: center; font-size: 12px; color: var(--text-muted); padding: 24px 0 8px; }

/* ============ ユーティリティ ============ */
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 12.5px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hide-mobile { display: none; }

/* ============================================================
   デスクトップ（768px〜）
   ============================================================ */
@media (min-width: 768px) {
  .topbar { display: none; }
  .bottom-nav { display: none; }
  .sidebar { display: flex; }
  .main { margin-left: var(--sidebar-w); padding: 28px 32px 40px; max-width: none; }
  .main > .inner { max-width: 1080px; margin: 0 auto; }
  .page-header h1 { font-size: 24px; }
  .card-grid { grid-template-columns: repeat(2, 1fr); gap: 18px; }
  .card-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
  .hero { padding: 30px 28px; }
  .hero h1 { font-size: 23px; }
  .hide-mobile { display: initial; }
  .hide-desktop { display: none; }
}

@media (min-width: 1080px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ============ サインアウト（POSTフォーム内ボタンをナビリンクと同じ見た目に） ============ */
.side-nav .nav-signout {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px;
  border: none; background: none; text-align: left;
  border-radius: var(--radius-sm);
  color: var(--text-light);
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer;
}
.side-nav .nav-signout:hover { background: var(--primary-pale); color: var(--text); }
.side-nav .nav-signout .icon { width: 20px; text-align: center; font-size: 16px; }
