/* ======================================================
   AIzoo スタイル
   ====================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w: 248px;
  --primary:   #2563EB;
  --pri-light: #EFF6FF;
  --surface:   #FFFFFF;
  --bg:        #F8FAFC;
  --border:    #E2E8F0;
  --text:      #1E293B;
  --muted:     #64748B;
  --radius:    10px;
  --shadow:    0 1px 8px rgba(0,0,0,.08);
}

html { scroll-behavior: smooth; }
body {
  font-family: "Hiragino Sans", "Noto Sans JP", "Meiryo", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }

/* ======================================================
   Sidebar
   ====================================================== */
.sidebar {
  position: fixed; top: 0; left: 0; z-index: 200;
  width: var(--sidebar-w); height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}

/* Desktop: always visible */
@media (min-width: 769px) {
  .sidebar { transform: translateX(0); }
  .page-wrapper { margin-left: var(--sidebar-w); }
  .overlay { display: none !important; }
  .topbar-burger { display: none !important; }
}

/* Mobile: slide in */
@media (max-width: 768px) {
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .overlay { display: block; }
}

/* Overlay */
.overlay {
  display: none; position: fixed; inset: 0; z-index: 150;
  background: rgba(0,0,0,.4);
}

/* Page wrapper */
.page-wrapper {
  min-height: 100vh;
  transition: margin-left .25s;
}

/* Sidebar logo */
.sidebar-logo {
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.logo-link {
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 1.1rem; color: var(--text);
}
.logo-icon { font-size: 1.4rem; }

/* Sidebar body */
.sidebar-body {
  flex: 1; overflow-y: auto; padding: 12px 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.sidebar-body::-webkit-scrollbar { width: 4px; }
.sidebar-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* New chat button */
.sb-new-chat {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius);
  background: var(--primary); color: #fff;
  font-weight: 700; font-size: .88rem;
  margin-bottom: 6px;
  transition: opacity .15s;
}
.sb-new-chat:hover { opacity: .88; }

/* Sidebar links */
.sb-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius);
  font-size: .88rem; color: var(--text);
  transition: background .12s;
  cursor: pointer; border: none; background: none;
  width: 100%; text-align: left;
}
.sb-link:hover { background: var(--bg); }
.sb-link.active { background: var(--pri-light); color: var(--primary); font-weight: 600; }
.sb-link.disabled { color: var(--muted); cursor: default; }
.sb-link.disabled:hover { background: none; }

.sb-link-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }

.sb-link-group-label {
  color: var(--muted); font-size: .82rem; font-weight: 700;
  cursor: default; pointer-events: none;
}
.sb-link-group-label:hover { background: none; }
.sb-sublink {
  padding-left: 28px;
  font-size: .85rem;
}

.sb-badge {
  margin-left: auto; font-size: .68rem; padding: 2px 7px;
  border-radius: 10px; background: var(--border); color: var(--muted);
  white-space: nowrap;
}

/* Section label */
.sb-section-label {
  font-size: .72rem; font-weight: 700; letter-spacing: .06em;
  color: var(--muted); text-transform: uppercase;
  padding: 12px 12px 4px;
}

/* History items */
.history-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius);
  transition: background .12s; cursor: pointer;
}
.history-item:hover { background: var(--bg); }
.history-icon { font-size: 1.1rem; flex-shrink: 0; }
.history-info { min-width: 0; flex: 1; }
.history-store {
  font-size: .82rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-preview {
  font-size: .73rem; color: var(--muted); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-time { font-size: .68rem; color: var(--muted); flex-shrink: 0; }
.no-history { font-size: .82rem; color: var(--muted); padding: 4px 12px; }

/* Sidebar footer */
.sidebar-footer {
  flex-shrink: 0; padding: 12px 8px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
}

/* ======================================================
   Topbar (mobile only)
   ====================================================== */
.topbar {
  display: none;
  align-items: center; gap: 12px;
  padding: 0 16px; height: 52px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
@media (max-width: 768px) { .topbar { display: flex; } }

.topbar-burger {
  display: flex; flex-direction: column; justify-content: center; gap: 5px;
  width: 34px; height: 34px; padding: 6px;
  background: none; border: none; cursor: pointer; border-radius: 8px;
  transition: background .12s;
}
.topbar-burger:hover { background: var(--bg); }
.topbar-burger span { display: block; height: 2px; background: var(--text); border-radius: 2px; }

.topbar-logo { font-weight: 800; font-size: 1rem; }

/* ======================================================
   Main content
   ====================================================== */
.main-content { min-height: 100vh; }

/* ======================================================
   Home / Dashboard
   ====================================================== */
.home-wrap {
  max-width: 920px; margin: 0 auto; padding: 36px 28px;
}

.home-greeting { font-size: 1.35rem; font-weight: 800; margin-bottom: 4px; }
.home-sub { font-size: .9rem; color: var(--muted); margin-bottom: 32px; }

/* Mode toggle */
.mode-toggle {
  display: flex; gap: 8px; margin-bottom: 32px;
}
.mode-btn {
  padding: 10px 22px; border-radius: var(--radius);
  border: 1.5px solid var(--border);
  font-size: .9rem; font-weight: 600; cursor: pointer;
  background: var(--surface); color: var(--muted);
  transition: all .15s;
}
.mode-btn.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.mode-btn:hover:not(.active) { border-color: var(--primary); color: var(--primary); }

/* Feature cards */
.feature-section-label {
  font-size: .82rem; font-weight: 700; color: var(--muted);
  margin-bottom: 12px; letter-spacing: .04em; text-transform: uppercase;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px; margin-bottom: 40px;
}
.feature-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1.5px solid var(--border);
  cursor: pointer; transition: border-color .12s, box-shadow .12s;
  text-decoration: none; color: inherit;
}
.feature-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 12px rgba(37,99,235,.1);
}
.feature-card.disabled {
  opacity: .5; cursor: default; pointer-events: none;
}
.feature-card-icon { font-size: 1.5rem; }
.feature-card-name { font-size: .88rem; font-weight: 700; }
.feature-card-desc { font-size: .74rem; color: var(--muted); line-height: 1.4; }

/* Concierge section */
.concierge-section { margin-bottom: 36px; }
.concierge-section-title {
  font-size: .95rem; font-weight: 800; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 8px; border-bottom: 1.5px solid var(--border);
}
.concierge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 8px;
}
.concierge-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1.5px solid var(--border);
  cursor: pointer; transition: border-color .12s, box-shadow .12s;
  text-decoration: none; color: inherit;
}
.concierge-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 12px rgba(37,99,235,.1);
}
.concierge-icon { font-size: 1.5rem; flex-shrink: 0; }
.concierge-body { flex: 1; min-width: 0; }
.concierge-name { font-size: .88rem; font-weight: 700; margin-bottom: 2px; }
.concierge-desc {
  font-size: .73rem; color: var(--muted); line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.concierge-arrow { color: var(--muted); font-size: 1rem; flex-shrink: 0; }

/* ======================================================
   Chat page
   ====================================================== */
.chat-page {
  display: flex; flex-direction: column;
  height: 100vh;
}
@media (max-width: 768px) {
  .chat-page { height: calc(100vh - 52px); }
}

/* Chat topbar */
.chat-topbar {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.chat-back {
  font-size: .83rem; color: var(--muted);
  padding: 6px 12px; border-radius: 8px;
  transition: background .12s; white-space: nowrap;
}
.chat-back:hover { background: var(--bg); }
.chat-identity { display: flex; align-items: center; gap: 10px; }
.chat-icon-lg { font-size: 1.6rem; }
.chat-meta-label { font-size: .72rem; color: var(--muted); }
.chat-title { font-size: 1rem; font-weight: 800; }

.chat-mode-toggle {
  display: flex; gap: 6px; margin-left: auto;
}
.chat-mode-btn {
  padding: 6px 16px; border-radius: 8px;
  border: 1.5px solid var(--border);
  font-size: .82rem; font-weight: 600; cursor: pointer;
  background: var(--surface); color: var(--muted);
  transition: all .12s; white-space: nowrap;
}
.chat-mode-btn.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.chat-mode-btn:hover:not(.active) { border-color: var(--primary); color: var(--primary); }

.chat-clear-btn {
  padding: 6px 12px; border-radius: 8px; border: none;
  background: none; color: var(--muted); cursor: pointer;
  font-size: .82rem; transition: background .12s;
  white-space: nowrap;
}
.chat-clear-btn:hover { background: var(--bg); }

/* Chat area */
.chat-wrap { flex: 1; overflow: hidden; position: relative; }
.chat-messages {
  height: 100%; overflow-y: auto;
  padding: 24px 20px 16px;
  display: flex; flex-direction: column; gap: 20px;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Messages */
.chat-messages { align-items: flex-start; }
.msg { display: flex; align-items: flex-start; gap: 10px; max-width: 80%; }
.ai-msg  { align-self: flex-start; }
.user-msg{ align-self: flex-end; flex-direction: row-reverse; }

.msg-bubble {
  padding: 12px 16px; border-radius: 16px;
  font-size: .9rem; line-height: 1.65;
  word-break: break-word; white-space: pre-wrap;
}
.ai-msg   .msg-bubble {
  background: var(--surface); border: 1.5px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow);
}
.user-msg .msg-bubble {
  background: var(--primary); color: #fff;
  border-bottom-right-radius: 4px;
}
/* 画像生成レスポンス */
.msg-img {
  max-width: 100%; border-radius: 12px; display: block;
  margin-top: 8px; cursor: pointer;
}

/* Typing dots */
.typing-dots span {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted); margin: 0 2px;
  animation: bounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes bounce {
  0%,80%,100% { transform: translateY(0); }
  40%         { transform: translateY(-6px); }
}

/* Model selector */
.model-selector-bar {
  flex-shrink: 0; display: flex; align-items: center; gap: 8px;
  padding: 6px 20px;
  background: var(--bg); border-top: 1px solid var(--border);
}
.model-selector-label { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.model-select {
  flex: 1; max-width: 320px; padding: 5px 10px; border-radius: 8px;
  border: 1.5px solid var(--border);
  font-size: .82rem; background: var(--surface); color: var(--text);
  outline: none; cursor: pointer; transition: border-color .15s;
}
.model-select:focus { border-color: var(--primary); }

/* Chat input */
.chat-input-bar {
  flex-shrink: 0;
  padding: 10px 20px 14px;
  background: var(--surface); border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(0,0,0,.04);
}
.chat-input-row {
  display: flex; align-items: flex-end; gap: 8px;
}
.attach-btn {
  flex-shrink: 0; width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 1.5px solid var(--border);
  background: var(--surface); cursor: pointer;
  font-size: 1.1rem; transition: border-color .12s, background .12s;
  align-self: flex-end;
}
.attach-btn:hover { border-color: var(--primary); background: var(--pri-light); }
.chat-textarea {
  flex: 1; resize: none; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: 12px;
  font-size: .9rem; font-family: inherit; line-height: 1.55;
  outline: none; transition: border-color .15s;
  max-height: 140px; overflow-y: auto;
}
.chat-textarea:focus { border-color: var(--primary); }
.send-btn {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 10px; border: none;
  background: var(--primary); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .15s, transform .1s; align-self: flex-end;
}
.send-btn:hover { opacity: .85; }
.send-btn:active { transform: scale(.94); }
.send-btn:disabled { opacity: .4; cursor: not-allowed; }

/* 添付ファイルプレビュー */
.file-preview-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0 8px;
}
.file-badge {
  display: flex; align-items: center; gap: 6px;
  background: var(--pri-light); border: 1.5px solid var(--primary);
  border-radius: 8px; padding: 4px 10px;
  font-size: .8rem; color: var(--primary); font-weight: 600;
  max-width: 240px;
}
.file-badge-name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px;
}
.file-remove-btn {
  background: none; border: none; color: var(--primary); cursor: pointer;
  font-size: 1rem; line-height: 1; padding: 0; flex-shrink: 0;
}
.supported-types {
  font-size: .74rem; color: var(--muted); margin-top: 4px;
}

/* ======================================================
   Home チャット入力バー
   ====================================================== */
.home-chat-bar {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 16px; padding: 12px 16px;
  margin-bottom: 36px;
  box-shadow: var(--shadow);
}
.home-input-row {
  display: flex; align-items: flex-end; gap: 8px;
}
.home-attach-btn {
  flex-shrink: 0; width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 1.5px solid var(--border);
  background: var(--surface); cursor: pointer;
  font-size: 1.1rem; transition: border-color .12s, background .12s;
  align-self: flex-end;
}
.home-attach-btn:hover { border-color: var(--primary); background: var(--pri-light); }
.home-textarea {
  flex: 1; resize: none; padding: 10px 14px;
  border: none; border-radius: 8px;
  font-size: .93rem; font-family: inherit; line-height: 1.55;
  outline: none; background: transparent;
  max-height: 120px; overflow-y: auto;
}
.home-send-btn {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 10px; border: none;
  background: var(--primary); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .15s; align-self: flex-end;
}
.home-send-btn:hover { opacity: .85; }
.home-supported {
  font-size: .74rem; color: var(--muted); margin-top: 8px;
}

/* ======================================================
   Settings page
   ====================================================== */
.settings-page {
  max-width: 600px; margin: 40px auto 80px; padding: 0 28px;
}
.settings-title { font-size: 1.4rem; font-weight: 800; margin-bottom: 24px; }

.success-toast {
  background: #D1FAE5; border: 1px solid #6EE7B7;
  color: #065F46; border-radius: var(--radius);
  padding: 12px 18px; margin-bottom: 20px; font-weight: 600;
}
.settings-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 24px; border: 1.5px solid var(--border); margin-bottom: 16px;
}
.settings-card h2 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.settings-hint { font-size: .87rem; color: var(--muted); margin-bottom: 18px; line-height: 1.6; }
.settings-hint a { color: var(--primary); text-decoration: underline; }

.current-key-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg); border-radius: 8px;
  padding: 10px 14px; margin-bottom: 16px;
}
.current-key-label { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.masked-key { font-size: .85rem; }

.settings-form { display: flex; flex-direction: column; gap: 12px; }
.form-label { font-size: .87rem; font-weight: 600; color: var(--muted); }
.form-input {
  padding: 11px 14px; border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: .93rem; outline: none; transition: border-color .15s;
}
.form-input:focus { border-color: var(--primary); }
.save-btn {
  padding: 11px 24px; border-radius: var(--radius); border: none;
  background: var(--primary); color: #fff; font-size: .93rem;
  font-weight: 700; cursor: pointer; align-self: flex-start;
  transition: opacity .15s;
}
.save-btn:hover { opacity: .85; }

.hint-list {
  list-style: none; display: flex; flex-direction: column; gap: 8px;
  font-size: .87rem; color: var(--muted); line-height: 1.6;
}
.hint-list li::before { content: "• "; color: var(--primary); font-weight: 700; }
.hint-list code {
  background: var(--bg); padding: 1px 5px; border-radius: 4px;
  font-family: monospace; font-size: .85em;
}

/* ======================================================
   Template overlay modal
   ====================================================== */
.tmpl-overlay {
  display: none; position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.45);
  align-items: center; justify-content: center;
  padding: 20px;
}
.tmpl-overlay.open { display: flex; }

.tmpl-modal {
  background: var(--surface); border-radius: 16px;
  width: 100%; max-width: 720px; max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: 0 8px 48px rgba(0,0,0,.2);
  overflow: hidden;
}
.tmpl-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.tmpl-modal-title { font-size: 1.1rem; font-weight: 800; }
.tmpl-close-btn {
  background: none; border: none; font-size: 1.1rem; cursor: pointer;
  color: var(--muted); padding: 4px 8px; border-radius: 6px;
  transition: background .12s;
}
.tmpl-close-btn:hover { background: var(--bg); }
.tmpl-body { flex: 1; overflow-y: auto; padding: 20px 24px; }

/* Template grid */
.tmpl-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.tmpl-card {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1.5px solid var(--border);
  cursor: pointer; text-align: left; width: 100%;
  transition: border-color .12s, box-shadow .12s;
  position: relative;
}
.tmpl-card:hover { border-color: var(--primary); box-shadow: 0 2px 12px rgba(37,99,235,.1); }
.tmpl-card-icon { font-size: 1.4rem; flex-shrink: 0; }
.tmpl-card-body { flex: 1; min-width: 0; }
.tmpl-card-name { font-size: .88rem; font-weight: 700; margin-bottom: 3px; }
.tmpl-card-desc { font-size: .74rem; color: var(--muted); line-height: 1.4; }
.tmpl-card-cat {
  position: absolute; top: 10px; right: 10px;
  font-size: .68rem; padding: 2px 7px; border-radius: 10px;
  background: var(--pri-light); color: var(--primary); font-weight: 600;
}

/* Template form */
.tmpl-back-btn {
  background: none; border: none; color: var(--primary); cursor: pointer;
  font-size: .85rem; padding: 0; margin-bottom: 16px; text-decoration: underline;
}
.tmpl-form-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 20px;
}
.tmpl-form-icon { font-size: 1.8rem; }
.tmpl-form-title { font-size: 1.05rem; font-weight: 800; }
.tmpl-fields { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.tmpl-field { display: flex; flex-direction: column; gap: 5px; }
.tmpl-field-label { font-size: .84rem; font-weight: 600; color: var(--muted); }
.tmpl-field-input {
  padding: 10px 13px; border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: .9rem; font-family: inherit; outline: none; transition: border-color .15s;
}
.tmpl-field-input:focus { border-color: var(--primary); }
.tmpl-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.tmpl-use-btn {
  width: 100%; padding: 13px; border-radius: var(--radius); border: none;
  background: var(--primary); color: #fff; font-size: .95rem; font-weight: 700;
  cursor: pointer; transition: opacity .15s;
}
.tmpl-use-btn:hover { opacity: .88; }

/* ======================================================
   Dashboard
   ====================================================== */
.dash-wrap { max-width: 900px; margin: 0 auto; padding: 36px 28px; }
.dash-title { font-size: 1.35rem; font-weight: 800; margin-bottom: 28px; }
.dash-empty { font-size: .9rem; color: var(--muted); }

.dash-summary-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px; margin-bottom: 28px;
}
.dash-summary-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.dash-summary-label { font-size: .78rem; color: var(--muted); margin-bottom: 8px; }
.dash-summary-value { font-size: 1.4rem; font-weight: 800; color: var(--text); }

.dash-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.dash-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.dash-card-title { font-size: .95rem; font-weight: 700; margin-bottom: 16px; }

.dash-rank-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.dash-rank-item {
  display: flex; align-items: center; gap: 12px;
  font-size: .88rem;
}
.dash-rank-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--pri-light); color: var(--primary);
  font-size: .75rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.dash-rank-name { flex: 1; color: var(--text); }
a.dash-rank-name:hover { color: var(--primary); text-decoration: underline; }
.dash-rank-count { color: var(--muted); font-size: .82rem; white-space: nowrap; }

.dash-recent-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.dash-recent-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 8px; transition: background .12s;
}
.dash-recent-link:hover { background: var(--bg); }
.dash-recent-icon { font-size: 1.2rem; flex-shrink: 0; }
.dash-recent-body { flex: 1; min-width: 0; }
.dash-recent-store { font-size: .85rem; font-weight: 600; }
.dash-recent-preview {
  font-size: .75rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-recent-date { font-size: .72rem; color: var(--muted); flex-shrink: 0; }
.dash-empty-sub { font-size: .85rem; color: var(--muted); }

/* ======================================================
   Concierge settings — fav button
   ====================================================== */
.fav-card { cursor: default; }
.fav-btn {
  background: none; border: none; font-size: 1.3rem; cursor: pointer;
  color: var(--muted); flex-shrink: 0; padding: 4px;
  transition: color .12s, transform .1s;
  line-height: 1;
}
.fav-btn:hover { transform: scale(1.2); }
.fav-btn.fav-active { color: #F59E0B; }

/* ======================================================
   Sidebar user info
   ====================================================== */
.sb-user-info {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius);
  background: var(--bg); margin-bottom: 2px;
}
.sb-user-icon { font-size: 1.1rem; flex-shrink: 0; }
.sb-user-detail { min-width: 0; }
.sb-user-name {
  font-size: .82rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-user-role { font-size: .72rem; color: var(--muted); }

/* ======================================================
   Login page
   ====================================================== */
.login-body {
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}
.login-card {
  background: var(--surface); border-radius: 16px;
  border: 1.5px solid var(--border);
  padding: 40px 36px; width: 100%; max-width: 400px;
  box-shadow: 0 4px 32px rgba(0,0,0,.08);
}
.login-logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.5rem; font-weight: 800; margin-bottom: 4px;
}
.login-logo-accent { color: var(--primary); }
.login-sub { font-size: .85rem; color: var(--muted); margin-bottom: 28px; }
.login-error {
  background: #FEE2E2; border: 1px solid #FCA5A5; color: #991B1B;
  border-radius: var(--radius); padding: 10px 14px;
  font-size: .87rem; margin-bottom: 20px;
}
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.login-input {
  padding: 11px 14px; border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: .93rem; outline: none; transition: border-color .15s; width: 100%;
}
.login-input:focus { border-color: var(--primary); }
.login-pw-wrap { position: relative; }
.login-pw-wrap .login-input { padding-right: 44px; }
.login-pw-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 1rem; padding: 4px;
}
.login-btn {
  padding: 12px; border-radius: var(--radius); border: none;
  background: var(--primary); color: #fff; font-size: .95rem; font-weight: 700;
  cursor: pointer; transition: opacity .15s; margin-top: 4px;
}
.login-btn:hover { opacity: .88; }
.login-note { font-size: .78rem; color: var(--muted); text-align: center; margin-top: 20px; }

/* ======================================================
   Admin panel
   ====================================================== */
.admin-wrap { max-width: 960px; margin: 0 auto; padding: 32px 28px; }
.admin-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px;
}
.admin-title { font-size: 1.35rem; font-weight: 800; }
.admin-tab-link {
  font-size: .88rem; color: var(--primary); text-decoration: underline;
}
.admin-alert {
  background: #FEE2E2; border: 1px solid #FCA5A5; color: #991B1B;
  border-radius: var(--radius); padding: 12px 16px;
  font-size: .87rem; margin-bottom: 20px;
}
.admin-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin-bottom: 20px;
}
.admin-card-title {
  font-size: 1rem; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.admin-count { font-size: .78rem; color: var(--muted); font-weight: 400; }

/* Inline form */
.admin-inline-form { display: flex; gap: 10px; align-items: center; }
.admin-input {
  padding: 9px 13px; border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: .9rem; outline: none; transition: border-color .15s; min-width: 0;
}
.admin-input:focus { border-color: var(--primary); }
.admin-select {
  padding: 9px 13px; border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: .9rem; outline: none; background: var(--surface); cursor: pointer;
  transition: border-color .15s;
}
.admin-select:focus { border-color: var(--primary); }

/* User form grid */
.admin-user-form { }
.admin-form-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.admin-field { display: flex; flex-direction: column; gap: 5px; }
.admin-label { font-size: .82rem; font-weight: 600; color: var(--muted); }
.admin-field .admin-input,
.admin-field .admin-select { width: 100%; }
.required { color: #EF4444; }

/* Filter bar */
.admin-filter-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.admin-filter-label { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.admin-filter-btn {
  padding: 5px 14px; border-radius: 20px; font-size: .82rem;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; transition: all .12s;
}
.admin-filter-btn:hover,
.admin-filter-btn.active { border-color: var(--primary); color: var(--primary); background: var(--pri-light); }

/* Table */
.admin-table {
  width: 100%; border-collapse: collapse; font-size: .88rem;
}
.admin-table th {
  text-align: left; padding: 10px 12px;
  font-size: .78rem; font-weight: 700; color: var(--muted);
  border-bottom: 1.5px solid var(--border); white-space: nowrap;
}
.admin-table td {
  padding: 12px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr.row-disabled td { opacity: .55; }
.td-name { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.td-date { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.td-actions { display: flex; gap: 6px; align-items: center; white-space: nowrap; }

/* Status indicators */
.org-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.dot-on  { background: #22C55E; }
.dot-off { background: #94A3B8; }

.status-badge {
  padding: 3px 10px; border-radius: 20px; font-size: .78rem; font-weight: 600;
}
.badge-on  { background: #DCFCE7; color: #166534; }
.badge-off { background: #F1F5F9; color: var(--muted); }

.role-badge {
  padding: 3px 10px; border-radius: 20px; font-size: .78rem; font-weight: 600;
}
.role-admin { background: #EFF6FF; color: var(--primary); }
.role-user  { background: var(--bg); color: var(--muted); }

/* User info */
.user-email { font-size: .85rem; font-weight: 600; }
.user-display { font-size: .75rem; color: var(--muted); }

/* Buttons */
.admin-btn-primary {
  padding: 9px 20px; border-radius: var(--radius); border: none;
  background: var(--primary); color: #fff; font-size: .88rem; font-weight: 700;
  cursor: pointer; white-space: nowrap; transition: opacity .15s;
}
.admin-btn-primary:hover { opacity: .88; }
.admin-btn-sm {
  padding: 6px 14px; border-radius: 8px;
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: .82rem; cursor: pointer; color: var(--text);
  white-space: nowrap; transition: background .12s;
}
.admin-btn-sm:hover { background: var(--bg); }
.btn-danger  { border-color: #FCA5A5; color: #DC2626; }
.btn-danger:hover  { background: #FEE2E2; }
.btn-success { border-color: #86EFAC; color: #166534; }
.btn-success:hover { background: #DCFCE7; }

.admin-empty { font-size: .88rem; color: var(--muted); padding: 8px 0; }

/* edit row */
.edit-row td { background: var(--bg); padding: 16px 12px; }
.inline-edit { padding: 0; }

/* ======================================================
   Responsive
   ====================================================== */
@media (max-width: 768px) {
  .home-wrap { padding: 20px 16px; }
  .dash-wrap { padding: 20px 16px; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .concierge-grid { grid-template-columns: 1fr; }
  .msg { max-width: 92%; }
  .chat-mode-toggle { display: none; }
  .dash-row { grid-template-columns: 1fr; }
  .tmpl-grid { grid-template-columns: 1fr; }
  .admin-form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .feature-grid { grid-template-columns: 1fr 1fr; }
}
