/* Caisse Mahali Webmail — luxe Moroccan theme (matches the landing). */
:root {
  --primary:#8B6F47; --primary-d:#6B5436;
  --gold:#C9A45F;    --gold-d:#A8843F;
  --cream:#F7F1E5;   --ink:#2B2218;   --muted:#7A6B5A;
  --border:#E8DFD0;  --danger:#B23A3A;
  --shadow:0 4px 18px rgba(139,111,71,.10);
}
* { box-sizing: border-box; }
html,body { margin:0; padding:0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-d); text-decoration: underline; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }

/* Top bar */
.topbar {
  background: linear-gradient(135deg, var(--primary), var(--primary-d));
  color:#fff; padding: 14px 24px; display:flex; align-items:center; gap: 20px;
  box-shadow: var(--shadow);
}
.topbar .brand { display:flex; align-items:center; gap:10px; color:#fff; font-weight:800; font-size:18px; }
.topbar .brand img { width:32px; height:32px; border-radius:6px; background:var(--cream); padding:3px; }
.topbar .links { margin-left:auto; display:flex; align-items:center; gap:16px; }
.topbar .links a { color:#fff; font-weight:600; opacity:.92; }
.topbar .links a:hover { opacity:1; text-decoration:none; }
.topbar .me { font-size:13px; opacity:.85; padding-left:12px; border-left:1px solid rgba(255,255,255,.25); }

/* Layout */
.wrap { max-width: 1100px; margin: 32px auto; padding: 0 24px; }
.page-title { margin: 0 0 24px; color: var(--primary); font-size: 28px; }
.badge {
  display:inline-block; background:var(--gold); color:#fff;
  padding:2px 10px; border-radius: 999px; font-size:13px; font-weight:700;
  margin-left:8px; vertical-align: middle;
}
.card { background:#fff; border:1px solid var(--border); border-radius:16px;
  padding:24px; margin: 0 0 24px; box-shadow: var(--shadow); }
.card h2 { margin-top:0; color: var(--primary); }

/* Buttons */
.btn-primary, .btn-ghost, .btn-danger {
  display:inline-flex; align-items:center; gap:6px;
  padding: 10px 18px; border-radius: 10px;
  font-weight:600; font-size:14px; cursor:pointer;
  border: 1.5px solid transparent; transition: all .15s;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-d); color:#fff; text-decoration:none; }
.btn-primary.big { font-size: 16px; padding: 14px 28px; }
.btn-ghost { background: transparent; color: var(--primary); border-color: var(--border); }
.btn-ghost:hover { background: var(--cream); }
.btn-danger { background: var(--danger); color:#fff; border-color: var(--danger); }
.btn-danger:hover { background: #8E2828; }
form.inline { display:inline; }

/* Inputs */
input[type=text], input[type=email], input[type=password], textarea {
  width: 100%; padding: 12px 14px;
  background: #fff; color: var(--ink);
  border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 15px; font-family: inherit;
}
input:focus, textarea:focus { outline:none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,164,95,.15); }
label { display:block; margin-bottom: 14px; color: var(--ink); font-weight: 600; font-size: 14px; }
label input, label textarea { margin-top: 6px; }

/* Login */
.login-card { max-width: 440px; margin: 60px auto; background:#fff; padding: 40px;
  border-radius: 20px; box-shadow: var(--shadow); border:1px solid var(--border); text-align:center; }
.login-card h1 { color: var(--primary); margin: 8px 0 4px; font-size:24px; }
.login-card .login-logo { width:72px; height:72px; border-radius:14px; background:var(--cream); padding:8px; }
.login-card form { text-align:left; margin-top: 20px; }
.login-card button { width:100%; justify-content:center; margin-top: 8px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-weight:600; }
.alert.err { background: #FBE6E6; color: var(--danger); border:1px solid #F0C9C9; }
.alert.ok  { background: #E6F4E6; color: #2D5F2D; border:1px solid #C9E5C9; }

/* Mailbox list */
.mlist { list-style: none; padding: 0; margin: 0; background:#fff;
  border:1px solid var(--border); border-radius:16px; overflow:hidden; box-shadow: var(--shadow); }
.mlist li { border-bottom: 1px solid var(--border); }
.mlist li:last-child { border-bottom: none; }
.mlist li a {
  display: grid; grid-template-columns: 220px 1fr 180px; gap: 16px;
  padding: 16px 20px; color: var(--ink); text-decoration: none;
}
.mlist li a:hover { background: var(--cream); }
.mlist li.unread a { background: #FFFAF0; }
.mlist li.unread .from, .mlist li.unread .subj { font-weight:700; color: var(--primary); }
.mlist .from { font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.mlist .subj { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.mlist .date { color: var(--muted); font-size: 13px; text-align:right; }
.empty { text-align:center; padding: 60px 20px; color: var(--muted);
  background:#fff; border:1px dashed var(--border); border-radius: 16px; }

/* Message */
.msg { background:#fff; border:1px solid var(--border); border-radius: 16px; padding: 28px;
  box-shadow: var(--shadow); }
.msg h1 { color: var(--primary); margin-top: 0; }
.msg .meta { padding: 16px 0; border-top:1px solid var(--border); border-bottom: 1px solid var(--border);
  margin-bottom: 20px; color: var(--muted); font-size: 14px; line-height: 1.8; }
.msg .body pre { background: var(--cream); padding: 20px; border-radius: 10px;
  white-space: pre-wrap; word-wrap: break-word; }
.back { display:inline-block; margin-bottom: 16px; }

/* Compose */
.compose .actions { display:flex; gap:12px; justify-content:flex-end; margin-top: 8px; }
textarea { resize: vertical; font-family: inherit; }

/* Accounts table */
.row { display:grid; grid-template-columns: 1.2fr 1.5fr 1.4fr 1.4fr 80px 100px; gap: 10px; align-items: center; }
.row .suffix { color: var(--muted); font-weight: 600; font-size: 14px; }
.check { display:flex; align-items:center; gap:6px; font-weight:500; margin:0; }
table.accounts { width: 100%; border-collapse: collapse; background:#fff; }
table.accounts th, table.accounts td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
table.accounts th { background: var(--cream); color: var(--primary); font-size: 13px; }
table.accounts td.actions { display:flex; gap:8px; align-items: center; }
.pw-edit summary { cursor:pointer; color: var(--primary); font-weight:600; user-select: none; padding: 6px 10px; border-radius: 8px; }
.pw-edit summary:hover { background: var(--cream); }
.pw-edit form { display:flex; gap:8px; margin-top: 8px; }
.pw-edit input { width: 220px; }
