/* Prodigy Educations Mail — brand: navy #1e3a63, gold #b7a06a, ink #12161c */

:root {
  --navy: #1e3a63;
  --navy-dark: #16294a;
  --navy-soft: #eaeff6;
  --gold: #b7a06a;
  --gold-soft: #f6f1e4;
  --ink: #12161c;
  --muted: #6b7686;
  --line: #e2e6ec;
  --bg: #f4f6f9;
  --white: #fff;
  --danger: #c0392b;
  --green: #1f9d55;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(18, 22, 28, .06), 0 8px 24px rgba(18, 22, 28, .07);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--navy); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.req { color: var(--danger); }
.hint { color: var(--muted); font-weight: 400; font-size: 11px; }

/* ───────── Buttons ───────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  border: 1px solid transparent; border-radius: 8px; padding: 8px 14px;
  font: 600 13px/1 var(--font); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--navy-dark); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { border-color: var(--navy); color: var(--navy); }
.btn-ghost.danger, .btn.danger { color: var(--danger); }
.btn-ghost.danger:hover { border-color: var(--danger); }
.btn-block { width: 100%; padding: 11px; }
.icon-btn {
  background: none; border: 0; font-size: 17px; cursor: pointer; color: var(--muted);
  padding: 6px 9px; border-radius: 8px; line-height: 1;
}
.icon-btn:hover { background: var(--navy-soft); color: var(--navy); }
.link-btn { background: none; border: 0; color: var(--navy); cursor: pointer; font: 600 12px var(--font); padding: 4px; }
.link-btn:hover { text-decoration: underline; }

/* ───────── Forms ───────── */
label { display: block; font-weight: 600; font-size: 12px; margin: 12px 0 5px; color: #39434f; }
input[type=text], input[type=email], input[type=password], input[type=search],
input[type=number], input:not([type]), select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font: 400 13px var(--font); background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus, .editor:focus {
  outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(30, 58, 99, .12);
}
.form-error { background: #fdeceb; color: #8e2117; border: 1px solid #f3c6c1; padding: 9px 12px; border-radius: 8px; margin-top: 12px; font-size: 13px; }
.form-note { background: var(--navy-soft); border: 1px solid #cddaea; color: var(--navy-dark); padding: 9px 12px; border-radius: 8px; margin-top: 12px; font-size: 13px; }
.form-note.error { background: #fdeceb; border-color: #f3c6c1; color: #8e2117; }
.form-note code { background: #fff; padding: 2px 6px; border-radius: 5px; font-size: 13px; border: 1px solid var(--line); }
.row-actions { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.saved-note { color: var(--green); font-weight: 600; font-size: 12px; }
.radio-set { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px 14px; margin: 14px 0 0; }
.radio-set legend { font-weight: 600; font-size: 12px; color: #39434f; padding: 0 6px; }
.radio-set label { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 13px; margin: 7px 0 0; }
.radio-set input { width: auto; }
.checkbox-cell { display: flex; align-items: flex-end; }
.checkbox-cell label { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 13px; margin: 0 0 9px; }
.checkbox-cell input { width: auto; }

/* ───────── Login ───────── */
.login {
  min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: linear-gradient(160deg, #f4f6f9 0%, #e7ecf4 55%, #f6f1e4 100%);
}
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; padding: 34px 32px 26px; box-shadow: var(--shadow); text-align: center; }
.login-logo { width: 118px; height: auto; }
.login h1 { font-size: 21px; margin: 6px 0 4px; color: var(--navy); letter-spacing: .2px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.login form { text-align: left; }
.login-foot { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

/* ───────── Shell ───────── */
.app { display: flex; flex-direction: column; height: 100%; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 9px 16px;
  background: #fff; border-bottom: 3px solid var(--gold); box-shadow: 0 1px 3px rgba(18,22,28,.05); z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { width: 42px; height: 42px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 14px; color: var(--navy); letter-spacing: .2px; }
.brand-text small { font-size: 10.5px; color: var(--gold); letter-spacing: .5px; }
.topbar-mid { display: flex; align-items: center; gap: 10px; flex: 1; max-width: 640px; }
.mailbox-select { max-width: 260px; font-size: 12.5px; padding: 7px 9px; }
.search-wrap { flex: 1; }
.search-wrap input { padding: 7px 12px; border-radius: 20px; background: var(--bg); }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.avatar-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--gold);
  background: var(--navy); color: #fff; font: 700 12px var(--font); cursor: pointer;
  display: grid; place-items: center; overflow: hidden; padding: 0;
}
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.user-menu { position: relative; }
.dropdown {
  position: absolute; right: 0; top: 46px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); min-width: 236px; padding: 6px; z-index: 40;
}
.dropdown-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.dropdown-head div { font-weight: 700; font-size: 13px; }
.dropdown-head small { display: block; color: var(--muted); font-size: 11.5px; margin: 2px 0 6px; word-break: break-all; }
.dropdown button {
  display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px;
  border-radius: 8px; cursor: pointer; font: 500 13px var(--font); color: var(--ink);
}
.dropdown button:hover { background: var(--navy-soft); }
.dropdown button.danger { color: var(--danger); }
.pill { display: inline-block; background: var(--gold-soft); color: #7a6524; border: 1px solid #e5d9bd; border-radius: 20px; padding: 2px 9px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.pill.ok { background: #e8f6ee; border-color: #bfe4cd; color: #1a6b3c; }
.pill.off { background: #f1f2f4; border-color: #dfe2e7; color: #6b7686; }
.pill.bad { background: #fdeceb; border-color: #f3c6c1; color: #8e2117; }

.body { flex: 1; display: flex; min-height: 0; }

/* ───────── Sidebar ───────── */
.sidebar {
  width: 232px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow-y: auto;
}
.nav-main { padding: 10px 8px; border-bottom: 1px solid var(--line); }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: 0; padding: 9px 12px; border-radius: 8px; cursor: pointer;
  font: 600 13px var(--font); color: #39434f;
}
.nav-item span { color: var(--gold); font-size: 14px; width: 16px; }
.nav-item:hover { background: var(--navy-soft); }
.nav-item.active { background: var(--navy); color: #fff; }
.nav-item.active span { color: var(--gold); }
.folder-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--muted);
}
.folders { list-style: none; margin: 0; padding: 0 8px 10px; }
.folders li button {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: none; border: 0; padding: 8px 12px; border-radius: 8px; cursor: pointer;
  font: 500 13px var(--font); color: #39434f;
}
.folders li button:hover { background: var(--navy-soft); }
.folders li button.active { background: var(--gold-soft); color: var(--navy); font-weight: 700; }
.folders .count { margin-left: auto; background: var(--navy); color: #fff; border-radius: 12px; padding: 1px 7px; font-size: 10.5px; font-weight: 700; }
.sidebar-foot { margin-top: auto; padding: 14px 16px 18px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); line-height: 1.7; }
.sidebar-foot .sf-title { font-weight: 700; color: var(--navy); font-size: 12px; }
.sidebar-foot a { display: block; color: var(--muted); text-decoration: none; word-break: break-all; }
.sidebar-foot a:hover { color: var(--navy); }

/* ───────── Mail view ───────── */
.main { flex: 1; display: flex; min-width: 0; min-height: 0; }
.main.single { display: block; overflow-y: auto; }
.list-pane { width: 380px; flex-shrink: 0; border-right: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; min-height: 0; }
.list-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 13px; }
.message-list { flex: 1; overflow-y: auto; }
.msg {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  border-bottom: 1px solid var(--line); padding: 11px 16px; cursor: pointer;
  border-left: 3px solid transparent;
}
.msg:hover { background: #fafbfc; }
.msg.active { background: var(--navy-soft); border-left-color: var(--navy); }
.msg.unread .msg-from, .msg.unread .msg-subject { font-weight: 700; color: var(--ink); }
.msg-top { display: flex; align-items: baseline; gap: 8px; }
.msg-from { font-size: 13px; color: #39434f; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.msg-date { font-size: 11px; color: var(--muted); white-space: nowrap; }
.msg-subject { font-size: 12.5px; margin-top: 3px; color: #39434f; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-badges { margin-top: 3px; display: flex; gap: 6px; font-size: 11px; color: var(--gold); }
.unread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--navy); flex-shrink: 0; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

.read-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #fff; }
.empty-state { flex: 1; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); }
.empty-state img { width: 110px; opacity: .3; }
.reader { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.reader-head { padding: 18px 22px 12px; border-bottom: 1px solid var(--line); }
.reader-head h2 { margin: 0 0 10px; font-size: 18px; color: var(--navy); line-height: 1.35; }
.reader-meta { font-size: 12.5px; line-height: 1.7; }
.reader-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 22px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.attachments a {
  display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 11px; font-size: 12px; text-decoration: none; color: var(--ink);
}
.attachments a:hover { border-color: var(--navy); }
.mail-frame { flex: 1; width: 100%; border: 0; background: #fff; min-height: 340px; }
.mail-frame.tall { height: 68vh; }

/* ───────── Pages (signature / admin / account) ───────── */
.page { max-width: 1140px; margin: 0 auto; padding: 26px 24px 60px; }
.page.narrow { max-width: 520px; }
.page-head h1 { font-size: 21px; margin: 0 0 6px; color: var(--navy); }
.page-head p { margin: 0 0 20px; color: var(--muted); max-width: 700px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card h2 { font-size: 15px; margin: 0 0 4px; color: var(--navy); }
.card h3 { font-size: 12px; margin: 16px 0 0; color: var(--gold); text-transform: uppercase; letter-spacing: 1px; border-top: 1px solid var(--line); padding-top: 14px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 0 16px; }
.grid-span { grid-column: 1 / -1; }
.grid-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

.dp-row { display: flex; align-items: center; gap: 18px; padding-bottom: 6px; }
.dp-preview { width: 82px; height: 82px; border-radius: 50%; border: 2px solid var(--gold); overflow: hidden; background: var(--navy-soft); flex-shrink: 0; }
.dp-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dp-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dp-actions small { width: 100%; color: var(--muted); font-size: 11px; }

.preview-card { position: sticky; top: 20px; }
.preview-tabs, .tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs { margin-bottom: 20px; }
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 14px;
  cursor: pointer; font: 600 13px var(--font); color: var(--muted);
}
.tab:hover { color: var(--navy); }
.tab.active { color: var(--navy); border-bottom-color: var(--gold); }
.sig-preview { background: #fff; padding: 14px 4px; overflow-x: auto; min-height: 130px; }

.table-wrap { overflow-x: auto; margin-top: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th {
  text-align: left; padding: 9px 10px; border-bottom: 2px solid var(--line);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted);
}
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:hover td { background: #fafbfc; }
.table .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.table .actions button { font-size: 11.5px; padding: 5px 9px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }
.btn-small { padding: 4px 10px; font-size: 12px; }
.db-status { background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 12px 0; }

/* ───────── Modals / compose ───────── */
.modal { position: fixed; inset: 0; background: rgba(18, 22, 28, .5); display: grid; place-items: center; padding: 20px; z-index: 100; }
.modal-card { background: #fff; border-radius: 14px; width: 100%; max-width: 820px; max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--navy); }
.modal-head h2 { margin: 0; font-size: 15px; color: #fff; }
.modal-head .icon-btn { color: rgba(255,255,255,.8); }
.modal-head .icon-btn:hover { background: rgba(255,255,255,.15); color: #fff; }
.compose-body { padding: 16px 20px 18px; overflow-y: auto; display: flex; flex-direction: column; }
.compose-row { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding: 5px 0; }
.compose-row label { width: 62px; margin: 0; flex-shrink: 0; font-size: 12px; color: var(--muted); }
.compose-row input, .compose-row select { border: 0; padding: 7px 2px; flex: 1; border-radius: 0; }
.compose-row input:focus, .compose-row select:focus { box-shadow: none; }
.editor-toolbar { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; padding: 9px 0; border-bottom: 1px solid var(--line); }
.editor-toolbar button { background: none; border: 1px solid transparent; border-radius: 6px; padding: 5px 9px; cursor: pointer; font: 500 12px var(--font); color: #39434f; }
.editor-toolbar button:hover { background: var(--navy-soft); border-color: #cddaea; }
.tb-sep { width: 1px; height: 18px; background: var(--line); margin: 0 5px; }
.tb-note { font-size: 11px; color: var(--muted); }
.editor { min-height: 210px; max-height: 46vh; overflow-y: auto; padding: 14px 4px; font-size: 14px; line-height: 1.65; outline: none; }
.editor:empty::before { content: attr(data-placeholder); color: #aab2bd; }
.quoted-wrap { border-top: 1px solid var(--line); padding-top: 8px; }
.quoted { border-left: 3px solid var(--line); padding: 6px 0 6px 12px; color: var(--muted); font-size: 12.5px; max-height: 220px; overflow-y: auto; margin-top: 8px; }
.quoted img { max-width: 100%; }
.attach-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--line); margin-top: 10px; }
.attach-list { list-style: none; display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 0; }
.attach-list li { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 4px 9px; font-size: 11.5px; display: flex; align-items: center; gap: 7px; }
.attach-list button { background: none; border: 0; cursor: pointer; color: var(--danger); font-size: 13px; padding: 0; }
.compose-actions { display: flex; align-items: center; gap: 10px; padding-top: 16px; margin-top: 6px; border-top: 1px solid var(--line); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 11px 20px; border-radius: 10px;
  font-size: 13px; z-index: 200; box-shadow: var(--shadow); max-width: 90vw;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--green); }

.only-mobile { display: none; }

/* ───────── Responsive ───────── */
@media (max-width: 1080px) {
  .split { grid-template-columns: 1fr; }
  .preview-card { position: static; }
  .list-pane { width: 320px; }
}
@media (max-width: 860px) {
  .only-mobile { display: inline-flex; }
  .brand-text { display: none; }
  .topbar { flex-wrap: wrap; gap: 8px; }
  .topbar-mid { order: 3; width: 100%; max-width: none; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 50; transform: translateX(-100%);
    transition: transform .2s; box-shadow: var(--shadow);
  }
  .sidebar.open { transform: none; }
  .main { flex-direction: column; }
  .list-pane { width: 100%; border-right: 0; }
  .read-pane { display: none; }
  .read-pane.mobile-open { display: flex; position: fixed; inset: 0; z-index: 45; }
  .list-pane { max-height: none; }
}

/* Multi-user picker for shared mailboxes */
.user-picker {
  border: 1px solid var(--line); border-radius: 8px; padding: 4px;
  max-height: 190px; overflow-y: auto; background: #fff;
}
.user-picker label {
  display: flex; align-items: center; gap: 10px; margin: 0;
  padding: 8px 10px; border-radius: 6px; font-weight: 500; font-size: 13px; cursor: pointer;
}
.user-picker label:hover { background: var(--navy-soft); }
.user-picker input { width: auto; flex-shrink: 0; }
.user-picker .up-role { margin-left: auto; }
.user-picker .up-mail { color: var(--muted); font-size: 11.5px; }
.user-picker .up-empty { padding: 10px; color: var(--muted); font-size: 12.5px; }
.shared-pill {
  display: inline-block; background: var(--navy-soft); border: 1px solid #cddaea; color: var(--navy);
  border-radius: 20px; padding: 1px 8px; font-size: 10.5px; font-weight: 700; margin-left: 6px;
}
.who-list { display: flex; flex-wrap: wrap; gap: 4px; }
.who-list span {
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 2px 7px; font-size: 11.5px; white-space: nowrap;
}
.who-list span.is-default { border-color: var(--gold); background: var(--gold-soft); }
