:root {
  --primary: #0e6fa5;
  --bright: #1a9bd8;
  --dark: #094e75;
  --darker: #063a5c;
  --bg: #f0f4f8;
  --white: #ffffff;
  --border: #cbd5e1;
  --border-l: #e2e8f0;
  --text: #0f172a;
  --text-s: #334155;
  --text-m: #64748b;
  --ok: #059669;
  --err: #dc2626;
  --hero-sub: #bae6fd;
  --radius-card: 14px;
  --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 8px 20px rgba(0, 0, 0, 0.12);
  --font: "Source Sans 3", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

button,
input {
  font-family: inherit;
}

a {
  color: inherit;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: var(--white);
  border-bottom: 2px solid var(--border-l);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.logo-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.logo-img {
  height: 46px;
  width: auto;
  object-fit: contain;
  display: block;
}

.header-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
  flex-shrink: 0;
}

.search-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary);
  pointer-events: none;
}

#search-input {
  width: 100%;
  padding: 11px 16px 11px 46px;
  border-radius: 10px;
  border: 2px solid var(--border);
  font-size: 16px;
  outline: none;
  background: var(--white);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

#search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 111, 165, 0.15);
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}


.btn-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--dark);
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid var(--border);
  transition: border-color 0.15s, color 0.15s;
}

.btn-switch:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-sp {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: var(--white);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  transition: background 0.15s, transform 0.15s;
}

.btn-sp:hover {
  background: var(--dark);
}

/* Main */
.main {
  flex: 1;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 20px 40px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-m);
  min-height: 28px;
}

.crumb {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--primary);
  font-weight: 700;
  font-size: 14px;
}

.crumb:hover {
  text-decoration: underline;
}

.crumb-sep {
  color: var(--border);
}

.crumb-current {
  color: var(--text);
  font-weight: 800;
}

.view-toggle {
  display: flex;
  gap: 4px;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 4px;
}

.view-toggle button {
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-s);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.view-toggle button.is-active {
  background: var(--primary);
  color: var(--white);
}

.view-toggle[hidden] {
  display: none;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--darker), var(--primary), var(--bright));
  border-radius: 16px;
  padding: 18px 24px;
  margin-bottom: 20px;
}

.hero h1 {
  color: white;
  font-size: 22px;
  font-weight: 900;
  margin: 0;
  line-height: 1.2;
}

.hero p {
  color: var(--hero-sub);
  margin: 6px 0 0;
  font-size: 15px;
  font-weight: 500;
}

/* Cards grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 12px;
}

.folder-card,
.area-card,
.app-card {
  background: var(--white);
  border: 2px solid var(--border-l);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  padding: 0;
  text-align: left;
  cursor: pointer;
  width: 100%;
  display: block;
  color: inherit;
  text-decoration: none;
  font: inherit;
}

.folder-card:hover,
.area-card:hover,
.app-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.folder-card:hover {
  border-color: var(--card-accent, var(--primary));
}

.area-card:hover {
  border-color: var(--card-accent, var(--primary));
}

.card-top {
  background: var(--card-accent, var(--primary));
  padding: 14px 14px 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.card-emoji {
  font-size: 34px;
  line-height: 1;
}

.card-tag {
  background: rgba(255, 255, 255, 0.22);
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

.card-body {
  padding: 10px 14px 14px;
}

.card-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.3;
  min-height: 34px;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.card-meta span {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-m);
}

.card-arrow {
  width: 16px;
  height: 16px;
  color: var(--card-accent, var(--primary));
  flex-shrink: 0;
}

/* List view */
.list-panel {
  background: var(--white);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-l);
}

.list-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: none;
  border-bottom: 1px solid var(--border-l);
  background: var(--white);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  text-decoration: none;
}

.list-row:last-child {
  border-bottom: none;
}

.list-row:hover {
  background: #f8fafc;
}

.list-emoji {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
  color: white;
}

.list-info {
  flex: 1;
  min-width: 0;
}

.list-info strong {
  display: block;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.list-info span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-m);
}

.list-meta {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-m);
  flex-shrink: 0;
}

/* Folder / area header panels */
.section-banner {
  background: var(--white);
  border-radius: 14px;
  padding: 14px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-left: 6px solid var(--primary);
  flex-wrap: wrap;
}

.section-banner .banner-emoji {
  font-size: 30px;
}

.section-banner h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  color: var(--dark);
  flex: 1;
  min-width: 140px;
}

.btn-open-sp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #eff6ff;
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  border: 1px solid #bfdbfe;
}

.btn-open-sp:hover {
  background: #dbeafe;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-s);
  cursor: pointer;
}

.btn-back:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Apps */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.app-card {
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.app-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #eff6ff;
  display: grid;
  place-items: center;
  font-size: 24px;
  flex-shrink: 0;
}

.app-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 800;
}

.app-card p {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-m);
  font-weight: 500;
  line-height: 1.35;
}

.app-cat {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: var(--primary);
  background: #eff6ff;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* Docs table */
.docs-panel {
  background: var(--white);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-l);
}

.doc-row {
  display: grid;
  grid-template-columns: 110px 1fr 120px 100px 80px;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-l);
  font-size: 14px;
}

.doc-row:last-child {
  border-bottom: none;
}

.doc-row.head {
  background: #f8fafc;
  font-weight: 800;
  color: var(--text-m);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.doc-code {
  font-weight: 800;
  color: var(--dark);
  font-size: 12px;
}

.doc-name {
  font-weight: 700;
}

.ext-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  background: #e2e8f0;
  color: var(--text-s);
}

.ext-badge.pdf {
  background: #fee2e2;
  color: #b91c1c;
}

.ext-badge.xlsx,
.ext-badge.xls {
  background: #dcfce7;
  color: #166534;
}

.ext-badge.docx,
.ext-badge.doc {
  background: #dbeafe;
  color: #1d4ed8;
}

/* Search */
.search-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-hit {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--white);
  border: 2px solid var(--border-l);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  text-decoration: none;
}

.search-hit:hover {
  border-color: var(--primary);
}

.search-hit .hit-emoji {
  font-size: 24px;
}

.search-hit .hit-body {
  flex: 1;
  min-width: 0;
}

.search-hit strong {
  display: block;
  font-size: 15px;
  font-weight: 800;
}

.search-hit span {
  font-size: 13px;
  color: var(--text-m);
  font-weight: 600;
}

.empty-state {
  background: var(--white);
  border-radius: 14px;
  padding: 40px 24px;
  text-align: center;
  color: var(--text-m);
  border: 2px dashed var(--border);
}

.empty-state h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
}

.empty-state p {
  margin: 0;
  font-weight: 500;
}

.loading {
  padding: 48px;
  text-align: center;
  color: var(--text-m);
  font-weight: 700;
}

.footer {
  background: var(--darker);
  margin-top: 40px;
  padding: 14px 20px;
}

.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  text-align: center;
}

.footer p {
  margin: 0;
  color: #bae6fd;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.error-banner {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: #fef2f2;
  color: var(--err);
  border: 1px solid #fecaca;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 700;
  z-index: 50;
  max-width: calc(100% - 32px);
}

@media (max-width: 720px) {
  .header-divider {
    display: none;
  }

  .btn-sp span,
  .btn-sp {
    font-size: 13px;
  }

  .hero h1 {
    font-size: 18px;
  }

  .doc-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .doc-row.head {
    display: none;
  }

  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}
