/* ===========================
   Design Tokens
   =========================== */
:root {
  --bg:           #F5F6F8;
  --surface:      #FFFFFF;
  --sidebar-bg:   #FFFFFF;
  --header-bg:    #FFFFFF;
  --text-1:       #1D1D1F;
  --text-2:       #6E6E73;
  --text-3:       #AEAEB2;
  --border:       #E5E5EA;
  --brand-blue:   #1B4E96;
  --brand-orange: #F2A900;
  --shadow-sm:    0 1px 3px rgba(16,24,40,0.06), 0 1px 2px rgba(16,24,40,0.04);
  --shadow-md:    0 4px 10px rgba(16,24,40,0.06), 0 10px 24px rgba(16,24,40,0.08);
  --radius-card:  14px;
  --radius-sm:    8px;
  --sidebar-w:    240px;

  /* カテゴリカラー (アイコン・アクセントのみに使用し、背景全面には使わない) */
  --c-home:        #334155;
  --c-security:    #2563EB;
  --c-mail:        #0D9488;
  --c-salesforce:  #0EA5E9;
  --c-printer:     #64748B;
  --c-workflow:    #16A34A;
  --c-cards:       #8B5CF6;
  --c-seminar:     #F59E0B;
  --c-homepage:    #6366F1;
  --c-master:      #DC2626;
  --c-other:       #6B7280;
}

/* ===========================
   Reset
   =========================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

html, body {
  height: 100%;
}

body {
  font-family: "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", -apple-system,
               BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.6;
}

/* ===========================
   App Shell
   =========================== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
  transition: transform 0.2s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 14px;
}

.sidebar-brand img { height: 22px; width: auto; }

.sidebar-title {
  padding: 0 20px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.sidebar-title .name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
}

.sidebar-title .sub {
  font-size: 11.5px;
  color: var(--text-2);
  margin-top: 2px;
}

.nav-list {
  padding: 4px 10px 20px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-1);
  text-align: left;
  margin-bottom: 2px;
}

.nav-item .nav-icon {
  font-size: 15px;
  width: 18px;
  text-align: center;
  flex: none;
}

.nav-item:hover { background: #F2F3F5; }

.nav-item.active {
  background: var(--nav-active-bg, #EEF2FF);
  color: var(--nav-active-color, var(--brand-blue));
  font-weight: 700;
}

.nav-item.master-item.active { background: #FEF2F2; color: var(--c-master); }

.sidebar-footer {
  padding: 12px 20px 18px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-3);
}

/* --- Main column --- */
.main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 28px;
}

.menu-toggle {
  display: none;
  font-size: 18px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.menu-toggle:hover { background: #F2F3F5; }

.search-box {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13.5px;
  background: #F5F6F8;
  color: var(--text-1);
}
.search-box input:focus {
  outline: none;
  border-color: var(--brand-blue);
  background: var(--surface);
}
.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: var(--text-3);
  pointer-events: none;
}

.top-bar-meta {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
}

/* --- Content --- */
.content {
  padding: 26px 28px 60px;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
}

.page-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 6px;
}

.page-head .page-icon {
  font-size: 22px;
  line-height: 1;
}

.page-head h1 {
  font-size: 21px;
  font-weight: 700;
}

.page-desc {
  color: var(--text-2);
  font-size: 13.5px;
  margin: 6px 0 22px;
  max-width: 720px;
}

.section-banner {
  margin-bottom: 18px;
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 1px solid var(--border);
  max-width: 720px;
}

/* Notice callout (Master権限系など) */
.notice-box {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #FEF2F2;
  border: 1px solid #FCD5D5;
  color: #7F1D1D;
  border-radius: var(--radius-card);
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 24px;
}
.notice-box .notice-icon { font-size: 16px; flex: none; margin-top: 1px; }

/* --- Groups & Cards --- */
.link-group { margin-bottom: 30px; }

.group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.group-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--group-color, var(--brand-blue));
  background: var(--group-tint, #EEF2FF);
}

.group-bar {
  flex: 1;
  height: 7px;
  min-width: 24px;
  border-radius: 4px;
  background: var(--group-color, var(--brand-blue));
  opacity: 0.9;
}

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

.link-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--card-color, var(--brand-blue));
  border-radius: var(--radius-card);
  padding: 14px 16px 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s ease, transform .15s ease;
}

.link-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.card-favicon {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.card-favicon img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 7px;
  background: #fff;
}

.card-favicon-fallback {
  font-size: 15px;
  color: var(--text-3);
}

.card-body { padding-right: 50px; flex: 1; }

.card-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-1);
}

.card-note {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 4px;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.card-open-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--card-color, var(--brand-blue));
}

.copy-btn {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--card-color, var(--brand-blue));
  padding: 6px 12px;
  border-radius: 7px;
  white-space: nowrap;
  transition: filter .15s ease, background .15s ease;
}
.copy-btn:hover { filter: brightness(0.92); }
.copy-btn.copied { background: #16A34A; }

/* --- Home hero --- */
.hero {
  display: flex;
  align-items: center;
  gap: 24px;
  background: linear-gradient(135deg, #F0F5FF 0%, #F7F8FA 60%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 26px 30px;
  margin-bottom: 30px;
}

.hero-text { flex: 1; }

.hero-text h1 {
  font-size: 23px;
  font-weight: 800;
  color: var(--brand-blue);
  margin-bottom: 10px;
}

.hero-text p {
  font-size: 13.5px;
  color: var(--text-2);
  max-width: 620px;
}

.hero-img { flex: none; width: 340px; }
.hero-img img { border-radius: 14px; }

.home-section-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}
.home-section-sub {
  font-size: 12.5px;
  color: var(--text-2);
  margin-bottom: 16px;
}

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

.tile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  text-align: left;
}
.tile-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.tile-card .tile-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex: none;
  background: var(--tile-bg, #EEF2FF);
  color: var(--tile-color, var(--brand-blue));
}

.tile-card .tile-name { font-size: 13.5px; font-weight: 700; }
.tile-card .tile-count { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* --- Search results --- */
.search-results { display: flex; flex-direction: column; gap: 10px; }
.search-hit {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--card-color, var(--brand-blue));
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.search-hit .card-favicon { position: static; flex: none; }
.search-hit .hit-body { min-width: 0; }
.search-hit .hit-path { font-size: 11px; color: var(--text-3); margin-bottom: 3px; }
.search-hit .hit-title { font-size: 13.5px; font-weight: 700; }
.search-hit .hit-note { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.search-empty { color: var(--text-3); font-size: 13px; padding: 20px 4px; }

/* ===========================
   Responsive
   =========================== */
@media (max-width: 860px) {
  .card-grid, .tile-grid { grid-template-columns: repeat(2, 1fr); }
  .hero { flex-direction: column; align-items: stretch; }
  .hero-img { width: 100%; max-width: 320px; margin: 0 auto; }
}

@media (max-width: 640px) {
  .menu-toggle { display: inline-flex; }
  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-md);
  }
  .sidebar.open { transform: translateX(0); }
  .card-grid, .tile-grid { grid-template-columns: 1fr; }
  .content { padding: 18px 16px 40px; }
  .top-bar { padding: 10px 14px; }
}
