/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Variables ── */
:root {
  --fs-ui: 12px;
  --fs-sm: 11px;
  --fs-lg: 13px;
  --accent:       #1a73e8;
  --accent-hover: #1557b0;
}

html[lang="en"] {
  --fs-ui: 13px;
  --fs-sm: 11px;
  --fs-lg: 14px;
}

html, body {
  height: 100%;
  font-family: Helvetica, 'Malgun Gothic', '맑은 고딕', Arial, sans-serif;
  font-size: var(--fs-ui);
  color: #333;
  background: #f5f5f5;
}

/* ── App grid ── */
#app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: 160px 1fr;
  grid-template-areas:
    "topbar  topbar"
    "sidebar main"
    "footer  footer";
  height: 100vh;
}

/* ── Top bar ── */
#topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #ddd;
  height: 48px;
  padding: 0 16px;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 168px;
  font-weight: 600;
  font-size: 15px;
}

.topbar__menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.topbar__menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: #333;
  border-radius: 1px;
}

.topbar__header {
  flex: 1;
  text-align: center;
  font-size: 15px;
  color: #555;
}

/* ── Sidebar ── */
#sidebar {
  grid-area: sidebar;
  background: #fff;
  border-right: 1px solid #ddd;
  padding: 16px 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

#sidebar nav {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.sidebar__nav {
  list-style: none;
  flex: 1;
}

.sidebar__nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: #444;
  text-decoration: none;
  border-radius: 0 6px 6px 0;
  transition: background 0.15s;
  font-size: 13px;
}

.sidebar__nav li a svg { flex-shrink: 0; opacity: 0.7; }
.sidebar__nav li a.active svg { opacity: 1; }

.sidebar__nav li a:hover { background: #f0f0f0; }

.sidebar__nav li a.active {
  background: #e8f0fe;
  color: #1a73e8;
  font-weight: 500;
}


/* ── Sidebar 서브메뉴 ── */
.sidebar__nav li.has-sub > .sidebar__sub {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.22s ease-out, opacity 0.18s ease;
}
.sidebar__nav li.has-sub.open > .sidebar__sub {
  max-height: 200px;
  opacity: 1;
}
.sidebar__nav li.has-sub > .sidebar__sub li a {
  padding: 7px 16px 7px 38px;
  font-size: 12px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  border-radius: 0 6px 6px 0;
  transition: background 0.15s;
}
.sidebar__nav li.has-sub > .sidebar__sub li a:hover {
  background: #f0f0f0;
  color: #333;
}
.sidebar__nav li.has-sub > .sidebar__sub li a.active {
  background: #e8f0fe;
  color: #1a73e8;
  font-weight: 500;
}
.sidebar__nav li.has-sub > .sidebar__sub li a svg { opacity: 0.55; }
.sidebar__nav li.has-sub > .sidebar__sub li a.active svg,
.sidebar__nav li.has-sub > .sidebar__sub li a:hover svg { opacity: 1; }
.sidebar__bottom {
  list-style: none;
  border-top: 1px solid #eee;
  padding-top: 8px;
  margin-top: 8px;
}

.sidebar__bottom li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: #444;
  text-decoration: none;
  border-radius: 0 6px 6px 0;
  transition: background 0.15s;
  font-size: 13px;
}

.sidebar__bottom li a svg { flex-shrink: 0; opacity: 0.7; }
.sidebar__bottom li a:hover { background: #f0f0f0; }

/* ── Nav Section (접힘/펼침) ── */
.nav-section + .nav-section {
  border-top: 1px solid #f0f0f0;
  margin-top: 4px;
  padding-top: 4px;
}

.nav-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px 5px;
  font-size: 11px;
  font-weight: 700;
  color: #3e3e3e;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}

.nav-section-title:hover { color: #555; }
.nav-section-title-text { flex: 1; }

.nav-chevron {
  flex-shrink: 0;
  color: #ccc;
  transition: transform 0.22s ease;
}

.nav-section.collapsed .nav-chevron { transform: rotate(-90deg); }

.nav-section-body {
  overflow: hidden;
  max-height: 600px;
  opacity: 1;
  transition: max-height 0.26s ease-out, opacity 0.2s ease;
}

.nav-section.collapsed .nav-section-body {
  max-height: 0;
  opacity: 0;
}

#sidebar nav > .nav-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#sidebar nav > .nav-section > .nav-section-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  max-height: 10000px;
  overflow-y: auto;
  transition: opacity 0.2s ease;
}

#sidebar nav > .nav-section.collapsed > .nav-section-body {
  flex: 0 0 0px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
}

#sidebar nav > .nav-section > .nav-section-body > .sidebar__nav { flex: 1; }

/* ── Main: 기본값 = sub-sidebar + sub-main split ── */
#main {
  grid-area: main;
  background: #fafafa;
  display: flex;
  overflow: hidden;
}

/* ── Footer ── */
#footer {
  grid-area: footer;
  background: #1e2a3a;
  border-top: none;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.3px;
}

/* ── Sidebar collapsed ── */
#app.sidebar-collapsed {
  grid-template-columns: 0 1fr;
}

#app.sidebar-collapsed #sidebar {
  overflow: hidden;
  padding: 0;
}

/* ── Topbar: nav + action buttons ── */
.topbar__nav {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
}

.topbar__nav a {
  display: flex;
  align-items: center;
  padding: 5px 13px;
  font-size: 13px;
  font-weight: 500;
  color: #555;
  text-decoration: none;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}

.topbar__nav a:hover  { background: #f0f0f0; color: #333; }
.topbar__nav a.active { background: #e8f0fe; color: #1a73e8; }

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.topbar__action-btn {
  width: 30px; height: 30px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: #666;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
  text-decoration: none;
  font-size: 12px;
}

.topbar__action-btn:hover { background: #f0f0f0; color: #333; }

.topbar__user-btn {
  width: 30px; height: 30px;
  border: none;
  background: #1a73e8;
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  transition: background 0.12s;
  text-decoration: none;
}

.topbar__user-btn:hover { background: #1557b0; }

/* ── Main content area ── */
.main-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px 14px;
  background: #fff;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.main-title {
  font-size: 18px;
  font-weight: 700;
  color: #111;
}

/* ── Login page ── */
body.page-login {
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,.1);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo-text {
  font-size: 1.4rem;
  font-weight: 800;
  color: #1c2536;
}

.login-logo-text em {
  font-style: normal;
  color: #667eea;
}

.login-subtitle {
  font-size: 1rem;
  font-weight: 600;
  color: #334155;
  text-align: center;
  margin-bottom: 24px;
}

.login-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 5px;
}

.login-input {
  width: 100%;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: .9rem;
  outline: none;
  transition: border-color .2s;
  margin-bottom: 16px;
}

.login-input:focus { border-color: #667eea; }

.login-btn {
  width: 100%;
  background: #1c2536;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}

.login-btn:hover { background: #2d3a4f; }

.login-error {
  background: #fef2f2;
  color: #dc2626;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: .82rem;
  margin-bottom: 16px;
}

/* ─────────────────────────────────────────────
   Sub-sidebar layout  (extracted from webmail.smartertools.co.kr/style.css)
   ───────────────────────────────────────────── */

/* ── Sub-sidebar ── */
#sub-sidebar {
  width: 200px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid #ddd;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sub-sidebar__new-btn {
  margin: 12px;
  padding: 8px 16px;
  background: #1e3a5f;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
}

.sub-sidebar__new-btn:hover { background: #16304f; }

.sub-sidebar__nav {
  list-style: none;
  padding: 4px 0;
}

.sub-sidebar__nav li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  color: #444;
  text-decoration: none;
  transition: background 0.15s;
  font-size: 13px;
}

.sub-sidebar__nav li a svg { flex-shrink: 0; opacity: 0.65; }
.sub-sidebar__nav li a.active svg,
.sub-sidebar__nav li a:hover svg { opacity: 1; }

.sub-sidebar__nav li a:hover { background: #f0f0f0; }

.sub-sidebar__nav li a.active {
  background: #e8f0fe;
  color: #1a73e8;
  font-weight: 500;
}

/* 드롭 대상 폴더 강조 */
.sub-sidebar__nav li.drop-over > a {
  background: #e8f0fe !important;
  color: #1a73e8 !important;
  outline: 2px dashed #1a73e8;
  outline-offset: -3px;
  border-radius: 6px;
}

/* 오른쪽 클릭 강조 */
.sub-sidebar__nav li.ctx-active > a {
  background: #e8f0fe;
  color: #1a73e8;
}

/* 폴더 추가 버튼 */
.sub-sidebar__folder-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: calc(100% - 24px);
  margin: 4px 12px 0;
  padding: 7px 10px;
  background: none;
  border: 1px dashed #ddd;
  border-radius: 6px;
  font-size: 12px;
  color: #aaa;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  text-align: left;
}

.sub-sidebar__folder-btn:hover {
  border-color: #1a73e8;
  color: #1a73e8;
  background: #f0f5ff;
}

/* 폴더 트리 +/- 토글 */
.ft-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  color: #888;
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.12s, color 0.12s;
}
.ft-toggle:hover { background: #dde4f0; color: #1a73e8; }
.sub-sidebar__nav li a.active .ft-toggle { color: #1a73e8; }

.ft-toggle-ph {
  display: inline-flex;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.ft-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Sub-main ── */
#sub-main {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* ── sub-main-search (공용) ── */
#sub-main-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f1f3f4;
  border-radius: 8px;
  padding: 8px 12px;
}

#sub-main-search input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: #333;
}

#sub-main-search input::placeholder { color: #aaa; }

/* ── sub-main-toolbar (공용) ── */
#sub-main-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px;
  margin-bottom: 16px;
}
/* ── Login: 자동저장 체크박스 ── */
.login-remember {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 18px;
  cursor: pointer;
  user-select: none;
}

.login-remember input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #667eea;
  cursor: pointer;
  flex-shrink: 0;
}

.login-remember span {
  font-size: .82rem;
  color: #64748b;
}
/* ── Design Guide ── */
.guide-section {
  display: none;
  flex-direction: column;
  gap: 24px;
}
.guide-section.active { display: flex; }

.guide-title {
  font-size: 17px;
  font-weight: 700;
  color: #111;
  padding-bottom: 10px;
  border-bottom: 2px solid #e8f0fe;
}

.guide-desc {
  font-size: 13px;
  color: #444;
  line-height: 1.7;
}

.guide-desc strong { color: #1a73e8; }

.guide-rule {
  background: #1e2a3a;
  border-radius: 8px;
  overflow: hidden;
}

.guide-rule-label {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  padding: 8px 16px 6px;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.guide-rule pre {
  margin: 0;
  padding: 14px 16px;
  font-family: 'Consolas', 'Fira Code', monospace;
  font-size: 12px;
  color: #e2e8f0;
  line-height: 1.65;
  overflow-x: auto;
  white-space: pre;
}

.guide-rule pre .sel  { color: #93c5fd; }
.guide-rule pre .prop { color: #86efac; }
.guide-rule pre .val  { color: #fde68a; }
.guide-rule pre .cmt  { color: #64748b; font-style: italic; }

.guide-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.guide-tag--layout  { background: #e8f0fe; color: #1a73e8; }
.guide-tag--base    { background: #f0fdf4; color: #16a34a; }
.guide-tag--component { background: #fef3c7; color: #d97706; }

.guide-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.guide-box {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  background: #f8fafc;
}

.guide-box-title {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.guide-var-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

.guide-var-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #e8eaed;
  border-radius: 6px;
}

.guide-var-name  { font-size: 11px; font-family: monospace; color: #1a73e8; }
.guide-var-value { font-size: 12px; color: #333; }

.guide-color-swatch {
  width: 100%;
  height: 28px;
  border-radius: 4px;
  margin-bottom: 4px;
  border: 1px solid rgba(0,0,0,0.06);
}

/* ─────────────────────────────────────────────────────────────
   Settings page  (extracted from webmail.smartertools.co.kr/style.css)
   ───────────────────────────────────────────────────────────── */

/* ── Settings nav (sub-sidebar) ── */
.basic-nav { padding: 12px 0; }

.basic-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: #444;
  text-decoration: none;
  font-size: 13px;
  transition: background 0.15s;
  border-radius: 0;
}

.basic-nav li a:hover  { background: #f0f0f0; }

.basic-nav li a.active {
  background: #e8f0fe;
  color: #1a73e8;
  font-weight: 600;
}

.basic-nav li a svg { flex-shrink: 0; opacity: 0.6; }
.basic-nav li a.active svg { opacity: 1; }

.basic-nav-divider {
  height: 1px;
  background: #eee;
  margin: 8px 14px;
}

/* ── Section ── */
.basic-section { margin-bottom: 22px; }

.basic-section-title {
  font-size: 11px;
  font-weight: 700;
  color: #aaa;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-bottom: 8px;
  padding: 0 2px;
}

/* ── Rows card ── */
.basic-rows {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  overflow: visible;
}

.basic-rows > .basic-row:first-child { border-radius: 11px 11px 0 0; }
.basic-rows > .basic-row:last-child  { border-radius: 0 0 11px 11px; }
.basic-rows > .basic-row:only-child  { border-radius: 11px; }

.basic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px;
  border-bottom: 1px solid #f5f5f5;
  gap: 20px;
  min-height: 52px;
}

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

.basic-row-label { flex: 1; min-width: 0; }

.basic-row-title {
  font-size: 13px;
  font-weight: 500;
  color: #111;
}

.basic-row-desc {
  font-size: 11px;
  color: #bbb;
  margin-top: 2px;
  line-height: 1.4;
}

.basic-row-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Toggle switch ── */
.basic-toggle {
  position: relative;
  width: 38px; height: 22px;
  flex-shrink: 0;
  cursor: pointer;
}

.basic-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.basic-toggle-track {
  position: absolute;
  inset: 0;
  background: #ddd;
  border-radius: 22px;
  transition: background 0.2s;
}

.basic-toggle-thumb {
  position: absolute;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  top: 3px; left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.basic-toggle input:checked ~ .basic-toggle-track { background: #1a73e8; }
.basic-toggle input:checked ~ .basic-toggle-thumb { transform: translateX(16px); }

/* ── Buttons ── */
.basic-btn {
  padding: 7px 14px;
  border: 1px solid #ddd;
  border-radius: 7px;
  background: #fff;
  font-size: 13px;
  color: #555;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.12s;
}

.basic-btn:hover           { background: #f5f7fa; }
.basic-btn.danger          { color: #dc2626; border-color: #fca5a5; }
.basic-btn.danger:hover    { background: #fee2e2; }
.basic-btn.primary         { background: #1a73e8; color: #fff; border-color: #1a73e8; }
.basic-btn.primary:hover   { background: #1557b0; }

/* ── Badge ── */
.basic-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 10px;
  flex-shrink: 0;
}

.basic-badge.inactive     { background: #f5f5f5; color: #999; }
.basic-badge.active-badge { background: #dcfce7; color: #16a34a; }
.basic-badge.warn         { background: #fef3c7; color: #d97706; }

/* ── Select ── */
.basic-select {
  padding: 7px 30px 7px 10px;
  border: 1px solid #ddd;
  border-radius: 7px;
  background: #fff;
  font-size: 13px;
  color: #333;
  cursor: pointer;
  outline: none;
  min-width: 150px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}

.basic-select:focus { border-color: #1a73e8; }

/* ── Text input (settings row용 보완) ── */
.basic-input {
  width: 260px;
  padding: 7px 11px;
  border: 1px solid #ddd;
  border-radius: 7px;
  font-size: 13px;
  color: #333;
  outline: none;
  transition: border-color .15s;
  background: #fff;
}

.basic-input:focus         { border-color: #1a73e8; }
.basic-input::placeholder  { color: #bbb; }

/* ── Toast / save feedback ── */
.basic-toast {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 7px;
  font-size: 12px;
  color: #15803d;
  font-weight: 500;
  margin-bottom: 16px;
}

.basic-toast.show  { display: flex; }
.basic-toast.error { background: #fef2f2; border-color: #fecaca; color: #dc2626; }

/* ── Danger zone ── */
.basic-rows.danger-zone             { border-color: #fca5a5; }
.basic-rows.danger-zone .basic-row { border-bottom-color: #fef2f2; }
/* ── Patcher section switch ── */
.patcher-sec          { display: none; }
.patcher-sec.active   { display: block; }

/* ── Page Tab Bar (from webmail mail-list-tab) ── */
.page-tab-bar {
  display: flex;
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 20px;
}
.page-tab {
  padding: 9px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: var(--fs-ui);
  color: #888;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.page-tab.active {
  color: #1a73e8;
  border-bottom-color: #1a73e8;
  font-weight: 600;
}
.page-tab:hover:not(.active) { color: #555; }
.page-tab-panel              { display: none; }
.page-tab-panel.active       { display: block; }

/* ── File Upload (from webmail reply-attach / mail-attachment) ── */

/* 드롭존 */
.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 2px dashed #d0d7e3;
  border-radius: 12px;
  padding: 40px 20px;
  background: #fafbfd;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-align: center;
}
.upload-zone:hover,
.upload-zone.dragover {
  border-color: #1a73e8;
  background: #f0f5ff;
}
.upload-zone-icon  { color: #b0bec5; }
.upload-zone-title { font-size: 13px; font-weight: 500; color: #444; }
.upload-zone-desc  { font-size: 11px; color: #aaa; }
.upload-zone input[type="file"] { display: none; }

/* 업로드된 파일 칩 (webmail .reply-attach-chip) */
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f0f4ff;
  border: 1px solid #c5d3f0;
  border-radius: 4px;
  padding: 2px 7px 2px 6px;
  font-size: 11px;
  color: #3c5a9a;
  max-width: 240px;
}
.file-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-chip-remove {
  background: none;
  border: none;
  color: #7a8ab5;
  cursor: pointer;
  padding: 0 1px;
  line-height: 1;
  font-size: 13px;
  flex-shrink: 0;
}
.file-chip-remove:hover { color: #dc2626; }

/* 칩 목록 (webmail .mail-attachments-list) */
.file-chip-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  min-height: 0;
}

/* 파일 목록 행 (webmail .mail-attachment-item) */
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 9px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.file-item:hover {
  border-color: #bcd0f7;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}
.file-item-name  { flex: 1; font-size: 12px; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item-size  { font-size: 11px; color: #aaa; flex-shrink: 0; }
.file-item-remove {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
}
.file-item-remove:hover { color: #dc2626; }

/* ── Search Wrap (from webmail apv-search-wrap) ── */
.search-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #f1f3f4;
  border-radius: 8px;
  padding: 7px 10px;
  border: 1.5px solid transparent;
  transition: border-color 0.15s, background 0.15s;
}
.search-wrap:focus-within {
  background: #fff;
  border-color: #1a73e8;
}
.search-wrap svg { flex-shrink: 0; color: #aaa; }
.search-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: #333;
  min-width: 0;
}
.search-wrap input::placeholder { color: #aaa; }
.search-wrap .search-clear {
  background: none;
  border: none;
  color: #bbb;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  display: none;
}
.search-wrap .search-clear.visible { display: block; }
.search-wrap .search-clear:hover   { color: #555; }

/* 검색 결과 없음 */
.search-empty {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 60px 20px;
  color: #bbb;
  font-size: 13px;
}
.search-empty.show { display: flex; }

/* ── Basic Table (from smartertools.co.kr .product-detail-table) ── */
.basic-table {
  border-collapse: collapse;           /* product-detail-table */
  font-size: var(--fs-ui);             /* product-detail-table: 12px */
  width: 100%;                         /* product-detail-table */
  margin: 14px 0;                      /* product-detail-table */
}

/* thead tr */
.basic-table thead tr {
  background: #ecf0f1;                 /* product-detail-table th 배경 */
}

/* th */
.basic-table th {
  background: #ecf0f1;                 /* product-detail-table th */
  border: 1px solid #cbcbcb;           /* product-detail-table th */
  height: 32px;                        /* product-detail-table th: 30px + 여백 */
  padding: 0 12px;                     /* product-detail-table th: padding-left 10px */
  text-align: left;                    /* product-detail-table th */
  font-weight: 600;                    /* product-detail-table th */
  vertical-align: middle;
  white-space: nowrap;
}

/* td */
.basic-table td {
  border: 1px solid #cbcbcb;           /* product-detail-table td */
  height: 32px;                        /* product-detail-table td: 30px + 여백 */
  padding: 0 12px;                     /* product-detail-table td: padding-left 10px */
  vertical-align: middle;             /* product-detail-table td */
}

/* tbody tr — 기본 행 */
.basic-table tbody tr {
  transition: background 0.1s;
}

/* tbody tr:hover */
.basic-table tbody tr:hover td {
  background: #f5f8ff;
}

/* tbody tr:nth-child(even) — 기본은 흰 배경, zebra 변형에서만 적용 */
.basic-table--zebra tbody tr:nth-child(even) td {
  background: #f9fafb;
}
.basic-table--zebra tbody tr:nth-child(even):hover td {
  background: #f0f5ff;
}

/* tbody tr:first-child — thead 없이 th를 첫 행에 쓸 때 */
.basic-table tbody tr:first-child th {
  border-top: 1px solid #cbcbcb;
}

/* tbody tr:last-child */
.basic-table tbody tr:last-child td,
.basic-table tbody tr:last-child th {
  border-bottom: 1px solid #cbcbcb;
}

/* 변형: compact */
.basic-table--compact th,
.basic-table--compact td {
  height: 26px;
  padding: 0 8px;
}

/* 변형: bordered (외곽 테두리) */
.basic-table--bordered {
  border: 1px solid #cbcbcb;
}

/* 변형: fixed layout (열 너비 고정) */
.basic-table--fixed {
  table-layout: fixed;
}
.basic-table--fixed td,
.basic-table--fixed th {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Basic File Input (from webmail .modal-input / .sender-add-input) ── */
.basic-file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.basic-file-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: #fff;
  border: 1.5px solid #e0e0e0;   /* sender-add-input */
  border-radius: 8px;             /* sender-add-input */
  font-size: var(--fs-ui);
  color: #333;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.basic-file-btn:hover {
  border-color: #1a73e8;
  background: #f0f5ff;
}
.basic-file-btn input[type="file"] { display: none; }

.basic-file-name {
  flex: 1;
  min-width: 0;
  padding: 7px 11px;              /* modal-input */
  border: 1px solid #ddd;         /* modal-input */
  border-radius: 7px;             /* modal-input */
  font-size: 13px;                /* modal-input */
  color: #bbb;
  background: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: border-color 0.15s; /* modal-input */
}
.basic-file-name.has-file { color: #333; }

.basic-field { margin-bottom: 16px; }
.basic-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 7px;
}

/* ── Basic Select (from webmail .modal-select / .settings-select) ── */
.basic-select {
  padding: 7px 30px 7px 10px;       /* settings-select */
  border: 1px solid #ddd;            /* modal-select */
  border-radius: 7px;                /* modal-select */
  background: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");    /* settings-select: 커스텀 화살표 */
  background-repeat: no-repeat;
  background-position: right 9px center;
  font-size: 13px;                   /* modal-select */
  font-family: inherit;
  color: #333;
  cursor: pointer;
  outline: none;
  min-width: 150px;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s;
}
.basic-select:focus { border-color: #1a73e8; outline: none; } /* modal-select:focus */
.basic-select:disabled { background: #f5f5f5; color: #bbb; cursor: not-allowed; }

/* ── Sub-nav 그룹 (한글 패치 하위 메뉴) ── */
.basic-nav-group-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px 5px;
  font-size: 11px;
  font-weight: 700;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  cursor: default;
  user-select: none;
}
.basic-nav-children {
  list-style: none;
  padding: 0;
  margin: 0 0 4px;
}
.basic-nav-children li a {
  display: block;
  padding: 7px 14px 7px 36px;
  font-size: 13px;
  color: #555;
  text-decoration: none;
  border-radius: 0 6px 6px 0;
  transition: background 0.12s, color 0.12s;
}
.basic-nav-children li a:hover { background: #f5f7fb; color: #1a73e8; }
.basic-nav-children li a.active { background: #e8f0fe; color: #1a73e8; font-weight: 600; }

/* ── SMPlus 추가 스타일 ── */
#sub-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px 14px;
  background: #fff;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.main-title {
  font-size: 18px;
  font-weight: 700;
  color: #111;
}

/* 통계 카드 그리드 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-label {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: #111;
}

/* 패널 */
.panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #f0f0f0;
}

.panel-title {
  font-size: 13px;
  font-weight: 600;
  color: #111;
}

.panel-link {
  font-size: 12px;
  color: #667eea;
  text-decoration: none;
}

.panel-link:hover { text-decoration: underline; }

.panel-empty {
  padding: 32px;
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
}

/* 데이터 테이블 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 18px;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  background: #f9fafb;
  border-bottom: 1px solid #f0f0f0;
  white-space: nowrap;
}

.data-table td {
  padding: 11px 18px;
  color: #374151;
  border-bottom: 1px solid #f5f5f5;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafafa; }

/* 배지 */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green  { background: #dcfce7; color: #166534; }
.badge-gray   { background: #f3f4f6; color: #4b5563; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-blue   { background: #dbeafe; color: #1e40af; }

/* ── Settings page (webmail 스타일 동기화) ── */
.settings-section { margin-bottom: 22px; }
.settings-section-title { font-size: 11px; font-weight: 700; color: #aaa; letter-spacing: 0.6px; text-transform: uppercase; margin-bottom: 8px; padding: 0 2px; }
.settings-rows { background: #fff; border: 1px solid #eee; border-radius: 12px; overflow: visible; }
.settings-rows > .settings-row:first-child  { border-radius: 11px 11px 0 0; }
.settings-rows > .settings-row:last-child   { border-radius: 0 0 11px 11px; }
.settings-rows > .settings-row:only-child   { border-radius: 11px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 20px; border-bottom: 1px solid #f5f5f5; gap: 20px; min-height: 52px; }
.settings-row:last-child { border-bottom: none; }
.settings-row-label { flex: 1; min-width: 0; }
.settings-row-title { font-size: 13px; font-weight: 500; color: #111; }
.settings-row-desc { font-size: 11px; color: #bbb; margin-top: 2px; line-height: 1.4; }
.settings-row-control { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.settings-toggle { position: relative; width: 38px; height: 22px; flex-shrink: 0; cursor: pointer; }
.settings-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.settings-toggle-track { position: absolute; inset: 0; background: #ddd; border-radius: 22px; transition: background 0.2s; }
.settings-toggle-thumb { position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.25); }
.settings-toggle input:checked ~ .settings-toggle-track { background: #1a73e8; }
.settings-toggle input:checked ~ .settings-toggle-thumb { transform: translateX(16px); }
.settings-select { padding: 7px 30px 7px 10px; border: 1px solid #ddd; border-radius: 7px; background: #fff; font-size: 13px; color: #333; cursor: pointer; outline: none; min-width: 150px; appearance: none; background-image: url(data:image/svg+xml,%3Csvg xmlns=http://www.w3.org/2000/svg width=12 height=12 viewBox=0 0 24 24 fill=none stroke=%23999 stroke-width=2%3E%3Cpolyline points=6 9 12 15 18 9/%3E%3C/svg%3E); background-repeat: no-repeat; background-position: right 9px center; }
.settings-select:focus { border-color: #1a73e8; outline: none; }
input[type=text].settings-select { background-image: none; padding-right: 10px; }

/* ── Settings footer bar (sticky save/cancel) ── */
.settings-footer-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0 16px;
  background: linear-gradient(to top, #fafafa 80%, transparent);
  z-index: 10;
}

/* ── Profile card ── */
.settings-profile-card { display:flex;align-items:center;gap:18px;background:#fff;border:1px solid #eee;border-radius:12px;padding:20px 24px;margin-bottom:20px; }
.settings-avatar-wrap { position:relative;flex-shrink:0; }
.settings-avatar { width:64px;height:64px;border-radius:50%;background:#1a73e8;color:#fff;font-size:22px;font-weight:700;display:flex;align-items:center;justify-content:center;overflow:hidden; }
.settings-avatar-edit-btn { position:absolute;bottom:0;right:0;width:22px;height:22px;border-radius:50%;background:#fff;border:2px solid #ddd;cursor:pointer;display:flex;align-items:center;justify-content:center;color:#555; }
.settings-avatar-edit-btn:hover { background:#f0f0f0; }
.settings-profile-info { flex:1;min-width:0; }
.settings-profile-name { font-size:17px;font-weight:700;color:#111; }
.settings-profile-email { font-size:13px;color:#888;margin-top:3px; }
.settings-profile-role { display:inline-block;font-size:11px;font-weight:600;color:#1a73e8;background:#e8f0fe;padding:2px 8px;border-radius:10px;margin-top:6px; }
.settings-profile-actions { display:flex;gap:8px;flex-shrink:0;align-items:center;flex-wrap:wrap; }
.settings-btn { padding:7px 14px;border:1px solid #ddd;border-radius:7px;background:#fff;font-size:13px;color:#555;cursor:pointer;white-space:nowrap;flex-shrink:0;transition:background 0.12s;text-decoration:none;display:inline-flex;align-items:center;gap:5px; }
.settings-btn:hover { background:#f5f7fa; }
.settings-btn.danger { color:#dc2626;border-color:#fca5a5; }
.settings-btn.danger:hover { background:#fee2e2; }
.settings-alert { display:flex;align-items:center;gap:8px;border-radius:8px;padding:10px 16px;margin-bottom:18px;font-size:13px; }
.settings-alert--ok { background:#dcfce7;color:#166534;border:1px solid #bbf7d0; }
.settings-alert--err { background:#fee2e2;color:#991b1b;border:1px solid #fecaca; }

/* ── Modal (webmail 동기화) ── */
.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,0.35);display:flex;align-items:center;justify-content:center;z-index:1000;opacity:0;visibility:hidden;transition:opacity 0.18s,visibility 0.18s}
.modal-overlay.open{opacity:1;visibility:visible}
.modal-box{background:#fff;border-radius:12px;box-shadow:0 8px 32px rgba(0,0,0,0.18);padding:24px;transform:translateY(8px);transition:transform 0.18s;max-height:92vh;overflow-y:auto}
.modal-overlay.open .modal-box{transform:translateY(0)}
.modal-title{font-size:15px;font-weight:700;color:#111;margin-bottom:18px;display:flex;align-items:center;gap:8px}
.modal-footer{display:flex;align-items:center;gap:8px}
.modal-box .modal-footer{justify-content:flex-end;margin-top:20px}
.modal-btn-cancel{padding:7px 16px;border:1px solid #ddd;border-radius:7px;background:#fff;font-size:13px;color:#555;cursor:pointer;font-family:inherit}
.modal-btn-cancel:hover{background:#f5f7fa}

/* ── Context Menu (webmail.smartertools.co.kr/style.css 동기화) ── */
.ctx-menu {
  position: fixed;
  display: none;
  background: #fff;
  border: 1px solid #e2e5ea;
  border-radius: 9px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.14), 0 2px 6px rgba(0,0,0,0.06);
  padding: 4px 0;
  min-width: 172px;
  z-index: 9000;
  transform-origin: top left;
  animation: ctxIn 0.1s ease;
}
.ctx-menu.visible { display: block; }
@keyframes ctxIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}
.ctx-menu-header {
  padding: 8px 14px 6px;
  font-size: 12px;
  color: #888;
  font-weight: 500;
  user-select: text;
  cursor: default;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ctx-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 13px;
  color: #333;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}
.ctx-menu-item:hover { background: #f5f7fa; }
.ctx-menu-item svg   { flex-shrink: 0; color: #888; }
.ctx-menu-item.danger       { color: #dc2626; }
.ctx-menu-item.danger svg   { color: #dc2626; }
.ctx-menu-item.danger:hover { background: #fee2e2; }
.ctx-menu-item.disabled { opacity: 0.35; cursor: default; pointer-events: none; }
.ctx-menu-divider { height: 1px; background: #f0f0f0; margin: 4px 0; }
.sub-sidebar__nav li.ctx-active > a { background: #e8f0fe; color: #1a73e8; }
