/* Панель почты Nexxe — тёмная тема с медью, как знак Nexxe */
/* Палитры: светлые (Небо — основная, Рассвет, Мята, Лаванда) и тёмные (Чёрно-оранжевая, Красно-оранжевая, Медь).
   Тема — атрибут data-theme на <html>, выбор хранится в браузере (theme.js). */
:root, [data-theme="sky"] {
  --bg: #f3f8fd; --glow: #dcecfb; --bg2: #ffffff; --card: #ffffff; --card2: #f5f9fd; --line: #dfe8f1; --line2: #cfdbe7;
  --txt: #1d2a37; --mut: #6a7b8c; --a1: #5bb4f2; --a2: #2f8fdc; --a3: #1f6fb8; --on: #ffffff;
  --ok: #2e9e63; --bad: #d4483b; --warn: #c98a12; --shade: 0 1px 2px rgba(30,60,90,.06); --top: rgba(243,248,253,.85); --ring: rgba(47,143,220,.18); --r: 16px;
}
[data-theme="dawn"] {
  --bg: #fff7f0; --glow: #ffe6d2; --bg2: #ffffff; --card: #ffffff; --card2: #fff6ee; --line: #f1e3d6; --line2: #e8d3c0;
  --txt: #33241a; --mut: #8a7464; --a1: #ffad5c; --a2: #f2832e; --a3: #d2651a; --on: #ffffff;
  --shade: 0 1px 2px rgba(120,70,30,.06); --top: rgba(255,247,240,.85); --ring: rgba(242,131,46,.18);
}
[data-theme="mint"] {
  --bg: #f1faf5; --glow: #d6f2e3; --bg2: #ffffff; --card: #ffffff; --card2: #f2faf6; --line: #dceee4; --line2: #c9e3d5;
  --txt: #1b2e25; --mut: #678378; --a1: #4fd1a1; --a2: #22ad7c; --a3: #138a60; --on: #ffffff;
  --shade: 0 1px 2px rgba(30,90,60,.06); --top: rgba(241,250,245,.85); --ring: rgba(34,173,124,.18);
}
[data-theme="lavender"] {
  --bg: #f7f5fd; --glow: #e8e2fb; --bg2: #ffffff; --card: #ffffff; --card2: #f7f4fe; --line: #e6e1f4; --line2: #d7cfee;
  --txt: #2a2340; --mut: #7a7194; --a1: #a594f5; --a2: #7c68e6; --a3: #5d49c7; --on: #ffffff;
  --shade: 0 1px 2px rgba(60,40,120,.06); --top: rgba(247,245,253,.85); --ring: rgba(124,104,230,.18);
}
[data-theme="ember"] {
  --bg: #0f0f0f; --glow: #2a1606; --bg2: #151515; --card: #181818; --card2: #1f1f1f; --line: #2b2b2b; --line2: #3a3a3a;
  --txt: #f2efeb; --mut: #9a948d; --a1: #ffb35c; --a2: #ff8a1f; --a3: #d96a00; --on: #1a0e02;
  --ok: #6cc28a; --bad: #ff6b5b; --shade: none; --top: rgba(15,15,15,.85); --ring: rgba(255,138,31,.22);
}
[data-theme="flame"] {
  --bg: #170d0b; --glow: #3a120a; --bg2: #1d1210; --card: #211512; --card2: #2a1a16; --line: #3a2620; --line2: #4a3129;
  --txt: #f6ece6; --mut: #a8918a; --a1: #ffa04a; --a2: #f2602f; --a3: #cf3a22; --on: #ffffff;
  --ok: #6cc28a; --bad: #ff7a6b; --shade: none; --top: rgba(23,13,11,.85); --ring: rgba(242,96,47,.24);
}
[data-theme="copper"] {
  --bg: #0d0c0b; --glow: #2b1c12; --bg2: #121110; --card: #171513; --card2: #1d1a17; --line: #2b2723; --line2: #3a342e;
  --txt: #ece6df; --mut: #958c82; --a1: #eeb27f; --a2: #c97d45; --a3: #9e5428; --on: #1a0f08;
  --ok: #6cc28a; --bad: #e0675b; --shade: none; --top: rgba(13,12,11,.85); --ring: rgba(201,125,69,.2);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(1100px 650px at 50% -12%, var(--glow) 0%, var(--bg) 62%) fixed, var(--bg);
  color: var(--txt); font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--a1); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 650; }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.muted { color: var(--mut); }
.small { font-size: 13px; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.logo { display: block; }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; transform: scale(.96); } }
@keyframes float { 50% { transform: translateY(-5px); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- вход ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 400px; padding: 38px 28px 30px; border-radius: 22px; animation: rise .45s ease both;
  background: var(--card);
  border: 1px solid var(--line); box-shadow: var(--shade);
}
.auth-card .logo { margin: 0 auto 14px;  animation: float 6s ease-in-out infinite; }
.brand { text-align: center; letter-spacing: .34em; font-weight: 700; font-size: 18px; margin-bottom: 4px;
  background: linear-gradient(90deg, var(--a1), var(--a3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-card .sub { text-align: center; color: var(--mut); margin: 0 0 24px; font-size: 14px; }
.auth-foot { margin-top: 22px; color: var(--mut); font-size: 12.5px; text-align: center; }

/* ---------- поля и кнопки ---------- */
label { display: block; font-size: 13px; color: var(--mut); margin: 0 0 6px; }
.field { margin-bottom: 14px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], input[type=number], textarea, select {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line2); outline: none;
  background: var(--bg2); color: var(--txt); font: inherit; transition: border-color .15s, box-shadow .15s;
}
input:focus { border-color: var(--a2); box-shadow: 0 0 0 3px var(--ring); }
input.code { text-align: center; letter-spacing: .5em; font-size: 22px; font-weight: 600; padding: 12px 6px 12px 18px; }
.pw { position: relative; }
.pw input { padding-right: 46px; }
.pw button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--mut); cursor: pointer; padding: 6px 8px; font-size: 13px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 12px;
  border: 1px solid var(--line2); background: var(--card2); color: var(--txt); font: inherit; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s; white-space: nowrap;
}
.btn:hover { border-color: var(--a2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: linear-gradient(180deg, var(--a2), var(--a3)); border-color: transparent; color: var(--on); }
.btn.primary:hover { background: linear-gradient(180deg, var(--a1), var(--a2)); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.err { color: var(--bad); font-size: 13.5px; min-height: 20px; margin: 4px 0 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1 1 200px; }

/* ---------- рабочая область ---------- */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 12px 20px;
  background: var(--top); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.top .logo { width: 34px; height: 34px; }
.top .brand { font-size: 14px; margin: 0; }
.top .me { margin-left: auto; color: var(--mut); font-size: 13px; text-align: right; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 18px 16px 60px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 18px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--mut); background: transparent; cursor: pointer; font: inherit; white-space: nowrap; }
.tab:hover { color: var(--txt); }
.tab.on { color: var(--on); background: linear-gradient(180deg, var(--a1), var(--a2)); border-color: transparent; font-weight: 600; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 14px; animation: rise .3s ease both; box-shadow: var(--shade); }
.card h2 { font-size: 17px; margin-bottom: 4px; }
.card .lead { color: var(--mut); font-size: 13.5px; margin: 0 0 14px; }
.list { border-top: 1px solid var(--line); }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.item .main { flex: 1 1 220px; min-width: 0; }
.item .main b { word-break: break-all; }
.item .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line2); color: var(--mut); margin-left: 6px; vertical-align: 1px; }
.badge.cu { color: var(--a2); border-color: var(--a1); }
.badge.ok { color: var(--ok); border-color: rgba(108,194,138,.4); }
.badge.bad { color: var(--bad); border-color: rgba(224,103,91,.4); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.kv { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.kv .k { color: var(--mut); font-size: 12.5px; }
.kv .v { font-weight: 600; word-break: break-all; }
.dns { width: 100%; border-collapse: collapse; font-size: 13px; }
.dns th, .dns td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.dns th { color: var(--mut); font-weight: 500; }
.dns td.val { word-break: break-all; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.log { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; max-height: 60vh; overflow: auto; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-all; color: var(--txt); }
.log .e { color: var(--bad); } .log .o { color: var(--ok); }
.secret { font: 600 18px/1.4 ui-monospace, Consolas, monospace; letter-spacing: .12em; text-align: center; padding: 14px; border-radius: 12px; background: var(--bg2); border: 1px dashed var(--a2); word-break: break-all; user-select: all; }
.steps { margin: 0 0 14px; padding-left: 20px; color: var(--txt); }
.steps li { margin-bottom: 6px; }
.empty { color: var(--mut); text-align: center; padding: 22px 0; }

/* ---------- окно ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(20,30,40,.35); display: grid; place-items: center; padding: 16px; z-index: 20; animation: rise .2s ease both; }
.modal { width: 100%; max-width: 440px; background: var(--card); border: 1px solid var(--line2); border-radius: 18px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.18); }
.modal h3 { font-size: 17px; margin-bottom: 12px; }
.modal .row { justify-content: flex-end; margin-top: 8px; }

#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(30px); opacity: 0; pointer-events: none;
  background: var(--card2); border: 1px solid var(--line2); color: var(--txt); padding: 11px 18px; border-radius: 12px; transition: .25s; z-index: 30; max-width: calc(100% - 32px); }
#toast.on { opacity: 1; transform: translateX(-50%); }
#toast.bad { border-color: var(--bad); }

@media (max-width: 560px) {
  .top { padding: 10px 14px; }
  .top .me .addr { display: none; }
  .card { padding: 15px; }
  .item .acts { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* служебные классы (встроенные стили запрещены правилами безопасности страницы) */
.hide { display: none !important; }
.mt0 { margin-top: 0; } .mt8 { margin-top: 8px; } .mt10 { margin-top: 10px; } .mt14 { margin-top: 14px; }
.center { text-align: center; } .full { grid-column: 1 / -1; } .w220 { max-width: 220px; } .scrollx { overflow-x: auto; }
p.center.mt8, p.center.mt10 { margin-bottom: 0; }

/* выбор палитры */
.themes { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.themes button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line2); cursor: pointer; padding: 0; transition: transform .15s; }
.themes button:hover { transform: scale(1.12); }
.themes button.on { border-color: var(--txt); }
.themes .t-sky { background: linear-gradient(135deg, #e9f4fe 50%, #2f8fdc 50%); }
.themes .t-dawn { background: linear-gradient(135deg, #fff1e4 50%, #f2832e 50%); }
.themes .t-mint { background: linear-gradient(135deg, #e6f7ee 50%, #22ad7c 50%); }
.themes .t-lavender { background: linear-gradient(135deg, #efeafd 50%, #7c68e6 50%); }
.themes .t-ember { background: linear-gradient(135deg, #111 50%, #ff8a1f 50%); }
.themes .t-flame { background: linear-gradient(135deg, #f2602f 50%, #ffa04a 50%); }
.themes .t-copper { background: linear-gradient(135deg, #171513 50%, #c97d45 50%); }
.auth-themes { margin-top: 16px; }
.top .themes { margin-left: auto; }
.top .me { margin-left: 12px; }
@media (max-width: 720px) { .top .themes { display: none; } .top .me { margin-left: auto; } }

/* поля правил: дата, текст, переключатели */
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
input[type=date] { width: auto; min-width: 170px; }
select.btn { padding-right: 28px; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--txt); font-size: 14px; cursor: pointer; margin: 0; }
.check input { width: 18px; height: 18px; accent-color: var(--a2); }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; margin: 0; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line2); transition: background .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.switch input:checked + span { background: var(--a2); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--ring); }
.card h2 .badge { font-weight: 500; }

/* ---------- почта ---------- */
.wrap.wide { max-width: 1500px; }
.mail { display: grid; grid-template-columns: 210px minmax(280px, 380px) 1fr; gap: 12px; height: calc(100vh - 150px); min-height: 460px; }
.mail > * { min-height: 0; }
.mf { display: flex; flex-direction: column; gap: 12px; }
.mfl { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.mfi { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 10px; border: 0; background: transparent; color: var(--txt); font: inherit; cursor: pointer; text-align: left; }
.mfi:hover { background: var(--card2); }
.mfi.on { background: var(--card); box-shadow: inset 3px 0 0 var(--a2); font-weight: 600; }
.mfi b { font-size: 12px; min-width: 22px; text-align: center; padding: 1px 7px; border-radius: 999px; background: var(--a2); color: var(--on); }
.ml, .mr { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shade); }
.mlh { display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); }
.mlh input { padding: 8px 12px; }
.mli { flex: 1; overflow-y: auto; }
.mi { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--txt); font: inherit; padding: 10px 14px; cursor: pointer; }
.mi:hover { background: var(--card2); }
.mi.on { background: var(--card2); box-shadow: inset 3px 0 0 var(--a2); }
.mi .r1 { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.mi .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi .dt { color: var(--mut); font-size: 12px; white-space: nowrap; }
.mi .r2 { color: var(--mut); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.mi.new .who, .mi.new .r2 { font-weight: 700; color: var(--txt); }
.mi.new { box-shadow: inset 3px 0 0 var(--a1); }
.mi .star { color: var(--warn); margin-right: 4px; } .mi .ans { color: var(--a2); margin-right: 4px; }
.mpg { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 8px; border-top: 1px solid var(--line); }
.mpg:empty { display: none; }
.mr { overflow-y: auto; }
.mempty { margin: auto; text-align: center; color: var(--mut); padding: 30px; }
.mempty img { opacity: .55; margin-bottom: 8px; }
.mrt { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); z-index: 1; }
.mrt .sp { flex: 1; }
.mrh { padding: 14px 18px 8px; }
.mrh h2 { font-size: 19px; margin-bottom: 6px; word-break: break-word; }
.matt { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 18px 10px; }
.matt a.btn { text-decoration: none; }
.mimg { padding: 0 18px 8px; }
.mframe { flex: 1; min-height: 60vh; width: 100%; border: 0; border-top: 1px solid var(--line); background: #fff; }
.mtext { padding: 10px 18px 24px; white-space: normal; word-break: break-word; line-height: 1.6; border-top: 1px solid var(--line); }
.mc { display: flex; flex-direction: column; gap: 8px; padding-bottom: 14px; flex: 1; }
.mc > :not(.mrt) { margin-left: 16px; margin-right: 16px; }
.mcf { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 8px; }
.mcf label { margin: 0; }
.mcf input { padding: 9px 12px; }
.mct { flex: 1; min-height: 260px; font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
.mc .row.small { gap: 14px; }
.mback { display: none; }
@media (max-width: 900px) {
  .mail { grid-template-columns: 1fr; height: calc(100vh - 140px); }
  .mail .mf, .mail .ml, .mail .mr { display: none; }
  .mail.show-folders .mf, .mail.show-list .ml, .mail.show-read .mr { display: flex; }
  .mback { display: inline-flex; }
  .wrap.wide { padding-left: 8px; padding-right: 8px; }
}
