:root {
  --bg: #FBF7F0;
  --card: #FFFFFF;
  --text: #1A1A1A;
  --muted: #8a857d;
  --accent: #C49A6C;
  --accent-dark: #a97f4f;
  --sale: #2B5E4B;
  --border: #e8e1d6;
  --danger: #b24a3a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* ===== Login ===== */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.login-card {
  background: var(--card);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 10px 40px rgba(26, 26, 26, 0.08);
}
.login-logo { text-align: center; margin-bottom: 20px; }
.login-logo img { max-height: 42px; }
.login-title { font-size: 22px; font-weight: 700; text-align: center; }
.login-sub { color: var(--muted); text-align: center; margin: 6px 0 22px; }
.login-error {
  background: #fdf0ee;
  color: var(--danger);
  border: 1px solid #f3d3cd;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
}
.login-form { display: flex; flex-direction: column; gap: 8px; }
.login-back { display: block; text-align: center; margin-top: 18px; color: var(--muted); text-decoration: none; font-size: 13px; }
.login-back:hover { color: var(--accent-dark); }

/* ===== Layout ===== */
.mail-body { height: 100vh; overflow: hidden; }
.app { display: grid; grid-template-columns: 240px 360px 1fr; height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.sidebar-logo { max-height: 28px; }
.sidebar-link { color: var(--muted); text-decoration: none; font-size: 13px; }
.sidebar-link:hover { color: var(--accent-dark); }
.box-switch { margin-bottom: 16px; }
.folders { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.folder {
  background: none;
  border: none;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
}
.folder:hover { background: var(--bg); }
.folder.active { background: rgba(196, 154, 108, 0.15); color: var(--accent-dark); font-weight: 600; }
.sidebar-bottom { border-top: 1px solid var(--border); padding-top: 12px; }
.user-chip {
  background: var(--bg);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  word-break: break-all;
}

/* ===== List pane ===== */
.pane-list {
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.list-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--card);
}
.list-title { font-size: 16px; font-weight: 700; }
.list-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.msg-list { flex: 1; overflow-y: auto; }
.msg-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.msg-item:hover { background: var(--card); }
.msg-item.unread { background: rgba(196, 154, 108, 0.07); }
.msg-item.unread .msg-from,
.msg-item.unread .msg-subject { font-weight: 600; }
.msg-from { font-size: 13px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-subject { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-date { font-size: 11px; color: var(--muted); margin-top: 4px; }
.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

/* ===== Read pane ===== */
.pane-read { background: var(--card); overflow-y: auto; }
.read-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
}
.read-head { padding: 20px 24px; border-bottom: 1px solid var(--border); }
.read-subject { font-size: 18px; font-weight: 700; }
.read-meta { color: var(--muted); font-size: 13px; margin-top: 6px; }
.read-body {
  padding: 20px 24px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.55;
}

/* ===== Compose ===== */
.compose-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.compose-overlay.show { display: flex; }
.compose-card {
  background: var(--card);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 20px 60px rgba(26, 26, 26, 0.25);
}
.compose-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.compose-head h3 { font-size: 17px; }
.compose-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.send-status { color: var(--sale); font-size: 13px; }

/* ===== Controls ===== */
.field-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.text-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.text-input:focus { border-color: var(--accent); }
textarea.text-input { resize: vertical; min-height: 60px; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-block { display: block; width: 100%; }
.btn-ghost {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  padding: 6px 10px;
  border-radius: 6px;
}
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

@media (max-width: 900px) {
  .app { grid-template-columns: 180px 1fr; }
  .pane-read { display: none; }
}
