:root {
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --surface-2: #F0F2F5;
  --text: #16181D;
  --muted: #5F6672;
  --line: #E2E5EA;
  --brand: #1E3A8A;
  --brand-ink: #FFFFFF;
  --accent: #2563EB;
  --star: #E0A100;
  --warn-bg: #FFF4D6;
  --warn-ink: #7A5200;
  --notice-bg: #EEF3FF;
  --notice-line: #C9D7FB;
  --ic-sheet: #188038;
  --ic-doc: #1A73E8;
  --ic-slides: #E8A100;
  --ic-form: #7248B9;
  --ic-console: #1E3A8A;
  --ic-page: #0E7490;
  --ic-artifact: #C2410C;
  --ic-site: #4B5563;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1115; --surface: #171A21; --surface-2: #1F232C; --text: #E8EAEE; --muted: #9BA3AF;
    --line: #2A2F3A; --brand: #93B4FF; --brand-ink: #0F1115; --accent: #7AA2FF; --star: #F5C542;
    --warn-bg: #3A2E0A; --warn-ink: #F5D27A; --notice-bg: #172038; --notice-line: #2B3B66;
    --ic-sheet: #4CC77A; --ic-doc: #6EA8FF; --ic-slides: #F5C542; --ic-form: #B497F0;
    --ic-console: #93B4FF; --ic-page: #4FC3D9; --ic-artifact: #FB8A4F; --ic-site: #A3ABB8;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1115; --surface: #171A21; --surface-2: #1F232C; --text: #E8EAEE; --muted: #9BA3AF;
  --line: #2A2F3A; --brand: #93B4FF; --brand-ink: #0F1115; --accent: #7AA2FF; --star: #F5C542;
  --warn-bg: #3A2E0A; --warn-ink: #F5D27A; --notice-bg: #172038; --notice-line: #2B3B66;
  --ic-sheet: #4CC77A; --ic-doc: #6EA8FF; --ic-slides: #F5C542; --ic-form: #B497F0;
  --ic-console: #93B4FF; --ic-page: #4FC3D9; --ic-artifact: #FB8A4F; --ic-site: #A3ABB8;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; max-width: 100%; overflow-x: hidden; }
body {
  background: var(--bg); color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: inherit; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* 로그인 */
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 32px 24px; text-align: center; box-shadow: var(--shadow);
}
.login-card h1 { font-size: 22px; margin: 12px 0 8px; }
.lead { color: var(--muted); margin: 0 0 20px; }
#gbtn { display: flex; justify-content: center; min-height: 44px; }
.logo {
  display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px;
  border-radius: 12px; background: var(--brand); color: var(--brand-ink); font-weight: 800; font-size: 24px;
}
.logo.sm { width: 28px; height: 28px; font-size: 15px; border-radius: 8px; }

/* 버튼 */
.btn {
  font: inherit; font-size: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 8px 16px; cursor: pointer; min-height: 40px;
}
.btn.small { padding: 6px 12px; font-size: 13px; min-height: 36px; }
.btn.ghost { margin-top: 16px; background: transparent; }
.btn:hover { background: var(--surface-2); }
.icon-btn {
  border: 0; background: transparent; color: var(--muted); cursor: pointer; width: 40px; height: 40px;
  border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 상단바 */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; min-width: 0; }
.brand span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who { display: flex; align-items: center; gap: 6px; min-width: 0; }
.uname { font-size: 13px; color: var(--muted); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); }

/* 검색 */
.search-box {
  margin: 20px 0 12px; display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 16px; box-shadow: var(--shadow);
}
.search-box:focus-within { border-color: var(--accent); }
.search-box .ic { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search-box input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 16px; height: 44px;
}
.search-box input::-webkit-search-cancel-button { display: none; }

.notice {
  margin: 0 0 16px; padding: 10px 14px; border-radius: 10px; background: var(--notice-bg);
  border: 1px solid var(--notice-line); font-size: 14px;
}

/* 탭 — 탭 줄만 가로로 넘기고 화면 전체는 가로 스크롤 없음 */
.tabs {
  display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; margin-bottom: 4px;
  scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.tab {
  flex: none; font: inherit; font-size: 14px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); padding: 6px 14px; border-radius: 999px; cursor: pointer; min-height: 38px; white-space: nowrap;
}
.tab .n { color: var(--muted); font-size: 12px; margin-left: 4px; }
.tab[aria-selected="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.tab[aria-selected="true"] .n { color: inherit; opacity: .8; }

/* 구역 */
.sec { margin: 20px 0; }
.sec h2 { font-size: 16px; margin: 0 0 10px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.list { display: flex; flex-direction: column; gap: 6px; }

.item {
  display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 6px 10px 12px; min-width: 0; box-shadow: var(--shadow);
}
.item:hover { border-color: var(--accent); }
.item a.main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; text-decoration: none; }
.item .tx { min-width: 0; flex: 1; }
.item .t, .item .d { display: block; }
.item .t { font-weight: 600; overflow-wrap: anywhere; word-break: keep-all; }
.item .m { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.item .d { font-size: 13px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.ticon { width: 34px; height: 34px; flex: none; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); }
.ticon svg { width: 20px; height: 20px; }
.star { color: var(--muted); }
.star[aria-pressed="true"] { color: var(--star); }
.star svg { width: 22px; height: 22px; }
mark { background: var(--warn-bg); color: inherit; border-radius: 3px; padding: 0 1px; }

.empty { text-align: center; padding: 32px 0; color: var(--muted); }
.foot { display: flex; flex-direction: column; gap: 4px; padding: 24px 0 40px; border-top: 1px solid var(--line); margin-top: 24px; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100% - 32px); z-index: 50;
}

@media (max-width: 560px) {
  .uname { display: none; }
  .grid { grid-template-columns: 1fr; }
  .brand span:last-child { font-size: 15px; }
}
