:root {
  --bg: #e9e5da; --panel: #f9f7f0; --ink: #20332a; --muted: #6c766e;
  --green: #214f3b; --rust: #a65f3c; --line: #cbc4b6; --danger: #9b3838;
  --serif: "Noto Serif KR", "Batang", serif; --sans: "Pretendard", "Noto Sans KR", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); font-family: var(--sans); }
a { color: inherit; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; }
.sidebar { padding: 28px 20px; background: var(--green); color: #f8f4e9; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar a { padding: 10px 12px; text-decoration: none; color: #d9e0d8; }
.sidebar a:hover, .sidebar a.active { background: #ffffff16; color: white; }
.shome-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 0 28px;
  padding: 0 !important;
  color: white !important;
}
.shome-brand:hover { background: transparent !important; }
.shome-brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 44px;
  padding: 5px;
  place-items: center;
  background: #f9f7f0;
}
.shome-brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.shome-brand > span:last-child { display: grid; line-height: 1.05; }
.shome-brand strong { font: 700 .92rem var(--serif); letter-spacing: .05em; }
.shome-brand small { margin-top: 5px; color: #becbc1; font-size: .58rem; letter-spacing: .16em; }
.main { padding: 34px; overflow: auto; }
.top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; }
h2, h3 { font-family: var(--serif); }
h2 { margin: 0; font-size: 2rem; }
.muted { color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.panel, .metric { background: var(--panel); border: 1px solid var(--line); padding: 22px; }
.metric strong { display: block; margin-top: 10px; font: 500 2rem var(--serif); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.panel h3 { margin-top: 0; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 12px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .75rem; text-transform: uppercase; }
.form { display: grid; gap: 15px; max-width: 820px; }
.form.cols { grid-template-columns: 1fr 1fr; }
.form .full { grid-column: 1 / -1; }
label { display: grid; gap: 6px; font-size: .84rem; font-weight: 700; }
input, textarea, select {
  width: 100%; padding: 12px 13px; border: 1px solid var(--line);
  color: var(--ink); background: white; font: inherit;
}
textarea { min-height: 220px; resize: vertical; }
button, .button {
  display: inline-block; border: 1px solid var(--green); padding: 10px 15px;
  background: var(--green); color: white; text-decoration: none; cursor: pointer; font: inherit;
}
.button.secondary { background: transparent; color: var(--green); }
.button.danger { background: var(--danger); border-color: var(--danger); }
.flash { padding: 13px 15px; margin-bottom: 18px; border-left: 4px solid var(--green); background: #dfe9df; }
.flash.error { border-color: var(--danger); background: #f2dede; }
.badge { display: inline-block; padding: 3px 8px; background: #e3e7df; font-size: .75rem; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(460px, 100%); padding: 36px; background: var(--panel); border: 1px solid var(--line); }
.auth-video-page {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--green);
}
.auth-video-page::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(10, 34, 25, .58), rgba(18, 31, 26, .22)),
    linear-gradient(0deg, rgba(7, 22, 17, .15), rgba(7, 22, 17, .15));
}
.auth-background-video {
  position: fixed;
  z-index: -2;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.auth-video-page .auth-card {
  position: relative;
  width: min(440px, 100%);
  padding: 50px 44px 44px;
  background:
    radial-gradient(circle at 12% 8%, rgba(173, 128, 63, .08), transparent 30%),
    radial-gradient(circle at 88% 92%, rgba(33, 79, 59, .06), transparent 34%),
    rgba(246, 241, 228, .94);
  border: 1px solid rgba(119, 87, 45, .68);
  border-radius: 28px;
  box-shadow:
    0 30px 80px rgba(8, 28, 21, .42),
    inset 0 0 0 8px rgba(255, 253, 246, .48),
    inset 0 0 0 9px rgba(119, 87, 45, .22);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.auth-video-page .auth-card::before,
.auth-video-page .auth-card::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 54px;
  height: 1px;
  background: #9b7444;
  transform: translateX(-50%);
}
.auth-video-page .auth-card::before { top: 22px; }
.auth-video-page .auth-card::after { bottom: 22px; }
.auth-video-page .auth-brand {
  gap: 14px;
  margin-bottom: 30px;
}
.auth-video-page .auth-brand::after {
  content: "";
  width: 96px;
  height: 1px;
  margin-top: 3px;
  background: linear-gradient(90deg, transparent, #a07848 18%, #a07848 82%, transparent);
}
.auth-video-page .auth-brand img {
  width: 82px;
  height: 85px;
  padding: 10px;
  background: rgba(239, 231, 211, .76);
  border: 1px solid rgba(130, 94, 49, .46);
  border-radius: 50%;
  box-shadow:
    0 0 0 4px rgba(249, 246, 237, .72),
    0 0 0 5px rgba(130, 94, 49, .18);
}
.auth-video-page .auth-brand strong {
  color: #263c31;
  font-size: 1.18rem;
  letter-spacing: .16em;
}
.auth-video-page .auth-title {
  margin: -4px 0 28px;
  color: #263c31;
  font: 600 1.45rem var(--serif);
  letter-spacing: .03em;
  text-align: center;
}
.auth-video-page .form { gap: 18px; }
.auth-video-page .form label {
  gap: 8px;
  color: #34483e;
  font-family: var(--serif);
  font-size: .76rem;
  letter-spacing: .05em;
}
.auth-video-page .form input {
  min-height: 48px;
  padding: 12px 14px;
  background: rgba(255, 253, 247, .86);
  border-color: #b9aa8d;
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(67, 48, 28, .06);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.auth-video-page .form input:focus {
  outline: 0;
  background: #fffdf7;
  border-color: #735a38;
  box-shadow: 0 0 0 3px rgba(151, 112, 62, .14);
}
.auth-video-page .form button {
  min-height: 50px;
  margin-top: 2px;
  border-color: #173d2d;
  border-radius: 8px;
  background: linear-gradient(180deg, #285e46, #1d4a37);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .16),
    0 5px 14px rgba(24, 58, 44, .16);
  font-family: var(--serif);
  letter-spacing: .1em;
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.auth-video-page .form button:hover {
  background: linear-gradient(180deg, #306a50, #214f3b);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .2),
    0 7px 18px rgba(24, 58, 44, .22);
  transform: translateY(-1px);
}
.auth-brand {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin-bottom: 28px;
  text-align: center;
}
.auth-brand img { display: block; width: 62px; height: 65px; object-fit: contain; }
.auth-brand strong { font: 700 1.15rem var(--serif); letter-spacing: .08em; }
@media (prefers-reduced-motion: reduce) {
  .auth-background-video { display: none; }
}
.secret { padding: 12px; background: white; border: 1px dashed var(--line); word-break: break-all; text-align: center; letter-spacing: .12em; }
.qr { display: block; width: 220px; height: 220px; margin: 20px auto; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding: 16px; background: white; font-family: monospace; }
.prewrap { white-space: pre-wrap; }
.top-gap { margin-top: 18px; }
.bottom-gap { margin-bottom: 18px; }
.inline { display: inline; }
.short-area { min-height: 100px; }
.eyebrow {
  margin-bottom: 8px; color: var(--rust); font-size: .72rem;
  font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
}
.section-title { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.section-title h3, .section-title p { margin-top: 0; }
.mail-hero {
  display: flex; align-items: end; justify-content: space-between; gap: 24px;
  padding: 26px 28px; color: #f8f4e9; background: var(--green);
}
.mail-hero h3 { max-width: 760px; margin: 0 0 8px; font-size: 1.65rem; }
.mail-hero p { margin: 0; color: #d9e0d8; }
.mail-hero-button { flex: 0 0 auto; color: white !important; border-color: #ffffff80 !important; }
.mail-account-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px; margin-top: 18px;
}
.mail-account-card {
  display: grid; gap: 18px; padding: 20px; background: white; border: 1px solid var(--line);
}
.mail-account-card h3 { margin: 10px 0 4px; }
.mail-account-card p { margin: 0; color: var(--muted); }
.mail-server-list { display: grid; gap: 8px; margin: 0; font-size: .82rem; }
.mail-server-list div { display: grid; grid-template-columns: 44px 1fr; gap: 10px; }
.mail-server-list dt { color: var(--muted); }
.mail-server-list dd { margin: 0; overflow-wrap: anywhere; }
.mail-account-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.mail-account-actions form { margin-left: auto; }
.mail-form-section {
  display: grid; grid-template-columns: 150px minmax(0, 1fr);
  gap: 24px; padding: 22px 0; border-top: 1px solid var(--line);
}
.mail-form-section:first-of-type { border-top: 0; }
.mail-form-section > div:first-child { display: flex; align-items: baseline; gap: 10px; }
.mail-form-section h4 { margin: 0; font: 600 1.05rem var(--serif); }
.mail-form-section > div:first-child span { color: var(--rust); font-size: .75rem; font-weight: 800; }
.mail-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 18px;
}
.mail-toolbar > div { display: flex; flex-wrap: wrap; gap: 8px; }
.mail-toolbar form { display: inline-flex; }
.mail-summary {
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 1px;
  margin-bottom: 18px; border: 1px solid var(--line); background: var(--line);
}
.mail-summary div { padding: 16px 18px; background: var(--panel); }
.mail-summary span { display: block; margin-bottom: 6px; color: var(--muted); font-size: .75rem; }
.mail-summary strong { font: 600 1.15rem var(--serif); }
.mail-inbox-panel { padding: 0; overflow: hidden; }
.mail-list-head, .mail-row {
  display: grid; grid-template-columns: 72px minmax(170px, .9fr) minmax(260px, 1.7fr) 140px;
  align-items: center; gap: 12px; padding: 0 18px;
}
.mail-list-head {
  min-height: 42px; color: var(--muted); background: #efebe1;
  font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
.mail-row {
  min-height: 64px; border-top: 1px solid var(--line);
  text-decoration: none; font-size: .86rem;
}
.mail-row:hover { background: #f0ede4; }
.mail-row.unread { background: #f3f5ef; font-weight: 700; }
.mail-state {
  justify-self: start; padding: 3px 7px; color: var(--muted);
  background: #e5e2d9; font-size: .68rem; font-weight: 700;
}
.mail-row.unread .mail-state { color: white; background: var(--rust); }
.mail-from, .mail-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-row time { color: var(--muted); font-size: .78rem; text-align: right; }
.mail-empty { padding: 32px; color: var(--muted); text-align: center; }
.mail-filter-bar {
  display: grid; grid-template-columns: minmax(190px, 1fr) minmax(160px, .7fr) auto;
  align-items: end; gap: 12px; margin-bottom: 18px; padding: 14px;
  background: #f2eee4; border: 1px solid var(--line);
}
.mail-category-label {
  display: inline-block; margin-right: 7px; padding: 2px 6px;
  color: var(--green); background: #e1e8df; font-size: .66rem; font-weight: 800;
}
.mail-pagination {
  display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 18px;
}
.mail-message { max-width: 1040px; padding: 0; overflow: hidden; }
.mail-message-header { padding: 26px 28px 22px; background: #efebe1; border-bottom: 1px solid var(--line); }
.mail-message-header h3 { margin: 0 0 18px; font-size: 1.55rem; }
.mail-message-header dl { display: grid; gap: 7px; margin: 0; font-size: .82rem; }
.mail-message-header dl div { display: grid; grid-template-columns: 80px 1fr; gap: 12px; }
.mail-message-header dt { color: var(--muted); }
.mail-message-header dd { margin: 0; overflow-wrap: anywhere; }
.mail-message-body {
  min-height: 320px; padding: 30px 28px; color: #26352e;
  background: white; font: .94rem/1.8 var(--sans); overflow-wrap: anywhere;
}
.mail-message-note { padding: 0 28px 20px; }
.mail-attachment-list { padding: 22px 28px; background: #f3f0e8; border-top: 1px solid var(--line); }
.mail-attachment-list h4 { margin: 0 0 12px; }
.mail-attachment-list > div {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line);
}
.mail-attachment-list small { color: var(--muted); }
.mail-compose { max-width: 1040px; }
.mail-compose .form { max-width: none; }
.mail-recipient-options summary { color: var(--green); cursor: pointer; font-size: .84rem; font-weight: 700; }
.mail-compose-actions { display: flex; gap: 9px; }
.mail-compose-picker {
  display: grid; grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
  align-items: end; gap: 12px; padding: 16px; background: #f3f0e8; border: 1px solid var(--line);
}
.mail-file-options { display: grid; gap: 14px; padding: 18px; background: #f3f0e8; border: 1px solid var(--line); }
.mail-settings-grid {
  display: grid; grid-template-columns: minmax(280px, .8fr) minmax(420px, 1.2fr);
  gap: 24px; margin-top: 20px;
}
.mail-settings-list { display: grid; align-content: start; gap: 10px; }
.mail-setting-card {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 15px; background: white; border: 1px solid var(--line);
}
.mail-setting-card h4 { margin: 8px 0 4px; }
.mail-setting-card p { margin: 0 0 4px; overflow-wrap: anywhere; }
.mail-setting-actions { display: flex; gap: 7px; }
.mail-chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.mail-category-chip {
  display: flex; align-items: center; gap: 7px; padding: 7px 9px;
  background: #e7e4db; border: 1px solid var(--line); font-size: .82rem;
}
.mail-category-chip small { color: var(--muted); }
.text-button {
  padding: 0; color: var(--danger); background: transparent; border: 0;
  font-size: .72rem; text-decoration: underline;
}
.mail-rule-list { display: grid; gap: 8px; }
.mail-rule-list > div {
  display: grid; grid-template-columns: 10px 1fr auto;
  align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line);
}
.mail-rule-list small { grid-column: 2; color: var(--muted); }
.mail-rule-list form { grid-column: 3; grid-row: 1 / 3; }
.mail-category-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rust); }
.mail-shared-list { display: grid; margin-top: 16px; }
.mail-shared-list > div {
  display: grid; grid-template-columns: minmax(220px, 1.5fr) minmax(190px, .8fr) auto;
  align-items: center; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line);
}
.mail-shared-list > div.expired { opacity: .58; }
.mail-shared-list strong, .mail-shared-list span, .mail-shared-list small { display: block; }
.mail-shared-list small { margin-top: 4px; color: var(--muted); }
.check-label {
  display: flex; grid-template-columns: none; flex-direction: row;
  align-items: center; gap: 8px; min-height: 44px;
}
.check-label input, input[type="checkbox"], input[type="color"] { width: auto; }
input[type="color"] { min-height: 44px; padding: 4px; }
code { padding: 2px 5px; background: #ffffff80; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .sidebar nav { grid-template-columns: repeat(3, 1fr); }
  .cards { grid-template-columns: 1fr 1fr; }
  .mail-form-section { grid-template-columns: 1fr; gap: 14px; }
  .mail-list-head { display: none; }
  .mail-row {
    grid-template-columns: 70px 1fr auto; gap: 8px 12px; padding: 14px 16px;
  }
  .mail-row .mail-subject { grid-column: 2 / -1; grid-row: 2; }
  .mail-row time { grid-column: 3; grid-row: 1; }
  .mail-settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .auth-video-page { padding: 16px; }
  .auth-video-page .auth-card { padding: 44px 28px 40px; }
  .main { padding: 22px 16px; }
  .cards, .grid-2, .form.cols { grid-template-columns: 1fr; }
  .sidebar nav { grid-template-columns: 1fr 1fr; }
  .mail-toolbar { align-items: stretch; flex-direction: column; }
  .mail-toolbar > .button { text-align: center; }
  .mail-summary { grid-template-columns: 1fr 1fr; }
  .mail-summary div:first-child { grid-column: 1 / -1; }
  .mail-row { grid-template-columns: 62px minmax(0, 1fr); }
  .mail-row time { grid-column: 2; grid-row: 3; text-align: left; }
  .mail-row .mail-subject { grid-column: 2; }
  .mail-account-actions form { margin-left: 0; }
  .mail-filter-bar, .mail-compose-picker { grid-template-columns: 1fr; }
  .mail-setting-card { align-items: stretch; flex-direction: column; }
  .mail-attachment-list > div { align-items: start; flex-direction: column; }
  .mail-shared-list > div { grid-template-columns: 1fr; }
}
