:root {
  --bg: #070a14;
  --bg2: #0e1220;
  --panel: #141a2e;
  --panel2: #1a2138;
  --border: #232c47;
  --text: #e6e9f0;
  --muted: #8a93ab;
  --accent: #3b6fff;
  --accent2: #5aa0ff;
  --danger: #ff5470;
  --ok: #2fd18b;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #10193a 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 860px; margin: 0 auto; padding: 24px 18px 60px; }
.wrap.wide { max-width: 1080px; }

/* Header / brand */
.brand { display: flex; align-items: center; gap: 12px; margin: 28px 0 6px; }
.logo {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), #7a5cff);
  display: grid; place-items: center; font-weight: 800; color: #fff;
  box-shadow: 0 8px 24px rgba(59,111,255,.35);
}
.brand h1 { font-size: 20px; margin: 0; letter-spacing: .2px; }
.brand .dom { color: var(--muted); font-size: 13px; }

/* Hero search */
.hero { text-align: center; padding: 8vh 0 4vh; }
.hero .logo { width: 62px; height: 62px; border-radius: 18px; font-size: 26px; margin: 0 auto 22px; }
.hero h1 { font-size: 30px; margin: 0 0 8px; font-weight: 700; }
.hero p { color: var(--muted); margin: 0 0 30px; font-size: 15px; }
.searchbar {
  display: flex; gap: 10px; max-width: 560px; margin: 0 auto;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 8px 8px 18px;
  box-shadow: 0 20px 50px rgba(0,0,0,.45);
}
.searchbar input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 16px;
}
.searchbar .suffix { color: var(--muted); align-self: center; font-size: 15px; }
.btn {
  border: none; cursor: pointer; font-weight: 600; font-size: 14px;
  padding: 11px 20px; border-radius: 999px; color: #fff;
  background: linear-gradient(135deg, var(--accent), #6b53ff);
  transition: transform .08s ease, box-shadow .2s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(59,111,255,.4); }
.btn.sq { border-radius: 10px; }
.btn.ghost { background: var(--panel2); border: 1px solid var(--border); }
.btn.danger { background: linear-gradient(135deg, #ff4d6a, #d43a6b); }
.btn.sm { padding: 7px 13px; font-size: 13px; }

/* Panels / lists */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 14px; flex-wrap: wrap; }
.addr-pill { background: var(--panel2); border: 1px solid var(--border); border-radius: 999px; padding: 7px 14px; font-size: 14px; }
.addr-pill b { color: var(--accent2); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: none; }
.mrow { display: flex; align-items: center; gap: 14px; padding: 14px 12px; border-radius: 10px; }
.mrow:hover { background: var(--panel2); }
.mrow .from { width: 210px; min-width: 120px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow .subj { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow .subj .snip { color: var(--muted); font-weight: 400; }
.mrow .when { color: var(--muted); font-size: 13px; white-space: nowrap; }

.empty { text-align: center; color: var(--muted); padding: 48px 20px; }
.empty .big { font-size: 40px; margin-bottom: 10px; opacity: .6; }

/* Message view */
.msg-head { border-bottom: 1px solid var(--border); padding-bottom: 14px; margin-bottom: 10px; }
.msg-head h2 { margin: 0 0 8px; font-size: 20px; }
.msg-meta { color: var(--muted); font-size: 14px; line-height: 1.7; }
.msg-meta b { color: var(--text); font-weight: 600; }
iframe.body {
  width: 100%; min-height: 60vh; border: none; border-radius: 10px;
  background: var(--bg2); margin-top: 12px;
}

/* Flash */
.flash { background: rgba(255,84,112,.12); border: 1px solid rgba(255,84,112,.4); color: #ffb3c0; padding: 11px 15px; border-radius: 10px; margin: 14px 0; font-size: 14px; }

/* Admin */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 18px 0; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat .n { font-size: 26px; font-weight: 800; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 4px; }
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th, table.tbl td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
table.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
table.tbl tr:hover td { background: var(--panel2); }
.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.tag.lock { color: #ffcf5a; border-color: rgba(255,207,90,.4); background: rgba(255,207,90,.1); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.topbar .l { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.inline { display: inline; }

/* Auth / lock cards */
.card-center { max-width: 400px; margin: 12vh auto 0; }
.field { margin: 12px 0; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  background: var(--bg2); border: 1px solid var(--border); color: var(--text);
  font-size: 15px; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 40px; }
.lockbox { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.lockbox .field { margin: 0; flex: 1; min-width: 160px; }
hr.sep { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

/* Attachments */
.atts { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.atts h4 { margin: 0 0 12px; font-size: 14px; color: var(--muted); font-weight: 600; }
.att-img { max-width: 240px; max-height: 240px; border-radius: 10px; border: 1px solid var(--border); margin: 0 8px 8px 0; vertical-align: top; }
.att-file { display: inline-flex; align-items: center; gap: 6px; background: var(--panel2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin: 0 8px 8px 0; font-size: 14px; }
.att-file .sz { color: var(--muted); font-size: 12px; }
