/* === INBOX: Header, Control Panel, Email List, Viewer === */

/* HEADER */
.hdr {
  text-align: center;
  padding: 24px 16px 20px;
}

.hdr-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 6px;
}

.hdr-logo img { width: 40px; height: 40px; border-radius: 10px; }

.hdr h1 {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, #2d8f4e, #38a169, #68d391, #f9a8c9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@media (min-width: 768px) { .hdr h1 { font-size: 38px; } }
.hdr p { color: var(--muted); font-size: 13px; margin-top: 4px; }

.hdr-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(56, 161, 105, 0.1);
  border: 1px solid rgba(56, 161, 105, 0.2);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 8px;
}

.dot-pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); animation: pulse-d 2s ease-in-out infinite; }
@keyframes pulse-d { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.8); } }

/* CONTROL PANEL */
.cpanel {
  padding: 20px 16px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
}

@media (min-width: 768px) { .cpanel { padding: 28px; } }

.cpanel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #2d8f4e, #68d391, #f9a8c9, #fff9c4);
  opacity: 0.8;
  border-radius: 3px 3px 0 0;
}

.crow { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
@media (min-width: 640px) { .crow { flex-direction: row; } }

.iwrap { position: relative; flex: 1; display: flex; flex-direction: column; }
.field-label { font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.iwrap .ic { position: absolute; left: 12px; bottom: 13px; color: var(--muted); width: 16px; height: 16px; pointer-events: none; }

.iwrap input,
.iwrap select {
  width: 100%;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  color: var(--txt);
  font-size: 16px;
  padding: 13px 13px 13px 38px;
  border-radius: 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

@media (min-width: 768px) { .iwrap input, .iwrap select { font-size: 14px; } }
.iwrap input:focus, .iwrap select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-g); }
.iwrap select { appearance: none; cursor: pointer; }
.iwrap .chv { position: absolute; right: 12px; bottom: 13px; color: var(--muted); width: 16px; height: 16px; pointer-events: none; }

.brow { display: flex; gap: 8px; }
.brow .btn { flex: 1; justify-content: center; }
@media (min-width: 640px) { .brow .btn { flex: unset; } }

/* ACTIVE EMAIL */
.ae-section { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.ae-label { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 2px; margin-bottom: 8px; }
.ae-box { position: relative; display: flex; align-items: center; }

.ae-box input {
  width: 100%;
  background: rgba(45, 143, 78, 0.04);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 16px;
  font-family: "SF Mono", "Consolas", monospace;
  font-weight: 600;
  padding: 14px 52px 14px 14px;
  border-radius: 14px;
  outline: none;
  cursor: pointer;
  transition: all 0.2s;
  text-overflow: ellipsis;
}

@media (min-width: 768px) { .ae-box input { font-size: 20px; padding: 16px 60px 16px 20px; } }
.ae-box input:hover { border-color: var(--accent); }

.ae-box .cbtn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.ae-box .cbtn:hover { background: var(--leaf-d); transform: translateY(-50%) scale(1.08); }
.ae-box .cbtn svg { width: 16px; height: 16px; }
.ae-hint { font-size: 10px; color: var(--muted); text-align: center; margin-top: 6px; }

/* EMAIL LIST LAYOUT */
.inbox-layout {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(400px, 1.5fr);
  gap: 14px;
}

@media (max-width: 767px) {
  .inbox-layout {
    grid-template-columns: 1fr;
  }
  .inbox-layout.viewing .elist-panel { display: none; }
  .inbox-layout.viewing .vpanel { display: flex; }
}

.elist-panel {
  display: flex;
  flex-direction: column;
  min-height: 400px;
  max-height: 70vh;
  overflow: hidden;
}

.elist-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.elist-toolbar h2 { font-size: 14px; font-weight: 700; color: var(--txt); display: flex; align-items: center; gap: 8px; }
.elist-toolbar h2 svg { color: var(--accent); }
.badge { background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }

.tright { display: flex; align-items: center; gap: 6px; }

.atoggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 8px;
  background: none;
  border: 1px solid var(--border);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  color: var(--txt2);
}

.atoggle:hover { border-color: var(--ok); }
.ldot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

.rbtn {
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: none;
  color: var(--txt2);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
}

.rbtn:hover { border-color: var(--accent); color: var(--accent); }
.rbtn svg { width: 14px; height: 14px; }

.ptrack { height: 2px; background: var(--border); overflow: hidden; }
.pbar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--sakura)); }
.escroll { flex: 1; overflow-y: auto; }

.eitem {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(74, 124, 89, 0.06);
  cursor: pointer;
  transition: background 0.15s;
}

.eitem:hover { background: rgba(56, 161, 105, 0.05); }
.eitem.active { background: rgba(56, 161, 105, 0.1); border-left: 3px solid var(--accent); }

.esender { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.esender span:first-child { font-weight: 600; font-size: 13px; color: var(--txt); }
.etime { font-size: 10px; color: var(--muted); }
.esubj { font-size: 12px; color: var(--txt2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty svg, .empty i { width: 40px; height: 40px; margin-bottom: 10px; opacity: 0.4; }
.empty p { font-size: 13px; }

/* VIEWER */
.vpanel {
  display: flex;
  flex-direction: column;
  min-height: 400px;
  max-height: 70vh;
  overflow: hidden;
}

@media (max-width: 767px) { .vpanel { display: none; min-height: 0; max-height: none; } }

.vplaceholder { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; color: var(--muted); }
.vplaceholder svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.3; }
.vplaceholder p { font-size: 13px; }

.mob-back {
  display: none;
  padding: 10px 14px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  align-items: center;
  gap: 6px;
}

.mob-back svg { width: 16px; height: 16px; }
@media (max-width: 767px) { .mob-back { display: flex; } }

.vheader { padding: 16px; border-bottom: 1px solid var(--border); }
.vsubj { font-size: 16px; font-weight: 700; margin-bottom: 6px; color: var(--txt); line-height: 1.3; }
.vmeta { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.from-b { font-weight: 600; color: var(--accent); }
.vmeta-i { display: flex; align-items: center; gap: 4px; }

.vtabs { display: flex; gap: 4px; padding: 8px 16px; border-bottom: 1px solid var(--border); }

.vtab {
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  background: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  font-family: inherit;
  transition: all 0.15s;
}

.vtab:hover { background: rgba(56, 161, 105, 0.06); color: var(--txt); }
.vtab.active { background: rgba(56, 161, 105, 0.12); color: var(--accent); }

.vbody { flex: 1; overflow-y: auto; padding: 16px; }
.vbody pre { white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.7; color: var(--txt2); font-family: "SF Mono", "Consolas", monospace; }
