/* ================================================================
   GN Mail - 통합 스타일시트
   gnb.css + gnmail.css + admin.css 통합
   ================================================================ */

/* ── CSS 변수 ── */
:root {
  --gnb-h:        56px;
  --sidebar-w:    220px;
  --primary:      #2563eb;
  --primary-dark: #1d4ed8;
  --primary-bg:   #eff6ff;
  --bg:           #f8fafc;
  --bg-card:      #ffffff;
  --border:       #e2e8f0;
  --text:         #1e293b;
  --text-muted:   #64748b;
  --text-light:   #94a3b8;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:    0 4px 16px rgba(0,0,0,.10);
  --radius:       8px;
  --radius-sm:    6px;
  --font:         'Pretendard', 'Segoe UI', 'Malgun Gothic', '맑은 고딕', sans-serif;
}
.theme-dark {
  --bg:        #0f172a;
  --bg-card:   #1e293b;
  --border:    #334155;
  --text:      #f1f5f9;
  --text-muted:#94a3b8;
  --primary-bg:#1e3a5f;
}

/* ── 리셋 ── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body.gn-body { font-family: var(--font); color: var(--text); background: var(--bg); }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ================================================================ */
/* GNB - 상단 고정 바                                               */
/* ================================================================ */
.gnb {
  position: fixed; top: 0; left: 0; right: 0; height: var(--gnb-h);
  background: var(--bg-card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 16px; gap: 12px;
  z-index: 200; box-shadow: var(--shadow-sm);
}
.gnb-brand { flex-shrink: 0; }
.gnb-logo  { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.logo-icon { font-size: 22px; color: var(--primary); }
.logo-text { font-size: 16px; font-weight: 500; color: var(--text); letter-spacing: -.3px; }
.logo-text strong { color: var(--primary); font-weight: 700; }

.gnb-search   { flex: 1; max-width: 500px; margin: 0 auto; }
.search-wrap  { display: flex; align-items: center; background: var(--bg);
                border: 1.5px solid var(--border); border-radius: 24px;
                overflow: hidden; transition: border-color .2s; }
.search-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.gnb-search-type  { border: none; background: transparent; padding: 0 10px 0 14px;
                    color: var(--text-muted); font-size: 12px; outline: none;
                    border-right: 1px solid var(--border); height: 36px; }
.gnb-search-input { flex: 1; border: none; background: transparent; padding: 0 10px;
                    font-size: 13px; color: var(--text); outline: none; height: 36px; }
.gnb-search-input::placeholder { color: var(--text-light); }
.gnb-search-btn   { width: 36px; height: 36px; border: none; background: transparent;
                    color: var(--text-muted); display: flex; align-items: center; justify-content: center;
                    transition: color .2s; flex-shrink: 0; }
.gnb-search-btn:hover { color: var(--primary); }

.gnb-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.gnb-compose-btn {
  display: flex; align-items: center; gap: 7px; padding: 7px 16px; border-radius: 20px;
  background: var(--primary); color: #fff; font-size: 13px; font-weight: 600;
  border: none; transition: background .2s, transform .1s; white-space: nowrap;
}
.gnb-compose-btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.gnb-icon-btn {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: transparent; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  position: relative; transition: background .15s, color .15s;
}
.gnb-icon-btn:hover { background: var(--bg); color: var(--primary); }
.bell-badge {
  position: absolute; top: 2px; right: 2px; background: #ef4444; color: #fff;
  font-size: 10px; font-weight: 700; line-height: 1; padding: 2px 4px; border-radius: 8px;
  min-width: 16px; text-align: center;
}

/* 사용자 드롭다운 */
.gnb-user       { position: relative; }
.gnb-avatar-btn { display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px;
                  border: 1.5px solid var(--border); border-radius: 20px; background: transparent;
                  color: var(--text); transition: border-color .2s, background .15s; }
.gnb-avatar-btn:hover { border-color: var(--primary); background: var(--primary-bg); }
.gnb-avatar   { width: 28px; height: 28px; border-radius: 50%; background: var(--primary);
                color: #fff; font-size: 12px; font-weight: 700;
                display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.gnb-username { font-size: 13px; font-weight: 500; max-width: 90px;
                overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gnb-caret    { color: var(--text-muted); transition: transform .2s; flex-shrink: 0; }
.gnb-avatar-btn[aria-expanded="true"] .gnb-caret { transform: rotate(180deg); }
.gnb-user-panel {
  position: absolute; top: calc(100% + 8px); right: 0; width: 260px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-md); z-index: 300;
  opacity: 0; transform: translateY(-8px) scale(.98); pointer-events: none;
  transition: opacity .18s, transform .18s;
}
.gnb-user-panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.user-panel-header { display: flex; align-items: center; gap: 12px; padding: 16px; }
.up-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary);
             color: #fff; font-size: 16px; font-weight: 700;
             display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.up-info   { min-width: 0; }
.up-info strong { display: block; font-size: 14px; font-weight: 600;
                  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-info span   { display: block; font-size: 12px; color: var(--text-muted);
                  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-quota       { padding: 0 16px 12px; }
.up-quota-bar   { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 4px; }
.up-quota-fill  { height: 100%; border-radius: 3px; transition: width .3s; }
.up-quota small { color: var(--text-muted); font-size: 11px; }
.up-divider     { border: none; border-top: 1px solid var(--border); margin: 0; }
.up-nav         { padding: 6px 0; }
.up-nav a       { display: block; padding: 8px 16px; font-size: 13px; color: var(--text); transition: background .15s; }
.up-nav a:hover { background: var(--bg); color: var(--primary); }
.up-logout      { padding: 6px 16px 12px; }
.up-logout-btn  { width: 100%; padding: 8px; border: 1px solid var(--border);
                  border-radius: var(--radius-sm); background: transparent; color: var(--text-muted);
                  font-size: 13px; transition: all .15s; }
.up-logout-btn:hover { background: #fef2f2; border-color: #fca5a5; color: #dc2626; }

/* ================================================================ */
/* 워크스페이스                                                       */
/* ================================================================ */
.gn-workspace { display: flex; margin-top: var(--gnb-h); height: calc(100vh - var(--gnb-h)); overflow: hidden; }
.gn-sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--bg-card);
  border-right: 1px solid var(--border); overflow-y: auto; padding: 12px 0;
}
.folder-list { list-style: none; }
.folder-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 16px;
  color: var(--text); font-size: 13.5px; transition: background .12s, color .12s; position: relative;
}
.folder-link:hover { background: var(--bg); color: var(--primary); }
.folder-item.active .folder-link { background: var(--primary-bg); color: var(--primary); font-weight: 600; }
.folder-item.active .folder-link::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--primary); border-radius: 0 3px 3px 0;
}
.folder-name   { flex: 1; }
.folder-badge  { background: var(--primary); color: #fff; font-size: 11px; font-weight: 700;
                 padding: 1px 6px; border-radius: 10px; min-width: 18px; text-align: center; }
.folder-badge-gray { background: var(--text-muted); }
.folder-divider { border-top: 1px solid var(--border); margin: 8px 0; }
.sidebar-quota  { margin: 12px 16px 0; padding-top: 12px; border-top: 1px solid var(--border); }
.quota-bar-wrap { height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; margin-bottom: 8px; }
.quota-bar      { height: 100%; border-radius: 999px; transition: width .3s ease; }
.quota-text     { display: block; color: var(--text-muted); font-size: 12px; line-height: 1.4; }
.gn-main        { flex: 1; overflow-y: auto; background: var(--bg); min-width: 0; }

/* ================================================================ */
/* 메일 목록                                                          */
/* ================================================================ */
.mail-list-pane { height: 100%; display: flex; flex-direction: column; }
.mail-toolbar {
  display: flex; align-items: center; gap: 8px; padding: 8px 16px;
  background: var(--bg-card); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10; flex-shrink: 0;
}
.toolbar-left  { display: flex; align-items: center; gap: 6px; }
.toolbar-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.chk-all { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }
.btn-tb {
  display: flex; align-items: center; gap: 5px; padding: 5px 10px; font-size: 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-card); color: var(--text); transition: background .12s, border-color .12s;
}
.btn-tb:hover    { background: var(--bg); border-color: var(--text-muted); }
.btn-tb:disabled { opacity: .4; cursor: not-allowed; }
.btn-tb.danger   { color: #dc2626; border-color: #fca5a5; }
.btn-tb.danger:hover { background: #fef2f2; }
.mail-count-txt { font-size: 12px; color: var(--text-muted); }
.paging-btns { display: flex; gap: 2px; }
.btn-page    { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
               border: 1px solid var(--border); border-radius: var(--radius-sm);
               background: var(--bg-card); color: var(--text-muted); font-size: 12px;
               transition: background .12s; text-decoration: none; }
.btn-page:hover { background: var(--bg); }
.mail-list { list-style: none; flex: 1; overflow-y: auto; }
.mail-item {
  display: flex; align-items: center; padding: 0 16px; height: 52px; gap: 10px;
  border-bottom: 1px solid var(--border); background: var(--bg-card);
  cursor: pointer; transition: background .1s;
}
.mail-item:hover { background: #f8faff; }
.mail-item.unread .mi-from, .mail-item.unread .mi-subject { font-weight: 700; color: var(--text); }
.mail-item.selected { background: var(--primary-bg); }
.mi-chk input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.mi-star  { flex-shrink: 0; width: 20px; text-align: center; }
.star-btn { background: none; border: none; padding: 2px; color: var(--text-light); transition: color .15s; font-size: 15px; }
.star-btn.on { color: #f59e0b; }
.star-btn:hover { color: #f59e0b; }
.mi-body  { flex: 1; display: grid; grid-template-columns: 160px 1fr; gap: 0 12px; min-width: 0; align-items: center; }
.mi-from  { font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--text-muted); }
.mi-subject-row { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; }
.mi-subject { font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--text-muted); }
.mi-attach  { flex-shrink: 0; color: var(--text-light); font-size: 12px; }
.mi-unread-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); flex-shrink: 0; }
.mi-date { flex-shrink: 0; font-size: 11.5px; color: var(--text-light); white-space: nowrap; }
.mail-empty { display: flex; flex-direction: column; align-items: center; justify-content: center;
              height: 60vh; color: var(--text-muted); gap: 12px; }
.mail-empty svg { opacity: .25; }
.mail-empty p   { font-size: 15px; }

/* ================================================================ */
/* 메일 읽기                                                          */
/* ================================================================ */
.mail-read-pane { padding: 24px 32px; max-width: 900px; margin: 0 auto; }
.mr-header      { border-bottom: 1px solid var(--border); padding-bottom: 16px; margin-bottom: 20px; }
.mr-subject     { font-size: 20px; font-weight: 700; margin-bottom: 16px; }
.mr-meta        { display: flex; align-items: flex-start; gap: 12px; }
.mr-avatar      { width: 40px; height: 40px; border-radius: 50%; background: var(--primary);
                  color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mr-meta-info   { flex: 1; min-width: 0; }
.mr-from        { font-size: 14px; font-weight: 600; }
.mr-from-email  { font-size: 12px; color: var(--text-muted); }
.mr-to          { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.mr-date        { font-size: 12px; color: var(--text-light); flex-shrink: 0; }
.mr-actions     { display: flex; gap: 6px; margin-top: 12px; }
.mr-btn {
  display: flex; align-items: center; gap: 5px; padding: 7px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-card); font-size: 13px; color: var(--text); transition: all .15s;
}
.mr-btn:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }
.mr-body     { line-height: 1.8; font-size: 14px; color: var(--text); }
.mr-body img { max-width: 100%; height: auto; }
.mr-attachments  { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.mr-attach-title { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 10px; }
.attach-list { display: flex; flex-wrap: wrap; gap: 8px; }
.attach-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card);
  font-size: 12px; color: var(--text); transition: all .15s; cursor: pointer; text-decoration: none;
}
.attach-item:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.attach-icon { font-size: 16px; flex-shrink: 0; }
.attach-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.attach-size { color: var(--text-light); font-size: 11px; }

/* ================================================================ */
/* 메일 작성                                                          */
/* ================================================================ */
.compose-wrap    { height: 100%; display: flex; flex-direction: column; background: var(--bg-card); }
.compose-topbar  { display: flex; align-items: center; justify-content: space-between;
                   padding: 12px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.compose-topbar h2     { font-size: 16px; font-weight: 700; }
.compose-topbar-btns   { display: flex; gap: 8px; }
.compose-fields        { border-bottom: 1px solid var(--border); flex-shrink: 0; }
.cf-row    { display: flex; align-items: center; padding: 0 20px; border-bottom: 1px solid var(--border); min-height: 44px; }
.cf-label  { width: 72px; font-size: 12px; font-weight: 600; color: var(--text-muted); flex-shrink: 0; }
.cf-input  { flex: 1; border: none; outline: none; background: transparent; font-size: 14px; color: var(--text); padding: 10px 0; font-family: inherit; }
.cf-extra-btn { font-size: 11px; color: var(--text-light); border: none; background: none; padding: 2px 6px; border-radius: 4px; transition: color .12s; }
.cf-extra-btn:hover { color: var(--primary); }
.cf-priority { border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12px; padding: 3px 6px; background: var(--bg); color: var(--text); outline: none; }
.cf-action-btn, .cf-important-btn { border: 1px solid var(--border); background: var(--bg-card); color: var(--text-muted); border-radius: 6px; padding: 5px 9px; margin-left: 6px; font-size: 12px; white-space: nowrap; }
.cf-action-btn:hover, .cf-important-btn:hover { color: var(--primary); border-color: var(--primary); }
.cf-action-btn.active { color: #fff; background: var(--primary); border-color: var(--primary); }
.cf-important-btn.active { color: #b45309; background: #fef3c7; border-color: #f59e0b; font-weight: 700; }
.compose-modal { position: fixed; inset: 0; z-index: 10000; background: rgba(15,23,42,.48); align-items: center; justify-content: center; padding: 20px; }
.compose-modal-box { width: min(620px, 96vw); max-height: min(720px, 90vh); background: var(--bg-card); border-radius: 12px; box-shadow: 0 24px 60px rgba(15,23,42,.24); display: flex; flex-direction: column; overflow: hidden; }
.compose-modal-head, .compose-modal-foot { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.compose-modal-head h3 { font-size: 16px; margin: 0; flex: 1; }
.compose-modal-close { border: 0; background: none; font-size: 24px; color: var(--text-muted); }
.compose-contact-search { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.compose-contact-search input { flex: 1; border: 1px solid var(--border); border-radius: 7px; padding: 9px 11px; background: var(--bg); color: var(--text); }
.compose-contact-search span, .compose-modal-foot > span { color: var(--text-muted); font-size: 12px; }
.compose-contact-list { overflow: auto; padding: 8px; min-height: 220px; }
.compose-contact-item { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.compose-contact-item:hover { background: var(--bg); }
.compose-contact-item span { display: flex; flex-direction: column; gap: 3px; }
.compose-contact-item small { color: var(--text-muted); }
.compose-contact-empty { text-align: center; color: var(--text-muted); padding: 50px 10px; }
.compose-modal-foot { justify-content: flex-end; border-top: 1px solid var(--border); border-bottom: 0; }
.compose-modal-foot > span { margin-right: auto; }
.compose-editor-wrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.editor-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 2px;
                  padding: 6px 16px; border-bottom: 1px solid var(--border); background: var(--bg); flex-shrink: 0; }
.et-btn    { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
             border: none; border-radius: 4px; background: transparent; color: var(--text-muted); font-size: 13px; transition: background .12s, color .12s; }
.et-btn:hover { background: var(--border); color: var(--text); }
.et-sep    { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.et-select { font-size: 11px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg); color: var(--text); padding: 2px 4px; outline: none; }
.mail-editor { flex: 1; padding: 16px 20px; outline: none; overflow-y: auto; font-size: 14px; line-height: 1.8; color: var(--text); min-height: 200px; }
.mail-editor:empty::before { content: attr(data-placeholder); color: var(--text-light); }
.compose-attach-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
                      padding: 8px 20px; border-top: 1px solid var(--border); background: var(--bg); flex-shrink: 0; }
.attach-input-hidden { display: none; }
.btn-attach-label { display: flex; align-items: center; gap: 6px; padding: 5px 12px;
                    border: 1.5px dashed var(--border); border-radius: var(--radius-sm);
                    color: var(--text-muted); font-size: 12px; cursor: pointer; transition: all .15s; }
.btn-attach-label:hover { border-color: var(--primary); color: var(--primary); }
.attach-file-chip { display: flex; align-items: center; gap: 5px; padding: 3px 8px;
                    background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
                    font-size: 11px; color: var(--text-muted); }
.attach-help { font-size: 11px; color: var(--text-light); margin-left: auto; }

/* 발송 로딩 */
.loading-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35);
                   display: flex; align-items: center; justify-content: center; z-index: 9999; }
.loading-box     { background: var(--bg-card); border-radius: var(--radius); padding: 24px 40px;
                   font-size: 15px; font-weight: 600; box-shadow: var(--shadow-md);
                   display: flex; align-items: center; gap: 12px; }
.loading-spinner { width: 20px; height: 20px; border: 3px solid var(--border);
                   border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ================================================================ */
/* 공통 버튼                                                          */
/* ================================================================ */
.btn-primary   { background: var(--primary); color: #fff; border: none; border-radius: var(--radius-sm);
                 padding: 8px 18px; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: background .15s; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border);
                 border-radius: var(--radius-sm); padding: 8px 18px; font-size: 13.5px; cursor: pointer; transition: background .15s; }
.btn-secondary:hover { background: var(--border); }
.btn-ghost     { background: transparent; color: var(--text-muted); border: none;
                 border-radius: var(--radius-sm); padding: 8px 12px; font-size: 13px; cursor: pointer; }
.btn-ghost:hover { background: var(--bg); }
.btn-danger    { background: #dc2626; color: #fff; border: none; border-radius: var(--radius-sm);
                 padding: 8px 18px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm  { display: inline-block; padding: 3px 10px; border: 1px solid var(--border);
           border-radius: 999px; font-size: 11px; font-weight: 600; cursor: pointer; background: var(--bg-card); color: var(--text); transition: all .12s; }
.btn-sm:hover    { border-color: var(--primary); color: var(--primary); }
.btn-outline     { color: var(--text); border-color: var(--border); }
.btn-info        { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; cursor: pointer; }
.btn-info:hover  { background: #bfdbfe; }
.btn-warning     { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; cursor: pointer; }
.btn-warning:hover { background: #fde68a; }
.btn-danger.btn-sm { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.btn-danger.btn-sm:hover { background: #fecaca; }

/* ================================================================ */
/* 모달                                                               */
/* ================================================================ */
.modal-bd  { position: fixed; inset: 0; background: rgba(0,0,0,.45);
             display: flex; align-items: center; justify-content: center; z-index: 500; animation: fadein .15s; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45);
                  display: flex; align-items: center; justify-content: center; z-index: 500; }
@keyframes fadein { from { opacity: 0; } }
.modal-box    { background: var(--bg-card); border-radius: var(--radius); width: 480px;
                max-width: 96vw; max-height: 90vh; display: flex; flex-direction: column;
                box-shadow: var(--shadow-md); animation: slidein .18s; }
.modal-dialog { background: var(--bg-card); border-radius: var(--radius); width: 480px;
                max-width: 96vw; max-height: 90vh; display: flex; flex-direction: column;
                box-shadow: var(--shadow-md); }
@keyframes slidein { from { transform: translateY(-16px); opacity: 0; } }
.modal-box.lg, .modal-dialog.modal-lg { width: 680px; }
.modal-hd, .modal-header { display: flex; align-items: center; justify-content: space-between;
                            padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-hd h3, .modal-header h3 { font-size: 15px; font-weight: 700; margin: 0; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 18px;
               width: 28px; height: 28px; border-radius: 4px; transition: background .12s; }
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-bd-body, .modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-ft, .modal-footer    { padding: 12px 20px; border-top: 1px solid var(--border);
                               display: flex; gap: 8px; justify-content: flex-end; }

/* ================================================================ */
/* 폼 공통                                                            */
/* ================================================================ */
.form-group  { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; color: var(--text-muted); }
.form-control { width: 100%; padding: 9px 12px; border: 1.5px solid var(--border);
                border-radius: var(--radius-sm); background: var(--bg-card); color: var(--text);
                font-size: 13.5px; font-family: inherit; outline: none; transition: border-color .15s; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.08); }
.form-hint   { font-size: 11.5px; color: var(--text-light); margin-top: 4px; display: block; }
.required    { color: #ef4444; }
.form-row-2  { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ================================================================ */
/* 알럿/배지                                                          */
/* ================================================================ */
.alert      { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }
.alert-ok   { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-err  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* 배지 */
.badge           { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge-default   { background: #dbeafe; color: #1d4ed8; }
.badge-success   { background: #dcfce7; color: #166534; }
.badge-secondary { background: #e5e7eb; color: #4b5563; }

/* 결과 배지 */
.result-badge   { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; }
.result-success { background: #dcfce7; color: #166534; }
.result-fail    { background: #fee2e2; color: #991b1b; }
.result-error   { background: #fef3c7; color: #92400e; }

/* 인증 상태 */
.verify-status  { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; }
.verify-ready   { background: #dcfce7; color: #166534; }
.verify-pending { background: #fef3c7; color: #92400e; }
.verify-fail    { background: #fee2e2; color: #991b1b; }

/* 롤/상태 배지 */
.role-badge      { font-size: 11px; padding: 2px 6px; border-radius: 4px; background: #eee; }
.role-superadmin { background: #8e44ad; color: #fff; }
.role-admin      { background: #e67e22; color: #fff; }
.role-user       { background: #eee; color: #555; }
.status-badge    { font-size: 11px; padding: 2px 6px; border-radius: 4px; }
.status-active   { background: #dcfce7; color: #166534; }
.status-inactive { background: #e2e3e5; color: #383d41; }
.status-locked   { background: #fee2e2; color: #991b1b; }
.status-suspended { background: #fef3c7; color: #92400e; }

/* ================================================================ */
/* 토스트                                                             */
/* ================================================================ */
.gn-toast { position: fixed; bottom: 24px; right: 24px; padding: 12px 18px;
            border-radius: var(--radius); color: #fff; font-size: 13.5px; font-weight: 500;
            opacity: 0; transform: translateY(12px); transition: all .25s;
            z-index: 9999; pointer-events: none; max-width: 320px; box-shadow: 0 4px 16px rgba(0,0,0,.15); }
.gn-toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: #16a34a; }
.toast-error   { background: #dc2626; }
.toast-info    { background: var(--primary); }
.toast-warn    { background: #d97706; }

/* ================================================================ */
/* 관리자 공통 (admin.css 통합)                                        */
/* ================================================================ */
.adm-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card-header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }

.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.adm-table th { background: var(--bg); padding: 10px 12px; text-align: left;
                border-bottom: 2px solid var(--border); font-weight: 600; white-space: nowrap; }
.adm-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.adm-table tr:last-child td { border-bottom: none; }
.adm-table tr:hover td { background: #f8faff; }
.table-sm .adm-table th, .table-sm .adm-table td { padding: 7px 10px; }

.search-grid    { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.search-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.adm-paging  { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px 0; }
.paging-btn  { padding: 6px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
               color: var(--text); text-decoration: none; transition: background .12s; background: var(--bg-card); }
.paging-btn:hover { background: var(--bg); }
.paging-info { color: var(--text-muted); font-size: 13px; }
.count-badge { font-size: 13px; color: var(--text-muted); font-weight: 400; margin-left: 8px; }

/* 유틸 */
.text-center  { text-align: center; }
.text-muted   { color: var(--text-muted); }
.text-danger  { color: #dc2626; }
.text-nowrap  { white-space: nowrap; }
.d-block      { display: block; }
.td-actions   { white-space: nowrap; }
.mt-2         { margin-top: 16px; }
.dns-value    { font-family: monospace; font-size: 12px; word-break: break-all; }
.action-modal-message { font-size: 14px; line-height: 1.6; color: var(--text); }

/* 대시보드 */
.dash-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card       { background: var(--bg-card); border-radius: var(--radius); padding: 20px;
                   box-shadow: var(--shadow-sm); text-align: center; border: 1px solid var(--border); }
.stat-card .stat-icon  { font-size: 2rem; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--text); }
.stat-card .stat-label { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.stat-card.blue   .stat-value { color: #2563eb; }
.stat-card.green  .stat-value { color: #16a34a; }
.stat-card.orange .stat-value { color: #d97706; }
.stat-card.red    .stat-value { color: #dc2626; }

/* ================================================================ */
/* 설치 마법사 (install.jsp 전용)                                      */
/* ================================================================ */
body.wizard-body { min-height: 100vh; background: #f0f2f5; display: flex; align-items: center; justify-content: center; font-family: var(--font); }
.wizard-box  { background: #fff; border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,.12); width: 680px; max-width: 98vw; }
.wizard-head { padding: 32px 40px 0; border-bottom: 1px solid #eee; }
.wizard-head h1 { font-size: 1.6rem; margin: 0 0 4px; color: var(--text); }
.wizard-step-bar { display: flex; margin: 16px 0 0; }
.wizard-step-bar .step {
  flex: 1; text-align: center; padding: 8px 0 12px; font-size: .8rem;
  color: #aaa; border-bottom: 3px solid #eee; transition: all .2s;
}
.wizard-step-bar .step.active { color: var(--primary); border-color: var(--primary); font-weight: 700; }
.wizard-step-bar .step.done   { color: #16a34a; border-color: #16a34a; }
.wizard-body-content { padding: 32px 40px; }
.wizard-nav  { padding: 0 40px 32px; display: flex; justify-content: space-between; }
.step-pane   { display: none; }
.step-pane.active { display: block; }
.test-result { margin-top: 12px; padding: 10px 16px; border-radius: 6px; display: none; }
.test-result.ok   { background: #dcfce7; color: #166534; }
.test-result.fail { background: #fee2e2; color: #991b1b; }
.install-complete      { text-align: center; padding: 32px 0; }
.install-complete h3   { font-size: 1.4rem; margin: 12px 0 8px; }

.db-options     { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.db-option-item { display: flex; align-items: center; gap: 10px; padding: 12px 16px;
                  border: 2px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: border-color .15s; }
.db-option-item:hover { border-color: var(--primary); }
.db-option-item:has(input:checked) { border-color: var(--primary); background: var(--primary-bg); }

/* ================================================================ */
/* 반응형                                                             */
/* ================================================================ */
@media (max-width: 1200px) { .dash-stats-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 900px) {
  :root { --sidebar-w: 52px; }
  .folder-name, .folder-badge, .gnb-username { display: none; }
  .folder-link { justify-content: center; padding: 12px; }
  .mi-body { grid-template-columns: 1fr; }
  .mi-from { display: none; }
  .search-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .dash-stats-grid { grid-template-columns: 1fr 1fr; }
  .search-grid     { grid-template-columns: 1fr; }
  .wizard-body-content, .wizard-head { padding-left: 20px; padding-right: 20px; }
  .wizard-nav { padding: 0 20px 20px; }
}
@media (max-width: 640px) {
  .gnb-search { display: none; }
  .gnb-compose-btn span { display: none; }
  .gn-sidebar { display: none; }
  .mail-read-pane { padding: 16px; }
  .form-row-2 { grid-template-columns: 1fr; }
}
