:root {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color: #172033;
  background: #f4f6fa;
}

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

html, body {
  max-width: 100vw;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 980px;
  margin: 8px auto;
  padding: 0 10px;
}

/* 1. 타이틀 확대 & 부제목 아래 줄 배치 */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

header > div:first-child {
  display: block !important;
}

.eyebrow {
  display: none !important;
}

h1 {
  font-size: 24px !important;
  font-weight: 800 !important;
  margin: 0 0 3px 0 !important;
  line-height: 1.2 !important;
  letter-spacing: -0.02em;
}

header p {
  display: block !important;
  font-size: 12px !important;
  margin: 0 !important;
  color: #64748b;
}

button, a, select, input {
  font: inherit;
}

.header-actions {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 5px !important;
  align-items: center;
}

.header-actions form {
  margin: 0;
}

.primary, .secondary {
  border: 0;
  border-radius: 7px !important;
  padding: 6px 10px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  height: 30px !important;
  cursor: pointer;
  white-space: nowrap;
}

.primary {
  background: #175cd3;
  color: #fff;
}

.secondary {
  background: #e2e8f0;
  color: #1e293b;
}

/* 2. 통계 박스: 파일/즐겨찾기 축소, 내용 색인 문서 박스 확대 */
.stats {
  display: grid !important;
  grid-template-columns: 0.65fr 0.65fr 1.1fr 1.7fr !important;
  gap: 5px !important;
  margin: 6px 0 !important;
}

.stats div {
  background: #fff;
  border: 1px solid #e5eaf2;
  border-radius: 8px !important;
  padding: 6px 4px !important;
  text-align: center;
  min-width: 0;
  grid-column: span 1 !important;
}

.stats b {
  display: block;
  font-size: 13px !important;
  line-height: 1.2 !important;
  white-space: nowrap;
}

.stats span {
  display: block;
  color: #64748b;
  font-size: 10px !important;
  margin-top: 2px;
  white-space: nowrap;
  letter-spacing: -0.03em;
}

/* 3. 검색바 컴팩트 한 줄 배치 */
.search {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 5px !important;
  align-items: center !important;
  background: #fff;
  border: 1px solid #e5eaf2;
  border-radius: 9px !important;
  padding: 6px !important;
  margin: 6px 0 !important;
}

.search input {
  flex: 1 1 auto !important;
  width: auto !important;
  min-width: 0 !important;
  height: 30px !important;
  border: 1px solid #cbd5e1;
  border-radius: 6px !important;
  padding: 4px 8px !important;
  font-size: 12px !important;
  background: #fff;
}

.search select {
  flex: 0 0 auto !important;
  width: auto !important;
  max-width: 86px !important;
  height: 30px !important;
  border: 1px solid #cbd5e1;
  border-radius: 6px !important;
  padding: 2px 4px !important;
  font-size: 11.5px !important;
  background: #fff;
}

.search button {
  flex: 0 0 auto !important;
  width: auto !important;
  height: 30px !important;
  padding: 0 10px !important;
  font-size: 12px !important;
  border-radius: 6px !important;
  margin: 0 !important;
}

/* 4. 카테고리 칩 숨김 */
.chips {
  display: none !important;
}

/* 5. 검색 결과: 본문 영역 최대 확보 + 하단 한 줄 액션바 */
.result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 6px 2px 4px !important;
  font-size: 12px !important;
}

.result-head small, footer {
  color: #64748b;
  font-size: 11px;
}

.results {
  display: grid;
  gap: 6px !important;
}

.file {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: flex-start !important;
  gap: 6px 8px !important;
  background: #fff;
  border: 1px solid #e5eaf2;
  border-radius: 9px !important;
  padding: 8px 10px !important;
  width: 100%;
}

.file-icon {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  display: grid;
  place-items: center;
  background: #edf3ff;
  color: #2459a8;
  border-radius: 7px !important;
  font-size: 9px !important;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 1px;
}

/* 우측 끝까지 전체 폭을 사용해 파일명과 본문 내용이 많이 보이도록 설정 */
.file-main {
  flex: 1 1 calc(100% - 42px) !important;
  width: calc(100% - 42px) !important;
  max-width: calc(100% - 42px) !important;
  min-width: 0 !important;
}

.file-main strong {
  display: block !important;
  font-size: 13px !important;
  line-height: 1.35 !important;
  white-space: normal !important;
  word-break: break-all !important;
  overflow-wrap: anywhere !important;
}

.file-main small {
  display: block !important;
  font-size: 11px !important;
  color: #64748b;
  margin-top: 2px !important;
  white-space: normal !important;
  word-break: break-all !important;
}

.snippet {
  font-size: 12px !important;
  line-height: 1.45 !important;
  color: #334155;
  background: #f8fafc;
  border-left: 2.5px solid #8aa7d8;
  padding: 5px 8px !important;
  margin-top: 5px !important;
  white-space: normal !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  width: 100% !important;
}

.index-error {
  font-size: 10.5px;
  color: #a34a25;
  margin-top: 3px;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* 카테고리 + 즐겨찾기 + MYBOX 열기를 줄바꿔서 같은 라인에 배치 */
.file-actions {
  flex: 0 0 100% !important;
  width: 100% !important;
  padding-left: 40px !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 6px !important;
  margin-top: 2px !important;
}

.file-actions select {
  flex: 0 1 125px !important;
  width: auto !important;
  max-width: 135px !important;
  height: 26px !important;
  font-size: 11px !important;
  padding: 2px 6px !important;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
}

.star {
  flex: 0 0 auto !important;
  border: 0;
  background: #f1f4f8;
  border-radius: 6px;
  height: 26px !important;
  padding: 0 8px !important;
  color: #9aa6b5;
  cursor: pointer;
  font-size: 11.5px !important;
}

.star.on {
  color: #e3a008;
  background: #fff7df;
}

.open {
  flex: 0 0 auto !important;
  font-size: 11.5px !important;
  font-weight: 600;
  text-decoration: none;
  color: #175cd3;
  white-space: nowrap !important;
  margin-left: 4px !important;
}

.notice {
  margin: 6px 0;
  padding: 8px 10px;
  font-size: 12px;
  color: #165c36;
  background: #eaf8ef;
  border-radius: 8px;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 14px 0;
  font-size: 12px;
}

.pagination a {
  color: #175cd3;
  text-decoration: none;
}

footer {
  text-align: center;
  padding: 10px;
}

.login {
  max-width: 340px;
  margin: 15vh auto;
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid #e5eaf2;
}

.login form {
  display: flex;
  gap: 6px;
}

.login input {
  flex: 1;
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
}

@media (max-width: 640px) {
  .wrap {
    margin: 6px auto !important;
    padding: 0 8px !important;
  }

  header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
    margin-bottom: 6px !important;
  }

  .header-actions {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 4px !important;
    width: 100% !important;
  }

  .header-actions form,
  .header-actions button {
    width: 100% !important;
    padding: 4px 2px !important;
    font-size: 11px !important;
  }
}
.login h1, .login .login-title { margin: 0 0 18px 0 !important; }
.login form { margin-top: 18px !important; }
