/* ============================================================
   mail.methane.hu — dark UI
   ============================================================ */
:root {
  --bg: #0b0e13;
  --surface: #11161d;
  --surface-2: #161d26;
  --surface-3: #1b232d;
  --border: #212a34;
  --border-2: #2b3742;
  --text: #e6edf3;
  --text-2: #9aa9b8;
  --text-3: #6b7d8f;
  --accent: #22c55e;
  --accent-2: #16a34a;
  --accent-soft: rgba(34, 197, 94, .14);
  --ok: #3fb950;
  --err: #f85149;
  --radius: 8px;
  --sidebar-w: 248px;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ic {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ic.big { width: 44px; height: 44px; stroke-width: 1.25; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ================= LOGIN ================= */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 420px at 50% -8%, rgba(34,197,94,.10) 0%, transparent 70%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 392px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 34px 32px 28px;
  box-shadow: 0 24px 64px rgba(0,0,0,.55), 0 1px 0 rgba(255,255,255,.03) inset;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.login-brand .brand-mark { width: 34px; height: 34px; border-radius: 9px; }
.login-brand .brand-mark .ic { width: 19px; height: 19px; }
.login-brand span { font-size: 1.06rem; font-weight: 650; letter-spacing: -.015em; }
.login-brand .dim { color: var(--text-2); font-weight: 500; }

.login-card h1 { margin: 0 0 4px; font-size: 1.12rem; letter-spacing: -.015em; }
.login-card .sub { margin: 0 0 22px; color: var(--text-2); font-size: .84rem; }

/* ================= SHELL ================= */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 12px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px 6px;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(160deg, #3ddc7f, #12924a);
  color: #04160c;
  box-shadow: 0 2px 8px rgba(34,197,94,.35);
}
.brand-mark .ic { width: 17px; height: 17px; stroke-width: 1.8; }
.brand-text {
  font-size: .96rem;
  font-weight: 650;
  letter-spacing: -.012em;
}
.brand-text .dim { color: var(--text-2); font-weight: 500; }

.compose-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 40px;
  background: var(--accent);
  color: #04160c;
  border: 0;
  border-radius: var(--radius);
  font: inherit;
  font-size: .875rem;
  font-weight: 600;
  letter-spacing: -.005em;
  cursor: pointer;
  transition: background .14s var(--ease), box-shadow .14s var(--ease);
  box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 12px rgba(34,197,94,.22);
}
.compose-btn:hover { background: var(--accent-2); }
.compose-btn:active { transform: translateY(.5px); }
.compose-btn .ic { width: 16px; height: 16px; stroke-width: 2.1; }

.nav { display: flex; flex-direction: column; gap: 1px; }

.nav-title {
  font-size: .67rem;
  text-transform: uppercase;
  letter-spacing: .085em;
  color: var(--text-3);
  font-weight: 650;
  padding: 8px 10px 5px;
}

.navitem {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  background: none;
  border: 0;
  border-radius: var(--radius);
  color: var(--text-2);
  padding: 0 10px;
  font: inherit;
  font-size: .855rem;
  cursor: pointer;
  text-align: left;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.navitem:hover { background: rgba(255,255,255,.045); color: var(--text); }
.navitem.active {
  background: var(--accent-soft);
  color: #b9f3cd;
  font-weight: 600;
}
.navitem.active .ic { color: var(--accent); }
.navitem .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.navitem .count {
  font-size: .7rem;
  font-weight: 650;
  color: var(--text-3);
  min-width: 18px;
  text-align: right;
}
.navitem .count.on {
  color: var(--accent);
  font-weight: 700;
}
.navitem .count:empty { display: none; }

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.userbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
  min-width: 0;
}
.avatar {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 650;
  font-size: .8rem;
  color: var(--accent);
}
.userinfo { min-width: 0; }
.userinfo .email {
  font-size: .78rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.userinfo .role { font-size: .68rem; color: var(--text-3); }

/* ================= CONTENT ================= */
.content { min-width: 0; display: flex; flex-direction: column; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(11,14,19,.86);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.page-head { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.toolbar h1 {
  margin: 0;
  font-size: .98rem;
  font-weight: 650;
  letter-spacing: -.014em;
  line-height: 1.25;
}
.page-sub {
  margin: 0;
  font-size: .735rem;
  color: var(--text-3);
  line-height: 1.3;
  min-height: 1em;
}
.toolbar .spacer { flex: 1; }

.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-2);
  cursor: pointer;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.iconbtn:hover { background: rgba(255,255,255,.06); color: var(--text); }
.iconbtn .ic { width: 16px; height: 16px; }

.content-inner {
  padding: 16px 24px 40px;
  width: 100%;
}

.listinfo {
  font-size: .74rem;
  color: var(--text-3);
  padding: 0 2px 8px;
  letter-spacing: .01em;
}

/* ================= LIST ================= */
.maillist {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.maillist .pad { padding: 26px 4px; font-size: .85rem; }

.mailrow {
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .1s var(--ease);
}
.mailrow:hover { background: var(--surface-2); }
.mailrow td { padding: 0 8px; height: 54px; vertical-align: middle; overflow: hidden; }

.cellstar { width: 34px; padding-left: 0 !important; padding-right: 0 !important; }
.star {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: none;
  border: 0;
  border-radius: 6px;
  color: #3d4c5a;
  cursor: pointer;
  transition: color .12s var(--ease), background .12s var(--ease);
}
.star .ic { width: 16px; height: 16px; stroke-width: 1.6; }
.star:hover { color: var(--accent); background: rgba(255,255,255,.06); }
.star.on { color: #f5b942; }
.star.on .ic { fill: currentColor; }

.btn.on { color: #f5b942 !important; border-color: rgba(245,185,66,.45) !important; }
.btn.on .ic { fill: currentColor; }

.dotcell { width: 18px; padding-left: 0 !important; padding-right: 0 !important; }
.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.fromcell {
  width: 196px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: .845rem;
  color: var(--text-2);
  letter-spacing: -.003em;
}

.subjcell {
  font-size: .845rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -.003em;
}
.subjcell .subj { color: #a9bac9; }
.subjcell .snip { color: var(--text-3); }

.datecell {
  width: 92px;
  text-align: right;
  font-size: .74rem;
  color: var(--text-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.mailrow.unread { background: rgba(34,197,94,.04); }
.mailrow.unread:hover { background: var(--surface-2); }
.mailrow.unread .fromcell { color: var(--text); font-weight: 650; }
.mailrow.unread .subjcell .subj { color: #eef4fa; font-weight: 600; }
.mailrow.unread .subjcell .snip { color: var(--text-2); }
.mailrow.unread .datecell { color: var(--text-2); }

/* ================= EMPTY ================= */
.empty { padding: 0 !important; }
.empty-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 72px 20px;
  color: var(--text-3);
  text-align: center;
}
.empty-inner .ic.big { color: #2c3a48; margin-bottom: 6px; }
.empty-title { font-size: .9rem; font-weight: 600; color: var(--text-2); }
.empty-sub { font-size: .8rem; }

/* ================= DETAIL ================= */
.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.msg-subject {
  margin: 0 0 14px;
  font-size: 1.32rem;
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: -.022em;
}

.msg-meta {
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 22px;
  display: grid;
  gap: 5px;
  font-size: .8rem;
}
.meta-row { display: flex; gap: 8px; min-width: 0; }
.meta-key {
  flex: 0 0 68px;
  color: var(--text-3);
  font-weight: 550;
}
.meta-val { color: var(--text-2); word-break: break-word; }

.msg-body {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  font-family: inherit;
  font-size: .885rem;
  line-height: 1.72;
  color: #d5e0ea;
}

.msg-html {
  width: 100%;
  min-height: 460px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.msg-attach { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.attach {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-size: .8rem;
  color: var(--text);
  transition: border-color .12s var(--ease), background .12s var(--ease);
}
.attach:hover { border-color: var(--border-2); background: var(--surface-3); text-decoration: none; }
.attach .ic { width: 15px; height: 15px; color: var(--text-3); }
.attach-size { color: var(--text-3); font-size: .74rem; }

/* ================= OLDAL / SZEKCIÓ HIERARCHIA ================= */
.page-intro { margin-bottom: 26px; max-width: 72ch; }
.page-title {
  margin: 0 0 5px;
  font-size: 1.22rem;
  font-weight: 650;
  letter-spacing: -.022em;
  line-height: 1.25;
}
.page-desc {
  margin: 0;
  color: var(--text-3);
  font-size: .82rem;
  line-height: 1.55;
}
.page-desc strong { color: var(--text-2); font-weight: 600; }

.section {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  margin-top: 24px;
}
.section:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }

.section-head { margin-bottom: 16px; max-width: 72ch; }
.section-head h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 4px;
  font-size: .88rem;
  font-weight: 650;
  letter-spacing: -.005em;
}
.section-head p {
  margin: 0;
  font-size: .78rem;
  color: var(--text-3);
  line-height: 1.5;
}

.count-pill {
  display: inline-block;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 999px;
  padding: 0 8px;
  font-size: .68rem;
  font-weight: 650;
  line-height: 1.6;
}

.form-grid { max-width: 620px; }
.form-narrow { max-width: 400px; }

/* ================= ADATTÁBLA ================= */
.datatable { width: 100%; border-collapse: collapse; font-size: .85rem; }
.datatable th {
  text-align: left;
  font-size: .69rem;
  text-transform: uppercase;
  letter-spacing: .085em;
  color: var(--text-3);
  font-weight: 700;
  padding: 0 10px 9px;
  border-bottom: 1px solid var(--border);
}
.datatable td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.datatable tr:last-child td { border-bottom: 0; }
.datatable tbody tr:hover { background: rgba(255,255,255,.02); }
.datatable .right { text-align: right; }

.role-tag {
  display: inline-block;
  font-size: .69rem;
  font-weight: 650;
  padding: 2px 9px;
  border-radius: 999px;
  letter-spacing: .01em;
}
.role-tag.admin {
  background: rgba(34,197,94,.13);
  border: 1px solid rgba(34,197,94,.38);
  color: #86e8a6;
}
.role-tag.user {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  color: var(--text-3);
}

/* ================= CARDS / FORMS ================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px;
  max-width: 620px;
}
.card + .card { margin-top: 16px; }

h2 { margin: 0 0 4px; font-size: .98rem; font-weight: 650; letter-spacing: -.012em; }
.hint { color: var(--text-3); font-size: .8rem; margin: 0 0 18px; }

.field { margin-bottom: 14px; }
label { display: block; font-size: .76rem; color: var(--text-2); margin-bottom: 6px; font-weight: 550; }

input, select, textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 11px;
  font: inherit;
  font-size: .85rem;
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease);
}
textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34,197,94,.16);
}
input::placeholder, textarea::placeholder { color: #4e5f70; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7d8f' stroke-width='2.4' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 32px;
}

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  background: var(--accent);
  color: #04160c;
  border: 0;
  border-radius: var(--radius);
  padding: 0 16px;
  font: inherit;
  font-size: .845rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s var(--ease), opacity .14s var(--ease);
}
.btn:hover:not(:disabled) { background: var(--accent-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .ic { width: 15px; height: 15px; }

.btn.ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
  font-weight: 550;
}
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); border-color: var(--border-2); }
.btn.ghost.danger:hover:not(:disabled) { color: #ff9d97; border-color: rgba(248,81,73,.5); background: rgba(248,81,73,.08); }

.btn.sm { height: 30px; padding: 0 12px; font-size: .79rem; gap: 6px; }
.btn.sm .ic { width: 14px; height: 14px; }
.btn.block { width: 100%; }

/* ================= ALERTS ================= */
.msg {
  border-radius: var(--radius);
  padding: 9px 13px;
  font-size: .81rem;
  margin-bottom: 14px;
  border: 1px solid transparent;
  display: none;
}
.msg.show { display: block; }
.msg.ok { background: rgba(63,185,80,.1); border-color: rgba(63,185,80,.32); color: #7ee787; }
.msg.err { background: rgba(248,81,73,.1); border-color: rgba(248,81,73,.32); color: #ff9d97; }

/* ================= TABLES ================= */
.plainlist { width: 100%; border-collapse: collapse; font-size: .845rem; }
.plainlist td { padding: 11px 4px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.plainlist tr:last-child td { border-bottom: 0; }
.plainlist .right { text-align: right; }

.mono { font-family: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace; font-size: .82rem; }
.muted { color: var(--text-3); }
.note { font-size: .76rem; }
.hidden { display: none !important; }

footer.foot {
  text-align: center;
  color: #3f4e5d;
  font-size: .71rem;
  letter-spacing: .015em;
  padding: 36px 0 6px;
}

/* ================= COMPOSE ================= */
.compose-panel {
  position: fixed;
  right: 24px;
  bottom: 0;
  width: 550px;
  max-width: calc(100vw - 24px);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -12px 48px rgba(0,0,0,.65);
  z-index: 100;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
}

.compose-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  padding: 0 8px 0 18px;
  background: var(--surface-3);
  border-bottom: 1px solid var(--border);
  border-radius: 12px 12px 0 0;
  font-size: .845rem;
  font-weight: 650;
  letter-spacing: -.01em;
}

.compose-body { padding: 14px 18px 14px; overflow-y: auto; }

.compose-field {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  padding: 6px 0;
}
.compose-field label {
  margin: 0;
  flex: 0 0 58px;
  font-size: .77rem;
  color: var(--text-3);
}
.compose-field input, .compose-field select {
  border: 0;
  background: transparent;
  padding: 4px 0;
  font-size: .855rem;
  border-radius: 0;
}
.compose-field input:focus, .compose-field select:focus { box-shadow: none; }

.compose-body textarea {
  border: 0;
  background: transparent;
  padding: 12px 0;
  min-height: 200px;
  font-size: .855rem;
  border-radius: 0;
}
.compose-body textarea:focus { box-shadow: none; }

.compose-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ================= MODAL ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 7, 11, .68);
  backdrop-filter: blur(3px);
}
.modal {
  width: 100%;
  max-width: 392px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
  display: flex;
  flex-direction: column;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 8px 12px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: .88rem; font-weight: 650; letter-spacing: -.01em; }
.modal-body { padding: 18px; }
.modal-sub {
  margin: 0 0 14px;
  font-size: .78rem;
  color: var(--text-3);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  word-break: break-all;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 18px 18px;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    gap: 10px;
    padding: 12px;
  }
  .brand { display: none; }
  .compose-btn { height: 38px; }

  #folderNav { flex-direction: row; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
  #folderNav .nav-title { display: none; }
  #folderNav .navitem {
    width: auto;
    height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    white-space: nowrap;
    font-size: .8rem;
  }
  #folderNav .navitem.active { background: var(--accent-soft); border-color: rgba(34,197,94,.45); }

  .sidebar-foot { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
  .sidebar-foot .nav { flex-direction: row; gap: 6px; }
  .sidebar-foot .navitem {
    width: auto;
    height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: .8rem;
  }
  .userbox { margin-left: auto; order: 3; }
  .sidebar-foot form { order: 2; }
  .btn.block { width: auto; height: 32px; padding: 0 12px; font-size: .8rem; }

  .toolbar { padding: 0 16px; height: 50px; }
  .content-inner { padding: 12px 16px 36px; }

  .fromcell { width: 116px; }
  .datecell { width: 68px; }
  .mailrow td { height: 50px; padding: 0 6px; }
  .cellstar { width: 28px; }

  .compose-panel { right: 0; left: 0; width: auto; max-width: 100vw; }
  .row { grid-template-columns: 1fr; }
  .card { max-width: none; }
  .meta-key { flex-basis: 60px; }
}
