/* ==========================================================================
   유비쿼터스 언어 사전 — design tokens + component styles
   Calm enterprise-SaaS look: grayscale surface, one indigo accent.
   ========================================================================== */

:root {
  --bg: #F7F7F9;
  --bg-alt: #EFEFF6;
  --surface: #FFFFFF;
  --surface-muted: #FAFAFB;

  --border: #E6E7EB;
  --border-strong: #E1E3E7;
  --border-soft: #F1F2F4;
  --border-faint: #F5F6F7;

  --text: #14161A;
  --text-secondary: #4B5058;
  --text-tertiary: #6B7080;
  --text-quaternary: #9AA0AC;
  --text-faint: #B0B4BC;
  --text-disabled: #D8DAE0;

  --accent: #5B57F2;
  --accent-strong: #4A46E0;
  --accent-bg: #F0EEFE;
  --accent-bg-strong: #F8F7FE;
  --accent-border: #DBD7FC;

  --danger: #B3261E;
  --danger-bg: #FDECEC;
  --danger-border: #F6C9C7;

  --warn: #92590B;
  --warn-bg: #FFF3DC;
  --warn-border: #F6DDA8;

  --success: #1F7A4D;
  --success-bg: #E8F6EE;
  --success-border: #C8ECDA;

  --neutral: #6B7080;
  --neutral-bg: #F1F2F4;

  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 8px;
  --r-xs: 6px;
  --r-pill: 999px;

  --font-display: 'Sora', system-ui, sans-serif;
  --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;

  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-card-hover: 0 6px 18px rgba(16, 24, 40, 0.08);
  --shadow-pop: 0 14px 40px rgba(16, 24, 40, 0.14);
  --shadow-modal: 0 24px 60px rgba(16, 24, 40, 0.25);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  font-size: 13px;
}

a { color: var(--accent-strong); text-decoration: none; }
a:hover { color: var(--accent); }

button { font-family: inherit; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--text-disabled); border-radius: 4px; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.hidden { display: none !important; }

/* -------------------------------------------------------------------------
   Primitives
   ------------------------------------------------------------------------- */

.display-font { font-family: var(--font-display); font-weight: 700; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--r-sm);
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  background: var(--surface);
  color: var(--text);
}
.btn:hover { background: var(--bg); }
.btn-sm { padding: 7px 13px; font-size: 12.5px; }
.btn-outline { border-color: var(--border-strong); background: var(--surface); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-danger-text { color: var(--danger); }
.btn-disabled { color: var(--text-faint); background: var(--bg); border-color: var(--border-soft); cursor: not-allowed; }
.btn-disabled:hover { background: var(--bg); }
.btn-link { background: none; border: none; padding: 0; color: var(--accent-strong); font-weight: 600; font-size: 12px; cursor: pointer; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: var(--r-xs);
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill-lg { padding: 4px 11px; font-size: 11.5px; border-radius: var(--r-pill); }
.pill-outline { border-color: var(--border-strong); color: var(--text-secondary); background: var(--surface); font-weight: 600; }

.tone-accent { color: var(--accent-strong); background: var(--accent-bg); border-color: var(--accent-border); }
.tone-danger { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-border); }
.tone-warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-border); }
.tone-success { color: var(--success); background: var(--success-bg); border-color: var(--success-border); }
.tone-neutral { color: var(--text-tertiary); background: var(--neutral-bg); border-color: var(--border-strong); }

.avatar {
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-family: var(--font-display); font-weight: 700;
  flex-shrink: 0;
}
.avatar-accent { background: var(--accent-bg); color: var(--accent-strong); }
.avatar-warn { background: #FEF1E3; color: #92590B; }
.avatar-success { background: #E8F6EE; color: #1F7A4D; }
.avatar-danger { background: #FDECEC; color: #B3261E; }
.avatar-neutral { background: var(--border-soft); color: var(--text-tertiary); }

.checkbox, .radio-dot {
  width: 15px; height: 15px; flex-shrink: 0;
  border: 1.5px solid var(--text-disabled);
  position: relative;
}
.checkbox { border-radius: 4px; }
.radio-dot { border-radius: 50%; }
.checkbox.checked { background: var(--accent); border-color: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 10px; }
.radio-dot.checked { border-color: var(--accent); }
.radio-dot.checked::after {
  content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent);
}

.toggle {
  width: 38px; height: 22px; border-radius: 11px; position: relative; flex-shrink: 0; cursor: default;
  background: var(--border-strong);
}
.toggle.on { background: var(--accent); }
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: left .12s ease;
}
.toggle.on::after { left: auto; right: 2px; }

table.dtable { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.dtable th {
  text-align: left; padding: 11px 16px; color: var(--text-quaternary);
  font-weight: 600; font-size: 11px; border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
table.dtable td { padding: 12px 16px; border-bottom: 1px solid var(--border-faint); color: var(--text-secondary); }
table.dtable tr:last-child td { border-bottom: none; }
table.dtable tr.clickable { cursor: pointer; }
table.dtable tr.clickable:hover { background: var(--surface-muted); }

.field-label { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.input-box {
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  padding: 9px 12px; font-size: 13px; color: var(--text); background: var(--surface);
}
.input-box.muted { color: var(--text-quaternary); }

.banner {
  border-radius: var(--r-sm); padding: 12px 16px; font-size: 12.5px; line-height: 1.6;
}
.banner-accent { background: var(--accent-bg-strong); border: 1px solid var(--accent-border); color: var(--text); }
.banner-neutral { background: var(--neutral-bg); color: var(--text-secondary); }

/* -------------------------------------------------------------------------
   App chrome
   ------------------------------------------------------------------------- */

#app { min-height: 100vh; }

.screen-center {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, var(--bg), var(--bg-alt));
}

.logo-mark {
  border-radius: 7px; background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700;
}

.login-card {
  width: 420px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 44px 40px;
  display: flex; flex-direction: column; gap: 22px; align-items: center; text-align: center;
  box-shadow: 0 8px 30px rgba(16, 24, 40, 0.06);
}

.social-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 1px solid var(--border-strong); border-radius: 10px; padding: 12px;
  font-size: 13.5px; font-weight: 600; color: var(--text); cursor: pointer; width: 100%;
}
.social-btn:hover { background: var(--bg); }

.workspaces-topbar {
  height: 72px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 40px;
}
.workspaces-body { max-width: 1040px; margin: 36px auto 0; padding: 0 24px 60px; }
.workspace-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.workspace-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px;
  display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow-card);
}
.workspace-card.clickable { cursor: pointer; }
.workspace-card.clickable:hover { box-shadow: var(--shadow-card-hover); border-color: var(--accent-border); }
.workspace-card .wc-stats {
  display: flex; justify-content: space-between; font-size: 12px; color: var(--text-tertiary);
  border-top: 1px solid var(--border-soft); padding-top: 12px;
}
.workspace-card-new {
  border: 1.5px dashed var(--text-disabled); border-radius: 14px; padding: 22px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: var(--text-quaternary); min-height: 150px; cursor: not-allowed;
}

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column; min-height: 100vh;
}
.sidebar-header {
  padding: 18px 18px 16px; border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-nav { flex: 1; overflow: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 16px; }
.sidebar-group-header {
  display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 6px;
  cursor: pointer; user-select: none;
}
.sidebar-group-title {
  font-size: 11px; font-weight: 700; color: var(--text-quaternary);
  text-transform: uppercase; letter-spacing: .04em;
}
.sidebar-chevron { font-size: 9px; color: var(--text-faint); display: inline-block; transition: transform .12s ease; }
.sidebar-chevron.closed { transform: rotate(-90deg); }
.sidebar-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600; cursor: pointer; color: var(--text-secondary);
}
.sidebar-item:hover { background: var(--bg); }
.sidebar-item.active { color: var(--accent-strong); background: var(--accent-bg); }
.sidebar-item.active:hover { background: var(--accent-bg); }
.sidebar-settings { margin-top: auto; }
.sidebar-settings .badge-hint { font-size: 10px; color: var(--text-faint); font-weight: 500; }
.sidebar-footer {
  padding: 14px 18px; border-top: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 10px;
}

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  height: 64px; flex-shrink: 0; border-bottom: 1px solid var(--border-soft); background: var(--surface);
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px; position: relative;
}
.topbar-title { font-family: var(--font-display); font-weight: 700; font-size: 17px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { width: 26px; height: 26px; border: 2px solid var(--surface); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.bell-btn {
  width: 32px; height: 32px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center;
  position: relative; cursor: pointer;
}
.bell-btn:hover { background: var(--bg); }
.bell-icon { width: 16px; height: 16px; border: 1.6px solid var(--text-tertiary); border-radius: 50% 50% 50% 4px; display: inline-block; }
.bell-dot {
  position: absolute; top: 6px; right: 7px; width: 7px; height: 7px; border-radius: 50%;
  background: #EF4444; border: 1.5px solid var(--surface);
}

.notif-panel {
  position: absolute; top: 56px; right: 28px; width: 400px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-pop);
  z-index: 30; animation: fadeIn .15s ease-out;
}
.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.notif-item {
  display: flex; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--border-faint); cursor: pointer;
}
.notif-item:hover { background: var(--surface-muted); }
.notif-item:last-of-type { border-bottom: none; }
.notif-item.read { opacity: .6; }
.notif-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex-shrink: 0; }
.notif-item.read .notif-dot { background: transparent; }
.notif-title { font-size: 12.5px; font-weight: 700; line-height: 1.5; }
.notif-item.read .notif-title { font-weight: 600; }
.notif-meta { font-size: 11.5px; color: var(--text-tertiary); margin: 3px 0 6px; }
.notif-action { font-size: 11px; font-weight: 600; color: var(--accent-strong); }
.notif-panel-footer { padding: 11px 16px; border-top: 1px solid var(--border-soft); font-size: 11.5px; color: var(--text-quaternary); }

.content { flex: 1; overflow: auto; padding: 28px 32px; }

/* -------------------------------------------------------------------------
   Shared screen bits
   ------------------------------------------------------------------------- */

.screen-title { font-family: var(--font-display); font-weight: 700; font-size: 19px; margin-bottom: 6px; }
.screen-subtitle { font-size: 12.5px; color: var(--text-tertiary); margin-bottom: 20px; line-height: 1.7; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.segmented { display: flex; border: 1px solid var(--border-strong); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.segmented > div { padding: 7px 13px; font-size: 12.5px; color: var(--text-quaternary); }
.segmented > div.active { background: var(--border-soft); color: var(--text); font-weight: 600; }
.segmented > div + div { border-left: 1px solid var(--border-strong); }
.filter-chip {
  border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: 7px 12px;
  font-size: 12.5px; color: var(--text-secondary); background: var(--surface); white-space: nowrap;
}
.filter-search { color: var(--text-quaternary); width: 180px; }
.sync-line { text-align: right; font-size: 11px; color: var(--text-quaternary); margin-bottom: 8px; }

.two-col { display: flex; gap: 20px; align-items: flex-start; }
.two-col > .col-flex { flex: 1; min-width: 0; }

.detail-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 20px;
  display: flex; flex-direction: column; gap: 16px; flex-shrink: 0;
}

.quote-block {
  border-left: 2px solid var(--border-strong); background: var(--surface-muted);
  border-radius: 0 var(--r-xs) var(--r-xs) 0; padding: 9px 12px;
}
.quote-block.split { border-left-color: var(--accent); }
.quote-text { font-size: 12px; font-style: italic; }
.quote-source { font-size: 10.5px; color: var(--text-quaternary); margin-top: 4px; }

.doc-body {
  font-size: 14px; line-height: 2.1; color: #2A2D33;
}
.doc-body .term-pending { color: var(--accent-strong); text-decoration: underline; font-weight: 600; cursor: pointer; }
.doc-body .term-resolved { border-bottom: 1.5px dashed var(--text-faint); cursor: default; }
.doc-body .term-flag-open { border-bottom: 2px solid var(--accent); background: var(--accent-bg); cursor: pointer; }
.doc-body .term-flag-neutral { border-bottom: 2px solid var(--border-strong); }
.doc-body .term-flag-danger { border-bottom: 2px solid var(--danger); background: var(--danger-bg); }

.suggestion-popover {
  width: 300px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 16px; box-shadow: var(--shadow-pop); font-size: 12.5px; line-height: 1.6;
}
.suggestion-popover .sp-title { font-weight: 700; margin-bottom: 12px; }
.suggestion-popover .sp-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.suggestion-popover .sp-actions .btn { padding: 6px 14px; font-size: 12px; }
.sp-note { font-size: 10.5px; color: var(--text-quaternary); margin-bottom: 4px; }
.sp-input { border: 1px solid var(--border-strong); border-radius: var(--r-xs); height: 26px; margin-bottom: 8px; background: var(--surface-muted); }
.sp-checkline { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-secondary); margin-bottom: 10px; }
.sp-checkline .checkbox { width: 12px; height: 12px; }

.tab-row { display: flex; gap: 16px; border-bottom: 1px solid var(--border-soft); }
.tab-row.settings-tabs { gap: 22px; margin-bottom: 22px; }
.tab-item { padding: 9px 2px; font-size: 12.5px; color: var(--text-quaternary); cursor: pointer; border-bottom: 2px solid transparent; }
.tab-item.active { color: var(--text); font-weight: 700; border-bottom-color: var(--accent); }
.settings-tabs .tab-item { font-size: 13px; font-weight: 600; color: var(--text-quaternary); }
.settings-tabs .tab-item.active { color: var(--text); border-bottom: 2px solid var(--accent); }

.pr-thread { width: 340px; flex-shrink: 0; display: flex; flex-direction: column; gap: 12px; }
.pr-thread.narrow { width: 320px; }
.comment-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.comment-card.mine { border: 1.5px solid var(--accent); }
.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.comment-head .avatar { width: 22px; height: 22px; font-size: 10px; }
.comment-name { font-size: 12.5px; font-weight: 700; }
.comment-time { font-size: 10.5px; color: var(--text-quaternary); }
.comment-text { font-size: 12.5px; color: var(--text-secondary); line-height: 1.6; }
.comment-action { font-size: 11px; color: var(--accent-strong); font-weight: 600; margin-top: 8px; cursor: pointer; }
.comment-compose { border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 12px; color: var(--text-quaternary); font-size: 12.5px; background: var(--surface-muted); }

.timeline-item { background: var(--surface); border-radius: 10px; padding: 12px 15px; }
.timeline-item .ti-top { display: flex; align-items: center; gap: 8px; }
.timeline-item .ti-date { font-size: 11px; color: var(--text-quaternary); margin: 4px 0; }
.timeline-item .ti-summary { font-size: 12px; color: var(--text-secondary); }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(20, 22, 26, .4); display: flex;
  align-items: center; justify-content: center; z-index: 50;
}
.modal-box {
  width: 480px; background: var(--surface); border-radius: 14px; padding: 26px;
  display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow-modal);
}
.reviewer-chip {
  border: 1.5px solid var(--accent); color: var(--accent-strong); background: var(--accent-bg);
  border-radius: 16px; padding: 6px 8px 6px 14px; font-size: 12.5px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.reviewer-chip .x { cursor: pointer; color: var(--text-quaternary); font-weight: 700; }

.req-mark { color: var(--danger); }

@media (max-width: 1400px) {
  .content { padding: 24px; }
}
