/* SR Astrostar Content Studio — admin theme (cream / gold / plum). */
:root {
  --cream: #fbf1e2;
  --cream-2: #f6e6cf;
  --card: #fffdf9;
  --gold: #c88a2e;
  --gold-dp: #a06a1c;
  --gold-lt: #e6b357;
  --plum: #4a1f3a;
  --plum-2: #3a1730;
  --ink: #3a241a;
  --muted: #8a6a4a;
  --line: rgba(200, 138, 46, 0.28);
  --danger: #b3341f;
  --ok: #2e7d4f;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(120, 80, 20, 0.12);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--cream); color: var(--ink); font-size: 15px; }
.muted { color: var(--muted); }
.error { color: var(--danger); font-size: 0.9rem; }
[hidden] { display: none !important; }
a { color: var(--gold-dp); }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.55rem 1.1rem; border-radius: 40px;
  border: 1px solid transparent; font-weight: 600; font-size: 0.9rem; cursor: pointer; background: #eee; color: var(--ink);
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s; }
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: linear-gradient(180deg, #f2c568, #c1861f); color: #3a230a; box-shadow: 0 8px 20px rgba(176,120,30,0.3); }
.btn.subtle { background: transparent; border-color: var(--line); color: var(--gold-dp); }
.btn.subtle:hover { background: rgba(200,138,46,0.1); }
.btn.danger { color: var(--danger); border-color: rgba(179,52,31,0.35); background: transparent; }
.btn.danger:hover { background: rgba(179,52,31,0.08); }
.btn.small { padding: 0.35rem 0.75rem; font-size: 0.82rem; }
.icon-btn { border: none; background: none; font-size: 1.4rem; cursor: pointer; color: var(--muted); line-height: 1; }

/* ---- login ---- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem;
  background: radial-gradient(120% 80% at 50% 0%, #fdf5e8, #f4e0c4); }
.login-card { background: var(--card); padding: 2.4rem; border-radius: 18px; box-shadow: var(--shadow);
  width: min(400px, 92vw); display: grid; gap: 0.9rem; text-align: center; border: 1px solid var(--line); }
.login-logo { margin: 0 auto; }
.login-card h1 { margin: 0; font-size: 1.6rem; color: var(--plum); }
.login-card label { text-align: left; display: grid; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.login-card input { padding: 0.7rem 0.9rem; border: 1px solid var(--line); border-radius: 10px; font-size: 1rem; }
.login-card .btn { justify-content: center; margin-top: 0.4rem; }

/* ---- app layout ---- */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, var(--plum), var(--plum-2)); color: rgba(255,244,232,0.85);
  display: flex; flex-direction: column; padding: 1.2rem 0.9rem; }
.brand { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0.6rem 1.2rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { color: #fff; font-size: 1.05rem; }
.brand-text .muted { color: var(--gold-lt); font-size: 0.72rem; }
.nav { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; }
.nav button { display: flex; align-items: center; gap: 0.6rem; text-align: left; padding: 0.6rem 0.7rem; border-radius: 9px;
  border: none; background: none; color: rgba(255,244,232,0.8); cursor: pointer; font-size: 0.92rem; }
.nav button:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav button.on { background: rgba(230,179,87,0.16); color: #fff; font-weight: 600; }
.sidebar-foot { border-top: 1px solid rgba(230,180,90,0.2); padding-top: 0.9rem; display: grid; gap: 0.5rem; }
.sidebar-foot .muted { color: rgba(255,244,232,0.55); font-size: 0.8rem; }
.sidebar-foot .btn.subtle { color: var(--gold-lt); border-color: rgba(230,180,90,0.3); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.6rem; border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 5; }
.topbar-title h2 { margin: 0; font-size: 1.3rem; color: var(--plum); }
.topbar-actions { display: flex; gap: 0.6rem; align-items: center; }
.view { padding: 1.6rem; }

/* ---- list ---- */
.list { display: grid; gap: 0.6rem; }
.list-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 0.9rem; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.7rem 0.9rem; cursor: pointer; }
.list-row:hover { border-color: var(--gold); }
.list-thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--cream-2); }
.list-thumb.ph { display: grid; place-items: center; color: var(--muted); font-size: 0.7rem; }
.list-main strong { display: block; color: var(--plum); }
.list-main .muted { font-size: 0.82rem; }
.badge { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.2rem 0.55rem; border-radius: 40px; }
.badge.published { background: rgba(46,125,79,0.14); color: var(--ok); }
.badge.draft { background: rgba(200,138,46,0.16); color: var(--gold-dp); }
.list-actions { display: flex; gap: 0.4rem; }
.empty { text-align: center; color: var(--muted); padding: 3rem; }

/* ---- form ---- */
.form { max-width: 760px; display: grid; gap: 1.1rem; }
.field { display: grid; gap: 0.35rem; }
.field > label { font-weight: 600; font-size: 0.85rem; color: var(--ink); }
.field .hint { font-size: 0.78rem; color: var(--muted); }
.field input[type=text], .field input[type=email], .field input[type=number], .field input[type=date],
.field input[type=datetime-local], .field select, .field textarea {
  width: 100%; padding: 0.6rem 0.8rem; border: 1px solid var(--line); border-radius: 10px; font-size: 0.95rem; background: #fff; font-family: inherit; }
.field textarea { min-height: 90px; resize: vertical; }
.field.check { grid-template-columns: auto 1fr; align-items: center; gap: 0.6rem; }
.field.check input { width: 18px; height: 18px; }
.field.check > label { order: 2; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }

/* media field */
.media-field { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.media-thumb { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--cream-2); }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-thumb .rm { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,0.55); color: #fff; border: none; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; font-size: 0.9rem; line-height: 1; }
.media-add { width: 84px; height: 84px; border: 1.5px dashed var(--gold); border-radius: 10px; background: rgba(200,138,46,0.06); color: var(--gold-dp); cursor: pointer; font-size: 0.8rem; }

/* ---- dialog / picker ---- */
.dialog { border: none; border-radius: 16px; padding: 1.4rem; box-shadow: 0 30px 80px rgba(60,20,40,0.35); max-width: 92vw; }
.dialog.wide { width: 820px; }
.dialog::backdrop { background: rgba(40,15,30,0.5); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.8rem; }
.dialog-head h3 { margin: 0; color: var(--plum); }
.upload { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 1rem; }
.upload input { display: none; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.6rem; max-height: 56vh; overflow: auto; }
.pick { border: 2px solid transparent; border-radius: 10px; overflow: hidden; cursor: pointer; aspect-ratio: 1; background: var(--cream-2); }
.pick img { width: 100%; height: 100%; object-fit: cover; }
.pick:hover { border-color: var(--gold); }

/* ---- toasts ---- */
.toasts { position: fixed; bottom: 1.2rem; right: 1.2rem; display: grid; gap: 0.5rem; z-index: 100; }
.toast { background: var(--plum); color: #fff; padding: 0.7rem 1.1rem; border-radius: 10px; box-shadow: var(--shadow); font-size: 0.9rem; animation: tin 0.2s; }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .two { grid-template-columns: 1fr; }
}

/* ============================ Webmail ============================ */
.nav-mail { margin-top: 0.4rem; border-top: 1px solid rgba(230,180,90,0.16); }
.mail-toolbar { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 1rem; flex-wrap: wrap; }
.mail-acct { padding: 0.5rem 0.7rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 0.9rem; min-width: 220px; }
.mail-tabs { display: flex; gap: 0.2rem; background: var(--cream-2); border-radius: 40px; padding: 0.2rem; }
.mail-tab { border: none; background: none; padding: 0.4rem 0.9rem; border-radius: 40px; cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.mail-tab.on { background: #fff; color: var(--plum); box-shadow: 0 2px 6px rgba(120,80,20,0.12); }
.mail-toolbar .btn.primary { margin-left: auto; }

.mail-layout { display: grid; grid-template-columns: 200px 320px 1fr; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; min-height: 60vh; background: var(--card); }
.mail-folders { border-right: 1px solid var(--line); padding: 0.6rem; display: flex; flex-direction: column; gap: 0.15rem; background: #fffdf9; }
.mail-folder { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; border: none; background: none; text-align: left; padding: 0.5rem 0.6rem; border-radius: 8px; cursor: pointer; font-size: 0.9rem; color: var(--ink); }
.mail-folder:hover { background: rgba(200,138,46,0.08); }
.mail-folder.on { background: rgba(230,179,87,0.18); color: var(--plum); font-weight: 600; }
.mail-unread { background: var(--gold); color: #fff; border-radius: 40px; font-size: 0.7rem; padding: 0.05rem 0.45rem; font-weight: 700; }

.mail-listcol { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.mail-search { display: flex; gap: 0.4rem; padding: 0.6rem; border-bottom: 1px solid var(--line); }
.mail-search input { flex: 1; padding: 0.45rem 0.7rem; border: 1px solid var(--line); border-radius: 8px; font-size: 0.85rem; }
.mail-list { overflow-y: auto; flex: 1; }
.mail-row { padding: 0.6rem 0.8rem; border-bottom: 1px solid rgba(200,138,46,0.14); cursor: pointer; }
.mail-row:hover { background: rgba(200,138,46,0.06); }
.mail-row.sel { background: rgba(230,179,87,0.16); }
.mail-row.unseen .mail-from, .mail-row.unseen .mail-row-sub { font-weight: 700; color: var(--plum); }
.mail-row-top { display: flex; justify-content: space-between; gap: 0.5rem; }
.mail-from { font-size: 0.88rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-date { font-size: 0.75rem; color: var(--muted); flex-shrink: 0; }
.mail-row-sub { font-size: 0.85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 0.15rem; }
.mail-star { color: var(--gold-dp); }
.mail-pager { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0.7rem; border-top: 1px solid var(--line); }

.mail-reader { padding: 1.1rem 1.3rem; overflow-y: auto; min-width: 0; display: flex; flex-direction: column; }
.mail-read-head h3 { margin: 0 0 0.5rem; color: var(--plum); }
.mail-addr { font-size: 0.85rem; margin: 0.1rem 0; }
.mail-read-meta { font-size: 0.78rem; color: var(--muted); margin-top: 0.3rem; }
.mail-read-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.9rem 0; padding-bottom: 0.9rem; border-bottom: 1px solid var(--line); }
.mail-atts { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.8rem; }
.mail-att { display: inline-flex; align-items: center; gap: 0.3rem; background: var(--cream-2); border-radius: 40px; padding: 0.25rem 0.7rem; font-size: 0.8rem; color: var(--gold-dp); text-decoration: none; }
.mail-att .rm { border: none; background: none; cursor: pointer; color: var(--danger); font-size: 1rem; }
.mail-frame { width: 100%; flex: 1; min-height: 340px; border: none; background: #fff; }
.mail-text { white-space: pre-wrap; word-wrap: break-word; font-family: inherit; font-size: 0.92rem; color: var(--ink); line-height: 1.55; }

/* compose */
.mail-compose .field { margin-bottom: 0.6rem; }
.mail-compose textarea { font-family: inherit; }
.mail-compose-actions { display: flex; gap: 0.6rem; align-items: center; margin-top: 0.8rem; }
.mail-compose-actions .btn.primary { margin-left: auto; }
.mail-attrow { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }

/* accounts + settings */
.mail-admin { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
.mail-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.mail-card h3 { margin: 0 0 0.8rem; color: var(--plum); }
.mail-card h4 { margin: 1rem 0 0.5rem; color: var(--ink); }
.mail-acct-row { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.55rem 0; border-bottom: 1px solid rgba(200,138,46,0.14); flex-wrap: wrap; }
.mail-acct-row .badge { margin-left: 0.5rem; }
.mail-acct-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.mail-newbox { margin-top: 0.6rem; display: grid; gap: 0.5rem; }
.mail-newbox input { padding: 0.5rem 0.7rem; border: 1px solid var(--line); border-radius: 8px; font-size: 0.9rem; }
.mail-inline { display: flex; align-items: center; gap: 0.4rem; }
.mail-inline input { flex: 1; }
.mail-check { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; margin-bottom: 0.6rem; }

@media (max-width: 900px) {
  .mail-layout { grid-template-columns: 1fr; min-height: 0; }
  .mail-folders { flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 1px solid var(--line); }
  .mail-listcol { border-right: none; border-bottom: 1px solid var(--line); max-height: 40vh; }
  .mail-admin { grid-template-columns: 1fr; }
}
