:root {
  --primary:   #FF6B35;
  --blue:      #0984E3;
  --dark:      #2D3436;
  --accent:    #00B894;
  --purple:    #6C5CE7;
  --white:     #FFFFFF;
  --bg:        #F0F2F5;
  --border:    #e5e7eb;
  --text:      #2D3436;
  --muted:     #636e72;
  --shadow-md: 0 8px 30px rgba(0,0,0,.12);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.18);
  --radius:    12px;
  --trans:     0.25s ease;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  min-height: 100%;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input { font-family: inherit; }

/* ── ログイン画面 ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  padding: 24px;
}
.login-card {
  background: var(--white);
  border-radius: 20px;
  padding: 48px 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  text-align: center;
  margin-bottom: 36px;
}
.login-logo-title {
  font-family: 'Poppins', sans-serif;
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--primary), #e17055);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: block;
}
.login-logo-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
  display: block;
}
.login-title {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 28px;
  color: var(--dark);
}
.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 6px;
}
.form-group input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color var(--trans), box-shadow var(--trans);
}
.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,107,53,.12);
}
.form-group input::placeholder { color: #b2bec3; }
.btn-login {
  width: 100%;
  padding: 15px;
  background: var(--primary);
  color: var(--white);
  font-size: 16px;
  font-weight: 700;
  border-radius: var(--radius);
  margin-top: 8px;
  transition: all var(--trans);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-login:hover {
  background: #E55A2B;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255,107,53,.35);
}
.login-error {
  display: none;
  background: #fff5f5;
  border: 1px solid #fed7d7;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #e53e3e;
  margin-bottom: 16px;
  align-items: center;
  gap: 8px;
}
.login-error.show { display: flex; }
.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 12px;
  color: var(--muted);
}
/* 開発用クイックログインボタン */
.quick-login-btn {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 8px;
  color: rgba(30,30,40,.75);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--trans), border-color var(--trans);
}
.quick-login-btn:hover {
  background: rgba(255,107,53,.08);
  border-color: rgba(255,107,53,.35);
  color: var(--primary);
}

/* ── アプリ選択画面（macOS風） ── */
.apps-page {
  min-height: 100vh;
  background: #f2f2f7;
}

/* ヘッダー */
.apps-header {
  background: rgba(255,255,255,.85);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0,0,0,.06);
  padding: 0 40px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.apps-header-logo {
  font-family: 'Poppins', sans-serif;
  font-size: 19px;
  font-weight: 800;
  color: #010066;
  letter-spacing: -.5px;
}
.apps-header-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-info { text-align: right; }
.user-name {
  font-size: 13px;
  font-weight: 600;
  color: #1c1c1e;
  display: block;
  line-height: 1.4;
}
.user-company {
  font-size: 11px;
  color: #8e8e93;
  display: block;
}

/* ヘッダーボタン */
.btn-admin {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 13px;
  background: rgba(99,91,255,.08);
  border: 1px solid rgba(99,91,255,.25);
  border-radius: 8px;
  font-size: 12px; font-weight: 600; color: #635bff;
  transition: all .18s ease; text-decoration: none;
}
.btn-admin:hover { background: #635bff; color: #fff; border-color: #635bff; }
.btn-logout {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 13px;
  background: rgba(0,0,0,.04);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 8px;
  font-size: 12px; font-weight: 600; color: #6b7280;
  transition: all .18s ease;
}
.btn-logout:hover { background: rgba(0,0,0,.08); color: #374151; }

/* メインコンテンツ */
.apps-body {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 40px 80px;
  overflow: visible;
}

/* ウェルカムセクション */
.apps-welcome {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(0,0,0,.07);
}
.apps-welcome h1 {
  font-size: 22px; font-weight: 700; color: #1c1c1e;
  margin-bottom: 4px; letter-spacing: -.3px;
}
.apps-welcome p { font-size: 13px; color: #8e8e93; }

/* セクションヘッダー（ラベル + ALL APPSリンク） */
.apps-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.apps-section-label {
  font-size: 11px; font-weight: 700;
  letter-spacing: .6px; text-transform: uppercase;
  color: #aeaeb2;
}
.apps-all-link {
  font-family: 'Poppins', sans-serif;
  font-size: 12px; font-weight: 700;
  color: #2563eb; letter-spacing: .03em;
  display: flex; align-items: center; gap: 5px;
  text-decoration: none;
  transition: gap .2s ease, opacity .2s ease;
}
.apps-all-link:hover { opacity: .75; gap: 8px; }

/* 横スクロール外枠 */
.apps-scroll-wrap {
  position: relative;
}

/* 矢印ボタン — コンテンツ外側に絶対配置 */
.apps-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px; height: 36px;
  background: rgba(255,255,255,.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0,0,0,.09);
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #3c3c43;
  cursor: pointer;
  transition: opacity .2s ease, transform .2s ease, box-shadow .2s ease;
  z-index: 10;
}
.apps-arrow:hover {
  background: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  color: #1c1c1e;
}
.apps-arrow:active { box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.apps-arrow.hidden {
  opacity: 0;
  pointer-events: none;
}
/* コンテンツ外側へ — .apps-body の padding(40px) 分だけ外に出す */
.apps-arrow-left  { left: -52px; }
.apps-arrow-right { right: -52px; }

/* 横スクロールコンテナ */
.apps-grid {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 12px;
  /* スクロールバー非表示（macOS風） */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.apps-grid::-webkit-scrollbar { display: none; }

/* カード */
.app-card {
  background: rgba(255,255,255,.95);
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 16px;
  padding: 24px 22px 22px;
  cursor: pointer;
  transition: box-shadow .25s ease, transform .25s ease, border-color .25s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 11px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06), 0 0 0 0.5px rgba(0,0,0,.04);
  /* 固定幅でスクロール */
  flex: 0 0 220px;
  scroll-snap-align: start;
}
.app-card:hover:not(.locked) {
  box-shadow: 0 8px 28px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.06);
  transform: translateY(-3px) scale(1.01);
  border-color: rgba(0,0,0,.1);
}
.app-card.locked {
  opacity: .45;
  cursor: default;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

/* カードアイコン */
.app-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.app-icon-solid   { background: linear-gradient(135deg,#dbeafe,#eff6ff); color: #2563eb; }
.app-icon-whatsno { background: linear-gradient(135deg,#ede9fe,#f3f0ff); color: #7c3aed; }
.app-icon-meetlog { background: linear-gradient(135deg,#fce7f3,#fdf2f8); color: #db2777; }
.app-icon-datashop{ background: linear-gradient(135deg,#d1fae5,#ecfdf5); color: #059669; }
.app-icon-aa      { background: linear-gradient(135deg,#dbe4ff,#eef2ff); color: #1f48ff; }
.app-icon-future  { background: rgba(0,0,0,.04); color: #aeaeb2; }

/* カードテキスト */
.app-name {
  font-size: 14px; font-weight: 700;
  color: #1c1c1e; letter-spacing: -.2px; line-height: 1.3;
}
.app-desc {
  font-size: 11.5px; color: #8e8e93;
  line-height: 1.6; flex: 1;
}

/* ステータスバッジ */
.app-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 20px;
  align-self: flex-start;
}
.app-tag-active { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.app-tag-soon   { background: rgba(0,0,0,.04); color: #aeaeb2; border: 1px solid rgba(0,0,0,.07); }

/* ロックアイコン */
.lock-icon {
  position: absolute; top: 14px; right: 14px;
  font-size: 12px; color: #c7c7cc;
}

/* カード内アロー（利用中のみ） */
.app-card:not(.locked)::after {
  content: '\f061';
  font-family: 'Font Awesome 6 Free'; font-weight: 900;
  position: absolute; top: 20px; right: 16px;
  font-size: 10px; color: #c7d2fe;
  transition: color .2s ease, transform .2s ease;
}
.app-card:hover:not(.locked)::after { color: #635bff; transform: translateX(3px); }

/* ══════════════════════════════════════════
   レスポンシブ
══════════════════════════════════════════ */

/* タブレット（〜1023px） */
@media (max-width: 1023px) {
  .apps-body { padding: 40px 32px 72px; }
  .apps-arrow-left  { left: -44px; }
  .apps-arrow-right { right: -44px; }
  .app-card { flex: 0 0 200px; }
}

/* スマホ（〜767px） */
@media (max-width: 767px) {
  /* ヘッダー */
  .apps-header { padding: 0 16px; height: 52px; }

  /* ユーザー名・会社名を非表示 */
  .user-info { display: none; }

  /* ボタンをアイコンのみに（font-size:0でテキスト消し、アイコンはリセット） */
  .btn-admin, .btn-logout {
    padding: 7px 10px;
    font-size: 0;
    gap: 0;
  }
  .btn-admin i, .btn-logout i { font-size: 14px; }

  /* ボディ */
  .apps-body { padding: 24px 16px 56px; }

  /* ウェルカム */
  .apps-welcome { margin-bottom: 24px; padding-bottom: 18px; }
  .apps-welcome h1 { font-size: 18px; }

  /* 矢印非表示（タッチスクロール使用） */
  .apps-arrow { display: none; }

  /* カード: 画面幅の約52%にして次カードが右端にのぞく */
  .app-card { flex: 0 0 52vw; max-width: 210px; padding: 18px 16px 16px; }
  .app-icon  { width: 40px; height: 40px; font-size: 17px; border-radius: 10px; }
  .app-name  { font-size: 13px; }
  .app-desc  { font-size: 11px; }

  /* 右端に余白を設けて「まだ続く」感を演出 */
  .apps-grid { padding-right: 32px; }

  /* ログイン */
  .login-card { padding: 32px 22px; }
  .login-logo-title { font-size: 30px; }
}

/* 極小（〜400px） */
@media (max-width: 400px) {
  .apps-welcome h1 { font-size: 16px; }
  .apps-welcome p  { font-size: 12px; }
  .app-card { flex: 0 0 160px; padding: 16px 14px; gap: 8px; }
  .app-icon  { width: 36px; height: 36px; font-size: 15px; }
  .app-name  { font-size: 12px; }
  .login-card { padding: 28px 18px; }
}
